| # install dependencies | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential | |
| sudo apt-get install -y cmake | |
| sudo apt-get install -y libgtk2.0-dev | |
| sudo apt-get install -y pkg-config | |
| sudo apt-get install -y python-numpy python-dev | |
| sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev | |
| sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev | |
| sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils | |
| # download opencv-2.4.11 | |
| wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.11/opencv-2.4.11.zip | |
| unzip opencv-2.4.11.zip | |
| cd opencv-2.4.11 | |
| mkdir release | |
| cd release | |
| # compile and install | |
| cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ CMAKE_C_COMPILER=/usr/bin/gcc -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 -D BUILD_FAT_JAVA_LIB=ON -D INSTALL_TO_MANGLED_PATHS=ON -D INSTALL_CREATE_DISTRIB=ON -D INSTALL_TESTS=ON -D ENABLE_FAST_MATH=ON -D WITH_IMAGEIO=ON -D BUILD_SHARED_LIBS=OFF -D WITH_GSTREAMER=ON .. | |
| make all -j4 # 4 cores | |
| sudo make install | |
| # ignore libdc1394 error http://stackoverflow.com/questions/12689304/ctypes-error-libdc1394-error-failed-to-initialize-libdc1394 | |
| #python | |
| #> import cv2 | |
| #> cv2.SIFT | |
| #<built-in function SIFT> |
majidhazari
commented
Jun 12, 2015
|
Very useful. Thanks. |
mattmezza
commented
Jul 28, 2015
|
Hey I'm on 15.04 but I'm not able to compile OpenCv 2.4.11, seems like there is a problem with ffmpeg with the highgui module. |
Yami-Bitshark
commented
Aug 1, 2015
|
Mattmezz, the 'sudo apt-get install -y libopencv-dev' is missing in the script, please add it to the script or do it manually. it will solve your problem |
Yami-Bitshark
commented
Aug 1, 2015
|
if it doesnt work, add this option to the cmake " -D WITH_FFMPEG=OFF " it will disable the ffmpeg ( i think u dont need it ), but it will solve your problem 100% (only for Ubuntu 15.04, because the ffmpeg is dropped or replaced , i dont know exactly) |
ekeup
commented
Aug 18, 2015
|
I'm running Ubuntu 14.10 and had to add: |
agakshat
commented
Sep 19, 2015
|
Great script man! worked without any hassles |
jorgepsmatos
commented
Oct 17, 2015
|
Worked on ubuntu 12.04. |
samuelololol
commented
Nov 14, 2015
|
message from ubuntu-15.10
|
Miketools
commented
Nov 17, 2015
|
Python:
=> [SOLVED] $ sudo apt-get install python-opencv |
khushali
commented
Feb 16, 2016
|
I am on 15.04 but can't compile opencv 2.4.11 and i tried what Yami-Bitshark said anything else to add or remove? |
lidaweironaldo
commented
Mar 27, 2016
|
In case of error "nvcc fatal : Unsupported gpu architecture 'compute_11' ", add "-D CUDA_GENERATION=Kepler .." to the end of cmake. |
201power
commented
May 4, 2016
|
Very useful, thanks |
GingerMuda
commented
May 5, 2016
|
I am getting the following error when running cmake Parse error in command line argument: -D |
liguanbin
commented
May 6, 2016
|
great! |
GingerMuda
commented
May 17, 2016
•
|
I was getting import cv2 errors so just thought of posting a solution here incase someone might have the same problem. If opencv installs successfully, you need to check if cv2.so is in |
tmkasun
commented
May 27, 2016
|
Thanks , |
Iseguel
commented
Jun 17, 2016
|
Great script, worked on Ubuntu 16.04 |
karanpathak
commented
Jul 10, 2016
•
|
I have imported cv2 but and cv2.ORB is working fine Please Help !!! |
MarwaElDiwiny
commented
Aug 5, 2016
|
I am using Ubuntu 15.04 and it doesn't work, I tried -D WITH_FFMPEG=OFF nothing solved, please help |
lhcavalcanti
commented
Sep 16, 2016
|
anyone has some script like that one for mac OS? |
absentm
commented
Jan 6, 2017
|
@Miketools, sure! it;s ok! |
karanpathak
commented
Jan 15, 2017
•
SOLVEDcv2.SIFT shows: AttributeError: 'module' object has no attribute 'SIFT'Copy opencv-2.4.11/release/lib/cv2.so file to /usr/lib/python2.7/dist-packages |
hlaidev
commented
Jan 25, 2017
|
broke my virtualenv after running the script. |
sammyaksangai
commented
Mar 23, 2017
|
Thanks. It worked on python 2.7.12. (which is my default one). How to make it work on python 3.5? |
yejingx
commented
Mar 28, 2017
|
try http://techtidings.blogspot.hk/2012/01/problem-with-libglso-on-64-bit-ubuntu.html if
because of a broken link. |
coyotte508
commented
Jun 10, 2017
•
|
Ubuntu 16.04, libxine-dev is not found, fails the rest. Maybe it should be on a separate line? |
HamdiHamed1992
commented
Jul 20, 2017
|
for people who are facing this error : |
TrinhTUHH
commented
Sep 8, 2017
•
|
If there is error with graphcuts.cpp, try this: |
lmiguelmh
commented
Oct 27, 2017
|
@TrinhTUHH thanks. It seems this problem was solved in the latest version (2.4.13.4) |
Nagaraj104065
commented
Dec 30, 2017
•
|
HOW TO FIX Built target pch_Generate_opencv_perf_highgui |
boneheadmed commentedMay 8, 2015
Outstanding! Worked the first time. Thanks!