Integrated image processing system and method based on Qt and OpenCV

By using an integrated image processing system based on Qt and OpenCV, the problems of flexibility and efficiency in visual debugging of machine vision software platforms are solved. Interactive single-step debugging and visual monitoring of image processing code are realized, improving development efficiency and system consistency.

CN121349459APending Publication Date: 2026-01-16SOUTH CHINA UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511912426.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-01-16

AI Technical Summary

Technical Problem

Existing machine vision software platforms suffer from significant technical bottlenecks in terms of flexibility, scalability, visualization debugging efficiency, and cross-platform compatibility, resulting in low development efficiency and complex deployment.

Method used

A graphical interface based on Qt and integrated with OpenCV is used to realize interactive step-by-step debugging and visual monitoring of image processing code. Through the integration of code editing module, main control module, variable monitoring module and image display module, combined with QProcess, dynamic compilation and real-time capture of output information are performed.

Benefits of technology

It improves the efficiency of debugging and understanding image processing algorithms, lowers the development threshold, realizes an integrated platform from coding to deployment, and enhances the speed of development iteration and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121349459A_ABST
    Figure CN121349459A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer vision, and particularly discloses an integrated image processing system and method based on Qt and OpenCV, and the system comprises a code editing module which comprises a graphic user interface constructed based on a Qt framework and is used for receiving an image processing code which is input by a user and is used for calling an OpenCV function, when the single-step execution instruction of the user is executed, the current execution line code is highlighted; the main control module is used for dynamically packaging and calling an image processing code of an OpenCV function into an executable file, calling a compiler to compile by utilizing QProcess, and capturing output information in a compiling process in real time; if compiling succeeds, running the executable file to decode a local image file, capturing variable data output in the program running process, transmitting the variable data to a variable monitoring module, and transmitting the image data to an image display module; according to the method, the graphical interface is constructed on the basis of Qt, and the OpenCV is integrated for dynamic compiling execution, so that interactive single-step debugging and visual monitoring of the C + + image processing codes are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and more specifically to an integrated image processing system and method based on Qt and OpenCV. Background Technology

[0002] With the deep integration of industrial automation transformation and upgrading with artificial intelligence technology, computer vision technology, as a core perception method, has been widely deployed and applied in key areas such as intelligent manufacturing, precision industrial inspection, intelligent traffic monitoring, medical image analysis, and public security identification.

[0003] Despite the diverse range of machine vision software platforms and solutions available today, significant technical bottlenecks and inherent limitations remain in key areas such as flexibility, scalability, visualization and debugging efficiency, deployment capabilities, and cross-platform compatibility in practical applications. These issues are intertwined and collectively constitute obstacles hindering the efficient development and widespread application of machine vision technology. Specifically, they can be summarized as follows: I. The inherent closed nature and functional limitations of graphical vision platforms. The core problem of graphical vision platforms lies in their "black box" inherent closed nature, which makes it impossible to customize and extend the algorithms, making it difficult to cope with complex or innovative applications. In addition, their high commercial costs and simple control logic severely limit user flexibility and bring about heavy economic and technological dependence.

[0004] II. High Development Threshold and Low Debugging Efficiency of Programmable Image Libraries. Open-source image processing libraries, such as OpenCV, require developers to have strong programming skills and build their own interfaces. However, traditional debugging methods lack intuitive visual feedback, making algorithm verification and optimization processes abstract and time-consuming, which seriously slows down the development iteration speed.

[0005] Third, the lack of visualization of debugging information and the challenges of non-interactive operation. Developers cannot intuitively correlate intermediate results in the image processing workflow with core data and can only rely on interrupts or logs. This non-interactive mode greatly increases the cognitive burden of understanding algorithm logic and locating errors.

[0006] IV. The fragmentation of the edge device (smart camera) ecosystem and the complexity of deployment. Inconsistent standards among manufacturers lead to strong coupling between algorithms and hardware. Developers need to master a large number of underlying proprietary technologies to complete the deployment, which seriously hinders the reuse of algorithms and cross-platform migration.

[0007] Fifth, the fatal flaw in the entire machine vision development process lies in the severe fragmentation of the entire chain. Development, debugging, deployment and other stages are forced to switch between multiple independent tools, lacking an integrated platform from coding to deployment. This has become a key bottleneck restricting the rapid iteration and efficient delivery of projects.

[0008] In summary, existing technologies have failed to effectively resolve the fundamental contradiction between "flexibility" and "ease of use" in machine vision software development, and have significant shortcomings in debugging efficiency and deployment migration. Therefore, there is an urgent need in this field for a new type of machine vision software system to overcome the aforementioned technical deficiencies. Summary of the Invention

[0009] The purpose of this invention is to provide an integrated image processing system and method based on Qt and OpenCV. By building a graphical interface based on Qt and integrating OpenCV for dynamic compilation and execution, interactive single-step debugging and visual monitoring of C++ image processing code can be achieved.

