Thursday, August 8, 2013

How to Install OpenCV in Fedora 19

OpenCV is an open-source library written in C/C++ for Computer Vision that was designed for computational efficiency and with a strong focus on real-time application. Applications that can be written in C, C++, JAVA, Android, Python, Linux, MAC OS and Windows.

The first steps:
you require to have installed some packages first for its compilation: cmake and gcc-c++, if you don't have them, don't worry the only thing you have to do is writing the next lines on the terminal:

sudo yum install cmake gcc-c++

the next lines depend on you if you want the video and GUI interfaces:

sudo yum install ffmpeg ffmpeg-devel
sudo yum install gtk2-devel

Those were the essential to compile opencv, the next step is downloading the code:

you can download it from here or you can get it directly from the git with the next line on the terminal:

git clone git://code.opencv.org/opencv.git

if you get it from the git it will be copied into you actual location in the terminal

go to the place writing the next commands

cd opencv

then do

mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make

(if you are programming on Python you might use this)
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON .. 
Instead of 
cmake -D CMAKE_BUILD_TYPE=RELEASE ..

with those commands you will build the code for installing

finally install it:

sudo make install

if you downloaded it you can do the same steps:
first decompress it in some place
the put the terminal into that place where you decompressed the file

and follow the same commands

and then you will have installed OpenCV



if you are looking for computer vision maybe you are interested too in images processing.
you may refer to the next packages:
PIL(Python Image Library)
NumPy(Fundamental package for scientific computing with Python)
TkInter for GUI(Optional)

here is a good tutorial for install PIL
http://www.yodi.sg/install-and-fix-pil-python-image-library-with-jpeg-support-and-zlib-fedora-17/
but first don't forget to install pip
for installing tkinter
sudo yum install tkinter

make sure you install everything you need for dependencies packages


references:
http://platformedia.com/oss-blog/opencv-on-fc17/