使用Visual Studio 2013在Windows 10上使用contrib模块为Python编译OpenCV

Compile OpenCV for Python wit contrib modules on Windows 10 using Visual Studio 2013

本文关键字:模块 contrib Python OpenCV 编译 Studio Visual 2013 Windows 使用      更新时间:2023-10-16

我想在windows 10上安装带有contrib模块的OpenCV 3,并将其与Python 2.7(32位)一起使用。我认为在opencv中拥有contrib模块的唯一方法是编译它

我已经用contrib模块编译了OpenCV,没有任何问题。我使用过Visual Studio 2013,在发布模式下编译(针对Win32)。

编译OpenCV后,我可以在$PYTHON_HOME/Libs/site-packages 中看到"cv2.pyd"模块

问题是:

当我尝试在Python IDLE中使用import cv2时,我会出现以下错误:

Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

正如你所看到的,我有一个32位的Python。此外,模块被"检测到"。

怎么了?

我发现了问题。

我不得不将OpenCV*.dll添加到PATH环境变量中。这个*.dll在中

$OPENCV_HOME/bin/release