[0010] To achieve the above objectives, the present invention provides the following technical solution: An integrated image processing system based on Qt and OpenCV includes: The code editing module includes a graphical user interface built on the Qt framework, which is used to receive image processing code that calls OpenCV functions from the user, respond to the user's single-step execution instructions, and highlight the current line of code when executing the single-step execution instructions; The main control module is used to dynamically encapsulate image processing code that calls OpenCV functions into executable files, use QProcess to call the compiler for compilation, and capture the output information during the compilation process in real time. The output information includes: compilation success status and error details. If compilation is successful, the executable file will be run to decode the local image file and capture the variable data and image data generated during program execution; The variable monitoring module is used to receive variable data and display it in the variable monitoring window in categories; The image display module is used to receive image data and raw image data generated during program execution and display them in real time in the image display window; The log output module includes compilation success status and error details, used to display output information during the compilation process.

[0011] Furthermore, the execution process of the single-step execution instruction is specifically as follows: S1. The main control module responds to the user's single-step execution command and enters single-step debugging mode; S2. The main control module requests the code editing module to highlight the code text of the line currently pointed to by the current pointer; S3. Encapsulate the currently executing line of code into a mini executable unit, compile and run it; S4. The main control module captures the image data and variable data generated during the execution of the currently executing line of code and sends them to the image display module and the variable monitoring module respectively. S5. After completing one single-step loop, pause execution and wait for the next single-step execution command from the user.

[0012] Furthermore, the system also includes: an error handling and reporting mechanism; The processing logic of the error handling and reporting mechanism is as follows: The main control module monitors the subprocesses and redirects their error streams, captures abnormal exit events and error details caused by internal logic errors in the subprocesses, and generates structured error reports. The main control module, based on the structured error report, highlights the last successfully executed line of code through the graphical user interface, disables the operation buttons in the graphical user interface, and displays the error information to the user to guide the user in debugging.

[0013] Furthermore, the code editing module also supports receiving code template selection instructions via a graphical user interface, specifically: The main control module dynamically retrieves the corresponding C++ image processing code snippets from the code template library and passes them to the code editing module through a signal mechanism; After the slot function of the code editing module responds, the corresponding C++ image processing code snippet is inserted into the cursor position. At the same time, the built-in syntax highlighting engine immediately parses and colors the code, thereby decoupling the user interface operation from the code editing function and ensuring convenient management of adding and deleting code templates.

[0014] Furthermore, the image display module also supports responding to histogram display commands, specifically: Users can click the "Show Histogram" button on the toolbar of the main control module; The main control module first determines whether the object of analysis is the original image data during program execution or the image data after the single-step execution instruction is executed, and sends a request signal to the image display module to obtain a copy of the current image data; The main control module calls OpenCV's calcHist function to calculate the histogram and visualizes it in the image display window of the image display module using a dedicated chart drawing component.

[0015] Furthermore, the system also includes: image loading and environment initialization functions, specifically: The main control module calls OpenCV's imread function to decode the image file into raw image data in memory; The raw image data is distributed by the main control module to the image display module and the backend execution engine; The image display module caches it as the original image and immediately renders and displays it on the interface; The backend execution engine serves as the input source for subsequent algorithm processing; The main control module broadcasts a "environment reset" signal to each module to ensure that the state of the entire development environment is synchronized.

[0016] This invention also provides a method for implementing an integrated image processing system based on Qt and OpenCV, comprising the following steps: S1. A graphical user interface built on the Qt framework, used to receive image processing code that calls OpenCV functions from user input, respond to user single-step execution instructions, and highlight the current line of code when executing single-step execution instructions; S2. Dynamically encapsulate the image processing code that calls OpenCV functions into an executable file, use QProcess to call the compiler for compilation, and capture the output information during the compilation process in real time; the output information includes: compilation success status and error details; S3. If compilation is successful, the executable file will be run to decode the local image file and capture the variable data and image data generated during program execution. S4. Display the image data in the image display window, and simultaneously display the variable data in the variable monitoring window.

[0017] According to specific embodiments provided by the present invention, the present invention has the following technical effects compared to the prior art: This invention significantly enhances the intuitiveness and efficiency of debugging and understanding image processing algorithms through a Qt-based graphical user interface for the code editing module, combined with single-step execution and code highlighting. It is particularly suitable for teaching and algorithm verification scenarios. The main control module dynamically encapsulates code and utilizes QProcess to call the compiler, achieving real-time compilation and execution. Simultaneously, it captures compilation output in real time, ensuring users can quickly locate and correct syntax or logical errors, shortening the development iteration cycle. The variable monitoring module categorizes and displays variable data generated during program execution, while the image display module simultaneously presents the original and processed image data. This dual-channel data visualization mechanism allows users to clearly understand the specific impact of each step of the algorithm on variable states and image effects, thereby gaining a deeper understanding of algorithm principles and performance bottlenecks. The log output module uniformly displays compilation status and error details, providing users with a clear feedback channel. Overall, this system not only simplifies the development and debugging process of OpenCV image processing code and lowers the technical threshold, but also significantly improves algorithm development and debugging efficiency and learning experience through real-time, visual interactive methods, providing an efficient and intuitive auxiliary tool for teaching, research, and prototype development in the field of image processing. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0019] The following description, in conjunction with the accompanying drawings, further illustrates the integrated image processing system and method based on Qt and OpenCV provided by the present invention. Figure 1 This is a flowchart illustrating the integrated image processing method based on Qt and OpenCV in Embodiment 2 of the present invention. Figure 2 This is a schematic diagram of the graphical user interface in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the code for loading and displaying local images in Embodiment 3 of the present invention; Figure 4 This is a schematic diagram of the code execution for the single-step execution and variable tracking functions in Embodiment 3 of the present invention; wherein (a) is a schematic diagram of the single-step execution function executing image processing code; and (b) is a schematic diagram of the code being executed line by line each time the "Single Step Execution" button is clicked. Figure 5 This is a schematic diagram of the code for performing image processing in Embodiment 3 of the present invention; Figure 6 This is a schematic diagram of searching and replacing in the code editing area in Embodiment 3 of the present invention; wherein (a) is a schematic diagram of searching in the code editing area; and (b) is a schematic diagram of replacing in the code editing area. Figure 7 This is a schematic diagram of the code for generating an image grayscale histogram in Embodiment 3 of the present invention; Figure 8 This is a schematic diagram of the image grayscale histogram in Embodiment 3 of the present invention. Detailed Implementation

