Compiling OpenCV for Linux (Debian)
I am sure that most of you know OpenCV, the open-source Computer Vision library initially developed by Intel.
Synaptic, the packages manager of all Debian based distributions do contain opencv packages (namely libcv, libcvaux and libhighgui). But they are seriously outdated (2.1 in Ubuntu 11.10 when the last stable release on sourceforge is the 2.3.1a).
If you want to use some new features (such as the new Python bindings in my case), you will have to compile OpenCV by yourself.
An excellent install guide for Debian is available on the OpenCV Wiki. Do not forget to install libgtk2.0 too if you want to use screen display functions later.
{% highlight bash %}
...
/home/jlengrand/downloads/OpenCV-2.3.1/modules/highgui/src/cap_libv4l.cpp:1673: error: ‘struct CvCaptureCAM_V4L’ has no member named ‘memoryBuffer’
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_libv4l.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
{% endhighlight %}
This error is due to libv4l, which causes problems to openCV. Here is a simple way to get rid of the error :
- Remove libv4l for your system.
- Then finish OpenCV compilation:
- Finally, you simply have to reinstall all previously removed packages (which depends on your system).
{% highlight bash %}
[jlengrand@ubuntu:~/downloads/OpenCV-2.3.1/release]$sudo apt-get install gstreamer0.10-plugins-good libgstfarsight0.10-0 libpurple-bin libpurple0 libv4l-0 libv4l-dev pidgin vlc vlc-nox vlc-plugin-notify vlc-plugin-pulse
{% endhighlight %}