Linux qt OpenCV installation configuration detail version __linux

Source: Internet
Author: User
Linux qt OpenCV installation Configuration (detailed edition) Directory

Linux qt OpenCV installation configuration details directory Linux installation configuration 1 download system mirroring 2 system Partition 3 make U disk boot Disk 4 installation System 5 EASYBCD repair system boot qt installation configuration 1 Install some dependent packages 2 download install qt 3 Configuration 4 Test OPENCV Installation Configuration 1 Install the necessary packages 2 from GitHub download source package 3 Compile installation 4 Configure 5 test

1. Linux installation configuration 1.1 download system mirroring

System mirroring can be downloaded from the Linux open source community, Ubuntu release, and so on. Take ubuntu16.04 lts For example, how to install a Win7+linux dual system under Win7. 1.2 System Partitions

You can refer to the Baidu Experience system with the partition method 1.3 make U disk Startup Disk

USB disk installation is the most secure, the way to make a startup disk is also a lot, my choice is to use the Yumi Muti-boot tool, the reason is that I can be engraved in the same disk with a number of versions of the system (Windows or Linux), as long as U disk has enough space. Because the system reload is a regular thing, so I made the Win7+ubuntu dual system boot disk.

Yumi Green version Download address

Production process: Open Yumi in the dropdown list select the type of system you want to create click Browse to find the specified mirror click Start, waiting to complete

The same is true when you add a new mirror, and you can also delete mirrors that have been carved. 1.4 Installation System

Insert a U disk to reboot the computer, press the shortcut key to choose the way to boot for u disk, select the system to install, the following installation process have wizards, the only thing to note is not directly click on the installation, it is best to click on other options to set up system files, select a new system partition, set up and partition file System/ root directory, EXT4 format, large capacity swap swap area, 4G boot system boot, EXT4 format, 200M Home User directory, EXT4 format, large capacity

The next key is to look at the section number of the boot, select the partition in the system boot Drop-down list below, and then click Install, which is done automatically below. 1.5 EASYBCD repair system boot

After the first installation restart, it is possible to directly enter the Win7 system, we can use the EASYBCD tool in the Win7 system to repair, download the open, you can view the current system boot project, if only the Win7 can add entries, and select the boot partition, Set the time to wait for the user to select the system when booting. After the reboot, there will be an interface that allows the user to choose to enter the system. 2. qt installation Configuration 2.1 Install some dependent packages

g++:

sudo apt-get install build-essential

Some other packages:

sudo apt-get install Libx11-dev libxext-dev Libxtst-dev

The following are not sure if they are necessary:

sudo apt-get install Libx11-dev libxau-devlibxaw7-dev libxcb1-dev Libxcomposite-dev Libxdmcp-dev
sudo apt-get install libxext-dev libxfixes-devlibxfont-dev libxft-dev Libxi-dev Libxinerama-dev Libxkbfile-devlibxmu-dev libxmuu-dev
sudo apt-get install Libxpm-dev libxrandr-devlibxrender-dev Libxres-dev Libxss-dev libxt-dev libxtst-dev libxv-devlibxvmc-dev
sudo apt-get install libglib2.0-dev
sudo apt-get install Libssl-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libcups2-dev
sudo apt-get install Libgl1-mesa-devlibglu1-mesa-dev
sudo apt-get install Libgstreamer0.10-dev
2.2 Download Install QT

Download the address, you can download the source version, or binary file version, the latter installation is very simple, the file name is Qt-opensource-xxx.run, the file that contains the QT library, also contains QT creator. Open Terminal

sudo chmod +x qt-opensource-linux-x64-5.3.0.run
sudo./qt-opensource-linux-x64-5.3.0.run

Waiting for automatic installation, after installation, the software is generally located in the/opt/directory 2.3 configuration

Set system path

Sudo GEDIT/ETC/BASH.BASHRC
is opened after the last add the following
export qtdir=/opt/qt5.3.0/5.3/gcc_64 #根据自已的具体版本
export path=$ Qtdir/bin: $PATH
export ld_library_path= $QTDIR/lib: $LD _library_path
Save
SOURCE/ETC/BASH.BASHRC

Qt Creator is located under/opt/qt5.5.1/tools/qtcreator/bin, and after adding path, it can be started in the terminal input Qtcreator

Export path= "$PATH:/opt/qt5.5.1/tools/qtcreator/bin"

Start qt Creator-> Tools-> Options->build &run->qt Vision, see if automatic detection to qmake, if not, manually add and find it, located in/OPT/QT5.5.1/ 5.5/gcc/bin/qmake 2.4 Test

New PROJECT->NON-QT Project->plain C + + project, write a Hello World program test. 3. OPENCV installation Configuration 3.1 Install the necessary packages

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavform At-dev libswscale-dev
#以下可选
sudo apt-get install python-dev python-numpy libtbb2 Libtbb-dev Libjpeg-dev Libpng-dev Libtiff-dev Libjasper-dev Libdc1394-22-dev
3.2 Download Source package from GitHub
CD ~/
wget https://github.com/opencv/opencv/archive/3.2.0.zip #主模块
unzip 3.2.0.zip
wget https:// Github.com/opencv/opencv_contrib/archive/3.2.0.zip #拓展模块
Unzip 3.2.0.zip
3.3 Compile installation
CD opencv-3.2.0/
mkdir build
CD build    #build目录
cmake-d cmake_build_type=release-d Cmake_install_ Prefix=/usr/local-d Opencv_extra_modules_path=~/opencv_contrib-3.2.0/modules. #cmake编译
make-j4 
sudo make install #安装

After the installation is complete, put the OpenCV header file in/usr/local/include and/usr/local/lib the library file. 3.4 Configuration

Add library path
sudo gedit/etc/ld.so.conf.d/opencv.conf
open Add
/usr/local/lib
update system library
sudo ldconfig
Add PATH
sudo gedit/etc/bash.bashrc
add
pkg_config_path= $PKG _config_path:/usr/local/lib/pkgconfig 
Export Pkg_config_path
3.5 Test

Open Qtcreator, new project, configure Pro file:

TEMPLATE = App
CONFIG + + console c++11
config-= app_bundle
config-= qt

SOURCES + = main.cpp

INC Ludepath + +/usr/local/include \
                /usr/local/include/opencv \
                /usr/local/include/opencv2

LIBS + =/usr/ local/lib/libopencv_highgui.so \
        /usr/local/lib/libopencv_core.so \
        /usr/local/lib/libopencv_ imgcodecs.so \
        /usr/local/lib/libopencv_videoio.so \
        /usr/local/lib/libopencv_imgproc.so

Source file:

#include <iostream>
#include "opencv2/core.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2 /videoio.hpp "
#include" opencv2/imgproc.hpp "

using namespace std;
using namespace CV;

int main ()
{
    Mat img;
    img = Imread ("lena.jpg", -1);
    Imshow ("A", IMG);
    Cvwaitkey (0);
    return 0;
}

Note: If the picture does not write a full path, to be placed in the project's debug directory, not the source file directory, otherwise the terminal window will appear: OpenCV Error:assertion failed (size.width>0, size.height>0) In Imshow ... Hint, the picture cannot be displayed.

When a undefine reference symbols error occurs, the Libs in the pro file is not included intact.

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.