[0020] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.

[0021] To better understand the purpose, structure, and function of this invention, the invention will be described in further detail below with reference to the accompanying drawings.

[0022] Example 1 This invention provides an integrated image processing system based on Qt and OpenCV, comprising: The code editing module includes a graphical user interface built on the Qt framework, which is used to receive image processing code that calls OpenCV functions from the user, respond to the user's single-step execution instructions, and highlight the current line of code when executing the single-step execution instructions; The main control module is used to dynamically encapsulate image processing code that calls OpenCV functions into executable files, use QProcess to call the compiler for compilation, and capture the output information during the compilation process in real time. The output information includes: compilation success status and error details. If compilation is successful, the executable file will be run to decode the local image file and capture the variable data and image data generated during program execution; The variable monitoring module is used to receive variable data and display it in the variable monitoring window in categories; The image display module is used to receive image data and raw image data generated during program execution and display them in real time in the image display window; The log output module includes compilation success status and error details, used to display output information during the compilation process.

[0023] In this embodiment, before receiving the user's execution command and responding to the user's single-step execution command, the process includes: an interaction flow of image loading and environment initialization, specifically: (1) User trigger: The user selects a local image file through the "Open Image" menu item or toolbar button on the main control module (MainWindow).

[0024] (2) Image Data Reading and Distribution: After receiving the file path, the control module immediately calls the underlying image processing engine (such as OpenCV's imread function) to decode the image file into image data in memory (such as cv::Mat objects). Subsequently, the main control module divides this image data into two data streams: One is to send it to the image display module (ImageDisplayWidget), which receives it, caches it as the "raw image", and immediately renders and displays it in the specified display area; the other is to send it to the backend execution engine as the input source for subsequent algorithm processing.

[0025] (3) State Reset and Notification: The main control module will send a "Environment reset" signal to other relevant modules to synchronize the state. Once the variable monitoring module (VariableListWidget) receives a signal, it will clear its existing variable list to prepare for the new processing flow.

[0026] Running the OutputWidget can clear previous log messages or output a "New image loaded" log.

[0027] The content of the code editor module (CodeEditorWidget) remains unchanged; subsequent execution will be based on the newly loaded image.

[0028] This process ensures that the entire development environment is restored to its initial state each time a new image is loaded, avoiding interference from old data with new tasks.

[0029] In this embodiment, when a user needs to execute an image processing algorithm, the modules work together according to the following process: (1) Triggering and requesting: The user clicks the "Run" button on the interface of the main control module (MainWindow). The main control module, as the commander-in-chief, receives this operation signal.

[0030] (2) Code Acquisition: The main control module then sends a request signal to the code editing module (CodeEditorWidget) to acquire all C++ code text in the current editor.

[0031] (3) Encapsulation and compilation: After receiving the code text, the main control module performs two key actions internally: Dynamic encapsulation: Encapsulates user code into a standard, compilable temporary .cpp file.

[0032] Start an external process: Use QProcess to call the system-configured compiler (such as MinGW or g++) to compile the temporary file.

[0033] (4) Compilation Information Feedback: During the compilation process, the main control module captures the compiler's standard output and error stream in real time and continuously forwards them to the runtime output module (OutputWidget) for display. Users can use this information to determine whether the compilation was successful or to locate syntax errors.

[0034] (5) Execution and Data Capture: After successful compilation, the main control module continues to run the generated executable file through QProcess. At this time, the specially designed program will output the final image data and key variable values ​​generated during the process to a preset temporary file or shared memory.

[0035] (6) Result distribution and display: After the program is completed, the main control module reads these output results and parses and distributes them: the image data is sent to the image display module (ImageDisplayWidget), which updates and displays the processed image immediately after receiving it; the structured variable data (key-value pair list) is sent to the variable monitoring module (VariableListWidget), which refreshes its list view and displays the final value of each variable.

[0036] Through the closed-loop process described above, the five modules, under the scheduling of the main control module, completed the entire process from code input to result visualization.

[0037] The specific interactive flow for responding to the user's single-step execution command and highlighting the current execution line is as follows: (1) State initialization: When the user clicks the "Step-by-step" button, the main control module enters the step-by-step debugging mode and internally maintains a pointer to the "current line number".

[0038] (2) Single-line code extraction and execution: Each time "Step-by-step" is clicked, the main control module will perform the following operations: (a) Request the code text of the line currently pointed to by the code editor module.

[0039] (b) Highlighting: Simultaneously notify the code editing module to highlight the line of code to clearly indicate the current execution location to the user.

[0040] (c) Single-step compilation execution: This encapsulates the line of code (along with the necessary context variable declarations) into a tiny, executable unit and performs a quick "compile-run" operation.

[0041] (3) Real-time status update and feedback: After the microprogram is executed, the main control module captures the instantaneous image and variable status it generates; immediately sends the updated image data to the image display module; immediately sends the updated variable values ​​to the variable monitoring module; and sends the relevant running logs or intermediate information to the running output module.

[0042] (4) Looping and waiting: After the main control module completes one single-step loop, it moves the "current line number" pointer down and pauses execution, waiting for the user's next "single-step run" instruction.

[0043] This embodiment of the process achieves a "slow-motion" decomposition of the algorithm execution process through high-frequency, short-term, and precise interactions between modules, enabling developers to understand the changes brought about by each operation step.

[0044] The code editing module also supports receiving code template selection instructions via a graphical user interface, specifically: The main control module dynamically retrieves the corresponding C++ image processing code snippets from the code template library and passes them to the code editing module through a signal mechanism; After the slot function of the code editing module responds, the corresponding C++ image processing code snippet is inserted at the cursor position. At the same time, the built-in syntax highlighting engine immediately parses and colors the code, thereby decoupling the user interface operation from the code editing function and ensuring convenient management of adding and deleting code templates.

[0045] This embodiment specifically provides a "one-click code insertion" function, and its interaction flow is as follows: (1) User request: In the menu bar of the main control module (MainWindow), the user browses the preset algorithm categories (such as "filtering" and "edge detection") and selects a specific algorithm template (such as "Gaussian filtering").

[0046] (2) Template query and retrieval: After receiving the user's selection, the main control module will find the corresponding C++ standard code snippet from a "code template library" maintained internally, based on the user's selection.

[0047] (3) Code injection: The main control module will transmit the obtained code fragment text to the code editing module (CodeEditorWidget) via a signal.

[0048] (4) Editor Response: When the slot function of the code editing module is triggered, an insertion operation is performed, inserting the received code text into the current cursor position. At the same time, its built-in syntax highlighting engine will immediately parse and highlight the newly inserted code.

[0049] By using the main control module as an "intermediary" and "resource library," the user interface operation and the core code editing function are decoupled, making it very convenient to add, delete, and manage code templates without modifying the code editing module itself.

[0050] The image display module also supports responding to histogram display commands, specifically: Users can click the "Show Histogram" button on the toolbar of the main control module; The main control module first determines whether the object of analysis is the original image data during program execution or the image data after the single-step execution instruction is executed, and sends a request signal to the image display module to obtain a copy of the current image data; The main control module calls OpenCV's calcHist function to calculate the histogram and visualizes it in the image display window of the image display module using a dedicated chart drawing component.

[0051] This embodiment specifically describes the interactive process for real-time analysis of grayscale histograms; This embodiment supports real-time grayscale histogram analysis of the current image, which demonstrates the bidirectional communication between the image display module and the main control module. (1) User trigger: The user clicks the “Show Histogram” button on the toolbar of the main control module (MainWindow).

[0052] (2) Image Data Request: After receiving the instruction, the main control module first determines which image needs to be analyzed (whether it is the original image or the processed result image). The main control module will send a request signal to the image display module (ImageDisplayWidget) to request a copy of the data of the currently displayed image.

[0053] (3) Data provision and calculation: The image display module responds to the request and returns the currently displayed cv::Mat object data to the main control module. The main control module then calls its built-in image processing engine (such as OpenCV's calcHist function) to calculate the grayscale distribution of the image data and obtain histogram data.

[0054] (4) Visualization: The main control module passes the calculated histogram data to a dedicated chart drawing component (which can be a separate pop-up window or a sub-module embedded in the main interface, logically managed by the main control module). After receiving the data, the component uses a drawing library (such as QChart) to render it into a bar chart that is visible to the user.

[0055] The process in this embodiment demonstrates that the main control module can not only "issue commands" to the display module (display images), but also "obtain status" from it (obtain current image data). This two-way interaction is the foundation for realizing complex analysis functions.

[0056] The system also includes: an error handling and reporting mechanism; The processing logic of the error handling and reporting mechanism is as follows: The main control module monitors the subprocesses and redirects their error streams, captures abnormal exit events and error details caused by internal logic errors in the subprocesses, and generates structured error reports. The main control module, based on the structured error report, highlights the last successfully executed line of code through the graphical user interface, disables the operation buttons in the graphical user interface, and displays the error information to the user to guide the user in debugging.

[0057] This embodiment provides a complete runtime error handling and reporting mechanism, the interaction flow of which is as follows: (1) Process status monitoring: After the main control module (MainWindow) starts the backend C++ executable program through its embedded process management component (such as QProcess), it does not just wait for it to terminate normally, but continuously and actively monitors the running status of the child process.

[0058] (2) Exception event capture: When a backend program crashes due to an internal logic error (division by zero, access to illegal memory, array out of bounds, etc.), the operating system will forcibly terminate the process. The main control module can capture this abnormal exit event in real time, for example, by detecting that the child process returns a non-zero exit code or receives a crash signal from the operating system.

[0059] (3) Redirection and collection of error information stream: Before starting the child process, the main control module has redirected its standard error stream (stderr). Therefore, when the child process outputs any error information provided by the compiler or operating system (such as "Floating point exception", "Segmentation fault", etc.) before crashing, this information will be completely captured and collected by the main control module.

[0060] (4) Structured Error Reporting and Interface Feedback: The main control module integrates the captured abnormal exit events and specific error stream text to form a structured error report. This report is then sent to the OutputWidget, which displays detailed error information to the user using prominent highlighting (e.g., red font) or dedicated error labels, enabling the user to quickly pinpoint the nature of the problem. The main control module can also send signals to the CodeEditorWidget, highlighting the last successfully executed line of code if possible, providing contextual clues for the user to troubleshoot errors.

[0061] (5) System State Locking and User Guidance: Upon reporting an error, the main control module immediately enters a "safety lock" state, temporarily disabling operation buttons on the interface such as "Run" and "Step-by-Step" that may lead to further errors. It can clearly inform the user that "a serious error has occurred during program execution; please check the code logic" by popping up a modal dialog box, thereby guiding the user to focus on debugging and avoiding continued operation in an unstable state.

[0062] In summary, the core technical means adopted in this invention include the following aspects: 1. Qt-based Graphical Integrated Development Interface: This invention uses the Qt framework to build a graphical interface, dividing it into multiple functional areas (image display window, code editor, variable list, output console, operation toolbar, etc.). Each area is decoupled and managed in a modular manner, and unified scheduling and event response are achieved through a signal-slot mechanism, thereby realizing a user-friendly image processing interactive environment. Through Qt's UI programming capabilities, the software encapsulates the entire image processing workflow in a graphical interface. Users can quickly access modules such as image preprocessing, filtering, edge detection, and feature extraction through the toolbar or menu bar. Each step of image processing can be visualized within the interface.

[0063] 2. Custom Code Editor Supports Real-Time C++ Programming and Syntax Highlighting: The platform integrates a custom-developed CodeEditorWidget, supporting C++ syntax highlighting, line number display, scroll wheel zoom, code formatting indentation, and other functions. It also supports file management operations such as saving, opening, and creating code. Users can directly write and modify image processing algorithms within the interface and trigger their execution.

[0064] 3. Image processing logic parsing and execution based on OpenCV: The platform calls the OpenCV function library as the image processing engine at the underlying level, supporting common image filtering, morphological operations, edge detection, feature extraction, and region processing operators. Users can call OpenCV functions to perform image operations using standard C++ syntax.

[0065] 4. Dynamic code compilation and execution mechanism: The platform has a built-in dynamic C++ compilation mechanism that uses QProcess in conjunction with a compiler (such as g++) to compile user-edited C++ code into an executable file and run it. During the execution process, standard output information and variable status are captured through the interface.

[0066] 5. Variable Monitoring Mechanism and Automatic Extraction Analysis: The platform features a variable parser module that extracts basic variables (such as int, float, double, bool, char) and their calculation results from the user's code after execution, and displays them in a variable list. Image type variables (such as cv::Mat) can also be recognized and linked with the image display window to show intermediate result images.

[0067] 6. Supports single-step image execution and debugging: The platform provides a "single-step execution" function, which runs only one line of user code at a time and updates variables and image status in real time, simulating the line-by-line debugging scenario during program execution, which is convenient for analyzing algorithm behavior and locating errors.

[0068] 7. Cross-platform deployment and smart camera compatibility design: Based on Qt's cross-platform capabilities and OpenCV's versatility, this platform features a lightweight framework that supports cross-compilation. It can be adapted and deployed to Linux systems, embedded systems, and even smart industrial cameras (such as the Hikvision SC3000 series). The code modules are clearly defined and easily decomposed, facilitating project portability.

[0069] The specific control instructions for the toolbar command set module are as follows: 1) File operation commands: including functions such as "create file", "open file", and "save file", with a status detection mechanism to ensure that user data is saved before operation to prevent data loss due to accidental operation.

[0070] 2) Editing commands: including operations such as "Undo", "Redo", "Comment", and "Uncomment", allowing users to quickly adjust the code structure and logic in image processing code development and improve programming efficiency.

