OpenCV is an open source C++ library for real time image processing and computer vision applications, originally developed by Intel and now supported by Willow Garage. The primary interface of OpenCV is C++ but also has C, python, Java interfaces. It is optimized for Intel processing and is available for OS like Mac, Linux, Windows, Android and iOS. This is free for both commercial and non-commercial use. OpenCV has modular structure and the main modules of openCV are listed below:
Here, ‘core’ is the basic module and has basic image processing functions. The next one, ‘highgui’ provides user interface capabilities, image and video capturing, mouse events, video codec etc. For advance UI capabilities, you can use Qt. ‘imgproc’ includes algorithm like image filtering, transformation, color space conversion etc. ‘video’ is video analysis tool and includes the algorithms like object tracking, background subtraction and the last one ‘objdetect’ provides the algorithms like object detection and recognition.
- Install the Dependencies
sudo apt-get -y install libopencv-dev build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff4-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
- Download OpenCV 3.0.0 alpha
mkdir opencv cd opencv wget https://github.com/Itseez/opencv/archive/3.0.0-alpha.zip -O opencv-3.0.0-alpha.zip unzip opencv-3.0.0-alpha.zip
- Install OpenCV
cd opencv-3.0.0-alpha mkdir build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON .. make -j $(nproc) sudo make install
- Finishing installation
To get OpenCV working properly, we need to tell Ubuntu:
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' sudo ldconfig
In the next post, we will start with basic image processing operations.