OpenCV on Ubuntu

OpenCV is an open source set of libraries used for processing image data. OpenCV libraries set a solid imaging logic foundation for C, C++, and Python. The algorithms are submitted by an open source community and refined by intel. Scripts utilizing these libraries can implement object/face recognition algorithms, motion tracking, and wide array of other very powerful imaging algorithms and filters in Desktop and Web applications. Follow this tutorial and begin to develop/play with these powerful features.

The OpenCV library is constantly being worked on and updated, so in order to get the newest version we will be inclined to install Subversion on our ubuntu box.


codensity@codensity:~$sudo apt-get install subversion.

Now we get can get the most recent stable trunk from the SourceForge repository and downloading it to the current user home directory, by typing…

codensity@codensity:~$ cd ~/
codensity@codensity:~$ sudo svn co

After several line of terminal output the snapshot is downloaded to you working directory. Next we should install all the necessary pre-requisites for working with OpenCV.

codensity@codensity:~$ sudo apt-get install cmake

codensity@codensity:~$ sudo apt-get install libv4l-dev

codensity@codensity:~$ sudo apt-get install ffmpeg

codensity@codensity:~$ sudo apt-get install libraw1394-dev

codensity@codensity:~$ sudo apt-get install libdc1394-22

codensity@codensity:~$ sudo apt-get install libc6-dev

codensity@codensity:~$ sudo apt-get install pkg-config

codensity@codensity:~$ sudo apt-get install libgtk2.0-dev


After you install all the necessary pre-requisites change you directory and make a release directory and make openCV.

codensity@codensity:~$ cd trunk/opencv

codensity@codensity:~/trunk/opencv$ sudo mkdir release

codensity@codensity:~/trunk/opencv$ cd release

codensity@codensity:~/trunk/opencv/release$ sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ../

The terminal will do its thing and output while making. Next..

codensity@codensity:~/trunk/opencv/release$ sudo make

A long build process will begin in the terminal, wait until this is done. Then type…

codensity@codensity:~/trunk/opencv/release$ sudo make install

Then set the paths…

codensity@codensity:~/trunk/opencv/release$ sudo ldconfig -v

codensity@codensity:~/trunk/opencv/release$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH


*During the build I hit a error and found the the work around at the following link.

add to cmake



More Sources and References

The simple math of a mediterranean breeze settles into currents and currents settle into seas.


Avinguda Gaudi, 6 4, 2 Bis Barcelona, 08025 España