[0071] 3) Find and replace function: Provides regular expression and case-sensitive find and replace functions, suitable for scenarios such as variable name replacement and batch modification.

[0072] 4) Program execution control: It integrates functions such as "run", "step run" and "reset program execution", and combined with the underlying code packaging and calling mechanism, it realizes the line-by-line execution debugging and backtracking operation of OpenCV image processing logic.

[0073] 5) Image tool call commands: such as the "Grayscale Histogram" button, which directly brings up the image analysis results and displays the current image status in a chart visualization, making it easy to debug and optimize parameters.

[0074] The key technical features of this invention mainly include: 1. Highly modular architecture design: Each functional module adopts a decoupled development approach and communicates with each other through signal slots, which facilitates subsequent expansion, refactoring and porting; 2. Unified Image Processing Development Workflow Interface: The platform integrates the four major processes of image display, algorithm development, code execution, and variable debugging into one interface, providing a unified entry point and interactive interface, breaking the traditional development approach that separates IDE, console, and image window.

[0075] 3. Automatic variable extraction and visualization mechanism: It supports the automatic identification of variables defined and operated in user code, and displays the variable name and current value in the interface in a table format, realizing synchronous feedback of data results and code logic, and enhancing debugging efficiency.

[0076] 4. High portability and hardware / software decoupling: The system architecture is loosely coupled and the modules are clearly defined, supporting smooth migration from the development environment to the target device; it also supports exporting the developed algorithms as independently runnable command-line programs and deploying them to smart devices.

