Movatterモバイル変換


[0]ホーム

URL:


CN111857708A - A realization method and system of multi-image stitching software based on Qt interface - Google Patents

A realization method and system of multi-image stitching software based on Qt interface
Download PDF

Info

Publication number
CN111857708A
CN111857708ACN202010480639.XACN202010480639ACN111857708ACN 111857708 ACN111857708 ACN 111857708ACN 202010480639 ACN202010480639 ACN 202010480639ACN 111857708 ACN111857708 ACN 111857708A
Authority
CN
China
Prior art keywords
function
parameter
slot
file
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010480639.XA
Other languages
Chinese (zh)
Other versions
CN111857708B (en
Inventor
张纯杨
张昊徳
笪庆
韩玉兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing University of Science and Technology
Original Assignee
Nanjing University of Science and Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing University of Science and TechnologyfiledCriticalNanjing University of Science and Technology
Priority to CN202010480639.XApriorityCriticalpatent/CN111857708B/en
Publication of CN111857708ApublicationCriticalpatent/CN111857708A/en
Application grantedgrantedCritical
Publication of CN111857708BpublicationCriticalpatent/CN111857708B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种基于Qt界面的多图像拼接的软件实现方法及其系统,该方法包括:配置Qt和OpenCV,创建Qt Gui Application项目;在ui文件中绘制窗口,添加Push Button和Scroll Area,设计对话框;在“.h”文件中添加所需的成员对象;在“.h”头文件中声明所需的成员函数,即与按钮部件对应的槽函数;在与项目同名的“.cpp”文件中建立槽函数与部件信号之间的联系,对槽函数进行定义;编译运行Debug版本和Release版本;对Release版本生成的可执行文件打包发布。本发明采用Qt界面,极大地提高了程序的跨平台特性,在拼接上,使用OpenCV中的自带方法进行拼接,极大地改善了拼接效果,又使代码更加简洁,并且程序可以输入多幅图像,也降低了拍摄全景图像对拍摄技术和相机空间位置这两项要求。

Figure 202010480639

The invention discloses a software implementation method and system for multi-image stitching based on Qt interface. The method includes: configuring Qt and OpenCV, creating a Qt Gui Application project; drawing a window in a ui file, adding Push Button and Scroll Area, Design the dialog box; add the required member objects in the ".h"file; declare the required member functions in the ".h" header file, that is, the slot function corresponding to the button component; in the ".cpp" with the same name as the project ” file to establish the connection between the slot function and the component signal, define the slot function; compile and run the Debug version and the Release version; package and release the executable file generated by the Release version. The invention adopts the Qt interface, which greatly improves the cross-platform characteristics of the program. In the splicing, the built-in method in OpenCV is used for splicing, which greatly improves the splicing effect, and makes the code more concise, and the program can input multiple images. , and also reduces the two requirements of shooting technology and camera space position for shooting panoramic images.

Figure 202010480639

Description

Translated fromChinese
一种基于Qt界面的多图像拼接软件的实现方法及其系统A realization method and system of multi-image stitching software based on Qt interface

技术领域technical field

本发明涉及一种多图像拼接软件实现技术,具体涉及一种基于Qt界面的多图像拼接的软件实现方法及其系统。The invention relates to a software realization technology of multi-image stitching, in particular to a software realization method and system of multi-image stitching based on Qt interface.

背景技术Background technique

目前单源成像难以满足我们的日常生活需要,例如需要拍摄全景照片时,可能会使用手机相机的全景功能,有时也可能需要两个相机甚至是三个相机,并且需要严格地确定相机位置和高度,来完成全景图像的制作。但是直接使用全景功能可能会因为相机握不稳导致拍摄效果不好,而使用多个相机拼接对摄像头位置和高度的要求过高。因此,需要一种对拍摄技术和相机空间位置这两项要求都不高的技术,来方便全景图像的制作。At present, single-source imaging is difficult to meet the needs of our daily life. For example, when we need to take panoramic photos, we may use the panoramic function of the mobile phone camera, and sometimes two cameras or even three cameras may be required, and the camera position and height need to be strictly determined. , to complete the production of the panoramic image. However, using the panorama function directly may lead to poor shooting results due to the unstable camera grip, and the use of multiple cameras stitching requires too much camera position and height. Therefore, there is a need for a technology that does not have high requirements on both the shooting technology and the spatial position of the camera, so as to facilitate the production of panoramic images.

发明内容SUMMARY OF THE INVENTION

本发明的目的在于提供一种基于Qt界面的多图像拼接的软件实现方法及其系统。The purpose of the present invention is to provide a software implementation method and system of multi-image stitching based on Qt interface.

实现本发明目的技术解决方案为:一种基于Qt界面的多图像拼接的软件实现方法,包括如下步骤:The technical solution for realizing the object of the present invention is: a software implementation method for multi-image stitching based on Qt interface, comprising the following steps:

步骤1,配置Qt和OpenCV,创建Qt Gui Application项目;Step 1, configure Qt and OpenCV, and create a Qt Gui Application project;

步骤2,在ui文件中绘制窗口,添加Push Button和Scroll Area,设计对话框;Step 2, draw the window in the ui file, add Push Button and Scroll Area, and design the dialog box;

步骤3,在“.h”文件中添加所需的成员对象;Step 3, add the required member objects in the ".h" file;

步骤4,在“.h”头文件中声明所需的成员函数,即与所需部件对应的槽函数;Step 4, declare the required member function in the ".h" header file, that is, the slot function corresponding to the required component;

步骤5,在与项目同名的“.cpp”文件中建立槽函数与部件信号之间的联系,对槽函数进行定义;Step 5, establish the connection between the slot function and the component signal in the ".cpp" file with the same name as the project, and define the slot function;

步骤6,编译运行Debug版本和Release版本;Step 6, compile and run the Debug version and the Release version;

步骤7,对Release版本生成的可执行文件打包发布。Step 7, package and release the executable file generated by the Release version.

进一步的,步骤2中,在ui文件中绘制窗口,添加Push Button和Scroll Area,设计对话框形式,具体方法如下:Further, in step 2, draw the window in the ui file, add Push Button and Scroll Area, and design the dialog box form. The specific methods are as follows:

在ui文件中绘制窗口,此处添加6个Push Button,4个用于点击后读取图片路径,一个用于点击后开始拼接,一个用于点击后退出程序;再添加4个Scroll Area用于显示待拼接图片。Draw the window in the ui file, add 6 Push Buttons here, 4 are used to read the image path after clicking, one is used to start stitching after clicking, and one is used to exit the program after clicking; and 4 Scroll Areas are added for Display the pictures to be stitched.

进一步的,步骤3中,在“.h”文件中添加所需的成员对象,具体方法如下:Further, in step 3, add the required member objects in the ".h" file, and the specific methods are as follows:

(一)添加QString类型对象,用于接收所读取路径的字符串;(1) Add a QString type object to receive the string of the read path;

(二)添加Mat类型对象,用以将路径下图片暂存,然后压入容器中;(2) Add a Mat type object to temporarily store the picture under the path, and then press it into the container;

(三)添加vector容器,用于存入(二)中的Mat类型对象数据,在以后的步骤中用以作为拼接函数的参数传入而实现拼接;(3) adding a vector container, which is used to store the Mat type object data in (2), and is used to pass in as a parameter of the splicing function in subsequent steps to realize splicing;

(四)添加string类型对象,用于确定保存拼接结果的文件名,注意要带上扩展名,例如“["dst1.jpg"]”;(4) Add a string type object to determine the file name for saving the splicing result, pay attention to bring the extension, such as "["dst1.jpg"]";

(五)添加四个QLabel类型指针,用于将(二)中获取的图像显示到ui界面上;(5) Add four QLabel type pointers for displaying the image obtained in (2) on the ui interface;

(六)添加Mat类型对象,用以保存拼接好的图像。(6) Add a Mat type object to save the stitched image.

进一步的,步骤4中,在“.h”头文件中声明所需的成员函数,即与按钮部件对应的槽函数,具体方法为:Further, in step 4, the required member function, that is, the slot function corresponding to the button component, is declared in the ".h" header file. The specific method is:

在“private”关键字后面添加宏“slots”,即在“private slots:”后面进行声明,声明的成员函数如下:Add the macro "slots" after the "private" keyword, that is, declare it after "private slots:". The declared member functions are as follows:

(一)函数一:部件一—按钮一对应的槽函数1;(1) Function 1: Slot function 1 corresponding to component 1-button 1;

(二)函数二:部件二—按钮二对应的槽函数2;(2) Function 2: Component 2 - slot function 2 corresponding to button 2;

(三)函数三:部件三—按钮三对应的槽函数3;(3) Function 3: Component 3 - slot function 3 corresponding to button 3;

(四)函数四:部件四—按钮四对应的槽函数4;(4) Function 4: Component 4 - slot function 4 corresponding to button 4;

(五)函数五:部件五—按钮五对应的槽函数b;(5) Function 5: Component 5—the slot function b corresponding to button 5;

(六)函数六:部件六—按钮六对应的槽函数exit。(6) Function 6: Component 6—the slot function corresponding to button 6 exit.

进一步的,步骤5中,在与项目同名的“.cpp”文件中建立槽函数与部件信号之间的联系,具体方法如下:Further, in step 5, the connection between the slot function and the component signal is established in the ".cpp" file with the same name as the project. The specific method is as follows:

首先是使用“connect”函数建立槽函数与部件信号之间的联系,不同联系关系,函数参数列表也不同,参数简介如下:The first is to use the "connect" function to establish the connection between the slot function and the component signal. Different connection relationships have different function parameter lists. The parameter introduction is as follows:

第一参数:ui.XXX,XXX代表ui对象下的成员名,其部件对象名称在步骤(2) 中添加部件时得到;The first parameter: ui.XXX, where XXX represents the member name under the ui object, and the component object name is obtained when the component is added in step (2);

第二参数:SIGNAL(clicked()),由于所有槽函数都是以点击按钮为信号,所以此处都为SIGNAL(clicked());The second parameter: SIGNAL(clicked()), since all slot functions use the clicked button as the signal, so here are SIGNAL(clicked());

第三参数:this,因为只有一个窗口,仅有一个接收者,所以此都处固定为this即可;The third parameter: this, because there is only one window and only one receiver, so this can be fixed as this;

第四参数:SLOT(对应槽函数名()),相应部件收到相应信号则执行此槽函数;The fourth parameter: SLOT (corresponding to the slot function name ()), the corresponding component will execute the slot function when it receives the corresponding signal;

connect函数的执行可以概括为:当第一参数对应的部件接收到第二参数形式的信号,在第三参数接收者执行第四参数的槽函数,这样就成功将所有按钮部件与槽函数建立联系。The execution of the connect function can be summarized as follows: when the component corresponding to the first parameter receives the signal in the form of the second parameter, the third parameter receiver executes the slot function of the fourth parameter, so that all button components and the slot function are successfully established. .

进一步的,在与项目同名的“.cpp”文件中对槽函数进行定义,具体方法如下:Further, define the slot function in the ".cpp" file with the same name as the project. The specific method is as follows:

槽函数1:使用QFileDialog类的成员函数getOpenFileName来读取图像路径、函数参数:Slot function 1: Use the member function getOpenFileName of the QFileDialog class to read the image path and function parameters:

第一参数:用于指定父组件,此处固定为this;The first parameter: used to specify the parent component, fixed here as this;

第二参数:对话框标题字符串;The second parameter: the dialog title string;

第三参数:默认读取的路径名字符串,为了能够随意寻找路径,将字符串空下,即将双引号直接输入,引号内部无内容即可;The third parameter: the path name string read by default, in order to be able to find the path at will, leave the string empty, that is, enter the double quotation marks directly, and there is no content inside the quotation marks;

第四参数:文件后缀名过滤字符串,因为读取文件必须是图片,所以此处填入: "Images(*.png*.bmp*.jpg*.tif*.gif)";The fourth parameter: the file suffix filter string, because the read file must be a picture, so fill in: "Images(*.png*.bmp*.jpg*.tif*.gif)";

该函数返回值赋值给QString对象;The function return value is assigned to the QString object;

接下来检测是否成功找到输入路径,使用if语句和QString对象下的成员函数isEmpty,该函数没有参数,只会返回bool类型数据,若相应对象数据为空则返回true,利用if语句判断返回值,若返回值为true则槽函数1直接结束返回,即return;若返回值为false,则继续执行接下来的步骤;Next, check whether the input path is successfully found. Use the if statement and the member function isEmpty under the QString object. This function has no parameters and only returns bool type data. If the corresponding object data is empty, it returns true, and the if statement is used to judge the return value. If the return value is true, the slot function 1 directly ends the return, that is, return; if the return value is false, the next steps are continued;

接下来初始化一个string类型对象,利用QString类型对象的成员函数toStdString() 的返回值,来为string类型对象赋值,因为读取路径下的图像所用的函数,函数参数的路径字符串应为标准string类型;Next, initialize a string type object, and use the return value of the member function toStdString() of the QString type object to assign a value to the string type object, because the function used to read the image under the path, the path string of the function parameter should be a standard string type;

下一步就是使用OpenCV函数“imread”来读取图像,利用Mat类型对象来接收所读取的图像数据;The next step is to use the OpenCV function "imread" to read the image, and use the Mat type object to receive the read image data;

然后就是将刚刚读取到的图像压入vector容器中去,用以拼接;Then it is to push the image just read into the vector container for splicing;

再次初始化一个Mat类型对象,用于下面步骤:Initialize a Mat type object again for the following steps:

然后进行图像大小调整,利用OpenCV的“resize”函数,注意,Qt中有同名函数,这里需要加入命名空间“cv”,即“cv::resize”,函数参数如下:Then adjust the image size and use the "resize" function of OpenCV. Note that there is a function of the same name in Qt. Here you need to add the namespace "cv", that is, "cv::resize", and the function parameters are as follows:

第一参数:待调整图像,此处为Mat类型对象;The first parameter: the image to be adjusted, here is a Mat type object;

第二参数:调整后接收使用的图像,此处为甲;The second parameter: the image received after adjustment, here is A;

第三参数:需调整的尺寸,即Size(长,宽);The third parameter: the size to be adjusted, namely Size (length, width);

下一步进行Mat类对象到QImage类对象的转换,首先初始化一个QImage类型对象,对象初始化时需要输入构造函数的参数,各个参数如下:The next step is to convert the Mat class object to the QImage class object. First, initialize a QImage type object. When the object is initialized, you need to input the parameters of the constructor. The parameters are as follows:

第一参数:图像数据,使用甲的对象“data”来获取数据,注意要进行强制类型转换,将其转换成“const unsigned char*”型数据;The first parameter: image data, use the object "data" of A to obtain the data, pay attention to the mandatory type conversion, and convert it into "const unsigned char*" type data;

第二参数:图像列数,与调整尺寸后的甲相同,使用甲的对象“cols”来获取数据;The second parameter: the number of image columns, which is the same as the resized A, and the A's object "cols" is used to obtain data;

第三参数:图像行数,与调整尺寸后的甲相同,使用甲的对象“rows”来获取数据;The third parameter: the number of image rows, which is the same as the resized A, and the A's object "rows" is used to obtain data;

第四参数:图像存入格式,这里是QImage类里的枚举类型数据,因为OpenCV中图像数据三通道的顺序是B、G、R,所以这里是“QImage::Format_BGR888”;Fourth parameter: image storage format, here is the enumeration type data in the QImage class, because the order of the three channels of image data in OpenCV is B, G, R, so here is "QImage::Format_BGR888";

然后初始化QLabel类型指针,使用算符new即可;Then initialize the QLabel type pointer and use the operator new;

使用这个指针的“->”运算符来执行成员函数;Use this pointer's "->" operator to execute member functions;

首先是“setPixmap”函数,参数如下:The first is the "setPixmap" function with the following parameters:

唯一参数:QPixmap::fromImage(刚刚初始化的QImage类型对象名);The only parameter: QPixmap::fromImage (the name of the QImage type object just initialized);

其次是:“resize”函数,参数如下:Followed by: "resize" function, the parameters are as follows:

唯一参数:QSize(刚刚初始化的QImage类型对象的宽度,刚刚初始化的QImage 类型对象的高度),其中宽度、高度分别可以用刚刚初始化的QImage类型对象的成员变量width(),height()来获得宽高;The only parameter: QSize (the width of the QImage type object just initialized, the height of the QImage type object just initialized), where the width and height can be obtained by using the member variables width() and height() of the QImage type object just initialized respectively. high;

最后一步,利用对象“ui”来使Scroll Area去显示QImage类型对象的图像;The last step is to use the object "ui" to make the Scroll Area display the image of the QImage type object;

ui.[Scroll Area对应的对象名]->setWidget([QLabel类型指针名]);ui.[Object name corresponding to Scroll Area]->setWidget([QLabel type pointer name]);

至此,槽函数1的定义结束;So far, the definition of slot function 1 is over;

槽函数2、槽函数3、槽函数4和槽函数1的定义流程基本相同,但是在QLabel类型指针的使用上,不同槽函数对应的QLabel类型指针不同,还应注意,利用对象“ui”来使ScrollArea去显示QImage类型对象的图像时,“[Scroll Area对应的对象名]”中不同槽函数所对应的对象名也不同;The definition process of slot function 2, slot function 3, slot function 4 and slot function 1 is basically the same, but in the use of QLabel type pointers, the QLabel type pointers corresponding to different slot functions are different. When the ScrollArea is used to display the image of the QImage type object, the object names corresponding to different slot functions in "[Scroll Area corresponding object name]" are also different;

槽函数b:这个槽函数用于开始拼接图像;Slot function b: This slot function is used to start stitching images;

首先初始化一个Sticher类对象,使用Sticher类的一个成员函数“Stitcher::createDefault()”对对象赋值,函数“Stitcher::createDefault()”无参数;First initialize a Stitcher class object, use a member function of the Sticker class "Stitcher::createDefault()" to assign values to the object, and the function "Stitcher::createDefault()" has no parameters;

再初始化一个Stitcher类的子类Status类对象,再使用Sticher类的成员函数“stitch”,进行拼接的同时为刚刚初始化的Status类对象赋值,以此检测容器内图像能否拼接;“stitch”函数参数如下:Then initialize a subclass Status class object of the Stitcher class, and then use the member function "stitch" of the Stitcher class to assign values to the newly initialized Status class object while stitching, so as to detect whether the images in the container can be stitched; the "stitch" function The parameters are as follows:

第一参数:容器名;The first parameter: container name;

第二参数:Mat类对象;The second parameter: Mat class object;

然后利用if语句和Status类对象判断判断是否成功拼接,如果成功拼接,Status类对象结果应为“Stitcher::OK”;使用if语句,来判断其结果不等于“Stitcher::OK”,若判断成立,则函数直接返回,表示输入的图像是不能够拼接的,此时需要退出程序,重新读取合适的图像;若判断不成立,则说明拼接成功,直接使用OpenCV的函数“imshow”来显示图像即可,“imshow”函数参数如下:Then use the if statement and the Status class object to judge whether the splicing is successful. If the splicing is successful, the result of the Status class object should be "Stitcher::OK"; use the if statement to judge that the result is not equal to "Stitcher::OK". If it is established, the function returns directly, indicating that the input image cannot be spliced. At this time, it is necessary to exit the program and re-read the appropriate image; if the judgment is not established, it means that the splicing is successful, and the OpenCV function "imshow" is used directly to display the image. That is, the parameters of the "imshow" function are as follows:

第一参数:显示窗口标题字符串,可随意取名,例如“["全景图像"]”;The first parameter: Display the window title string, which can be named arbitrarily, such as "["panorama image"]";

第二参数:用于保存拼接好的图像的Mat类型对象,此处是拼接完成的全景图像,与“stich”函数的第二参数相同;The second parameter: the Mat type object used to save the stitched image, here is the stitched panoramic image, which is the same as the second parameter of the "stich" function;

然后使用waitKey函数来使窗口保持显示,该函数不需要添加参数;Then use the waitKey function to keep the window displayed, this function does not need to add parameters;

至此,槽函数b的定义完成;So far, the definition of slot function b is completed;

槽函数exit:保存图片,退出程序;Slot function exit: save the picture and exit the program;

首先使用if语句和OpenCV的函数“empty”来确定之前的拼接是否成功,所以应是用于保存拼接好的图像的Mat类对象来调用该函数,这个函数没有参数,它会返回bool 类型值,如果对应Mat类型对象中无数据,则会返回“true”,这里的判断对函数返回值取非,若成立,则拼接成功,可使用OpenCV的“imwrite”函数来保存拼接结果,函数参数如下:First, use the if statement and the OpenCV function "empty" to determine whether the previous stitching was successful, so the function should be called by the Mat class object used to save the stitched image. This function has no parameters, and it will return a bool type value. If there is no data in the corresponding Mat type object, it will return "true". The judgment here is to negate the return value of the function. If it is true, the stitching is successful. The "imwrite" function of OpenCV can be used to save the stitching result. The function parameters are as follows:

第一参数:保存路径和文件名,直接保存在与程序相同的路径下即可,此处为string 类型对象中的字符串;The first parameter: save the path and file name, directly save it in the same path as the program, here is the string in the string type object;

第二参数:Mat类型对象,需要保存的图像,此处为用于保存拼接好的图像的Mat类对象;The second parameter: Mat type object, the image to be saved, here is the Mat class object used to save the stitched image;

然后使用OpenCV函数“destroyAllWindows”来关闭所有由OpenCV打开的窗口,该函数无参数;Then use the OpenCV function "destroyAllWindows" to close all windows opened by OpenCV, this function has no parameters;

最后是程序退出函数“exit”,该函数仅有一个参数,填入数字0即可,表示程序正常退出;Finally, the program exit function "exit", this function has only one parameter, fill in the number 0, indicating that the program exits normally;

至此槽函数exit的定义完成。At this point, the definition of the slot function exit is completed.

进一步的,步骤6中,在Debug和Release版本编译运行后,调整“cv::resize”函数的第三参数。Further, in step 6, after the Debug and Release versions are compiled and run, adjust the third parameter of the "cv::resize" function.

一种基于Qt界面的多图像拼接的软件实现系统,包括:A software implementation system for multi-image stitching based on Qt interface, comprising:

编译环境设置模块,用于配置Qt和OpenCV,创建Qt Gui Application项目;Compile environment setting module, used to configure Qt and OpenCV, create Qt Gui Application project;

对话框设置模块,用于在ui文件中绘制窗口,添加Push Button和Scroll Area,设计对话框;The dialog setting module is used to draw the window in the ui file, add Push Button and Scroll Area, and design the dialog;

成员对象设置模块,用于在“.h”文件中添加所需的成员对象;The member object setting module is used to add the required member objects in the ".h" file;

成员函数设置模块,用于在“.h”头文件中声明所需的成员函数,即与所需部件对应的槽函数;The member function setting module is used to declare the required member function in the ".h" header file, that is, the slot function corresponding to the required component;

槽函数关联定义模块,用于在与项目同名的“.cpp”文件中建立槽函数与部件信号之间的联系,对槽函数进行定义;The slot function association definition module is used to establish the connection between the slot function and the component signal in the ".cpp" file with the same name as the project, and define the slot function;

编译模块,用于编译运行Debug版本和Release版本;Compile module for compiling and running Debug version and Release version;

发布模块,用于对Release版本生成的可执行文件打包发布。The release module is used to package and release the executable file generated by the Release version.

一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现以下步骤:A computer device, comprising a memory, a processor and a computer program stored in the memory and running on the processor, the processor implements the following steps when executing the computer program:

步骤1,配置Qt和OpenCV,创建Qt Gui Application项目;Step 1, configure Qt and OpenCV, and create a Qt Gui Application project;

步骤2,在ui文件中绘制窗口,添加Push Button和Scroll Area,设计对话框;Step 2, draw the window in the ui file, add Push Button and Scroll Area, and design the dialog box;

步骤3,在“.h”文件中添加所需的成员对象;Step 3, add the required member objects in the ".h" file;

步骤4,在“.h”头文件中声明所需的成员函数,即与所需部件对应的槽函数;Step 4, declare the required member function in the ".h" header file, that is, the slot function corresponding to the required component;

步骤5,在与项目同名的“.cpp”文件中建立槽函数与部件信号之间的联系,对槽函数进行定义;Step 5, establish the connection between the slot function and the component signal in the ".cpp" file with the same name as the project, and define the slot function;

步骤6,编译运行Debug版本和Release版本;Step 6, compile and run the Debug version and the Release version;

步骤7,对Release版本生成的可执行文件打包发布。Step 7, package and release the executable file generated by the Release version.

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:A computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

步骤1,配置Qt和OpenCV,创建Qt Gui Application项目;Step 1, configure Qt and OpenCV, and create a Qt Gui Application project;

步骤2,在ui文件中绘制窗口,添加Push Button和Scroll Area,设计对话框;Step 2, draw the window in the ui file, add Push Button and Scroll Area, and design the dialog box;

步骤3,在“.h”文件中添加所需的成员对象;Step 3, add the required member objects in the ".h" file;

步骤4,在“.h”头文件中声明所需的成员函数,即与所需部件对应的槽函数;Step 4, declare the required member function in the ".h" header file, that is, the slot function corresponding to the required component;

步骤5,在与项目同名的“.cpp”文件中建立槽函数与部件信号之间的联系,对槽函数进行定义;Step 5, establish the connection between the slot function and the component signal in the ".cpp" file with the same name as the project, and define the slot function;

步骤6,编译运行Debug版本和Release版本;Step 6, compile and run the Debug version and the Release version;

步骤7,对Release版本生成的可执行文件打包发布。Step 7, package and release the executable file generated by the Release version.

本发明与现有技术相比,其显著优点在于:采用Qt界面,极大地提高了程序的跨平台特性,在拼接上,使用OpenCV中的自带方法进行拼接,极大地改善了拼接效果,又使代码更加简洁,并且程序可以输入多幅图像,也降低了拍摄全景图像对拍摄技术和相机空间位置这两项要求。Compared with the prior art, the present invention has the significant advantages that: using the Qt interface, the cross-platform characteristics of the program are greatly improved; in the splicing, the self-contained method in OpenCV is used for splicing, which greatly improves the splicing effect; The code is more concise, and the program can input multiple images, and the two requirements of shooting technology and camera space position for shooting panoramic images are reduced.

附图说明Description of drawings

图1为程序运行流程图。Figure 1 is a flow chart of program operation.

图2为拼接的流程图。Figure 2 is a flow chart of splicing.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.

在64位WindowsOS上安装Visual Studio 2017IDE,并配合Qt 5.14.2、OpenCV3.4.2,以C++为主体语言,软件最多拼接四幅图为例,详细介绍本发明基于Qt界面的多图像速拼接方法。图1所示为程序的运行流程,图2所示为拼接的流程,本发明方法主要的执行步骤如下:Install Visual Studio 2017 IDE on 64-bit WindowsOS, and cooperate with Qt 5.14.2 and OpenCV3.4.2, take C++ as the main language, and the software stitches up to four pictures as an example, and introduces the multi-image fast stitching method based on the Qt interface of the present invention in detail. Fig. 1 shows the running flow of the program, Fig. 2 shows the flow of splicing, and the main execution steps of the method of the present invention are as follows:

(1)根据已有配置方法搭建编译环境。此部分为前提部分,不属于发明部分,但是必须执行,故不多做赘述。(1) Build a compilation environment according to the existing configuration method. This part is a prerequisite, not an invention part, but must be implemented, so I won't go into details.

(2)在ui文件中绘制窗口,此处添加6个Push Button,四个用于点击后读取图片路径,一个用于点击后开始拼接,一个用于点击后退出程序。再添加4个Scroll Area用于显示待拼接图片。(2) Draw the window in the ui file, add 6 Push Buttons here, four are used to read the image path after clicking, one is used to start splicing after clicking, and one is used to exit the program after clicking. Add 4 Scroll Areas to display the pictures to be stitched.

(3)在自动生成的“.h”文件中添加所需的成员对象,此处添加情况如下:(3) Add the required member objects in the automatically generated ".h" file, where the additions are as follows:

(一)QString类型对象,用于接收所读取路径的字符串;(1) QString type object, used to receive the string of the read path;

(二)Mat类型对象,用以将路径下图片暂存,然后压入容器中;(2) The Mat type object is used to temporarily store the picture under the path, and then press it into the container;

(三)vector容器,为动态容器,用于存入(二)中的Mat类型对象数据,在以后的步骤中用以作为拼接函数的参数传入而实现拼接;(3) The vector container, which is a dynamic container, is used to store the Mat type object data in (2), and is used as a parameter of the splicing function in the subsequent steps to implement splicing;

(四)string类型对象,用于确定保存拼接结果的文件名,注意要带上扩展名,例如“["dst1.jpg"]”;(4) String type object, used to determine the file name for saving the splicing result, pay attention to bring the extension, such as "["dst1.jpg"]";

(五)四个QLabel类型指针,用于将(二)中获取的图像显示到ui界面上;(5) Four QLabel type pointers, which are used to display the image obtained in (2) on the ui interface;

(六)Mat类型对象,用以保存拼接好的图像。(6) The Mat type object is used to save the stitched image.

以上成员对象均是私有类(private)成员,需要在类内自行声明“private:”;The above member objects are all private class members, and you need to declare "private:" in the class;

(4)在自动生成的“.h”头文件中声明所需的成员函数,即与所需部件对应的槽函数,槽函数声明方法与普通成员函数略有不同,需要在“private”关键字后面添加宏“slots”,即在“private slots:”后面进行声明。声明的成员函数如下:(4) Declare the required member function in the automatically generated ".h" header file, that is, the slot function corresponding to the required component. The slot function declaration method is slightly different from the ordinary member function, and needs to be used in the "private" keyword. Add the macro "slots" later, that is, declare it after "private slots:". The declared member functions are as follows:

(一)函数一:部件一—按钮一对应的槽函数1(以下简称槽函数1);(1) Function 1: Slot function 1 corresponding to component 1-button 1 (hereinafter referred to as slot function 1);

(二)函数二:部件二—按钮二对应的槽函数2(以下简称槽函数2);(2) Function 2: Component 2 - Slot function 2 corresponding to button 2 (hereinafter referred to as slot function 2);

(三)函数三:部件三—按钮三对应的槽函数3(以下简称槽函数3);(3) Function 3: Component 3 - Slot function 3 corresponding to button 3 (hereinafter referred to as slot function 3);

(四)函数四:部件四—按钮四对应的槽函数4(以下简称槽函数4);(4) Function 4: Component 4—the slot function 4 corresponding to button 4 (hereinafter referred to as slot function 4);

(五)函数五:部件五—按钮五对应的槽函数b(以下简称槽函数b);(5) Function 5: Component 5—the slot function b corresponding to the button 5 (hereinafter referred to as the slot function b);

(六)函数六:部件六—按钮六对应的槽函数exit(以下简称槽函数exit)。(6) Function 6: Component 6—the slot function exit corresponding to button 6 (hereinafter referred to as slot function exit).

例如,按照上述添加,则添加如下代码段即可:For example, according to the above addition, add the following code snippet:

private slots:private slots:

void on_1_clicked();void on_1_clicked();

void on_2_clicked();void on_2_clicked();

void on_3_clicked();void on_3_clicked();

void on_4_clicked();void on_4_clicked();

void on_b_clicked();void on_b_clicked();

void on_exit_clicked();(5)在自动生成的、与项目同名的“.cpp”文件中添加必要的代码,主要是建立槽函数与部件信号之间的联系以及对槽函数进行定义,各项如下:void on_exit_clicked(); (5) Add the necessary code to the automatically generated ".cpp" file with the same name as the project, mainly to establish the connection between the slot function and the component signal and define the slot function, the items are as follows :

首先是使用“connect”函数建立槽函数与部件信号之间的联系,不同联系关系,函数参数列表也不同,参数简介如下:The first is to use the "connect" function to establish the connection between the slot function and the component signal. Different connection relationships have different function parameter lists. The parameter introduction is as follows:

第一参数:ui.XXX,XXX代表ui对象下的成员名,可以在步骤(2)中添加部件时得到其部件对象名称;The first parameter: ui.XXX, XXX represents the member name under the ui object, and the component object name can be obtained when adding a component in step (2);

第二参数:SIGNAL(clicked()),由于所有槽函数都是以点击按钮为信号,所以此处都为SIGNAL(clicked());The second parameter: SIGNAL(clicked()), since all slot functions use the clicked button as the signal, so here are SIGNAL(clicked());

第三参数:this,因为只有一个窗口,仅有一个接收者,所以此都处固定为this即可;The third parameter: this, because there is only one window and only one receiver, so this can be fixed as this;

第四参数:SLOT(对应槽函数名()),相应部件收到相应信号则执行此槽函数。The fourth parameter: SLOT (corresponding to the slot function name ()), the corresponding component will execute the slot function when it receives the corresponding signal.

connect函数的执行可以概括为:当第一参数对应的部件接收到第二参数形式的信号,在第三参数接收者执行第四参数的槽函数。这样就成功将所有按钮部件与槽函数建立联系。The execution of the connect function can be summarized as follows: when the component corresponding to the first parameter receives a signal in the form of the second parameter, the receiver of the third parameter executes the slot function of the fourth parameter. In this way, all button widgets are successfully associated with the slot function.

其次是各个槽函数的定义:The second is the definition of each slot function:

槽函数1:使用QFileDialog类的成员函数getOpenFileName来读取图像路径,函数参数:Slot function 1: Use the member function getOpenFileName of the QFileDialog class to read the image path, function parameters:

第一参数:用于指定父组件,此处固定为this即可;The first parameter: used to specify the parent component, which can be fixed as this here;

第二参数:对话框标题字符串,比如:“Select Picture”;The second parameter: the dialog title string, for example: "Select Picture";

第三参数:默认读取的路径名字符串,为了能够随意寻找路径,将字符串空下,即将双引号直接输入,引号内部无内容即可;The third parameter: the path name string read by default, in order to be able to find the path at will, leave the string empty, that is, enter the double quotation marks directly, and there is no content inside the quotation marks;

第四参数:文件后缀名过滤字符串,因为读取文件必须是图片,所以此处填入: "Images(*.png*.bmp*.jpg*.tif*.gif)"。The fourth parameter: the file suffix filter string, because the read file must be a picture, so fill in: "Images(*.png*.bmp*.jpg*.tif*.gif)".

该函数返回值赋值给(3)(一)中所说的QString对象。The return value of this function is assigned to the QString object mentioned in (3)(1).

接下来检测是否成功找到输入路径,使用if语句和QString对象下的成员函数isEmpty,该函数没有参数,只会返回bool类型数据,若相应对象数据为空则返回true,利用if语句判断返回值,若返回值为true则槽函数1直接结束返回,即return;若返回值为false,则继续执行接下来的步骤。Next, check whether the input path is successfully found. Use the if statement and the member function isEmpty under the QString object. This function has no parameters and only returns bool type data. If the corresponding object data is empty, it returns true, and the if statement is used to judge the return value. If the return value is true, the slot function 1 directly ends the return, that is, return; if the return value is false, the next step is continued.

接下来初始化一个string类型对象,利用(3)(一)中所说的QString类型对象的成员函数toStdString()的返回值,来为string类型对象赋值,因为读取路径下的图像所用的函数,函数参数的路径字符串应为标准string类型。Next, initialize a string type object, and use the return value of the member function toStdString() of the QString type object mentioned in (3) (1) to assign a value to the string type object, because the function used to read the image under the path, Path strings for function parameters should be of standard string type.

下一步就是使用OpenCV函数“imread”来读取图像,利用(3)(二)中的Mat类型对象来接收所读取的图像数据。The next step is to use the OpenCV function "imread" to read the image, and use the Mat type object in (3) (2) to receive the read image data.

然后就是将刚刚读取到的图像压入(3)(三)中的vector容器中去,用以拼接。Then it is to push the image just read into the vector container in (3) (3) for splicing.

再次初始化一个Mat类型对象(我们称其为甲),用于下面步骤。Initialize a Mat type object (we call it A) again for the following steps.

然后进行图像大小调整,利用OpenCV的“resize”函数,注意,Qt中有同名函数,这里需要加入命名空间“cv”,即“cv::resize”,函数参数如下:Then adjust the image size and use the "resize" function of OpenCV. Note that there is a function of the same name in Qt. Here you need to add the namespace "cv", that is, "cv::resize", and the function parameters are as follows:

第一参数:待调整图像,此处为(3)(二)中的Mat类型对象;The first parameter: the image to be adjusted, here is the Mat type object in (3) (2);

第二参数:调整后接收使用的图像,此处为甲;The second parameter: the image received after adjustment, here is A;

第三参数:需调整的尺寸,可以直接输入Size(长,宽)。The third parameter: the size to be adjusted, you can directly input Size (length, width).

因为界面大小有限,Scroll Area的尺寸也就有限,我们可以通过(2)中的绘制Scroll Area来得到一个合适的尺寸,这里也可以先设置成一个比Scroll Area尺寸小的多的尺寸,等到最终编译运行时再做适当调整,这样会更合适。Because the size of the interface is limited, the size of the Scroll Area is also limited. We can obtain a suitable size by drawing the Scroll Area in (2). Here, we can also set it to a size much smaller than the size of the Scroll Area, and wait until the final Make appropriate adjustments when compiling and running, which will be more appropriate.

下一步进行Mat类对象到QImage类对象的转换,首先初始化一个QImage类型对象,对象初始化时需要输入构造函数的参数,各个参数如下:The next step is to convert the Mat class object to the QImage class object. First, initialize a QImage type object. When the object is initialized, you need to input the parameters of the constructor. The parameters are as follows:

第一参数:图像数据,可以使用甲的对象“data”来获取数据,注意要进行强制类型转换,将其转换成“const unsigned char*”型数据;The first parameter: image data, you can use the object "data" of A to get the data, pay attention to the mandatory type conversion, and convert it into "const unsigned char*" type data;

第二参数:图像列数,与调整尺寸后的甲相同,我们可以使用甲的对象“cols”来获取数据;The second parameter: the number of image columns, which is the same as the resized A, we can use the A's object "cols" to get the data;

第三参数:图像行数,与调整尺寸后的甲相同,我们可以使用甲的对象“rows”来获取数据;The third parameter: the number of image rows, which is the same as the resized A, we can use the A's object "rows" to get the data;

第四参数:图像存入格式,这里是QImage类里的枚举类型数据,因为OpenCV中图像数据三通道的顺序是B、G、R,所以这里是“QImage::Format_BGR888”。Fourth parameter: image storage format, here is the enumeration type data in the QImage class, because the order of the three channels of image data in OpenCV is B, G, R, so here is "QImage::Format_BGR888".

然后初始化(3)(五)的QLabel类型指针,使用算符new即可,例如:Then initialize the QLabel type pointer of (3) (5) and use the operator new, for example:

[(3)(五)中其中一个的QLabel类型指针名]=new QLabel();[QLabel type pointer name of one of (3)(5)]=new QLabel();

使用这个指针的“->”运算符来执行成员函数。Use the '->' operator on this pointer to execute member functions.

首先是“setPixmap”函数,参数如下:The first is the "setPixmap" function with the following parameters:

唯一参数:QPixmap::fromImage(刚刚初始化的QImage类型对象名)。The only parameter: QPixmap::fromImage (the name of the QImage type object just initialized).

其次是:“resize”函数,参数如下:Followed by: "resize" function, the parameters are as follows:

唯一参数:QSize(刚刚初始化的QImage类型对象的宽度,刚刚初始化的QImage类型对象的高度),其中宽度、高度分别可以用刚刚初始化的QImage类型对象的成员变量width(),height()来获得宽高。The only parameter: QSize (the width of the QImage type object just initialized, the height of the QImage type object just initialized), where the width and height can be obtained by using the member variables width() and height() of the QImage type object just initialized respectively. high.

最后一步,利用对象“ui”来使Scroll Area去显示QImage类型对象的图像。The last step is to use the object "ui" to make the Scroll Area display the image of the QImage type object.

ui.[Scroll Area对应的对象名]->setWidget([(3)(五)中其中一个的QLabel类型指针名]);ui.[Object name corresponding to Scroll Area]->setWidget([(3)(5) one of the QLabel type pointer name]);

至此,槽函数2、槽函数3、槽函数4和槽函数1的定义流程基本相同,但是在QLabel类型指针的使用上,不同槽函数对应的QLabel类型指针不同(在(3)(五)中填加了不止一个,就是要在这里分开使用)。还应注意,在上述提到的最后一步,利用对象“ui”来使ScrollArea去显示QImage类型对象的图像时,“[Scroll Area对应的对象名]”中不同槽函数所对应的对象名也不同,对象名可以在(2)中查看。So far, the definition process of slot function 2, slot function 3, slot function 4 and slot function 1 is basically the same, but in the use of QLabel type pointers, the QLabel type pointers corresponding to different slot functions are different (in (3) (5) If more than one is added, it is to be used separately here). It should also be noted that in the last step mentioned above, when the object "ui" is used to make the ScrollArea display the image of the QImage type object, the object names corresponding to different slot functions in "[Scroll Area corresponding object name]" are also different. , the object name can be viewed in (2).

槽函数b:这个槽函数用于开始拼接图像。Slot function b: This slot function is used to start stitching the image.

首先初始化一个Sticher类对象,使用Sticher类的一个成员函数“Stitcher::createDefault()”对对象赋值,函数“Stitcher::createDefault()”无参数。First initialize a Stitcher class object, use a member function of the Stitcher class "Stitcher::createDefault()" to assign values to the object, and the function "Stitcher::createDefault()" has no parameters.

再初始化一个Stitcher类的子类Status类对象,再使用Sticher类的成员函数“stitch”,进行拼接的同时为刚刚初始化的Status类对象赋值,以此检测容器内图像能否拼接。“stitch”函数参数如下:Then initialize a subclass Status class object of the Stitcher class, and then use the member function "stitch" of the Stitcher class to assign values to the newly initialized Status class object while splicing, so as to detect whether the images in the container can be spliced. The parameters of the "stitch" function are as follows:

第一参数:(3)(三)中的容器名;The first parameter: the container name in (3) (3);

第二参数:(3)(六)中的Mat类对象。The second parameter: the Mat class object in (3) (6).

然后利用if语句和Status类对象判断判断是否成功拼接,如果成功拼接,Status类对象结果应为“Stitcher::OK”。使用if语句,来判断其结果不等于“Stitcher::OK”,若判断成立,则函数直接返回,表示输入的图像是不能够拼接的,此时需要退出程序,重新读取合适的图像;若判断不成立,则说明拼接成功,直接使用OpenCV的函数“imshow”来显示图像即可,“imshow”函数参数如下:Then use the if statement and the Status class object to judge whether the splicing is successful. If the splicing is successful, the result of the Status class object should be "Stitcher::OK". Use the if statement to judge that the result is not equal to "Stitcher::OK". If the judgment is true, the function returns directly, indicating that the input image cannot be stitched. At this time, you need to exit the program and re-read the appropriate image; if If the judgment is not established, it means that the stitching is successful. You can directly use the OpenCV function "imshow" to display the image. The parameters of the "imshow" function are as follows:

第一参数:显示窗口标题字符串,可随意取名,例如“["全景图像"]”;The first parameter: Display the window title string, which can be named arbitrarily, such as "["panorama image"]";

第二参数:Mat类型对象,此处是拼接完成的全景图像,与上文中“stich”函数的第二参数相同。Second parameter: Mat type object, here is the stitched panoramic image, which is the same as the second parameter of the "stich" function above.

然后使用waitKey函数来使窗口保持显示。该函数不需要添加参数。Then use the waitKey function to keep the window displayed. The function does not need to add parameters.

至此,槽函数b的定义完成。At this point, the definition of the slot function b is completed.

槽函数exit:保存图片,退出程序。首先使用if语句和OpenCV的函数“empty”来确定之前的拼接是否成功,所以应是(3)(六)中的Mat类对象来调用该函数,这个函数没有参数,它会返回bool类型值,如果对应Mat类型对象中无数据(此处可以直接理解为拼接失败,没有对(3)(六)中的Mat类对象写入数据),则会返回“true”,这里的判断对函数返回值取非,若成立,则拼接成功,可使用OpenCV的“imwrite”函数来保存拼接结果,函数参数如下:Slot function exit: save the picture and exit the program. First use the if statement and the OpenCV function "empty" to determine whether the previous splicing was successful, so it should be the Mat class object in (3) (6) to call the function, this function has no parameters, it will return a bool type value, If there is no data in the corresponding Mat type object (here, it can be directly understood that the splicing fails, and no data is written to the Mat type object in (3) (6)), it will return "true", and the judgment here is the return value of the function Negative, if it is true, the splicing is successful. You can use the "imwrite" function of OpenCV to save the splicing result. The function parameters are as follows:

第一参数:保存路径和文件名,直接保存在与程序相同的路径下即可,此处为(3)(四)中的字符串;The first parameter: save the path and file name, directly save it in the same path as the program, here is the string in (3) (4);

第二参数:Mat类型对象,需要保存的图像,此处为(3)(六)中的Mat类对象。The second parameter: Mat type object, the image to be saved, here is the Mat class object in (3) (6).

然后使用OpenCV函数“destroyAllWindows”来关闭所有由OpenCV打开的窗口,该函数无参数。Then use the OpenCV function "destroyAllWindows" to close all windows opened by OpenCV, which has no parameters.

最后是程序退出函数“exit”,该函数仅有一个参数,填入数字0即可,表示程序正常退出。Finally, there is the program exit function "exit". This function has only one parameter. Fill in the number 0, which means that the program exits normally.

至此槽函数exit的定义完成。At this point, the definition of the slot function exit is completed.

(6)在Debug和Release版本编译运行,此时可以顺便调整“cv::resize”函数的第三参数,使图像的显示更加合适。(6) Compile and run in the Debug and Release versions. At this time, you can adjust the third parameter of the "cv::resize" function to make the image display more suitable.

(7)最后一步是打包发布,这一部分不属于发明部分,可以自行查找相对应平台的发布方法即可,例如64位WindowsOS配合Visual Studio 2017可以使用Qt自带的MSVC201764-bit工具进行发布。此处不多做赘述。(7) The last step is to package and release. This part does not belong to the invention part. You can find the release method of the corresponding platform by yourself. For example, 64-bit WindowsOS with Visual Studio 2017 can use the MSVC201764-bit tool that comes with Qt to release. I won't go into details here.

基于上述方法,本发明还提出一种基于Qt界面的多图像拼接的软件实现系统,包括:Based on the above method, the present invention also proposes a software implementation system for multi-image stitching based on the Qt interface, including:

编译环境设置模块,用于配置Qt和OpenCV,创建Qt Gui Application项目;Compile environment setting module, used to configure Qt and OpenCV, create Qt Gui Application project;

对话框设置模块,用于在ui文件中绘制窗口,添加Push Button和Scroll Area,设计对话框;The dialog setting module is used to draw the window in the ui file, add Push Button and Scroll Area, and design the dialog;

成员对象设置模块,用于在“.h”文件中添加所需的成员对象;The member object setting module is used to add the required member objects in the ".h" file;

成员函数设置模块,用于在“.h”头文件中声明所需的成员函数,即与所需部件对应的槽函数;The member function setting module is used to declare the required member function in the ".h" header file, that is, the slot function corresponding to the required component;

槽函数关联定义模块,用于在与项目同名的“.cpp”文件中建立槽函数与部件信号之间的联系,对槽函数进行定义;The slot function association definition module is used to establish the connection between the slot function and the component signal in the ".cpp" file with the same name as the project, and define the slot function;

编译模块,用于编译运行Debug版本和Release版本;Compile module for compiling and running Debug version and Release version;

发布模块,用于对Release版本生成的可执行文件打包发布。The release module is used to package and release the executable file generated by the Release version.

一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现以下步骤:A computer device, comprising a memory, a processor and a computer program stored in the memory and running on the processor, the processor implements the following steps when executing the computer program:

步骤1,配置Qt和OpenCV,创建Qt Gui Application项目;Step 1, configure Qt and OpenCV, and create a Qt Gui Application project;

步骤2,在ui文件中绘制窗口,添加Push Button和Scroll Area,设计对话框;Step 2, draw the window in the ui file, add Push Button and Scroll Area, and design the dialog box;

步骤3,在“.h”文件中添加所需的成员对象;Step 3, add the required member objects in the ".h" file;

步骤4,在“.h”头文件中声明所需的成员函数,即与所需部件对应的槽函数;Step 4, declare the required member function in the ".h" header file, that is, the slot function corresponding to the required component;

步骤5,在与项目同名的“.cpp”文件中建立槽函数与部件信号之间的联系,对槽函数进行定义;Step 5, establish the connection between the slot function and the component signal in the ".cpp" file with the same name as the project, and define the slot function;

步骤6,编译运行Debug版本和Release版本;Step 6, compile and run the Debug version and the Release version;

步骤7,对Release版本生成的可执行文件打包发布。Step 7, package and release the executable file generated by the Release version.

一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:A computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

步骤1,配置Qt和OpenCV,创建Qt Gui Application项目;Step 1, configure Qt and OpenCV, and create a Qt Gui Application project;

步骤2,在ui文件中绘制窗口,添加Push Button和Scroll Area,设计对话框;Step 2, draw the window in the ui file, add Push Button and Scroll Area, and design the dialog box;

步骤3,在“.h”文件中添加所需的成员对象;Step 3, add the required member objects in the ".h" file;

步骤4,在“.h”头文件中声明所需的成员函数,即与所需部件对应的槽函数;Step 4, declare the required member function in the ".h" header file, that is, the slot function corresponding to the required component;

步骤5,在与项目同名的“.cpp”文件中建立槽函数与部件信号之间的联系,对槽函数进行定义;Step 5, establish the connection between the slot function and the component signal in the ".cpp" file with the same name as the project, and define the slot function;

步骤6,编译运行Debug版本和Release版本;Step 6, compile and run the Debug version and the Release version;

步骤7,对Release版本生成的可执行文件打包发布。Step 7, package and release the executable file generated by the Release version.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM) 或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage In the medium, when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other medium used in the various embodiments provided in this application may include non-volatile and/or volatile memory. Nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Road (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features It is considered to be the range described in this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are specific and detailed, but should not be construed as a limitation on the scope of the invention patent. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.

Claims (10)

CN202010480639.XA2020-05-302020-05-30Realization method and system of multi-image splicing software based on Qt interfaceActiveCN111857708B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202010480639.XACN111857708B (en)2020-05-302020-05-30Realization method and system of multi-image splicing software based on Qt interface

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202010480639.XACN111857708B (en)2020-05-302020-05-30Realization method and system of multi-image splicing software based on Qt interface

Publications (2)

Publication NumberPublication Date
CN111857708Atrue CN111857708A (en)2020-10-30
CN111857708B CN111857708B (en)2023-05-12

Family

ID=72986019

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202010480639.XAActiveCN111857708B (en)2020-05-302020-05-30Realization method and system of multi-image splicing software based on Qt interface

Country Status (1)

CountryLink
CN (1)CN111857708B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN112732258A (en)*2021-01-112021-04-30中国船舶重工集团公司第七0七研究所Dynamic switch button software implementation method based on state machine
CN115904353A (en)*2023-03-022023-04-04上海合见工业软件集团有限公司Method and system for generating target source file of user interface

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6243859B1 (en)*1998-11-022001-06-05Hu Chen-KuangMethod of edit program codes by in time extracting and storing
CN105468366A (en)*2015-11-212016-04-06成都飞机工业(集团)有限责任公司Intelligent interface based on Qt ground station
CN111192199A (en)*2019-12-312020-05-22武汉兴图新科电子股份有限公司Method for splicing computer desktop and camera images across Windows and Linux platforms

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6243859B1 (en)*1998-11-022001-06-05Hu Chen-KuangMethod of edit program codes by in time extracting and storing
CN105468366A (en)*2015-11-212016-04-06成都飞机工业(集团)有限责任公司Intelligent interface based on Qt ground station
CN111192199A (en)*2019-12-312020-05-22武汉兴图新科电子股份有限公司Method for splicing computer desktop and camera images across Windows and Linux platforms

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
使用QT实现图片拼接功能: "嗜血的蚂蚁@", 《HTTPS://BLOG.CSDN.NET/WEIXIN_42054950/ARTICLE/DETAILS/84987037》*

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN112732258A (en)*2021-01-112021-04-30中国船舶重工集团公司第七0七研究所Dynamic switch button software implementation method based on state machine
CN115904353A (en)*2023-03-022023-04-04上海合见工业软件集团有限公司Method and system for generating target source file of user interface
CN115904353B (en)*2023-03-022023-06-23上海合见工业软件集团有限公司Method and system for generating target source file of user interface

Also Published As

Publication numberPublication date
CN111857708B (en)2023-05-12

Similar Documents

PublicationPublication DateTitle
LaganièreOpenCV computer vision application programming cookbook second edition
CN105117233B (en)API Calls method and device
Smith et al.Android recipes: a problem-solution approach
JP5189986B2 (en) Extensible mechanism for object composition
CN105378689B (en)Method and apparatus for unified Extensible Firmware Interface (UEFI) driver and agreement
CN111857708A (en) A realization method and system of multi-image stitching software based on Qt interface
US20170090886A1 (en)System and Method for Using Ubershader Variants Without Preprocessing Macros
CN102292736A (en)Collaborative environment project extensibility with composition containers
CN108509343A (en)Automated testing method based on image recognition technology and system
EP4307106A1 (en)Visual software development system, method and apparatus, and computer storage medium
US20230291994A1 (en)Photographing information management method and worker terminal in which program for executing photographing information management method is installed
CN109445845A (en)Interface call method, device, computer equipment and storage medium
CN112015378A (en)Skeleton screen page generation method and device, computer equipment and storage medium
WO2022174613A1 (en)Application generation method and device based on android system, and storage medium
CN115757135A (en)Test environment deployment method, apparatus, storage medium, and program product
US10489652B2 (en)Image capturing system
Escrivá et al.OpenCV 4 Computer Vision Application Programming Cookbook: Build Complex Computer Vision Applications with OpenCV and C++
WO2019052143A1 (en)Jsx file generation method and apparatus, storage medium and computer device
CN110032390B (en)Method for realizing multi-model co-upgrade package, storage medium and intelligent terminal
US20080028283A1 (en)Document production support device, methods thereof and storage medium
CN112905440B (en) Test modules and test methods of artificial intelligence quality inspection system
CN110673890B (en) Plug-in calling method, system, medium and device
JP5334124B2 (en) Information processing apparatus, control method thereof, and program
KornyakovInstant OpenCV for iOS
CN117425080B (en) Photographing methods and related equipment

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
CB03Change of inventor or designer information
CB03Change of inventor or designer information

Inventor after:Han Yubing

Inventor after:Zhang Chunyang

Inventor after:Zhang Haode

Inventor after:Da Qing

Inventor before:Zhang Chunyang

Inventor before:Zhang Haode

Inventor before:Da Qing

Inventor before:Han Yubing

GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp