Вы находитесь на странице: 1из 11

Manuel Ignacio Lpez Quintero Manuel Ignacio Lpez Quintero

Home Archive CV Contact About


Install OpenCV on Ubuntu Linux
Note: This tutorial has been tested on Ubuntu 12.04 LTS with OpenCV 2.4.3.
Install OpenCV on Ubuntu Linux is a bit long but very easy. Simply, follow these steps:
1. UPDATE AND UPGRADE UBUNTU
Open your terminal and execute:
sudo apt-get update
sudo apt-get upgrade
2. INSTALL THE DEPENDENCIES
Now execute:
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 libeigen2-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
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
1 de 11 28/03/14 01:56
libavformat-dev libswscale-dev
3. DOWNLOAD AND DECOMPRESS OPENCV
Enter the OpenCV official website and download the latest version for Ubuntu Linux. Then
decompress the downloaded file.
4. COMPILE OPENCV
Now, in your terminal, make sure you are within the OpenCV directory and run the following
commands:
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 ..
make
sudo make install
5. CONFIGURE OPENCV
In your terminal, execute:
sudo gedit /etc/ld.so.conf.d/opencv.conf
Add the following line and save it:
/usr/local/lib
Now, in your terminal, execute:
sudo ldconfig
Again, execute:
sudo gedit /etc/bash.bashrc
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
2 de 11 28/03/14 01:56
Add the following two lines at the end of the file and save it:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
Finally, reboot your computer.
6. TRY AN EXAMPLE
To test an example, from your terminal enters in the OpenCV folder. Once you're inside it enters
in samples/c.
Now, execute:
chmod +x build_all.sh
./build_all.sh
./facedetect lena.jpg
43 comments:
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
3 de 11 28/03/14 01:56
Replies
Reply
Manuel Ignacio Lpez Quintero December 20, 2012 at 6:50 PM
Do you like this article? Share it with this link:
http://miloq.blogspot.com/2012/12/install-opencv-ubuntu-linux.html
Thanks for reading!
Reply
Pedro Bello Maldonado November 19, 2013 at 8:57 PM
It worked like a charm! Thank you very much.
Anonymous January 29, 2014 at 3:25 AM
it worked. thanks!
Anonymous March 22, 2014 at 2:28 AM
This works perfectly, no problems at all. Much thanks! Ubuntu 13.10.
Anonymous March 27, 2013 at 6:41 PM
Hi,
Thanks for the tutorial..It was just what i needed to get Opencv installed.
Great Job!!!
Cheers
Reply
Yeneneh Mulatu March 29, 2013 at 11:18 PM
it took me a while, but got it running at last, you blog has help me a lot, Thank you
Reply
harryDUDE June 2, 2013 at 2:48 PM
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
4 de 11 28/03/14 01:56
Replies
Reply
Nice article. Precise & Lucid !
Great Work.
Thanks.
Reply
Cisne Negro June 12, 2013 at 7:05 PM
Simple and clean.
Thank you
Reply
Yuan Gao June 18, 2013 at 10:24 AM
Really helpful.
Thanks.
Reply
Franco Barenghi August 29, 2013 at 1:30 PM
Great!
this is the best tutorial I ever seen about OpenCV.
Thanks
Reply
sriram IITian September 11, 2013 at 8:33 PM
at last getting error ... like
https://www.dropbox.com/s/1yv0x60xz776qu7
/Screenshot%20from%202013-09-12%2000%3A59%3A11.png
Reply
Manuel Ignacio Lpez Quintero September 12, 2013 at 12:52 PM
It is because you don't apply correctly the step 5: Configure OpenCV.
Anonymous September 22, 2013 at 6:14 AM
Very good one...Thanks :-)
Reply
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
5 de 11 28/03/14 01:56
Replies
Muhammad Atif Sheikh September 23, 2013 at 5:34 AM
Hello, I am having problem with hough transform . can u help? it is giving some error
Reply
Anonymous September 23, 2013 at 1:46 PM
Hello, very nice manual
However, in the example part, after ./build_all.sh I get this output
g++: error: tbb: No such file or directory
g++: error: rt: No such file or directory
g++: error: pthread: No such file or directory
g++: error: m: No such file or directory
g++: error: dl: No such file or directory
Can you please inform me about this error?
Reply
Jiatian Pi October 18, 2013 at 2:33 AM
Hi,Have you solved that error ?,I meet the same problem, can you tell me how to
do with it?
srinivas rao jojigiri November 12, 2013 at 2:28 PM
Hi I've solved this problem by doing this
First locate opencv.pc file, its usually in /usr/lib/../pkg-config/opencv.pc
goto last but one line and it should be like this
tbb rt pthread m dl
Need to change this like below
-ltbb -lrt -lpthread -lm -ldl
Now try compiling it should work fine
got this solution from some question in stackoverflow
Manuel Ignacio Lpez Quintero November 19, 2013 at 4:26 PM
Thanks for the help, Srinivas.
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
6 de 11 28/03/14 01:56
Reply
Replies
Reply
Anonymous October 11, 2013 at 10:56 PM
I am getting the error of which Anonymous is getting up there ^ ?? Thanks in advance.
Reply
Umar Chughtai October 19, 2013 at 12:23 AM
Hi
You guys should download opencv again, and make sure you compile with in the
opencv directory i.e step 4
Manuel Ignacio Lpez Quintero October 25, 2013 at 5:55 PM
Thanks for the help, Umar.
Kushal Saharan October 19, 2013 at 4:48 AM
Thanks!! Big Help!!
Reply
Anonymous October 21, 2013 at 4:01 PM
thank you!!! literally spent months trying to get it to work
Reply
Hagai Korenblum October 23, 2013 at 8:19 AM
hi all ,
my name is hagai,
I have run this steps ./facedetect lena.jpg
i got this massage
Illegal instruction (core dumped)
can anyone help?
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
7 de 11 28/03/14 01:56
Reply
Gabriel October 26, 2013 at 9:19 PM
Thanks for this! saved me some time!
Reply
VKS October 28, 2013 at 4:30 PM
Thanks man... one of the best and easy way to install...i have some doubts related to the
subject. Is there any blog of yours related to the opencv and opencv related programs.If it
is there can you tell?
Reply
Anonymous October 30, 2013 at 6:08 PM
do we need any prerequisites before starting with the first step?
coz wen i tried the step 2 it showed no such entry
please help me
Reply
Anonymous November 3, 2013 at 9:28 PM
Thank you so much!!!!!
Reply
Anonymous November 4, 2013 at 4:22 PM
After I try to execute step 2 (installing the dependencies), I get the following error:
Package 'libtbb-dev' has no installation candidate
Unable to locate package libfaac-dev
Are there some other dependencies that I need to install beforehand? Is the order of the
dependencies incorrect?
Reply
Anonymous November 12, 2013 at 8:34 AM
thank you! works perfectly! saved me a lot of time!
Reply
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
8 de 11 28/03/14 01:56
Replies
Reply
Jian Quan November 28, 2013 at 4:16 PM
Hi, I am having a problem when it comes to step 4 when i execute the command 'make'
it gives me this error
Linking CXX executable ../../bin/opencv_perf_gpu
/usr/bin/ld: ../../lib/libopencv_highgui.so.2.4.3: don't know how to handle section ` ' [0x
2372]
../../lib/libopencv_highgui.so.2.4.3: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[2]: *** [bin/opencv_perf_gpu] Error 1
make[1]: *** [modules/gpu/CMakeFiles/opencv_perf_gpu.dor/all] Error 2
make:: *** [all] Error 2
i hope that you can help me resolve this problem as I need to rush with the completion of
my project and opencv is a very important aspect of it, thanks so much for ur reply
Reply
Anonymous December 1, 2013 at 9:01 AM
To install OpenCV using the terminal on Ubuntu:
$ su -
# apt-get update
# apt-get install build-essential
# apt-get install libavformat-dev
# apt-get install x264 v4l-utils ffmpeg
# apt-get install libcv2.3 libcvaux2.3 libhighgui2.3 python-opencv opencv-doc libcv-dev
libcvaux-dev libhighgui-dev
http://namhuy.net/1205/how-to-install-opencv-on-ubuntu.html
Reply
Jian Quan December 1, 2013 at 11:26 PM
can this be the same for raspbian on raspberry pi too? thanks
Anonymous January 12, 2014 at 5:13 AM
thank you ....
Reply
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
9 de 11 28/03/14 01:56
Replies
Reply
Anonymous January 13, 2014 at 7:25 AM
while running samples/c file I m getting fatal error of file not found or directory not found
can some one solve this problem
Reply
Anonymous January 20, 2014 at 1:45 PM
Thanks a bunch! I've been trying to install OpenCV on Win8 for the past four months but
with no success. Now I'm on Ubuntu 13.10 and this really worked for me!
Reply
Sathish Kumar January 24, 2014 at 7:18 AM
Reply
Sathish Kumar January 24, 2014 at 7:19 AM
Thanks, I am also installed Opencv 2.4.8 in Ubuntu 13.10 Its worked......
Anonymous February 15, 2014 at 5:04 PM
THANK YOU VERY MUCH
Reply
Anonymous March 3, 2014 at 7:00 AM
Superb blog....Follow every word as it is and your are done
Reply
Ramakrishna Yalamati March 4, 2014 at 9:58 PM
Thank you so much for your tutorial. This helped me a lot. perfect blog for openCV
beginners.
Reply
Anonymous March 19, 2014 at 4:56 PM
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
10 de 11 28/03/14 01:56
Newer Post Older Post Home
Subscribe to: Post Comments (Atom)
Comment as: Select profile...
Publish Publish Preview Preview
help! I have this message error before passage 5:
CMake Error at CMakeLists.txt:62 (include):
include could not find load file:
cmake/OpenCVUtils.cmake
CMake Error at CMakeLists.txt:64 (ocv_clear_vars):
Unknown CMake command "ocv_clear_vars".
-- Configuring incomplete, errors occurred!
what can I do?
Reply
Anonymous March 27, 2014 at 4:51 PM
When i try and run step 5, i get a permission denied error. any ideas?
Reply
All content by Manuel Ignacio Lpez Quintero under this license. Powered by Blogger.
Enter your comment...
Install OpenCV on Ubuntu Linux - Manuel Ignacio... http://miloq.blogspot.com/2012/12/install-opencv...
11 de 11 28/03/14 01:56

Вам также может понравиться