[0077] 5. Supports cross-platform deployment: The software is based on Qt and C++ standards and can be compiled to Windows, Linux, and embedded ARM platforms, exhibiting excellent portability; 6. Single-step execution and code highlighting: The platform implements a "single-step execution" mechanism, allowing users to run their code line by line. Each line executed highlights the relevant code and displays the current result image and variable status. This near-debugger functionality greatly improves the efficiency of image algorithm teaching and analysis.

[0078] The main innovative points of this invention are as follows: 1. An integrated platform combining native C++ image processing algorithms with a graphical user interface: Most current image processing software (such as Halcon and MATLAB) relies on scripting languages ​​or visual flowcharts to construct algorithms, making it difficult to directly verify C++ logic. This platform, however, is the first to integrate C++ image processing capabilities with a Qt graphical interface into a unified platform. Users can write code while viewing the results of image and variable execution, achieving a full-process experience similar to an IDE with visualization.

[0079] 2. Code-level single-step execution and image / variable visualization linkage mechanism: Traditional debugging methods such as using breakpoints and outputting logs are not suitable for image processing scenarios. This platform innovatively proposes a "single-step execution + highlighting + real-time image variable updates" mechanism, which greatly improves the efficiency of image algorithm teaching, debugging, and demonstration, and provides a more intuitive and user-friendly interactive method for visual development.

