# 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> |
Are this only work in ubuntu 16.04 ?
one thing is truly told by Linus Torvald that Ubuntu is horrible with the make command.
Ubuntu 16.04, libxine-dev is not found, fails the rest. Maybe it should be on a separate line?
Same problem here, but Ubuntu 18.04.1
$ 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 ```
throws me:
E: Unable to locate package libxine-dev
E: Unable to locate package libgstreamer0.10-dev
E: Couldn't find any package by glob 'libgstreamer0.10-dev'E: Couldn't find any package by regex 'libgstreamer0.10-dev'
E: Unable to locate package libgstreamer-plugins-base0.10-devE: Couldn't find any package by glob 'libgstreamer-plugins-base0.10-dev'
E: Couldn't find any package by regex 'libgstreamer-plugins-base0.10-dev'
I've tried different ways to install libxine-dev
effortless. Any idea how to solve it?
If any of you use Ubuntu 16.04 with cuda 10.0 ,then please install 2.4.13.2 instead of this version, cause due to cuda mismatch the build won't work.
And cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D CUDA_GENERATION=Kepler .. @HamdiHamed1992
if this error occurs:
'nvcc fatal : Unsupported gpu architecture 'compute_20'
Outstanding! Worked the first time. Thanks
Outstanding! Worked the first time. Thanks!
Which version of Ubuntu have you used for installing it? I am installing it on Ubuntu 16.04.7 on a VirtualBox (Win 10), but get errors.
Thanks. It worked on python 2.7.12. (which is my default one). How to make it work on python 3.5?
Hello, I also want to make it work on Python 3.5/3.5+ -- any luck getting it worked on Python 3.5+?
Everything goes fine until I run the following command.
"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"
When I run the above command, it gives me the following error:
"E: Package 'libxine-dev' has no installation candidate"
I have python 3.8.9 installed on Ubuntu 16.04.7
Ubuntu 16.04, libxine-dev is not found, fails the rest. Maybe it should be on a separate line?
Same problem here, but Ubuntu 18.04.1
$ 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 ```
throws me:
E: Unable to locate package libxine-dev E: Unable to locate package libgstreamer0.10-dev E: Couldn't find any package by glob 'libgstreamer0.10-dev'E: Couldn't find any package by regex 'libgstreamer0.10-dev' E: Unable to locate package libgstreamer-plugins-base0.10-devE: Couldn't find any package by glob 'libgstreamer-plugins-base0.10-dev' E: Couldn't find any package by regex 'libgstreamer-plugins-base0.10-dev'
I've tried different ways to install
libxine-dev
effortless. Any idea how to solve it?
I'm using ubuntu 18.04, and still got the same error.
I tried 'libxine2' instead of 'libxine-dev' and it works !
All the dependencies in the shell looks fine, however to install opencv-2.4.11 there is an easier way to do it by running:
sudo apt-get install python-opencv
in your command line. Note that the SIFT/SURF API has changed due to patent issues and can be called like this:Notice that the second line used to be called using
cv2.SIFT
. Details can be found here