Hi community,
I compiled OpenCV 2.4.9 on x64 / Windows 7, with Visual Studio 2012.
To use the python binding I copied cv2.pyd
in the proper place on the python path, and then got the following error upon import :
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (initcv2)
Here's what worked for me to correct the issue
In cv2.cpp
I replaced:
extern "C" CV_EXPORTS void initcv2();
with:
extern "C" __declspec(dllexport) void initcv2();
Here's what I hoped would work, but did not
trying to modify the definition of CV_EXPORTS:
In cvdef.h
, replace:
#if (defined WIN32 || defined _WIN32 || defined WINCE || defined __CYGWIN__) && defined CVAPI_EXPORTS
with:
#if (defined WIN32 || defined _WIN32 || defined _WIN64 || defined WINCE || defined __CYGWIN__) && defined CVAPI_EXPORTS
What would be the proper way to correct this issue ?
Thx!