[0080] 3. Image and Non-Image Variable Classification, Extraction, and Partitioned Display Mechanism: By analyzing the processing results, the system can automatically extract Mat image objects and basic type variables, and display them in a categorized manner on the interface. Users can clearly distinguish between image data and intermediate calculation variables, and understand the processing procedure and parameter changes.

[0081] 4. Modular insertion mechanism based on code snippets lowers the learning and usage threshold: This software platform implements a modular mechanism of "one-click insertion" by predefining function snippets corresponding to commonly used image processing algorithms (such as Gaussian filtering, edge detection, Hough transform, etc.). Users do not need to write complex image processing workflows from scratch; they can simply click on the menu item to automatically insert standard operator code into the code editing area, effectively lowering the entry barrier for image processing.

[0082] 5. Integrated Image Processing Toolbar Design: This software integrates a customized "image processing + code editing" command toolbar for image processing software, covering the entire workflow from file management and editing operations to image execution control. Toolbar commands such as single-step execution, resetting program execution, and grayscale histogram analysis are linked to background image variables in real time, allowing users to analyze the result image status and variable changes with a single click during debugging, thus forming a complete closed-loop development and debugging system.

[0083] 6. Provides a "code export + cross-compilation" preparation mechanism for embedded edge computing deployment: This software is not only suitable for the visual development and testing of image algorithms on PCs, but also fully considers the actual needs of integration with smart cameras or embedded devices (such as ARM architecture) in its architecture design. After completing the writing and verification of image processing algorithms on this platform, users can export the code as a standard cpp file, which can be used as a basic module for embedded system deployment.

[0084] Example 2 like Figure 1 As shown, the present invention also provides a method for implementing the integrated image processing system based on Qt and OpenCV in Embodiment 1, comprising the following steps: S1. A graphical user interface built on the Qt framework, such as... Figure 2 As shown, it receives C++ image processing code from the image file to be processed and the user's single-step execution instruction, and highlights the current line of code when executing the single-step execution instruction; S2. Dynamically encapsulates C++ image processing code into a temporary file and uses QProcess to call the compiler for compilation, capturing the output information during the compilation process in real time; the output information includes: compilation success status and error details; S3. If compilation is successful, execute the generated program and capture the variable data and image data output during program execution; S4. Display the image data generated during program execution in the image display window, and display the variable data generated during program execution in the variable monitoring window.

[0085] Example 3 Based on the integrated image processing system based on Qt and OpenCV in Embodiment 1 of this invention, this embodiment further demonstrates how users can use this software to achieve key functions such as image loading, image processing code editing and execution, variable tracking, and image result display, reflecting the visualization, modularity, and interactive characteristics of this system.

