2023-11-02 15:04:12 +00:00
|
|
|
# to build this docker image:
|
|
|
|
# docker build -f Dockerfile.opencv -t gocv/opencv:4.6.0 .
|
|
|
|
FROM golang:1.18-buster AS opencv
|
2022-08-21 20:31:19 +00:00
|
|
|
LABEL maintainer="hybridgroup"
|
|
|
|
|
2023-11-02 15:04:12 +00:00
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
git build-essential cmake pkg-config unzip libgtk2.0-dev \
|
|
|
|
curl ca-certificates libcurl4-openssl-dev libssl-dev \
|
|
|
|
libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev \
|
|
|
|
libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
2022-08-21 20:31:19 +00:00
|
|
|
|
2023-11-02 15:04:12 +00:00
|
|
|
ARG OPENCV_VERSION="4.6.0"
|
2022-08-21 20:31:19 +00:00
|
|
|
ENV OPENCV_VERSION $OPENCV_VERSION
|
|
|
|
|
2023-11-02 15:04:12 +00:00
|
|
|
RUN curl -Lo opencv.zip https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
|
2022-08-21 20:31:19 +00:00
|
|
|
unzip -q opencv.zip && \
|
2023-11-02 15:04:12 +00:00
|
|
|
curl -Lo opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \
|
2022-08-21 20:31:19 +00:00
|
|
|
unzip -q opencv_contrib.zip && \
|
2023-11-02 15:04:12 +00:00
|
|
|
rm opencv.zip opencv_contrib.zip && \
|
|
|
|
cd opencv-${OPENCV_VERSION} && \
|
2022-08-21 20:31:19 +00:00
|
|
|
mkdir build && cd build && \
|
|
|
|
cmake -D CMAKE_BUILD_TYPE=RELEASE \
|
|
|
|
-D WITH_IPP=OFF \
|
|
|
|
-D WITH_OPENGL=OFF \
|
|
|
|
-D WITH_QT=OFF \
|
|
|
|
-D CMAKE_INSTALL_PREFIX=/usr/local \
|
|
|
|
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${OPENCV_VERSION}/modules \
|
|
|
|
-D OPENCV_ENABLE_NONFREE=ON \
|
|
|
|
-D WITH_JASPER=OFF \
|
|
|
|
-D WITH_TBB=ON \
|
|
|
|
-D BUILD_DOCS=OFF \
|
|
|
|
-D BUILD_EXAMPLES=OFF \
|
|
|
|
-D BUILD_TESTS=OFF \
|
2023-11-02 15:04:12 +00:00
|
|
|
-D BUILD_PERF_TESTS=OFF \
|
2022-08-21 20:31:19 +00:00
|
|
|
-D BUILD_opencv_java=NO \
|
|
|
|
-D BUILD_opencv_python=NO \
|
|
|
|
-D BUILD_opencv_python2=NO \
|
|
|
|
-D BUILD_opencv_python3=NO \
|
|
|
|
-D OPENCV_GENERATE_PKGCONFIG=ON .. && \
|
|
|
|
make -j $(nproc --all) && \
|
|
|
|
make preinstall && make install && ldconfig && \
|
|
|
|
cd / && rm -rf opencv*
|
|
|
|
|
2023-11-02 15:04:12 +00:00
|
|
|
CMD ["go version"]
|