I built the OpenCV from the source to access GPU inference on Cuda using this great tutorial on windows. I tested the yolov3 inference (using cv2.dnn method) on GPU and it worked fine.
but after I installed another package named mediapipe using pip, the cv2 throw an error DLL load failed error when importing cv2, which of course is because of the fact that mediapipe installation also includes the opencv-python-contrib package.
Now I was wondering if there is any probable solution to fix this problem that avoids building OpenCV again from the source and does the things all over again.
I would appreciate it if you could specify solutions in detail.
CodePudding user response:
OK, I fixed the problem using these steps:
- after activating the environment, I uninstalled both
opencv-pythonandopencv-python-contribusingpip. please note thatmediapipewas not removed. - I rebuilt the OpenCV library by setting the python interpreter in this environment as the OpenCV CmakeListVars file which can be done using CMake software.
- at the end both mediapipe and OpenCV ran with no issue.
So I did not find any shortcut to this issue, and we should run all the building process again.
