Tuesday, 20 December 2022

How to build opencv inside a docker to support both python and cpp?

 cmake -DCMAKE_BUILD_TYPE=RELEASE \

        -DCMAKE_INSTALL_PREFIX=/opt/conda/envs/python37/ \

        -DINSTALL_C_EXAMPLES=ON \

        -DOPENCV_GENERATE_PKGCONFIG=ON \

        -DINSTALL_PYTHON_EXAMPLES=ON \

        -DBUILD_SHARED_LIBS=ON \

        -DWITH_TBB=ON \

        -DWITH_V4L=ON \

        -DBUILD_opencv_world=OFF \

        -DOPENCV_PYTHON3_INSTALL_PATH=/opt/conda/envs/python37/lib/python3.7/site-packages/ \

        -DWITH_QT=ON \

        -DWITH_OPENGL=ON \

        -DWITH_FFMPEG=ON \

        -DHAVE_FFMPEG=OFF \

-DWITH_GSTREAMER=ON \

-DHAVE_GSTREAMER=ON \

        -DWITH_CUDA=ON \

        -DHAVE_CUDNN=ON \

        -DCUDNN_INCLUDE_DIRS=/usr/include/x86_64-linux-gnu \

        -DCUDNN_LIBRARY=/usr/lib/x86_64-linux-gnu/libcudnn.so.8.0.4 \

        -DWITH_CUFFT=ON \

        -DWITH_CUBLAS=ON \

        -DWITH_NVCUVID=OFF \

        -DHAVE_NVCUVID=OFF\

        -DWITH_NVCUVENC=ON \

        -DHAVE_NVCUVENC=ON \

        -DBUILD_CUDA_STUBS=OFF \

        -DBUILD_opencv_cudalegacy=ON \

        -DBUILD_opencv_cudacodec=ON \

        -DCUDA_FAST_MATH=ON \

        -DCUDA_ARCH_BIN="8.6" \

        -DCUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda-11.1" \

        -DOPENCV_EXTRA_MODULES_PATH="/data/opencv_contrib-4.4.0/modules" \

        -DBUILD_NEW_PYTHON_SUPPORT=ON \

        -DBUILD_opencv_python3=ON \

        -DHAVE_opencv_python3=ON \

        -DPYTHON3_EXECUTABLE=/opt/conda/envs/python37/bin/python \

        -DPYTHON3_DEFAULT_EXECUTABLE=/opt/conda/envs/python37/bin/python \

        -DPYTHON3_INCLUDE_PATH=/opt/conda/envs/python37/include/python3.7m \

        -DPYTHON3_NUMPY_INCLUDE_DIRS=/opt/conda/envs/python37/lib/python3.7/site-packages/numpy/core/include \

        -DPYTHON3_PACKAGES_PATH=/opt/conda/envs/python37/lib/python3.7/site-packages/ \

        -DPYTHON3_LIBRARIES=/opt/conda/envs/python37/lib/libpython3.7m.so \

        -DPYTHON3_LIBRARIES_PATH=/opt/conda/envs/python37/lib \

-D OpenGL_GL_PREFERENCE=GLVND \

-D BUILD_opencv_rgbd=OFF \

        -D WITH_QT=ON \

        -D WITH_OPENGL=ON \

        -D WITH_GTK_2_X=ON \

        -DBUILD_EXAMPLES=OFF ..

No comments:

Post a Comment