Ubuntu12.04 configure the qt4 + opencv2.4.1 environment

Source: Internet
Author: User
Article: http: wwwsamontabcomweb201206installing-opencv-2

First install g ++

hugo@hugo-ThinkPad-Edge:~$ sudo apt-get install g++
hugo@hugo-ThinkPad-Edge:~$ sudo apt-get install g++ automake
Install qt4
hugo@hugo-ThinkPad-Edge:~$ sudo apt-get install libqt4-dev qt4-dev-tools qt4-designer qt4-doc qt4-demos
Install qt4 creator

: Http://qt-project.org/downloads/

After the download is the run file, modify the permission and run it, and then install it on the GUI.

hugo@hugo-ThinkPad-Edge:~/Downloads$ sudo chmod 777 qt-creator-opensource-linux-x86_64-3.0.1.run 
Configure the opencv environment

First, update and upgrade the system.

hugo@hugo-ThinkPad-Edge:~$ sudo apt-get update
hugo@hugo-ThinkPad-Edge:~$ sudo apt-get upgrade
Install necessary dependent environments
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 libavformat-dev libswscale-dev
Download, compile, and run opencv2.4.1 (2.4.8 is not recommended. I have problems after 2.4.8 is configured)
hugo@hugo-ThinkPad-Edge:~/Downloads$ wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.1/OpenCV-2.4.1.tar.bz2
hugo@hugo-ThinkPad-Edge:~/Downloads$ tar jxvf OpenCV-2.4.1.tar.bz2 
hugo@hugo-ThinkPad-Edge:~/Downloads$ cd OpenCV-2.4.1
hugo@hugo-ThinkPad-Edge:~/Downloads/Opencv-2.4.1$ mkdir build
hugo@hugo-ThinkPad-Edge:~/Downloads/Opencv-2.4.1$ cd build
hugo@hugo-ThinkPad-Edge:~/Downloads/OpenCV-2.4.1/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 ..
hugo@hugo-ThinkPad-Edge:~/Downloads/OpenCV-2.4.1/build$ make
hugo@hugo-ThinkPad-Edge:~/Downloads/OpenCV-2.4.1/build$ sudo make install
Edit environment variables
hugo@hugo-ThinkPad-Edge:~/Downloads/OpenCV-2.4.1/build$ sudo vim /etc/ld.so.conf.d/opencv.conf

Path to add the opencv Library:

/usr/local/lib
hugo@hugo-ThinkPad-Edge:~/Downloads/OpenCV-2.4.1/build$ sudo ldconfig
hugo@hugo-ThinkPad-Edge:~/Downloads/OpenCV-2.4.1/build$ sudo vim /etc/bash.bashrc 
Add at the end:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfigexport PKG_CONFIG_PATH
So far, the configuration is successful.
Related Article

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.