So I’ve been working on a Python script to detect faces in a webcam feed and then authenticate them. However I ran into issues installing OpenCV on Ubuntu 10.04. There were some guides online, however they used pre-compiled versions of OpenCV and I wanted the newest version from source. This assumes Python 2.6, but just change the 11a step to whatever Python version you have installed. So here’s how to do it:
- sudo apt-get install build-essential cmake ffmpeg
- mkdir ~/opencv
- cd ~/opencv/
- svn co https://code.ros.org/svn/opencv/trunk
- cd trunk/opencv
- mkdir release
- cd release
- cmake -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON -D CMAKE_BUILD_TYPE=RELEASE ..
- sudo make install
- sudo apt-get install python-opencv
- Open up python and try to import cv. (type python, hit enter, then type import cv, hit enter). If it fails do the following step (quit python first, cntrl – d):
- sudo mv /usr/local/lib/python2.6/site-packages/cv.so /usr/local/lib/python2.6/dist-packages/cv.so
- try step 12 again. It should import!
This worked for me, but let me know if you run into issues. The problem that I encountered is when I was trying to get the external libraries to link with OpenCV. Installing python-opencv fixed this issue for me, but you could also do this manually by downloading the lib-dev packages yourself and installing them for the various image libraries.