[0086] 1. Image loading and display function When a user clicks the "Open Image" button in the main interface toolbar, a file selection dialog box pops up, allowing them to select a local image file (such as JPEG, PNG, BMP, etc.). The software loads the image using cv::imread() and displays it in a dedicated image display area using ImageDisplayWidget::setImage(), such as... Figure 3 As shown. This image area supports zooming and dragging using the mouse wheel, and the display ratio can be set via the zoom level drop-down box (QComboBox) in the toolbar, such as "50%", "100%", "double", etc. Figure 5 As shown.

[0087] 2. Single-step execution and variable tracking functions This example demonstrates how a user executes image processing code line by line using the "Step-by-Step" function and views the results of each step in the "Variable List Window," such as... Figure 4 As shown in (a), the system maintains an index of the currently executing line. Each time the "Step-by-Step" button is clicked, the corresponding line is extracted from the code, rewritten as a single-line function, compiled, and executed as shown in (a). Figure 4 As shown in (b). After execution, the newly generated variable names and their corresponding values ​​are extracted and updated in the VariableListWidget table.

[0088] 3. Image processing code editing and execution Users enter C++ image processing code in the code editing window, and the system automatically packages the code into a C++ source file in the background and compiles it in real time using an existing compiler (such as MinGW or MSVC). Figure 5 As shown; and the image processing results are displayed after running.

[0089] After clicking the "Run" button, the system completes the following process: encapsulates the code into a temporary .cpp file; uses a system call (QProcess) to invoke the compiler; compiles and generates an executable program, and runs it; captures the variables and images after execution and displays them on the main interface.

[0090] 4. Application of toolbar commands The system provides several convenient toolbar commands, enabling users to quickly complete common code editing and debugging operations, such as "New File," "Save File," "Undo / Redo," "Comment / Uncomment," and "Find / Replace." These functions are uniformly managed by QAction buttons and bound to corresponding slot functions, improving user efficiency in the graphical interface. For example, when the user presses the "Find and Replace" button, a search dialog box will automatically pop up, allowing the user to enter the keywords to search for and specify the replacement content. Toolbar commands also support keyboard shortcuts, such as Ctrl+Z for undo and Ctrl+F for find; a screenshot of the search and replace operation in the code editing area is shown below. Figure 6 (a) and Figure 6 As shown in (b).

[0091] The toolbar commands include: New File, Open File, Save File, Undo, Redo, Comment, Uncomment, Find and Replace, Run, Step-by-Step, Reset Program Execution, Grayscale Histogram, etc., as shown in Table 1.

[0092] Table 1 Toolbar Commands and Descriptions

[0093] The search and replace function in the code editing area supports matching case sensitivity and matching whole words.

[0094] 5. Image grayscale histogram generation and display When the user clicks the "Grayscale Histogram" button, the software will automatically convert the current image to grayscale and use OpenCV's calcHist to generate histogram data, such as... Figure 7 As shown; it is then displayed in the form of an OpenCV GUI or a Qt custom-drawn window, making it convenient for users to analyze the brightness distribution characteristics of the image, such as... Figure 8 As shown.

[0095] In summary, the image processing software platform provided by this invention is built on Qt, integrating code writing, image preview, variable monitoring, and module debugging. Addressing the problems of poor interactivity, weak scalability, and platform fragmentation in traditional image processing tools, it proposes a graphical image processing programming system for developers and engineers. This software system has significant technical improvements in structural design, functional integration, operation mode, and user interaction, bringing the following beneficial technical effects: lowering the threshold for image processing algorithm development, improving interactivity and visualization. While traditional image processing platforms (such as Halcon and VisionPro) are powerful, they have high usage barriers and often use scripting languages ​​or flowcharts, making seamless integration with actual C++ projects difficult. The image processing platform provided by this invention allows users to directly input standard C++ and OpenCV syntax in the graphical interface, running and viewing results in a WYSIWYG manner. The system has built-in code highlighting, line numbers, comment control, search and replace editing functions, making code writing consistent with traditional IDEs and improving the development experience. Image processing results can be displayed in real time in the image window, allowing users to quickly adjust algorithm parameters or logic based on image feedback. Supporting single-step execution and variable tracking enhances algorithm debugging capabilities. Users can execute image processing code line by line and automatically view the current variable values ​​in the variable panel, including basic types such as integers, floating-point numbers, strings, and arrays. This mechanism can be used to debug logical errors, numerical errors, and data flow analysis in image algorithms, effectively improving the maintainability and transparency of image processing programs. It achieves a closed-loop process for image input, processing, and output, improving system integrity. This invention integrates three major processes: image input (image loading, camera acquisition), image processing (code editing and execution), and image output (saving and display), allowing users to complete the entire process on a unified platform. It eliminates the need for external software or multiple scripts to connect modules, effectively improving system consistency and stability. This invention adopts a modular design, with main functional areas including a code editing module, image display module, variable monitoring module, and log output module. Each part has independent functions and clear interfaces, facilitating future functional expansion (such as supporting Python, adding deep learning modules, etc.) or platform migration (such as porting to embedded devices, smart cameras, etc.). The software integrates a log output module to record runtime status, compilation information, variable results, and exceptions, helping users quickly pinpoint the source of problems. Especially when handling long image processing workflows or complex image operations, the log feedback mechanism becomes an important auxiliary tool, improving system stability and debugging efficiency.

