QT5.4.2MINGW Compiling configuration opencv2.4.9

Source: Internet
Author: User

1 Download the tools you need

(1) Qt-opensource-windows-x86-mingw491_opengl-5.4.2.exe 842M

Https://download.qt.io/archive/qt/5.4/5.4.2/

(2) OpenCV for Windows (Opencv-2.4.9.exe 348M)

Http://opencv.org/downloads.html

(3) Cmake-2.8.12.2-win32-x86.exe 10M

https://cmake.org/files/v2.8/

2 Installing QT 5.4.2

The process is simple, choose Components to select all, installation prompt step by step. The default installation path is C:\Qt\Qt5.4.2, be careful not to drastically change the path, I just changed C to D, so my installation path is d:\Qt\Qt5.4.2

3 Installing OpenCV2.4.9

It is not so much an installation as extracting it to a location.

Double-click the Opencv-2.4.9.exe, the decompression path to the D-disk, the easier the better, do not give yourself trouble.

After the decompression, a OpenCV folder will be generated in the D drive, such as:

4 Installing CMake

(1) The installation path cannot have Chinese and space (2) tick add all environment variables

5 Set the system environment variable of QT, need to set two

Make Path D:\Qt\Qt5.4.2\Tools\mingw491_32\bin

Qmake Path D:\Qt\Qt5.4.2\5.4\mingw491_32\bin

Click on the path, then click Edit, press the computer's home button to position the cursor at the beginning of the value of the variable box, and then paste the two paths, the different paths should be separated by a semicolon in the English state.

6. Open CMake, compile with CMake OpenCV

(1) Set the source path and the generated target path

D:/opencv/sources is the 3rd step to extract OpenCV after the source path generated

D:/opencv/compile This compile path is a new folder that I created under d:/opencv/to hold the compiled generated files.

(2) Click the Configure button (first click Configure). In the popup dialog box, select Mingwmakefiles, as shown in

Then click Next and set the following:

C:d:\qt\qt5.4.2\tools\mingw491_32\bin\gcc.exe

C + +:d: \qt\qt5.4.2\tools\mingw491_32\bin\g++.exe

Fortran not required

The results that appear after clicking Finish are as follows:

The work of the front is very good!!!

(3) Check the above list of With_opengl and WITH_QT two, the other items are best not to change.

(4) Click Configure Again (second click Configure), the results are as follows:

Although there will be many warnings, such as this warning are for project developers. Use-wno-dev to suppress it, but it will not affect our final success.

(5) Click the Generate button to generate the makefile file, after success, the bottom will prompt generating done. There will be some warnings, I can not, basically step (2) Success, the back is very smooth, I was stuck in the second step for a long time.

7 Open cmd to compile

(1) Enter the target path you just set (D:/opencv/compile)

First Enter D: Enter D, then enter cdopencv/compile into the Compile folder

(2) then enter the Mingw32-make command to start compiling, the process is about 25 minutes
(3) then enter Mingw32-make install this process takes about 1-2 minutes

8 Starting the OPENCV development environment to configure QT Creator

(1) Copy D:\opencv\build's include directory to D:\OPENCV

(2) Copy D:\opencv\compile bin and Lib directory (7th, 8 step generated files) to D:\OPENCV

(3) After the copy of the result, just keep the box selected three directories, other directories can be deleted.

(4) Add the bin directory to the system environment variable

http://blog.csdn.net/bladeandmaster88/article/details/51591579

QT5.4.2MINGW Compiling configuration opencv2.4.9

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.