Installing OpenCV on Linux
In order to install OpenCV library on Linux, one needs to compile the source file. Suggested sequence of compilation is as below. The latest version of the library is OpenCV-1.0.0 at the time of writing. Version upgrade may affect the way of library installment. Install requirements are as below. See INSTALL file for more detail.
+ GTK+ 2.x or higher including headers
+ pkgconfig
+ libpng, zlib, libjpeg, libtiff, libjasper with development files.
+ Python 2.3, 2.4 or 2.5 with headers installed (developer package)
+ libavcodec, etc. from ffmpeg 0.4.9-pre1 or later + headers.
Compilation
Compilation starts with extracting the source file in a directory. (/tmp/ is recommended) A new directory named 'opencv-1.0.0' will be created. In the new directory, execute commands litsted as below.
tar xvzf OpenCV-1.0.0.tar.gz cd opencv-1.0.0 ./configure --prefix=/opencv_library_install_path/opencv-1.0.0 make; make install
If the installation is successful, you get below message after 'make install' command is finished.
---------------------------------------------------------------------- Libraries have been installed in: /opencv_library_install_path/opencv-1.0.0/lib
It is recommended to have a soft link to opencv-1.0.0 directory. Go to the directory having opencv-1.0.0 directory in it. Create a link in that directory. Simple change the link to a new one when there is update. The link can be created as below.
ln -s opencv-1.0.0 opencv
Path Configuration
In order to use the libraries in Linux, thier path should be specified. Library path can be specified in /etc/ld.so.conf.d/ by creating a file called 'opencv.conf' which contains the opencv library path (Default configuration is /usr/local/lib). Once the file is created, execute 'ldconfig -v' as root to make new set library pathes effective.
Test OpenCV
After installation process is finished, one can check whether the library is installed properly by executing 'make check' in opencv-1.0.0 directory, which is created when opencv-1.0.0.tar.gz is extracted.
cd /.../opencv-1.0.0/ make check