Note: This tutorial has been tested on Ubuntu 14.04 LTS with OpenCV 2.4.11 which is most stable opencv version till date. If you find some configuration settings erroneous please do mention the platform details in the comment and the error Thanks!
1. KEEP UBUNTU OR DEBIAN UP TO DATE
Open your terminal and execute:
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove.
2. INSTALL THE DEPENDENCIES
Build tools:
sudo apt-get install build-essential cmake
GUI:
sudo apt-get install qt5-default libvtk6-dev
Media I/O:
sudo apt-get install zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev
Video I/O:
sudo apt-get install libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev
Parallelism and linear algebra libraries:
sudo apt-get install libtbb-dev libeigen3-dev
Python:
sudo apt-get install python-dev python-tk python-numpy python3-dev python3-tk python3-numpy
sudo apt-get install build-essential checkinstall cmake pkg-config yasm sudo apt-get install libtiff4-dev libjpeg-dev libjasper-dev 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.
In your terminal, make sure you are within the OpenCV directory and run the following commands:
mkdir build
cd build
cmake -D WITH_XINE=ON -D WITH_OPENGL=ON -D WITH_TBB=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_V4L=ON..
make -j4
sudo make install
5. CONFIGURE OPENCV
1. Open a text editor and edit the ld.so.conf file by changing directory into it with privileges
sudo nano /etc/ld.so.conf
2. Enter the following line into it
/usr/local/lib
3. Close and save and exit and enter the following command
sudo ldconfig
sudo nano /etc/bash.bashrc
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lo cal/lib/pkgconfig
export PKG_CONFIG_PATH
4. Now you are ready for testing
cd ~/OpenCV-2.4.6/samples/c
chmod +x build_all.sh
./build_all.sh
5. Try the python examples and make sure they work
python ~/OpenCV-2.4.10/samples/python2/turing.py
thanks a lot for sharing, this really helped in my workboss linux default username and password
ReplyDelete