In Ubuntu 12.04 only OpenCv 2.3 is available. To exploit the examples in Abid Rahman's blog, at least OpenCv 2.4 is necessary.
To install OpenCV 2.4.2, open you package manager (synaptics) and uninstall if necessary previous OpenCv version. Check if the required/optionnal libraries are installed, for example:
Commit Log for Wed Jul 4 21:38:54 2012
Les paquets suivants ont été installés :
libtbb-dev (4.0+r233-1)
libtbb-doc (4.0+r233-1)
libtbb2 (4.0+r233-1)
tbb-examples (4.0+r233-1)
Les paquets suivants ont été installés :
libtbb-dev (4.0+r233-1)
libtbb-doc (4.0+r233-1)
libtbb2 (4.0+r233-1)
tbb-examples (4.0+r233-1)
cmake must be installed, it's convenient to install cmake-gui too. Download OpenCv 2.4.x (here 2.4.2) and uncompress the archive in some directory. Make an other directory to build OpenCV:
For example, in a directory called Applications, the OpenCv source code is in OpenCv-2.4.2 and an empty directory Build OpenCv242.
Run cmake-gui, it can be found from the dash:
Run cmake-gui, it can be found from the dash:
![]() |
looking for CMake with the Dash |
Once cmake run, select the directory containing OpenCv source code, and the target directory that will contain the build OpenCv:
![]() |
CMake gui running after having selected the source code directory and the build directory |
Within cmake, check the different options that are needed (tiff support, python ...), click on the configure button, then on generate. If everything went fine, open the destination directory, open a console in it and type the commands:
make
then
sudo make install
The options selected can be found in the CMakeCache.txt file.
The installation can be checked by opening a ipython shell and importing cv2 as follow:
The installation can be checked by opening a ipython shell and importing cv2 as follow:
![]() |
ipython shell after cv2 importation |