Ask Your Question

mikolune's profile - activity

2013-07-20 16:01:23 -0600 received badge  Nice Question (source)
2013-05-30 15:53:01 -0600 commented question Bug Python binding x64 / Windows 7

Just filed the report.

2013-05-30 15:41:19 -0600 commented answer Bug Python binding x64 / Windows 7

OK, thanks! I will file a bug report on that.

2013-05-30 14:01:08 -0600 received badge  Student (source)
2013-05-30 13:53:19 -0600 received badge  Editor (source)
2013-05-30 13:51:43 -0600 asked a question Bug Python binding x64 / Windows 7

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();

Of course, this works only for Windows.

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

So, what would be the proper way to correct this issue ?

Thx!