Install opencv-2.4.7 in Ubuntu 11.10 with Qt support

Source: Internet
Author: User
Tags chmod curl gtk mkdir

Please visit the original address: http://blog.csdn.net/ajaxhe/article/details/16986451

Combine your own problems with installing opencv-2.4.7 under Ubuntu 11.10, organized as follows:

Install opencv-2.4.7 in Ubuntu 11.10 with Qt support ref-link:http://www.cnblogs.com/steven-blog/archive/2013/04/27/ 3046357.html
Ref-link:http://www.cnblogs.com/keyemb/p/3233966.html

Requirement:
python-2.7.2+
cmake-2.8.8+

pre-install:
[Plain] View Plain copy print? $ sudo apt-get install Python-dev libcv-dev libcvaux-dev libhighgui-dev   $ sudo apt-get install libtbb-dev&nbsp ; Libqt4-dev libqt4-opengl-dev libjpeg-dev libtiff4-dev   $ sudo apt-get install yasm Libfaac-dev Libopencore-amrnb-dev libopencore-amrwb-dev Libtheora-dev Libvorbis-dev libxvidcore-dev Libx264-dev Texlive-latex-extra libv4l-dev Libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev  $ 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 

$ sudo apt-get install Python-dev libcv-dev libcvaux-dev libhighgui-dev 
$ sudo apt-get install Libtbb-dev  libqt4- Dev Libqt4-opengl-dev libjpeg-dev libtiff4-dev 
$ sudo apt-get install yasm libfaac-dev Libopencore-amrnb-dev Libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev Texlive-latex-extra Libv4l-dev Libdc1394-22-dev Libavcodec-dev libavformat-dev libswscale-dev
$ 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

Install Command:
[Plain]View Plain copy print? $ TAR-AXVF opencv-2.4.7.tar.gz $ cd opencv-2.4.7 $ mkdir release $ cd release $ cmake-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 build_examples=on-d WIT H_qt=on-d With_opengl=on.
$ TAR-AXVF opencv-2.4.7.tar.gz
$ cd opencv-2.4.7
$ mkdir Release
$ cd release
$ cmake-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 BUILD_ Examples=on-d with_qt=on-d With_opengl=on.
[Plain]View Plain copy print? $ make $ sudo make install
$ make
$ sudo make install

Set Environment:
[Plain]View Plain copy print? $ sudo echo "/usr/local/lib" >>/etc/ld.so.conf $ sudo ldconfig $ export pkg_config_path= $PKG _config_path:/usr/loc Al/lib/pkgconfig
$ sudo echo "/usr/local/lib" >>/etc/ld.so.conf
$ sudo ldconfig
$ export pkg_config_path= $PKG _config_path :/usr/local/lib/pkgconfig

Build Samples
[Plain]View Plain copy print? $ cd opencv-2.4.7/samples/c $./build_all.sh
$ CD opencv-2.4.7/samples/c
$./build_all.sh

Run a sample:
[Plain]View Plain copy print? $./delaunay
$./delaunay

notic:
1. Build_python_support is for the old OpenCV version, when you compiling opencv-2.4.7, you should use Build_new_python_suppor T
2. If you haven ' t install Independens, you'll get the following errors or warning

-------

problem:
Make Error at/home/bbs/documents/opencv/opencv-2.4.7/cmake/cl2cpp.cmake:50 (string):
String does not recognize Sub-command MD5

Solution:
This project requires version 2.8.8 of CMake. I am running version 2.8.5.

How to update CMake in Ubuntu11.10?
ref-link:http://askubuntu.com/questions/263826/cmake-2-8-9-on-ubuntu-10-04

Enter the Folloe commands:
[Plain]View Plain copy print? $ cd ~ $ wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2-Linux-i386.sh $ chmod +x cmake-2.8.10.2-linux-i386.sh $./ Cmake-2.8.10.2-linux-i386.sh then you'll a new fold named "cmake-2.8.10.2-linux-i386" in ~ directory, and add the path To PATH Environment $ export path=~/cmake-2.8.10.2-linux-i386/bin: $PATH $ cmake--version cmake version 2.8.10.2
$ cd ~
$ wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2-Linux-i386.sh
$ chmod +x cmake-2.8.10.2-linux-i386.sh
$/cmake-2.8.10.2-linux-i386.sh Then you'll
a new fold named " Cmake-2.8.10.2-linux-i386 "in ~ directory, and  add the path to PATH environment
$ export Path=~/cmake-2.8.10.2-li Nux-i386/bin: $PATH
$ cmake--version
cmake version 2.8.10.2

--------

Prblem:
Could not find Pythonlibs (missing:python_include_dirs) (Required are at least version "2.7.2")

Solution:
[Plain]View Plain copy print? sudo apt-get install Python-dev
sudo apt-get install Python-dev

--------

problem:
[Plain]View Plain copy print? $ python python:error while loading shared libraries:libstdc++.so.5:cannot open Shared object file:no such file or di Rectory
$ python
python:error while loading shared libraries:libstdc++.so.5:cannot open Shared object file:no such file or Directory

Solution:
[Plain]View Plain copy print? $ sudo apt-get install libstdc++5
$ sudo apt-get install libstdc++5

---------

problem:
Update python-2.4 to python-2.7.2

Solution:
Ref-link:http://stackoverflow.com/questions/5233536/python-2-7-on-ubuntu

