Joint application of QT and Opencv

Use the QT platform to reproduce the fuzzing and grayscale of opencv c++, and encapsulate the running code into an exe file, which can be transplanted to another computer for operation. Among them, there is no need to install QT or opencv for other computer configuration requirements, and the same function can also be realized.

 Below is a simple rendering of the final result.

              final effect

Table of contents

1. Environment configuration

2. Interface introduction

3. Start building the user ui interface



1. Environment configuration

First of all, the version configuration I use is: QT is 5.12.9, and the version of opencv c++ is 4.5.1

 The reference link for installing the software here is put below for your reference:

http://download.qt.io/                                                            QT software installation URL

https://opencv.org/releases/                                                  opencv c++ download URL

The specific installation method has been introduced in other blogs, so I won’t explain too much here. --If you have installation problems, you can ask in the comment area

2. Interface introduction

First, the interface of QT is shown in the figure below:

Open the installed QT Creator

Then you can start the first QT file, first click the file in the upper right corner --> click New --> application (qt) --> QT widgets application. to create.

 Then click choose to proceed to the next step, as shown in the figure:

 The name can be modified at will (do not appear in Chinese), here is the default, pay attention to modify the path, and then click Next:

 Here, select qmake from the drop-down menu. If you use VSc++ to program, use cmake. Then click Next,

Check generate form here to prepare for using the ui interface later

 Then click Next, and the following page can be defaulted, and then according to the computer you use, generally choose 64-bit, and choose one of the two.

 Then click Next --> Finish.

In this way, your first QT is newly created.

3. Start building the user ui interface

There are three places here for an explanation, 1 is the project file you created, 2 is the header file you need to use, 3 is the written .c file, and 4 is the place for visualization and simple page editing. Below we will use them one by one.

First, click the fourth place circled in the picture above, open it as shown in the picture below, then use the mouse to drag the label control to the specified position, click Edit and enter: hello world

 Then click the green triangle symbol in the lower left corner, and you will get the first QT program, as shown in the figure below:

Next, start to import the opencv library into the QT project, the process is as follows:

The installation of opencv is not explained in this article. Go directly to the topic and import opencv.

as the picture shows:

Guess you like

Origin blog.csdn.net/Helloorld_1/article/details/127836635
Recommended