Friday, May 6, 2016

HoW To InStAlL OpEnCv PyThOn AnD C++ In UbUnTu 14.04(LTS)

1 comment
now we gonna learn about how to install opencv python2 and opencv c++ in ubuntu 14.04(LTS) version


Updated and upgraded
sudo apt-get update
sudo apt-get upgrade
Install many dependencies
sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen3-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev default-jdk ant libvtk5-qt4-dev
 To get the OpenCV 2.4.9 source code
cd ~
wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip
unzip opencv-2.4.9.zip
cd opencv-2.4.9
 Generate mkdir files
mkdir build
cd build
cmake -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 -D WITH_VTK=ON ..


 Compile and install OpenCV 2.4.9
 
make
sudo make install
  Configure OpenCV

sudo gedit /etc/ld.so.conf.d/opencv.conf

http://www.samontab.com/web/wp-content/uploads/2012/06/openCVConf1.png

now copy
/usr/local/lib
 then press ctrl+x.then save and exit from that

Run followling code for libaries


sudo ldconfig
 now need to open file in that
sudo gedit /etc/bash.bashrc
now copy this two lines into that file at end of page
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
 now opencv python and c++ installed perfectly

to check c++ opencv type in terminal
~/opencv-2.4.9/build/bin/cpp-example-calibration_artificial

to check this lets run sample file.enter following command on terminal for facedetect through pythoncv
python ~/opencv-2.4.9/samples/python2/facedetect.py

this is running facedetect smaple program.we can check also other method

in terminal lets type following things for wheather working proparly or not
$ python
>>import cv2

 when you type and import cv2 in python if anything wrong thats goes next line >>
otherwise error will occurs

p.s
thankss for ur time to read this post


i have tested in my laptop dell 5000 series






1 comment :