How to update python in Ubuntu 11.10
[Plain]View Plain copy print? $ python-v python 2.6.6 $ curl-kl Https://raw.github.com/utahta/pythonbrew/master/pythonbrew-install | bash $.   $HOME/.PYTHONBREW/ETC/BASHRC $ pythonbrew Install 2.7.2 $ pythonbrew Switch 2.7.2 switched to Python-2.7.2 $ python-v Python 2.7.2
$ python-v
python 2.6.6
$ curl-kl Https://raw.github.com/utahta/pythonbrew/master/pythonbrew-install | bash< c2/>$. $HOME/.PYTHONBREW/ETC/BASHRC
$ pythonbrew Install 2.7.2
$ pythonbrew Switch 2.7.2
switched to Python-2.7.2
$ python-v
Python 2.7.2

----------

problem:
CMake Warning:
Manually-specified variables were not used by the project:
Build_python_support

Solution:
Ref-link:http://stackoverflow.com/questions/8510972/building-opencv-2-3-1-with-python-2-7-support-in-ubuntu-11-10-64bit
It looks like the You ' re using a old install guide. Use Build_new_python_support instead.
Change the CMake command line
From
$ cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local-d Build_python_support=on.
To:
$ cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local-d build_new_python_support=on-d BUILD_EXAMPLES =on.

--------

problem:
Pkg-config Cann ' t find the OPENCV setting
$ pkg-config OpenCV--cflags--libs
Package OpenCV is not found in the Pkg-config search path.
Perhaps you should add the directory containing ' opencv.pc '
To the PKG_CONFIG_PATH environment variable
No package ' OpenCV ' found

Solution:
[Plain] View Plain copy print? $ export pkg_config_path= $PKG _config_path:/usr/share/pkgconfig  $ pkg-config--cflags--libs opencv -I/usr/ local/include/opencv-i/usr/local/include /usr/local/lib/libopencv_calib3d.so/usr/local/lib/libopencv_ Contrib.so/usr/local/lib/libopencv_core.so/usr/local/lib/libopencv_features2d.so/usr/local/lib/libopencv_ Flann.so/usr/local/lib/libopencv_gpu.so/usr/local/lib/libopencv_highgui.so/usr/local/lib/libopencv_imgproc.so/ usr/local/lib/libopencv_legacy.so/usr/local/lib/libopencv_ml.so/usr/local/lib/libopencv_nonfree.so/usr/local/ lib/libopencv_objdetect.so/usr/local/lib/libopencv_ocl.so/usr/local/lib/libopencv_photo.so/usr/local/lib/ libopencv_stitching.so/usr/local/lib/libopencv_superres.so/usr/local/lib/libopencv_ts.a/usr/local/lib/ libopencv_video.so/usr/local/lib/libopencv_videostab.so-lrt-lpthread-lm-ldl 
$ export pkg_config_path= $PKG _config_path:/usr/share/pkgconfig
$ pkg-config--cflags--libs OpenCV
-i/usr/ Local/include/opencv-i/usr/local/include  /usr/local/lib/libopencv_calib3d.so/usr/local/lib/libopencv_ Contrib.so/usr/local/lib/libopencv_core.so/usr/local/lib/libopencv_features2d.so/usr/local/lib/libopencv_ Flann.so/usr/local/lib/libopencv_gpu.so/usr/local/lib/libopencv_highgui.so/usr/local/lib/libopencv_imgproc.so/ usr/local/lib/libopencv_legacy.so/usr/local/lib/libopencv_ml.so/usr/local/lib/libopencv_nonfree.so/usr/local/ lib/libopencv_objdetect.so/usr/local/lib/libopencv_ocl.so/usr/local/lib/libopencv_photo.so/usr/local/lib/ libopencv_stitching.so/usr/local/lib/libopencv_superres.so/usr/local/lib/libopencv_ts.a/usr/local/lib/ Libopencv_video.so/usr/local/lib/libopencv_videostab.so-lrt-lpthread-lm-ldl

--------

problem:
OPENCV Application Runtime Error:
OpenCV error:unspecified Error (the function is not implemented. Rebuild the library with Windows, GTK + 2.x or Carbon support. If you is on Ubuntu or Debian, install Libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in Cvnamedwin Dow, File/home/bbs/documents/opencv/opencv-2.4.7/modules/highgui/src/window.cpp, line 483
Terminate called after throwing an instance of ' Cv::exception '
What ():/home/bbs/documents/opencv/opencv-2.4.7/modules/highgui/src/window.cpp:483:error: ( -2) The function was not Implemented. Rebuild the library with Windows, GTK + 2.x or Carbon support. If you is on Ubuntu or Debian, install Libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function CV Namedwindow

Aborted

Solution:
Make sure has installed a graphic lib (gtk+2.0 or Qt) at least. If you choose Qt, just using follow command:
$ sudo apt-get install Libqt4-dev
And reconfigure the CMake, make sure you have a switch on WITH_QT:
$ cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local-d with_tbb=on-d build_new_python_support=on-d W Ith_v4l=on-d build_examples=on-d With_qt=on-D With_opengl=on.
Then recompile and reinstall OpenCV.

-------

problem:
When you running OPENCV application with Qt Interface, Terminal Show:
gtk-warning * *: Unable to locate theme engine in Module_path: "Pixmap"

Solution:
[Plain]View Plain copy print? sudo apt-get install Gtk2-engines-pixbuf
sudo apt-get install Gtk2-engines-pixbuf


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.