Open source computer vision library OpenCV is gaining a lot of traction and now comes with what looks like a pretty good Python interface. There are installers for Windows and Linux but Mac OS X support has been lacking. There are several ways to install from source as described here. MacPorts is one option that I usually like but since I'm not using the MacPort version of the Python/Numpy/Scipy/Matplotlib stack I decided to try to build using cmake. I followed the instructions to the point:
Now everything builds and installs properly. When testing the python interface I got:
This was solved by adding the directory containing cv.so to my PYTHONPATH. In my case:
Then it all works fine. I can start python and run the cookbook examples without any problems. That's it. Hope these instructions can be of use.
Check out the online OpenCV Python reference guide for more examples and details.
svn co https://code.ros.org/svn/opencv/trunk/opencv
cd opencv
sudo cmake -G "Unix Makefiles" .
sudo make -j8
sudo make install
Now everything builds and installs properly. When testing the python interface I got:
>>> import cv
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named cv
This was solved by adding the directory containing cv.so to my PYTHONPATH. In my case:
export PYTHONPATH=/usr/local/lib/python2.6/site-packages/
Then it all works fine. I can start python and run the cookbook examples without any problems. That's it. Hope these instructions can be of use.
Check out the online OpenCV Python reference guide for more examples and details.