First install dependency packages
Install Code Blocks IDE
sudo apt-get install codeblocks
Required packages
sudo apt-get install build-essential sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
Optional packages
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
Clone the latest OpenCV from github
git clone https://github.com/opencv/opencv.git
Compile and Install
cd ~/opencv mkdir release cd release cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. make
For using with QT and OpenGL and for sample code snippets use this cmake
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 ..
sudo make install
Now open CodeBlocks.Now go to settings –>compiler
Under the compiler settings tab select the other options tab and copy the following command into the pane.
`pkg-config opencv --cflags`
Now open the Linker Settings Tab and copy the following command int the other linker options pane:
`pkg-config opencv --libs`
Click OK to save the settings.
Happy Hacking 🙂