Answer the question
In order to leave comments, you need to log in
How to put your module in OpenCV?
Hello everyone, I need to wrap OpenCV to use GPU modules as there is no support for Python.
I found a repo in which there is a solution, but for some reason the pythoncuda module, which is opencv_contrib/modules, does not work inside python after compilation, that is, cv2.pythoncuda gives an import error, tell me what I'm doing wrong, or what's wrong with the repo.
Repo: https://github.com/NeerajGulia/python-opencv-cuda
My cmake
cmake \
-DCMAKE_BUILD_TYPE=RELEASE \
-DOPENCV_ENABLE_NONFREE=ON \
-DWITH_CUDA=ON \
-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.0/modules \
-DINSTALL_PYTHON_EXAMPLES=OFF \
-DINSTALL_C_EXAMPLES=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_DOCS=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_opencv_dnn=OFF \
-DTINYDNN_USE_NNPACK=OFF \
-DTINYDNN_USE_TBB=ON \
-DTINYDNN_USE_OMP=ON \
-DENABLE_FAST_MATH=ON \
-DWITH_OPENMP=ON \
-DWITH_TBB=ON \
-DWITH_JPEG=OFF \
-DWITH_IPP=OFF \
-DMKL_WITH_TBB=ON \
-DBUILD_opencv_cudacodec=OFF \
-DMKL_WITH_OPENMP=ON \
-DBUILD_opencv_python2=OFF \
-DPYTHON3_EXECUTABLE=$(which python3) \
-DPYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-DPYTHON_INCLUDE_DIR2=$(python3 -c "from os.path import dirname; from distutils.sysconfig import get_config_h_filename; print(dirname(get_config_h_filename()))") \
-DPYTHON_LIBRARY=$(python3 -c "from distutils.sysconfig import get_config_var;from os.path import dirname,join ; print(join(dirname(get_config_var('LIBPC')),get_config_var('LDLIBRARY')))") \
-DPYTHON3_NUMPY_INCLUDE_DIRS=$(python3 -c "import numpy; print(numpy.get_include())") \
-DPYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
..
make
sudo make install
sudo ldconfig
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question