[0096] The software includes multiple toolbar operation commands, including but not limited to: create, open, save file, undo, redo, comment / uncomment, find and replace, run, step-by-step execution, program reset, and grayscale histogram generation. These functions can be quickly accessed via the menu bar or keyboard shortcuts, simplifying the user's workflow and making it particularly suitable for users who need to frequently test image algorithms.

[0097] The above description of the disclosed embodiments enables those skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An integrated image processing system based on Qt and OpenCV, characterized in that, The system comprises: a code editing module comprising a graphical user interface built based on a Qt framework, configured to receive image processing code in which OpenCV functions are called by a user, and to highlight the current execution line code in response to a single-step execution instruction from the user; a main control module configured to dynamically encapsulate the image processing code in which OpenCV functions are called into an executable file, to call a compiler using QProcess to compile, and to capture output information in real time during the compilation process; wherein the output information comprises: a compilation success status and error details; if the compilation is successful, the executable file is run to decode a local image file, and variable data and image data generated during program execution are captured; a variable monitoring module configured to receive the variable data and display the variable data in a variable monitoring window; an image display module configured to receive image data and original image data generated during program execution and display the image data and the original image data in an image display window in real time; a log output module comprising the compilation success status and error details, configured to display the output information during the compilation process.

2. The Qt and OpenCV based integrated image processing system according to claim 1, wherein, The execution process of the single-step execution instruction is specifically as follows: S1. The main control module enters a single-step debugging mode in response to a single-step execution instruction from the user; S2. The main control module requests the code editing module to highlight the current execution line code with the code text at the line pointed to by the current pointer; S3. The current execution line code is encapsulated into a micro-executable unit, which is compiled and run; S4. The main control module captures image data and variable data generated during the running of the current execution line code, and sends the image data and the variable data to the image display module and the variable monitoring module, respectively; S5. After one single-step cycle is completed, the execution is paused, and the next single-step execution instruction from the user is awaited.

3. The Qt and OpenCV based integrated image processing system according to claim 1, wherein, The system further comprises an error handling and reporting mechanism; The processing logic of the error handling and reporting mechanism is specifically as follows: The main control module monitors a sub-process and redirects its error stream, captures an abnormal exit event and error details of the sub-process due to internal logic errors, and generates a structured error report; The main control module highlights the last successfully executed code line through the graphical user interface, disables the operation buttons of the graphical user interface, and displays the error information to the user, so as to guide the user to debug, according to the structured error report.

4. The Qt and OpenCV based integrated image processing system according to claim 1, wherein, The code editing module further supports receiving a code template selection instruction through the graphical user interface, specifically as follows: The main control module dynamically obtains a corresponding C++ image processing code segment from a code template library and transmits the C++ image processing code segment to the code editing module through a signal mechanism; After the slot function of the code editing module responds, the corresponding C++ image processing code segment is inserted into the cursor position, and a built-in syntax highlighting engine immediately performs parsing and coloring, thereby decoupling the user interface operation and the code editing function, to ensure that the addition and deletion of code templates are convenient.

5. The Qt and OpenCV based integrated image processing system according to claim 1, wherein, The image display module further supports responding to a histogram display instruction, specifically as follows: The user clicks a "display histogram" button on a toolbar of the main control module; The main control module first judges whether the analysis object is original image data in the program running process or image data after single-step instruction execution, and sends a request signal to the image display module to obtain a current image data copy; The main control module calls the calcHist function of OpenCV to calculate a histogram, and visualizes a column chart in the image display window of the image display module through a dedicated chart drawing component.

6. The Qt and OpenCV based integrated image processing system according to claim 1, wherein, The system also includes an image loading and environment initialization function, specifically: The main control module calls the imread function of OpenCV to decode the image file into original image data in memory; The original image data is distributed by the main control module to the image display module and the execution engine in the back end; The image display module caches it as an original image and immediately renders and displays it on the interface; The execution engine in the back end is an input source for subsequent algorithm processing; The main control module broadcasts a "environment reset" signal to each module to ensure the state synchronization of the entire development environment.

7. An integrated Qt and OpenCV based image processing method for implementing the integrated Qt and OpenCV based image processing system of any one of claims 1-6, wherein, The method comprises the following steps: S1, a graphical user interface based on a Qt framework is used to receive image processing code calling OpenCV functions input by a user, respond to single-step execution instructions of the user, and highlight the current execution line code when the single-step execution instruction is executed; S2, dynamically encapsulate the image processing code calling OpenCV functions into an executable file, use QProcess to call a compiler for compilation, and capture output information in the compilation process in real time; The output information includes: compilation success status and error details; S3, if the compilation is successful, run the executable file to decode local image files, and capture variable data and image data generated in the program running process; S4, display the image data in an image display window, and display the variable data in a variable monitoring window.

Citation Information

Patent Citations

  • Construction method of universal machine vision platform system for industrial detection

    CN117406963A

  • Debugging method and device for visual storage process of openGauss database

    CN119829412A