OpenCV is a powerful tool for building computer vision based applications. For one of my projects, I needed it to be compiled on my Raspberry.
Installing it from repositories was not an option because of its too old version.
If this wouldn’t bother you, consider using: sudo apt-get install libopencv-dev
Here is how I installed it on my Rasbian Wheezy from source:
prerequisites:
sudo apt-get -y install build-essential cmake cmake-qt-gui pkg-config libpng12-0 libpng12-dev libpng++-dev libpng3 libpnglite-dev zlib1g-dbg zlib1g zlib1g-dev pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-progs ffmpeg libavcodec-dev libavcodec53 libavformat53 libavformat-dev libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libxine1-ffmpeg libxine-dev libxine1-bin libunicap2 libunicap2-dev libdc1394-22-dev libdc1394-22 libdc1394-utils swig libv4l-0 libv4l-dev python-numpy libpython2.6 python-dev python2.6-dev libgtk2.0-dev pkg-config
after that:
downloading the zipfile into a folder located in $HOME
mkdir ~/opencv cd ~/opencv wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip unzip opencv*.zip cd opencv* mkdir build cd ./build/ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON make sudo make install
Make took about 6-7 hours on my Raspberry Pi, so be sure you have a stable connection or consider using a tool like ‘screen’.
Please also see:
- http://opencv.willowgarage.com/wiki/InstallGuide%20%3A%20Debian
- http://mitchtech.net/raspberry-pi-opencv/
For openni2_camera it’s not necessary to go further like other posts suggested.