I cannot get the example Python programs to run. When executing the Python command "from opencv import cv" I get the message "ImportError: No module named _cv". There is a stale _cv.pyd in the site-packages directory, but no _cv.py anywhere. See step 5 below.
MS Windows XP, VC++ 2008, Python 2.6, OpenCV 2.0
Here's what I have done.
You should install opencv using python dist utils. This can be accomplished by going to the opencv directory, and typing:
python setup.py install
Edit:
openCV uses distutils, but somewhat indirectly. On UNIX the installation is more along the lines of:
configure
make -j 8
make install
For Windows, the easiest approach is probably to download the installer, much as the easiest approach for Linux is to use a package manager to install the application. You can't just copy OpenCV into the python path and have things work, as it relies on a number of C libraries which need to be compiled.
I would imagine that the windows installer would install binaries (rather than needing to compile everything, and it probably is bad to use the installer and compile everything yourself). In any event, do not copy the files your self, either do a make install, or use the installer.
Good luck with OpenCV, and I hope you enjoy using it!
After Step 1 (Installer) just copy the content of C:\OpenCV2.0\Python2.6\Lib\site-packages
to C:\Python26\Lib\site-packages
(standard installation path assumed).
That's all.
If you have a webcam installed you can try the camshift.demo in C:\OpenCV2.0\samples\python
The deprecated stuff (C:\OpenCV2.0\samples\swig_python
) does not work at the moment as somebody wrote above. The OpenCV People are working on it. Here is the full picture:
31/03/10 (hopefully) Next OpenCV Official Release: 2.1.0 is due March 31st, 2010. link://opencv.willowgarage.com/wiki/Welcome/Introduction#Announcements
04/03/10 [james]rewriting samples for new Python 5:36 PM Mar 4th
via API link://twitter.com/opencvlibrary12/31/09 We've gotten more serious about OpenCV's software engineering. We now have a full C++ and Python interface. link://opencv.willowgarage.com/wiki/OpenCV%20Monthly
9/30/09 Several (actually, most) SWIG-based Python samples do not work correctly now. The reason is this problem is being investigated and the intermediate update of the OpenCV Python package will be released as soon as the problem is sorted out. link://opencv.willowgarage.com/wiki/OpenCV%20Monthly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With