Here are instructions for installation of Opencv 2.3.1 on Ubuntu 12.04 Precise Pangolin. For opencv installation we need FFmpeg, x264, v4l and their dependencies. It is a bit longer process as compared to windows installations. Step by step process is shown below.
1. Install dependencies for FFmpeg and x264
Enter following lines in terminal to check and install dependencies.
2. Install Gstreamer by entering following lines in terminal
3. Download recent version (0.8+)of FFmpeg from https://github.com/FFmpeg/FFmpeg extract it and go to the directory. Now configure and install FFmpeg by entering following commons one by one.
4. Install recent version of x264 from ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ extract it and go to the directory. Now configure and install x264 by entering following commons one by one.
5. Download video for linux v4l libs from http://www.linuxtv.org/downloads/v4l-utils/ extract it and go to the directory. Install v4l using following command.
6. Install gtk libs using apt-get
7. Install libjpeg using following command
8. Now our dependencies are complete. We can install Opencv now. Download Opencv from http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/ Extract it and go to the directory. Enter following command to configure and install Opencv
We are done with installing Opencv on ubuntu 12.04 Precise Pangolin. In order to set path open /etc/bash.bashrc using your favorite text editor and add following lines
Restart your system and you are ready to use awesome Opencv!
1. Install dependencies for FFmpeg and x264
Enter following lines in terminal to check and install dependencies.
sudo apt-get install build-essential checkinstall git cmake libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html yasm zlib1g-dev
2. Install Gstreamer by entering following lines in terminal
sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg
3. Download recent version (0.8+)of FFmpeg from https://github.com/FFmpeg/FFmpeg extract it and go to the directory. Now configure and install FFmpeg by entering following commons one by one.
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab make sudo make install
4. Install recent version of x264 from ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ extract it and go to the directory. Now configure and install x264 by entering following commons one by one.
./configure --enable-static make sudo make install
5. Download video for linux v4l libs from http://www.linuxtv.org/downloads/v4l-utils/ extract it and go to the directory. Install v4l using following command.
make sudo make install
6. Install gtk libs using apt-get
sudo apt-get install libgtk2.0-0 libgtk2.0-dev
7. Install libjpeg using following command
sudo apt-get install libjpeg62 libjpeg62-dev
8. Now our dependencies are complete. We can install Opencv now. Download Opencv from http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/ Extract it and go to the directory. Enter following command to configure and install Opencv
mkdir build cd build cmake .. make sudo make install
We are done with installing Opencv on ubuntu 12.04 Precise Pangolin. In order to set path open /etc/bash.bashrc using your favorite text editor and add following lines
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH
Restart your system and you are ready to use awesome Opencv!
Hi.. I am entirely new to ubuntu and opencv...
ReplyDeleteI am trying to install opencv but in first step only i am getting following error...
---------------------------------------------------------
E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/cache/apt/archives/
--------------------------------------------------------
Please tell me now what should i do??
Close any other software installing or repository accessing software like Software Center or Synaptic Manager and then try to execute.
Deletecant be install ffmpeg too from repository like (sudo apt-get install ffmpeg)?
ReplyDeletehi..
ReplyDeleteplease can you help me to find what i should download from the link of ffmpeg, there is a lot of things so i can't find my goal :(
when i insert the instruction of ./configure, i'm getting the following error:
bash: ./configure: Aucun fichier ou dossier de ce type
please, can u help me!
Hi..
ReplyDeleteMy webcam is not working. Its giving error like
vidioc_querymenu invalid argument
vidioc_querymenu invalid argument
vidioc_querymenu invalid argument
Any solution for this?
root@xxx:/home/xxx/Downloads/OpenCV-2.4.4/build# make
ReplyDelete[ 5%] Built target libtiff
[ 8%] Built target libjasper
[ 16%] Built target IlmImf
[ 16%] Built target opencv_core_pch_dephelp
[ 16%] Built target pch_Generate_opencv_core
[ 19%] Built target opencv_core
[ 19%] Built target opencv_ts_pch_dephelp
[ 19%] Built target pch_Generate_opencv_ts
[ 19%] Built target opencv_imgproc_pch_dephelp
[ 19%] Built target pch_Generate_opencv_imgproc
[ 24%] Built target opencv_imgproc
[ 25%] Built target opencv_flann_pch_dephelp
[ 26%] Built target pch_Generate_opencv_flann
[ 26%] Built target opencv_flann
[ 26%] Built target opencv_highgui_pch_dephelp
[ 26%] Built target pch_Generate_opencv_highgui
Linking CXX shared library ../../lib/libopencv_highgui.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: ** [lib/libopencv_highgui.so.2.4.4] Erro 1
make[1]: ** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Erro 2
make: ** [all] Erro 2
help-me, please ;(
i have the same problem too please help
ReplyDeletesame here please help :(
ReplyDelete