OpenCV Practice Repository https://github.com/AmitThakur/opencvp.git
Credits: [http://www.raben.com/book/export/html/3] [http://karytech.blogspot.in/2012/05/opencv-24-on-ubuntu-1204.html]
- Install developer environment to build OpenCV source code:
sudo apt-get install build-essential cmake pkg-config
- Install Image I/O libraries:
sudo apt-get install libjpeg62-dev
sudo apt-get install libtiff4-dev libjasper-dev
- Install Python development environment:
sudo apt-get install python-dev python-numpy
- Install Video I/O libraries:
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
Optional
- Install Intel TBB for OpenCV parallel coding:
sudo apt-get install libtbb-dev
- Install GUI backend-GTK or QT:
sudo apt-get install libqt4-dev libgtk2.0-dev
Get OpenCV Source Code:
Get latest version using Git:
cd ~/path/to/working/directory
git clone https://github.com/Itseez/opencv.git
Or get the source package from http://opencv.org/downloads.html, extract and create build directory inside opencv directory: (Replace * with numbers as per requirement)
tar -xvf OpenCV-*.*.*.tar.bz2
cd OpenCV-*.*.*
mkdir build
cd build
- Now is the time to generate configure OpenCV build using Cmake. Last two dots are for source directory of OpenCV (Parent Directory here):
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 INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON
-D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
- Compiling: (add -j3 or -j4 to make compiling faster)
make
- Install:
sudo make install
Using OpenCV in your project:
- First using following command to find out the locations of OpenCV files for include path(-l)
pkg-config --cflags opencv
which gives results like this:
-I/usr/local/include/opencv -I/usr/local/include
So include path is: /usr/local/include/opencv
- Now we find libraries path using following path:
pkg-config --libs opencv
which gives result like this:
/usr/local/lib/libopencv_bioinspired.so /usr/local/lib/libopencv_calib3d.so ...
So Library search path (-L) is: /usr/local/lib
These path can be included in Compiler Settings of IDEs.
Uninstalling:
cd /path/to/OpenCV-*.*.*/build
sudo make uninstall
Yep, that's a very useful .md. Thanks !