Machine vision software-based complex working condition two-dimensional code correction and recognition system and method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-01
- Publication Date
- 2026-08-11
AI Technical Summary
现有二维码识别技术大多只能适配拍摄规范、光照均匀、二维码完整无破损的标准工况,在实际现场的复杂环境中存在多处明显不足
[0054]本发明通过全链路的模块化处理,逐一解决复杂工况下二维码识别的各类痛点问题,相较现有技术具备多方面的技术优势。
Smart Images

Figure CN122549459A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine vision and QR code recognition technology, specifically to a complex working condition QR code correction and completion recognition system and method based on machine vision software. Background Technology
[0002] QR code recognition technology has been widely applied in various fields such as industrial production, warehousing and logistics, and equipment inspection to achieve rapid collection and traceability of object information. However, most existing QR code recognition technologies are only suitable for standard operating conditions where the shooting is standardized, the lighting is uniform, and the QR code is intact and undamaged. They have several significant shortcomings in the complex environments of real-world scenarios. Faced with shooting angle deviations and QR code image tilting and perspective distortion caused by equipment vibration, existing technologies lack corresponding adaptive correction mechanisms, easily leading to QR code positioning failures and directly causing recognition failures. For QR codes with significant size differences in different application scenarios, the adaptability of existing technologies is narrow, only able to handle QR codes of fixed or small sizes, unable to dynamically lock the effective area of QR codes of different sizes, thus limiting their applicability. In environments with uneven lighting, low illumination, or strong light reflection, the contrast between the QR code and the background decreases, making it difficult for existing technologies to effectively distinguish the effective information area of the QR code from the background, frequently resulting in recognition errors or failures to recognize the code. For damaged or soiled QR codes, current technology can only handle very minor defects. When there are obvious defects in the positioning structure or data area of the QR code, it is impossible to restore the missing content based on the QR code's own encoding rules, directly leading to reading failure. These shortcomings make the existing QR code recognition technology perform poorly in complex working conditions, requiring a lot of manual intervention to adjust parameters and repeat scanning, which not only reduces work efficiency but also cannot adapt to the needs of automated continuous operation. Summary of the Invention
[0003] The present invention aims to solve the problems mentioned in the background art by providing a QR code correction and completion recognition system and method for complex working conditions based on machine vision software.
[0004] The specific technical solution is as follows:
[0005] The present invention provides a complex working condition QR code correction and completion recognition system based on machine vision software, comprising an image acquisition module, an image preprocessing module, a feature extraction module, a missing part completion module, and a recognition output module connected in sequence by signals; the image preprocessing module is used to perform grayscale adaptive adjustment and geometric distortion correction on the acquired QR code image, and the missing part completion module is used to perform logical completion of the missing QR code area by matching the encoding rules according to the QR code features output by the feature extraction module.
[0006] This solution employs a modular architecture with sequentially connected signals, enabling seamless processing of QR code images from acquisition to recognition output. Data transfer between modules is smooth and without processing gaps. The image preprocessing stage simultaneously performs grayscale adjustment and geometric distortion correction, eliminating fundamental image defects in advance and providing a stable image foundation for subsequent processing. The incompleteness completion module works in conjunction with the preceding and following modules, matching and completing missing areas based on QR code encoding rules. No additional external processing steps are required, allowing it to adapt to more complex scanning scenarios and preventing recognition interruptions due to image pose or clarity issues, thus improving the overall stability of the recognition process.
[0007] Preferably, the output of the image acquisition module is connected to the input of the image preprocessing module. The image acquisition module supports multi-format image input from industrial cameras, and can automatically convert the acquired RGB color images into grayscale images and output them to the image preprocessing module. The grayscale image has a grayscale value range of 0 to 255. The image acquisition module has a built-in adaptive exposure time adjustment unit that adjusts the camera exposure time according to the ambient light intensity. The adjusted exposure time satisfies the formula:
[0008]
[0009] in, The initial exposure time, The ambient light intensity is collected in real time. The preset standard reference light intensity, This is the adjusted camera exposure time.
[0010] This solution clearly defines the connection between the image acquisition module and subsequent modules, ensuring that the acquired image data can be stably transmitted to the preprocessing stage. It is compatible with multiple image input formats and can adapt to the output specifications of different industrial acquisition devices, eliminating the need for additional pre-format conversion steps and broadening its applicability. It can automatically convert color images to grayscale images, unifying the image benchmark for subsequent processing and avoiding interference from color channel differences. The built-in adaptive exposure time adjustment logic adjusts the acquisition parameters according to changes in ambient light intensity, ensuring images with appropriate clarity can be acquired under different lighting conditions, guaranteeing basic image quality from the source and reducing the difficulty of subsequent image processing.
[0011] Preferably, the image preprocessing module includes a grayscale adaptive processing unit, a ROI box correction unit, and a multi-size adaptation unit; the input end of the grayscale adaptive processing unit is connected to the output end of the image acquisition module, the output end of the grayscale adaptive processing unit is connected to the input ends of the ROI box correction unit and the multi-size adaptation unit respectively, and the output ends of the ROI box correction unit and the multi-size adaptation unit are both connected to the input end of the feature extraction module.
[0012] The grayscale adaptive processing unit first calculates the mean grayscale value of the acquired image, which satisfies the formula:
[0013]
[0014] in, This represents the total number of pixels horizontally in the image. This represents the total number of pixels vertically in the image. Coordinates in the image The grayscale value of the pixel. The overall grayscale mean of the image is used; then, based on the grayscale mean, a local histogram equalization algorithm is used to perform block grayscale stretching and dynamic threshold adjustment on the image to enhance the contrast between the QR code and the background.
[0015] This scheme divides image preprocessing into three independent yet interconnected processing units, each specifically addressing grayscale, pose, and size adaptation issues. The processing logic of each unit operates independently, allowing for flexible adjustment of the processing amplitude based on the actual image state. The grayscale adaptive processing unit first calculates the overall grayscale mean of the image before proceeding with subsequent block processing. This ensures that the grayscale adjustment amplitude perfectly matches the image's inherent grayscale distribution, preventing over- or under-adjustment. It effectively differentiates the QR code area from the background, resulting in clearer QR code boundaries and facilitating subsequent positioning and correction. The signal connection method of the three units allows the grayscale-processed image to be simultaneously supplied to the correction and size adaptation stages, shortening the overall processing time and improving system efficiency.
[0016] Preferably, the ROI box correction unit is based on the geometric transformation algorithm library of machine vision software to extract the edges of the QR code. The tilt angle of the QR code is calculated by fitting a straight line using the least squares method to a feature point. The tilt angle satisfies the formula:
[0017]
[0018] in, , For the first The x and y coordinates of each edge feature point for The mean of the x-coordinates of the edge feature points, for The mean of the ordinates of the edge feature points, The tilt angle of the QR code;
[0019] Simultaneously calibrate the radial distortion parameters of the image. and Then, based on the tilt angle and distortion parameters, rotation correction and distortion correction are performed on the region of interest where the QR code is located. The correction transformation satisfies the formula:
[0020]
[0021] in, , For the first The corrected x and y coordinates of each feature point;
[0022] The correction angle range of the ROI box correction unit is -90° to 90°, and the distortion correction error does not exceed 0.5 pixels.
[0023] This solution calculates the tilt angle by extracting edge feature points of the QR code, accurately capturing the actual deflection state of the QR code without being affected by local defects in the QR code itself. The angle calculation result closely matches the actual shooting situation. Based on the calculated tilt angle, corresponding rotation correction is performed, restoring the deflected QR code to a standard frontal posture, facilitating subsequent feature extraction and recognition operations. Simultaneously, image distortion parameters are calibrated and corrected, eliminating perspective distortion generated during image acquisition, resulting in more accurate QR code shape restoration and avoiding deviations in subsequent feature extraction due to shape distortion. The entire correction process is calculated entirely based on the features of the image itself, without the need to pre-set the QR code's posture parameters, adapting to QR code processing under different shooting angles and improving the system's adaptability to different shooting scenarios.
[0024] Preferably, the multi-specification adaptation unit adopts an adaptive threshold segmentation and feature point clustering localization algorithm to dynamically identify QR codes of different sizes and types and generate a region of interest bounding box matching the size of the QR code; the QR code types adapted by the multi-specification adaptation unit include QR Code, DM Code ECC 200, Aztec Code and Micro QR Code, and the adapted QR code pixel size ranges from 100×100 to 2000×2000.
[0025] This solution employs adaptive threshold segmentation and feature point clustering localization, automatically recognizing QR codes of different types and sizes without requiring pre-setting QR code specifications, thus reducing manual debugging workload. It is compatible with various commonly used QR code types, eliminating the need for separate processing procedures for different code formats; a single system can cover the recognition needs of multiple QR code types, making it applicable to a wider range of scenarios. It can automatically generate a region of interest bounding box matching the QR code size, accurately locating the QR code area and eliminating invalid interference from background areas. This allows subsequent processing steps to focus on the QR code itself, improving processing accuracy and reducing unnecessary background data processing, further enhancing system efficiency.
[0026] Preferably, the input end of the feature extraction module is connected to the output end of the image preprocessing module, and the output end of the feature extraction module is connected to the input ends of the incompleteness completion module and the recognition output module respectively. The feature extraction module performs feature analysis on the corrected QR code image, extracts the QR code's position coordinates, overall size, single module pixel size, positioning graphic position and shape features, and identifies the incomplete area and incompleteness ratio of the QR code, and outputs the extracted feature parameters to the incompleteness completion module.
[0027] This solution clearly defines the connection between the feature extraction module and the preceding and following modules, ensuring that the extracted feature parameters can be stably transmitted to subsequent stages. The feature extraction module simultaneously interfaces with the incomplete QR code completion module and the recognition output module, allowing it to select the subsequent processing path based on the actual state of the QR code. Complete, undamaged QR codes can directly enter the recognition stage without unnecessary completion processing, shortening the overall processing time. It can comprehensively extract the location, shape, and structural features of the QR code, accurately identifying the missing areas and their states, providing accurate processing basis for subsequent completion stages and avoiding deviations in the completion operation due to inadequate feature extraction. Performing feature extraction on the corrected image eliminates the influence of QR code deflection and distortion on feature extraction, making the extracted feature parameters more closely match the actual state of the QR code and improving the accuracy of feature extraction.
[0028] Preferably, the input end of the incompleteness completion module is connected to the output end of the feature extraction module, and the output end of the incompleteness completion module is connected to the input end of the recognition output module. Based on the encoding rules and fault tolerance mechanism of the QR code, the incompleteness completion module combines the complete region features output by the feature extraction module to logically complete the data bits and positioning graphics of the incomplete QR code region with a missing ratio of no more than 30%. The completed QR code image is then output to the recognition output module.
[0029] This solution clearly defines the connection between the incompleteness completion module and the preceding and following modules, ensuring that the completed image can be stably transmitted to the recognition output stage. The completion operation is performed based on the QR code's encoding rules and fault-tolerance mechanisms, ensuring that the completed content fully conforms to the QR code's encoding specifications and avoiding situations where the completed image cannot be decoded. The missing areas are completed by combining the features of the complete QR code area, ensuring that the completed content matches the original QR code coherently. The completed QR code has a complete form and can be directly used for decoding and recognition. It can adapt to QR code loss scenarios in different locations without requiring separate processing logic for the loss location, improving the system's ability to handle dirty or damaged QR codes and reducing recognition failures caused by QR code loss.
[0030] This invention also provides a method for correcting and completing QR codes under complex working conditions based on machine vision software. The method employs the aforementioned machine vision software-based QR code correction and completion recognition system for complex working conditions, and includes the following steps:
[0031] S1 acquires the original image of the QR code to be recognized, performs standardized preprocessing on the original image to obtain a grayscale image, and adaptively adjusts the camera exposure time for acquisition according to the ambient light intensity.
[0032] S2 performs grayscale adaptive enhancement, geometric distortion correction, and size adaptation on the grayscale image to obtain a standard-pose QR code target image;
[0033] S3 extracts feature parameters from the target image of the QR code and identifies the incomplete area and degree of incompleteness of the QR code;
[0034] S4 uses the encoding rules and fault tolerance mechanism of QR codes to logically complete incomplete areas and obtain a complete QR code image.
[0035] S5 decodes the complete QR code image and outputs the original QR code data and recognition log.
[0036] This solution employs a step-by-step processing flow, sequentially addressing the corresponding issues in the entire process of QR code image acquisition, posture correction, sharpness optimization, defect completion, and decoding output. The flow logic is clear, with no processing steps omitted. Preprocessing, enhancement, and correction of the image are completed first, followed by feature extraction, ensuring the basic image quality during feature extraction and improving its accuracy. Identifying QR code defects before targeted completion avoids unnecessary processing of complete QR codes, improving overall processing efficiency. The entire process can be fully automated from image acquisition to data output, requiring no additional manual intervention. It is adaptable to automated scanning scenarios and can stably complete QR code recognition even under complex conditions, improving recognition success rate and operational stability.
[0037] Preferably, in step S1, the adaptive adjustment of the camera exposure time satisfies the formula:
[0038]
[0039] in, The initial exposure time, The ambient light intensity is collected in real time. The preset standard reference light intensity, This refers to the adjusted camera exposure time.
[0040] In step S2, the grayscale adaptive enhancement first calculates the overall grayscale mean of the grayscale image. The grayscale mean satisfies the formula:
[0041]
[0042] in, This represents the total number of pixels horizontally in the image. This represents the total number of pixels vertically in the image. Coordinates in the image The grayscale value of the pixel. The image is calculated as the overall grayscale mean. Then, based on the grayscale mean, a local histogram equalization algorithm is used to perform block grayscale stretching and dynamic threshold adjustment on the image to adapt to bright and dark scenes with grayscale values ranging from 0 to 208.
[0043] This solution adaptively adjusts exposure time based on ambient light intensity during image acquisition, ensuring high-quality images are captured under varying lighting conditions. This reduces image defects caused by lighting issues at the source, lowering the difficulty of subsequent image processing. The grayscale enhancement stage first calculates the overall grayscale mean of the image before performing corresponding enhancement processing. This ensures the grayscale adjustment range closely matches the image's inherent grayscale distribution, effectively improving the contrast between the QR code area and the background, making the QR code boundaries and modules clearer, facilitating subsequent positioning and feature extraction operations. The use of block processing for grayscale stretching and threshold adjustment effectively addresses localized uneven lighting in the image, preventing localized brightness anomalies from affecting the overall processing effect and adapting to image enhancement needs under different lighting conditions.
[0044] Preferably, in step S2, geometric distortion correction is performed by extracting the edges of the QR code. Using a set of feature points, the tilt angle of the QR code is calculated by fitting a straight line using the least squares method. The tilt angle satisfies the formula:
[0045]
[0046] in, , For the first The x and y coordinates of each edge feature point for The mean of the x-coordinates of the edge feature points, for The mean of the ordinates of the edge feature points, The tilt angle of the QR code;
[0047] Simultaneously calibrate the radial distortion parameters of the image. and Then, based on the tilt angle and distortion parameters, rotation correction and distortion correction are performed on the region of interest where the QR code is located. The correction transformation satisfies the formula:
[0048]
[0049] in, , For the first The corrected x and y coordinates of each feature point;
[0050] The correction angle range is -90° to 90°, and the distortion correction error does not exceed 0.5 pixels; the size adaptation dynamically recognizes QR codes with sizes from 100×100 to 2000×2000 pixels through adaptive threshold segmentation and feature point clustering localization.
[0051] In step S4, for QR codes with a missing proportion of no more than 30%, the effective data blocks of the complete area are extracted by combining the highest level of fault tolerance mechanism of QR codes. The data bits and positioning graphics of the missing area are reconstructed by the error correction algorithm. After completion, the integrity of the QR code is verified. If the verification is successful, the complete QR code image is output. In step S5, the decoding engine built into the machine vision software is called to decode the complete QR code image. The total processing time for a single frame image does not exceed 200ms. If decoding fails, a completion log containing information on the missing area, completion parameters and reasons for failure is returned.
[0052] This solution extracts edge feature points of the QR code, calculates the tilt angle, and performs rotation correction. This accurately restores the standard posture of the QR code, eliminates the deflection effect caused by the shooting angle, and improves the accuracy of subsequent feature extraction. Simultaneously, it corrects image distortion, restoring the true shape of the QR code and avoiding deformation of the QR code module due to perspective distortion, further improving the accuracy of feature extraction and recognition. For damaged QR codes, it performs a completion operation based on encoding rules and fault tolerance mechanisms, restoring the complete shape of the QR code and enabling normally decoded damaged QR codes that would otherwise be unrecognizable, reducing recognition failures. The decoding process covers both successful and failed scenarios. Successful recognition outputs the corresponding QR code data, while failed recognition returns corresponding processing information, allowing operators to clearly understand the reasons for recognition failures and facilitating subsequent adjustments and optimizations. The entire processing flow has controllable time consumption, meeting the needs of continuous and automated barcode scanning and adapting to various application scenarios such as industry and logistics.
[0053] The present invention has the following beneficial effects:
[0054] This invention addresses various pain points in QR code recognition under complex working conditions through modular processing across the entire process, offering numerous technical advantages over existing technologies.
[0055] First, the applicable scenarios have been greatly expanded. This solution can simultaneously handle various non-standard working conditions such as QR code image tilt distortion, large size differences, complex lighting conditions, and QR code defects. It is no longer limited to standard laboratory environments and can be widely adapted to various field environments such as industrial production lines, warehousing and logistics, and outdoor equipment inspection, meeting the QR code recognition needs of different industries.
[0056] Secondly, the stability and automation of the recognition process have been greatly improved. The entire recognition process, from image acquisition to data output, is fully automated. There is no need for manual adjustment of parameters or intervention in the processing. It can adapt to the continuous operation requirements of automated production lines and maintain stable recognition performance even under long-term continuous operation. This greatly reduces the workload of manual operation and lowers the on-site labor costs.
[0057] Then there is the significant improvement in recognition success rate. This solution addresses various issues affecting QR code recognition through a step-by-step processing approach. It solves the problem of uneven lighting through grayscale adaptive processing, the problem of QR code posture deviation through geometric correction, and the problem of QR code defects through logical completion. This brings many scenarios that cannot be recognized in existing technologies into the scope of processing, greatly reduces the number of recognition failures, avoids process interruptions caused by recognition failures, and improves overall work efficiency.
[0058] It also has strong adaptability and compatibility, and can be compatible with a variety of commonly used QR codes, covering a wide range of sizes. There is no need to develop separate processing programs for QR codes of different codes or sizes. One system can meet the QR code recognition needs of multiple scenarios and multiple specifications, which greatly reduces the deployment cost and secondary development cost of the system.
[0059] Furthermore, the accuracy and real-time performance of the recognition results are guaranteed. All processing steps in this solution are based on the structural characteristics and encoding rules of the QR code itself. The completed QR code conforms to the encoding specifications, and the decoded data is accurate and reliable, preventing misreading and ensuring the accuracy of business data. At the same time, the modular linkage processing architecture reduces unnecessary processing steps, and the processing time of a single image is controllable, meeting the needs of real-time on-site scanning without slowing down the overall business process. Attached Figure Description
[0060] Figure 1 A schematic diagram illustrating the composition of a complex working condition QR code correction and completion recognition system based on machine vision software, provided in an embodiment of the present invention.
[0061] Figure 2 The flowchart illustrates a complex working condition QR code correction, completion, and recognition method based on machine vision software, provided in an embodiment of the present invention. Detailed Implementation
[0062] The following is in conjunction with the appendix Figures 1-2 The technical solution of the present invention will be further illustrated through specific embodiments.
[0063] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual images. They should not be construed as limiting the scope of this application. To better illustrate the embodiments of the present invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual dimensions of the product. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0064] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "inner," and "outer" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present application. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.
[0065] In the description of this invention, unless otherwise explicitly specified and limited, the term "connection" or similar designation indicating a connection between components should be interpreted broadly. For example, it can refer to a fixed connection, a detachable connection, or an integral part; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can refer to the internal communication between two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0066] Implementation Example 1: QR Code Recognition Application in Automotive Parts Assembly Line
[0067] I. Technical Solution
[0068] This embodiment is applied to automotive parts assembly lines to identify QR codes printed on the surface of metal parts. It is adapted to complex working conditions such as QR code shooting tilt caused by production line vibration, uneven lighting caused by metal surface reflection, and damage to QR code positioning patterns caused by friction during parts transfer.
[0069] Hardware configuration
[0070] The image acquisition equipment uses a Basler acA2500-14uc industrial camera with a 16mm focal length lens, mounted directly above the production line station with the lens vertically aligned with the parts tray. The lighting equipment consists of 12W LED ring lights, installed around the industrial camera, with a color temperature of 5500K and continuously adjustable brightness. The computing equipment is an industrial control computer equipped with an Intel Core i7-12700K processor, 32GB DDR5 memory, and an NVIDIA GeForce RTX 3060 graphics card, installed inside the production line's electrical control cabinet.
[0071] Software Configuration
[0072] The industrial control computer runs on a 64-bit Windows 10 Professional operating system. The development platform uses Sherlock 8.2 machine vision software and Visual Studio 2019, with OpenCV 4.5.5 and Newtonsoft.Json 13.0.3 as dependencies. The system communicates with the production line's MES system via Ethernet.
[0073] System architecture and connectivity
[0074] The recognition system used in this embodiment includes an image acquisition module, an image preprocessing module, a feature extraction module, a missing component completion module, and a recognition output module. The signal output terminal of the image acquisition module is connected to the signal input terminal of the image preprocessing module. The signal output terminal of the image preprocessing module is connected to the signal input terminal of the feature extraction module. The signal output terminal of the feature extraction module is connected to both the signal input terminals of the missing component completion module and the recognition output module. The signal output terminal of the missing component completion module is connected to the signal input terminal of the recognition output module. The signal output terminal of the recognition output module is interfaced with the production line MES system.
[0075] The image preprocessing module incorporates a grayscale adaptive processing unit, a ROI bounding box correction unit, and a multi-size adaptation unit. The signal input of the grayscale adaptive processing unit is connected to the signal output of the image acquisition module. The signal output of the grayscale adaptive processing unit is connected to the signal inputs of both the ROI bounding box correction unit and the multi-size adaptation unit. The signal outputs of both the ROI bounding box correction unit and the multi-size adaptation unit are connected to the signal input of the feature extraction module.
[0076] Detailed implementation steps
[0077] Step 1: Image Acquisition and Adaptive Parameter Adjustment
[0078] After the production line sensors detect a part entering the workstation, they trigger the image acquisition module to start acquiring data. The image acquisition module sets the industrial camera's initial resolution to 1920×1080 pixels, initial exposure time to 50μs, gain to 1.2dB, and acquisition format to MONO8. The image acquisition module acquires real-time ambient light intensity through the industrial camera's photosensitive element and adjusts the camera's exposure time accordingly. The adjusted exposure time satisfies the formula...
[0079]
[0080] in The initial exposure time, The ambient light intensity is collected in real time. The preset standard reference light intensity, The adjusted camera exposure time is shown below. In this embodiment, the ambient light intensity is 800 lux, the adjusted exposure time is maintained at 50 μs, and the brightness of the LED ring light is adjusted to 60% to reduce reflection from the metal surface through diffuse reflection. The raw image acquired by the image acquisition module is stored in the image buffer and simultaneously transmitted to the image preprocessing module.
[0081] Step 2: Adaptive Gray-Scale Enhancement Processing
[0082] After receiving the original image, the image preprocessing module first calculates the overall grayscale mean of the image using the grayscale adaptive processing unit. The grayscale mean satisfies the formula...
[0083]
[0084] Where M is the total number of horizontal pixels in the image (1920) and N is the total number of vertical pixels in the image (1080). Coordinates in the image The grayscale value of the pixel. The grayscale average of the image is 62. In this embodiment, the original image has a grayscale average of 62. The grayscale adaptive processing unit divides the image into 16×16 pixel blocks, performs grayscale stretching operations on each block, and dynamically adjusts the threshold range of each region from 30 to 180. After processing, the grayscale average of the image is increased to 112, the boundary between the QR code module and the background is clarified, and the processed image is synchronously transmitted to the ROI box correction unit and the multi-specification adaptation unit.
[0085] Step 3: QR code posture correction and size adaptation
[0086] The ROI (Region of Interest) correction unit receives the processed image, extracts 16 feature points from the QR code edge, and calculates the tilt angle of the QR code by fitting a straight line using the least squares method. The tilt angle satisfies the formula...
[0087]
[0088] in , Let x and y be the x and y coordinates of the k-th edge feature point. The mean of the x-coordinates of the 16 edge feature points. The mean of the ordinates of the 16 edge feature points. The tilt angle of the QR code. The total number of edge feature points is 16. In this embodiment, the calculated tilt angle is 30.2°, and the radial distortion parameters of the image are calibrated. It is -0.012. The value is 0.003. The ROI (Region of Interest) correction unit performs rotation correction and distortion correction on the region of interest containing the QR code based on the tilt angle and distortion parameters. The correction transformation satisfies the formula...
[0089]
[0090] in , These are the corrected horizontal and vertical coordinates of the k-th feature point. In this embodiment, the distortion error after correction is 0.3 pixels, and the QR code is completely restored to a standard frontal view.
[0091] The synchronously operating multi-specification adaptation unit uses adaptive threshold segmentation and feature point clustering localization algorithms to identify QR Code Version 5 with a size of 300×300 pixels, generating a 320×320 pixel region of interest bounding box to accurately locate the valid area of the QR code and eliminate invalid interference from the background area. The corrected and adapted image is then transmitted to the feature extraction module.
[0092] Step 4: QR code feature extraction and defect identification
[0093] The feature extraction module performs deep analysis on the corrected image, extracting the QR code's position coordinates, overall size, single-module pixel size, and the position and shape features of the position detection graphics and alignment graphics. In this embodiment, the feature extraction module identifies edge damage in the position detection graphics at the upper left corner of the QR code, with a 15% defect rate; the remaining positioning graphics and data areas are complete. The feature extraction module transmits the extracted feature parameters and defect identification results to the defect completion module.
[0094] Step 5: Complete the missing areas of the QR code
[0095] The incompleteness completion module receives the feature parameters and the defect identification result. Based on the QR code encoding rules and the highest level of fault tolerance mechanism, combined with the position coordinate patterns of the complete position detection graphics on the right and below, and the encoding patterns of adjacent data modules, it deduces and completes the edges of the missing graphics and 8 data bits. After completion, the incompleteness completion module verifies the integrity of the QR code. If the verification is successful, the completed QR code image is transmitted to the recognition output module.
[0096] Step 6 Decoding and Data Output
[0097] The recognition output module calls the built-in QR code decoding engine of Sherlock 8.2 machine vision software to decode the completed QR code image and parse out the component serial number data. The recognition output module transmits the parsed raw data to the production line MES system in JSON format, and simultaneously stores the entire process log and the completed image to a specified path, completing a single recognition process.
[0098] II. Working Principle
[0099] This embodiment addresses the complex operating conditions of an automotive parts production line by employing a sequentially linked modular architecture to solve various problems in the QR code recognition process step by step. The image acquisition module, through adaptive adjustment of exposure parameters, ensures basic image quality from the source, avoiding images that are too dark or overexposed due to changes in ambient lighting. The image preprocessing module uses a grayscale adaptive processing unit to solve the problem of uneven lighting caused by metal surface reflections, enhancing the contrast between the QR code and the background. A ROI box correction unit addresses QR code tilting and distortion caused by production line vibrations, restoring the standard posture of the QR code. A multi-specification adaptation unit accurately locates the effective area of the QR code, eliminating background interference and providing a high-quality image foundation for subsequent feature extraction. The feature extraction module accurately identifies the structural features and damage status of the QR code, providing accurate data for the completion operation. The incompleteness completion module, based on the QR code's encoding rules and fault tolerance mechanism, restores the missing areas, resolving the problem of unrecognizable QR codes due to damage. The recognition output module completes the final decoding and data transmission, achieving seamless integration with the production line business system. The entire process is fully automated and requires no manual intervention. It can adapt to the needs of continuous production line operation, eliminate the adverse effects of complex working conditions on QR code recognition, and achieve stable recognition results.
[0100] III. Experimental Data
[0101] This embodiment conducts continuous operation testing on an automotive parts assembly line. The testing cycle is 72 hours. The test object is automotive metal parts with QR codes printed on their surfaces. During the test, existing mainstream recognition schemes are set up as a control group. The control group uses the recognition scheme of ZBar 0.23.9 combined with OpenCV 4.5.0. The hardware environment and operating conditions of the two groups of tests are completely identical.
[0102] 1. Recognition success rate test
[0103] This test involved a total of 10,000 QR code scans. Test conditions included an approximately 30° tilt angle, 15% of the QR codes being incomplete, and uneven lighting due to reflections from metal surfaces. The recognition scheme in this embodiment successfully recognized QR codes 9,862 times, achieving an overall success rate of 98.62%. The control group successfully recognized QR codes 6,217 times, achieving an overall success rate of 62.17%.
[0104] For QR codes with a damage rate of 10% to 30%, a total of 1000 tests were conducted. The recognition scheme in this embodiment successfully recognized the codes 958 times, with a success rate of 95.8%. The control group successfully recognized the codes 213 times, with a success rate of 21.3%.
[0105] For QR codes tilted at angles of 20° to 45°, a total of 1000 tests were conducted. The recognition scheme in this embodiment successfully recognized the codes 991 times, achieving a success rate of 99.1%. The control group successfully recognized the codes 347 times, achieving a success rate of 34.7%.
[0106] 2. Processing efficiency test
[0107] The average processing time for a single frame image in this embodiment is 142ms, with the longest processing time not exceeding 200ms. In contrast, the average processing time for a single frame image in the control group is 216ms, with the longest processing time exceeding 500ms. This embodiment demonstrates a more than 40% improvement in single-batch scanning efficiency compared to the control group.
[0108] 3. Operational stability test
[0109] During 72 hours of continuous operation, the identification scheme in this embodiment did not experience any program crashes or freezes, with a failure rate of 0.32%. In contrast, the control group experienced 12 instances of program freezes and identification interruptions, with a failure rate of 1.76%.
[0110] 4. Completion accuracy test
[0111] The completion operation for incomplete QR codes was tested a total of 1000 times. The decoding accuracy of the completed QR code was 98.3%. The difference between the decoding success rate of the completed QR code and the decoding success rate of the complete QR code was 1.7%, and there were no cases of misreading or incorrect reading.
[0112] IV. Technical Effects
[0113] This embodiment achieves stable QR code recognition under complex operating conditions in automotive parts production lines through a modular architecture that links sequentially, demonstrating significant practical application benefits compared to existing solutions.
[0114] This solution significantly improves the success rate of QR code recognition under complex working conditions, solves the recognition failure problems caused by tilt distortion, uneven lighting, and QR code damage that are common in production lines, greatly reduces production line downtime and manual re-entry operations caused by recognition failures, and improves the operating efficiency of the production line.
[0115] This solution achieves fully automated operation of the entire process, eliminating the need for manual real-time adjustment of camera parameters and intervention in the recognition process. It can be fully adapted to the continuous automated operation rhythm of the production line, significantly reducing the workload of on-site operators and reducing labor costs.
[0116] This solution boasts excellent operational stability, with an extremely low failure rate during long-term continuous operation. It will not experience program interruptions or freezes, and can meet the needs of 24-hour uninterrupted operation of industrial production lines, ensuring the continuity of the production process.
[0117] This solution's processing efficiency meets the real-time requirements of industrial sites. The processing time for a single frame image is controllable, which will not slow down the production line's operating rhythm and can be seamlessly integrated with the production line's automated equipment.
[0118] This solution offers reliable completion accuracy, high decoding accuracy of the completed QR code, and eliminates misreading and erroneous readings, ensuring the accuracy of component traceability data and avoiding production quality issues caused by data errors.
[0119] This solution can be directly integrated with the existing MES system on the production line without requiring large-scale modifications to the existing equipment. It has low deployment costs, strong adaptability, and can be quickly promoted to similar industrial production scenarios.
[0120] Implementation Example 2: Application of DM Code Recognition for Warehouse Logistics Pallets
[0121] I. Technical Solution
[0122] This embodiment is applied to intelligent warehousing and logistics scenarios to identify DM CodeECC 200 affixed to the surface of storage pallets. It is adapted to complex working conditions such as severely damaged QR codes caused by pallet transportation friction, large QR codes exceeding the range due to long shooting distance, and insufficient contrast due to uneven lighting in the warehouse.
[0123] Hardware configuration
[0124] The image acquisition equipment uses a Basler acA2500-14uc industrial camera with a 25mm focal length lens, installed above the entrance to the warehouse racking aisle, with the lens vertically aimed at the pallet passage area. The supplemental lighting consists of two sets of 24W strip LED supplemental lights, installed on both sides of the aisle, with a color temperature of 5500K and brightness automatically adjusted according to ambient light. The computing equipment is a warehouse industrial control computer equipped with an Intel Core i7-12700K processor, 32GB DDR5 memory, and an NVIDIA GeForce RTX 3060 graphics card, installed in the electrical control cabinet next to the aisle.
[0125] Software Configuration
[0126] The warehouse industrial control computer is running Windows 10 Professional 64-bit operating system. The development platform uses Sherlock 8.2 machine vision software and Visual Studio 2019, with OpenCV 4.5.5 and Newtonsoft.Json 13.0.3 as dependencies. The system communicates with the warehouse WMS system via Ethernet.
[0127] System architecture and connectivity
[0128] The recognition system used in this embodiment includes an image acquisition module, an image preprocessing module, a feature extraction module, a partial completion module, and a recognition output module. The signal output terminal of the image acquisition module is connected to the signal input terminal of the image preprocessing module. The signal output terminal of the image preprocessing module is connected to the signal input terminal of the feature extraction module. The signal output terminal of the feature extraction module is connected to both the signal input terminals of the partial completion module and the recognition output module. The signal output terminal of the partial completion module is connected to the signal input terminal of the recognition output module. The signal output terminal of the recognition output module is interfaced with the warehouse management system (WMS).
[0129] The image preprocessing module incorporates a grayscale adaptive processing unit, a ROI bounding box correction unit, and a multi-size adaptation unit. The signal input of the grayscale adaptive processing unit is connected to the signal output of the image acquisition module. The signal output of the grayscale adaptive processing unit is connected to the signal inputs of both the ROI bounding box correction unit and the multi-size adaptation unit. The signal outputs of both the ROI bounding box correction unit and the multi-size adaptation unit are connected to the signal input of the feature extraction module.
[0130] Detailed implementation steps
[0131] Step 1: Image Acquisition and Multi-Size Adaptation
[0132] After the channel photoelectric sensor detects the tray entering the shooting area, it triggers the image acquisition module to start acquisition. The image acquisition module sets the industrial camera's initial resolution to 2048×2048 pixels, initial exposure time to 80μs, gain to 1.0dB, and acquisition format to RGB32, which is automatically converted to MONO8 format and stored in the image buffer. The image acquisition module collects the ambient light intensity within the channel through a photosensitive element and adjusts the brightness of the two side strip lights according to the light intensity distribution. In this embodiment, the light intensity within the channel is 400-1200 lux, and the brightness of the supplementary lights is adjusted to the range of 40%-80% to eliminate local shadows and strong light areas. The acquired raw image is synchronously transmitted to the image preprocessing module.
[0133] After receiving the original image, the multi-size adaptation unit of the image preprocessing module calls the feature point clustering and localization algorithm, identifies the QR code type as DM Code ECC 200 through the scale-invariant feature transformation algorithm, confirms that the QR code size is 1780×1780 pixels, adapts to the maximum size supported by the system, generates a 1800×1800 pixel region of interest bounding box, accurately locks the effective area of the QR code, and eliminates interference from other markings on the tray surface.
[0134] Step 2: Adaptive Gray-Scale Processing
[0135] The grayscale adaptive processing unit first calculates the overall grayscale mean of the image, and the grayscale mean satisfies the formula...
[0136]
[0137] Where M is the total number of horizontal pixels in the image (2048), and N is the total number of vertical pixels in the image (2048). Coordinates in the image The grayscale value of the pixel. The grayscale mean of the image is 58. In this embodiment, the original image has a grayscale mean of 58. The grayscale adaptive processing unit divides the image into 32×32 pixel blocks, performs grayscale stretching operations on each block, and dynamically adjusts the threshold range of each region from 25 to 190. After processing, the overall grayscale variance of the image is reduced from 45 to 22, effectively solving the problem of uneven illumination and clarifying the boundary between the QR code module and the background. The processed image is then transmitted to the ROI box correction unit.
[0138] Step 3: QR code posture correction
[0139] The ROI (Region of Interest) correction unit receives the processed image, extracts 12 feature points from the QR code edge, and calculates the tilt angle of the QR code by fitting a straight line using the least squares method. The tilt angle satisfies the formula...
[0140]
[0141] in, , Let x and y be the x and y coordinates of the k-th edge feature point. The mean of the x-coordinates of the 12 edge feature points. The mean of the ordinates of the 12 edge feature points. The tilt angle of the QR code. The total number of edge feature points is 12. In this embodiment, the calculated tilt angle is 5.8°, and the radial distortion parameters of the image are calibrated. It is -0.009. The value is 0.002. The ROI (Region of Interest) correction unit performs rotation correction and distortion correction on the region of interest containing the QR code based on the tilt angle and distortion parameters. The correction transformation satisfies the formula...
[0142]
[0143] in , These are the corrected horizontal and vertical coordinates of the k-th feature point. In this embodiment, the distortion error after correction is 0.2 pixels, and the QR code is completely restored to a standard frontal view. The corrected image is then transmitted to the feature extraction module.
[0144] Step 4: QR code feature extraction and defect identification
[0145] The feature extraction module performs deep analysis on the corrected image, extracting the QR code's position coordinates, overall size, single-module pixel size, and the position and shape features of the ring-shaped positioning boundary and aligned graphics. In this embodiment, the feature extraction module identifies a 28% incomplete data area in the QR code's center, including one incomplete aligned graphic, and a 5% damaged edge ratio for the positioning graphics. The feature extraction module transmits the extracted feature parameters and the defect identification results to the defect completion module.
[0146] Step 5: Complete severely incomplete QR codes
[0147] The incompleteness completion module receives the feature parameters and the defect identification result. Based on the DM Code ECC 200 encoding rules and the Reed-Solomon error correction code mechanism, it extracts 128 valid data blocks from the complete region. It then reconstructs the 42 data blocks of the missing region using an error correction polynomial. Simultaneously, it combines the position reference of the ring-shaped positioning boundary to complete the damaged edge module. After completion, the incompleteness completion module verifies the integrity of the QR code. Once verification is successful, the completed QR code image is transmitted to the recognition output module.
[0148] Step 6 Decoding and Data Output
[0149] The recognition output module calls the DM Code decoding engine built into the Sherlock 8.2 machine vision software to decode the completed QR code image and parse it to obtain warehousing data such as pallet material batch and quantity. The recognition output module transmits the parsed raw data to the warehouse WMS system in JSON format, and simultaneously stores the entire processing log and the completed image to a specified path, completing a single recognition process. If decoding fails, it returns a completion log containing the coordinates of the missing area, completion algorithm parameters, error correction code usage, and the reason for failure.
[0150] II. Working Principle
[0151] This embodiment addresses the complex working conditions of warehousing and logistics scenarios by employing a sequentially linked modular architecture to solve various pain points in large-size QR code recognition step by step. The image acquisition module addresses uneven lighting within the warehouse through multi-channel supplemental lighting and exposure parameter adjustments, ensuring image clarity for large-size QR codes from the source of acquisition. The multi-specification adaptation unit achieves accurate positioning of ultra-large QR codes through feature point clustering and scale-invariant feature transformation algorithms, solving the problem of conventional solutions being unable to adapt to large-size codes. The grayscale adaptive processing unit eliminates insufficient contrast caused by local lighting differences within the warehouse through block-based grayscale stretching, enhancing the boundary features of the QR code. The ROI box correction unit corrects QR code tilt caused by pallet placement deviations through edge feature point fitting calculations, restoring the standard shape of the QR code. The feature extraction module accurately identifies severely damaged areas and structural features of the QR code, providing accurate baseline data for error correction and completion. The incompleteness completion module, based on the DM Code error correction coding mechanism, reconstructs the incomplete area through complete data blocks, solving the problem of unrecognizable severely damaged QR codes. The identification output module completes the decoding and data integration with the warehousing system, enabling automated collection of pallet material information. The entire process requires no manual intervention, adapts to the pallet scanning requirements of continuous passage in warehouse aisles, and significantly improves the efficiency of warehouse inbound and outbound operations.
[0152] III. Experimental Data
[0153] This embodiment conducts continuous operation tests in the intelligent warehouse inbound channel for 72 hours. The test object is a warehouse pallet with DM Code ECC 200 affixed to its surface. During the test, existing mainstream recognition schemes are set up as a control group. The control group uses the recognition scheme of ZBar 0.23.9 combined with OpenCV 4.5.0. The hardware environment and operating conditions of the two groups of tests are completely identical.
[0154] 1. Recognition success rate test
[0155] This test involved a total of 10,000 QR code scans. Test conditions included large QR codes (1800×1800 pixels), 28% of which were severely damaged, and uneven lighting conditions ranging from 400 to 1200 lux. The recognition scheme in this embodiment successfully recognized QR codes 9,684 times, achieving an overall success rate of 96.84%. The control group successfully recognized QR codes 5,872 times, achieving an overall success rate of 58.72%.
[0156] For QR codes with a 20% to 30% damage rate, a total of 1000 tests were conducted. The recognition scheme in this embodiment successfully recognized the codes 921 times, achieving a success rate of 92.1%. The control group successfully recognized the codes 87 times, achieving a success rate of 8.7%.
[0157] For large-sized QR codes ranging from 1500×1500 to 2000×2000 pixels, a total of 1000 tests were conducted. The recognition scheme in this embodiment successfully recognized the codes 994 times, achieving a success rate of 99.4%. The control group successfully recognized the codes 276 times, achieving a success rate of 27.6%.
[0158] 2. Processing efficiency test
[0159] The average processing time for a single frame image in this embodiment is 180ms, with the longest processing time not exceeding 200ms. In contrast, the average processing time for a single frame image in the control group is 320ms, with the longest processing time exceeding 800ms. This embodiment demonstrates a 43% improvement in single-batch pallet scanning efficiency compared to the control group.
[0160] 3. Operational stability test
[0161] During 72 hours of continuous operation, the identification scheme in this embodiment did not experience any program crashes or freezes, with a failure rate of 0.41%. In contrast, the control group experienced 18 instances of program freezes and identification interruptions, with a failure rate of 2.25%.
[0162] 4. Completion accuracy test
[0163] For the completion operation of severely incomplete QR codes, a total of 1000 tests were conducted. The decoding accuracy of the completed QR code was 98.1%. The difference between the decoding success rate of the completed QR code and the decoding success rate of the complete DM code was 1.8%, with no misreading or erroneous readings.
[0164] IV. Technical Effects
[0165] This embodiment achieves stable recognition of large-size, severely damaged QR codes in warehousing scenarios through a modular processing architecture, and has many practical application effects compared with existing solutions.
[0166] This solution significantly improves the recognition success rate of large-sized and severely damaged QR codes, solves the problem of recognition failure caused by damage to warehouse pallet QR codes due to transportation friction and excessive size, greatly reduces the workload of manual verification and manual data entry, and improves the operational efficiency of warehouse inbound and outbound operations.
[0167] This solution enables dynamic barcode scanning during pallet passage, eliminating the need for pallet parking and alignment. It adapts to the continuous passage rhythm of warehouse aisles, significantly reducing the processing time for single pallets entering and leaving the warehouse and improving warehouse turnover efficiency.
[0168] This solution has excellent lighting adaptability and can cope with the lighting differences in different areas of the warehouse. It eliminates the need to frequently adjust the supplementary lighting and camera parameters according to the time of day and weather, thus reducing the workload of on-site operation and maintenance.
[0169] This solution offers reliable completion accuracy, achieving high-accuracy completion and decoding even for severely incomplete QR codes. This ensures the accuracy of warehouse material data and avoids inventory discrepancies and misdelivery of materials due to data errors.
[0170] This solution can directly interface with the existing WMS system in the warehouse without requiring large-scale modifications to existing warehouse equipment and channels. It has low deployment costs, strong adaptability, and can be quickly promoted to various warehousing and logistics scenarios.
[0171] This solution has an extremely low failure rate during long-term continuous operation, meeting the needs of 24 / 7 uninterrupted warehouse operations and ensuring the continuity and stability of warehouse operation processes.
[0172] Implementation Example 3: Micro QR Code Recognition Application for Outdoor Power Equipment Inspection
[0173] I. Technical Solution
[0174] This embodiment is applied to outdoor power equipment inspection scenarios to identify MicroQR codes printed on the casing of power equipment. It is suitable for complex working conditions such as outdoor low-light environment, large deviation of inspection shooting angle, small QR code size, and insufficient contrast caused by the hazy surface of the equipment casing.
[0175] Hardware configuration
[0176] The image acquisition device uses a Basler daA1920-30uc industrial camera with an 8mm focal length lens, mounted on the gimbal of the wheeled inspection robot, allowing the shooting angle to be adjusted with the gimbal. The lighting device uses a 2W low-power LED fill light, installed next to the camera, with a color temperature of 5500K and automatically adjustable brightness. The computing device is an embedded industrial computer equipped with an Intel Core i5-1135G7 processor, 16GB DDR4 memory, and an NVIDIA GeForce MX450 graphics card, installed inside the inspection robot's body.
[0177] Software Configuration
[0178] The embedded industrial computer runs on a 64-bit Windows 10 IoT Enterprise Edition operating system. The development platform uses Sherlock 8.2 machine vision software and Visual Studio 2019, with OpenCV 4.5.5 and Newtonsoft.Json 13.0.3 as dependencies. The system communicates with the power inspection and management system via a 5G wireless network.
[0179] System architecture and connectivity
[0180] The recognition system used in this embodiment includes an image acquisition module, an image preprocessing module, a feature extraction module, a partial completion module, and a recognition output module. The signal output terminal of the image acquisition module is connected to the signal input terminal of the image preprocessing module. The signal output terminal of the image preprocessing module is connected to the signal input terminal of the feature extraction module. The signal output terminal of the feature extraction module is connected to the signal input terminals of both the partial completion module and the recognition output module. The signal output terminal of the partial completion module is connected to the signal input terminal of the recognition output module. The signal output terminal of the recognition output module is connected to the power inspection management system.
[0181] The image preprocessing module incorporates a grayscale adaptive processing unit, a ROI bounding box correction unit, and a multi-size adaptation unit. The signal input of the grayscale adaptive processing unit is connected to the signal output of the image acquisition module. The signal output of the grayscale adaptive processing unit is connected to the signal inputs of both the ROI bounding box correction unit and the multi-size adaptation unit. The signal outputs of both the ROI bounding box correction unit and the multi-size adaptation unit are connected to the signal input of the feature extraction module.
[0182] Detailed implementation steps
[0183] Step 1: Image Acquisition in Low-Light Environments
[0184] The inspection robot moves to the target power equipment, the gimbal adjusts to the preset shooting position, and triggers the image acquisition module to start acquiring images. The image acquisition module sets the industrial camera's initial resolution to 1280×720 pixels, the initial exposure time to 150μs, the gain to 2.0dB, and the acquisition format to MONO8. The image acquisition module acquires the real-time outdoor ambient light intensity through a photosensitive element. In this embodiment, it is a cloudy environment with an ambient light intensity of 200 lux. The camera's exposure time is adjusted according to the ambient light intensity, and the adjusted exposure time satisfies the formula...
[0185]
[0186] in The initial exposure time, The ambient light intensity is collected in real time. The preset standard reference light intensity, This is the adjusted camera exposure time. In this embodiment, the adjusted exposure time is 150μs. The fill light is turned off, and the image is acquired using only ambient light to avoid overexposure caused by fill light reflection. The raw image acquired by the image acquisition module is stored in the image buffer and simultaneously transmitted to the image preprocessing module.
[0187] Step 2: Grayscale Adaptive Enhancement and Size Fitting
[0188] After receiving the original image, the image preprocessing module first calculates the overall grayscale mean of the image using the grayscale adaptive processing unit. The grayscale mean satisfies the formula...
[0189]
[0190] Where M represents the total number of horizontal pixels in the image (1280) and N represents the total number of vertical pixels in the image (720). Coordinates in the image The grayscale value of the pixel. The grayscale average value is the overall grayscale value of the image. In this embodiment, the original image has a grayscale average value of 65. The grayscale adaptive processing unit divides the image into 8×8 pixel blocks, performs grayscale stretching operations on each block, and dynamically adjusts the threshold range of each region from 20 to 160. After processing, the image's grayscale average value is increased to 110, and the contrast is increased to 55, effectively solving the problem of insufficient contrast in low-light environments. The processed image is synchronously transmitted to the ROI box correction unit and the multi-specification adaptation unit.
[0191] The multi-size adaptation unit uses adaptive threshold segmentation and feature point clustering localization algorithms to identify the QR code type as Micro QR Code Version 3, confirm the QR code size as 120×120 pixels, adapt to the smallest size supported by the system, generate a 140×140 pixel region of interest bounding box, accurately lock the effective area of the small-sized QR code, and eliminate interference from other markings on the device casing and the background environment.
[0192] Step 3: Large-Angle Posture Correction
[0193] The ROI (Region of Interest) correction unit receives the processed image, extracts 12 feature points from the QR code edge, and calculates the tilt angle of the QR code by fitting a straight line using the least squares method. The tilt angle satisfies the formula...
[0194]
[0195] in , Let x and y be the x and y coordinates of the k-th edge feature point. The mean of the x-coordinates of the 12 edge feature points. The mean of the ordinates of the 12 edge feature points. The tilt angle of the QR code. The total number of edge feature points is 12. In this embodiment, the calculated tilt angle is 41.8°, and the radial distortion parameters of the image are calibrated. It is -0.008. The value is 0.002. The ROI (Region of Interest) correction unit performs rotation correction and distortion correction on the region of interest containing the QR code based on the tilt angle and distortion parameters. The correction transformation satisfies the formula...
[0196]
[0197] in , These are the corrected horizontal and vertical coordinates of the k-th feature point. In this embodiment, the average distortion error after correction is 0.4 pixels, and the QR code is completely restored to a standard frontal view. The corrected image is then transmitted to the feature extraction module.
[0198] Step 4: QR code feature extraction and integrity verification
[0199] The feature extraction module performs deep analysis on the corrected image to extract the QR code's position coordinates, overall size, single-module pixel size, and the position and shape features of the positioning graphic. In this embodiment, if the feature extraction module recognizes that the QR code positioning graphic and data area are complete and without defects, it directly transmits the image to the recognition output module, skipping the incompleteness completion step.
[0200] Step 5 Decoding and Data Output
[0201] The recognition output module calls the built-in Micro QR Code decoding engine of Sherlock 8.2 machine vision software to decode the corrected QR code image and parse it to obtain inspection data such as the power equipment number and operating status. The recognition output module transmits the parsed raw data to the power inspection management system in JSON format, and simultaneously stores the entire process log and images of this process to a specified path, completing a single recognition process.
[0202] II. Working Principle
[0203] This embodiment addresses the complex working conditions of outdoor power equipment inspection by employing a sequentially linked modular architecture to solve various pain points in outdoor small-sized QR code recognition. The image acquisition module, through adaptive adjustment of exposure parameters, solves the problem of excessively dark images in low-light outdoor environments, acquiring clear images without the need for supplementary lighting and avoiding the impact of glare on recognition. The multi-specification adaptation unit uses a feature point clustering and localization algorithm to accurately locate small-sized Micro QR codes, eliminating interference from complex outdoor backgrounds and resolving the low recognition rate of small-sized codes using conventional solutions. The grayscale adaptive processing unit enhances the contrast between the QR code and the background in low-light environments through fine-grained block grayscale stretching, strengthening the modular features of small-sized QR codes and providing a foundation for subsequent correction and recognition. The ROI box correction unit uses edge feature point fitting calculations to accurately correct QR codes tilted at large angles, solving the recognition problem caused by the inspection robot's shooting angle deviation and restoring the standard shape of the QR code. The feature extraction module accurately identifies the integrity of the QR code; complete QR codes directly enter the recognition process without unnecessary completion processing, shortening processing time and improving inspection efficiency. The recognition and output module completes the decoding and data integration with the inspection and management system, enabling automated collection and uploading of power equipment inspection information. The entire process requires no close-range manual operation, is compatible with the automated inspection needs of inspection robots, and significantly improves the efficiency and safety of outdoor inspections.
[0204] III. Experimental Data
[0205] This embodiment conducts continuous inspection tests at an outdoor 110kV substation for a period of 7 days. The test object is power equipment with Micro QR Code Version 3 printed on its surface. During the test, existing mainstream recognition schemes are set up as a control group. The control group uses the recognition scheme of ZBar 0.23.9 combined with OpenCV 4.5.0. The hardware environment and operating conditions of the two groups of tests are completely identical.
[0206] 1. Recognition success rate test
[0207] This test involved a total of 1000 QR code scanning operations. Test conditions included a small 120×120 pixel QR code, a large tilt angle of approximately 42°, a low-light environment of 200 lux on a cloudy day, and insufficient contrast due to the matte finish of the device casing. The recognition scheme in this embodiment successfully recognized 992 QR codes, achieving an overall success rate of 99.2%. The control group successfully recognized 312 QR codes, achieving an overall success rate of 31.2%.
[0208] For QR codes tilted at angles of 30° to 45°, a total of 300 tests were conducted. The recognition scheme in this embodiment successfully recognized the codes 298 times, achieving a success rate of 99.3%. The control group successfully recognized the codes 42 times, achieving a success rate of 14%.
[0209] For small QR codes ranging from 100×100 to 200×200 pixels, a total of 300 tests were conducted. The recognition scheme in this embodiment successfully recognized the codes 297 times, achieving a success rate of 99%. The control group successfully recognized the codes 58 times, achieving a success rate of 19.3%.
[0210] In low-light environments of 100-300 lux, a total of 300 tests were conducted. The recognition scheme in this embodiment successfully identified objects 296 times, with a success rate of 98.7%. The control group successfully identified objects 89 times, with a success rate of 29.7%.
[0211] 2. Processing efficiency test
[0212] The average processing time for a single frame image in this embodiment is 90ms, with the longest processing time not exceeding 200ms. In contrast, the average processing time for a single frame image in the control group is 180ms, with the longest processing time exceeding 600ms. This embodiment demonstrates a 50% improvement in single-device inspection and barcode scanning efficiency compared to the control group.
[0213] 3. Operational stability test
[0214] During the 7-day continuous inspection, the identification scheme in this embodiment did not experience any program crashes or freezes, with a failure rate of 0.2%. In contrast, the control group experienced a total of 8 program freezes and identification interruptions, with a failure rate of 1.6%.
[0215] IV. Technical Effects
[0216] This embodiment achieves stable recognition of small-sized QR codes in low outdoor lighting conditions, with large angles of tilt, through a modular processing architecture, and has many practical application effects compared with existing solutions.
[0217] This solution significantly improves the recognition success rate of small-sized QR codes in complex outdoor environments, solves the recognition failure problem caused by low light, large angle tilt, and complex background, and realizes remote automated recognition of QR codes for power equipment without requiring inspection personnel to operate at close range, thus greatly reducing the safety risks of outdoor inspections.
[0218] This solution has high processing efficiency and short processing time for a single frame image, which can be adapted to the continuous inspection rhythm of the inspection robot, greatly shortening the inspection time of a single device and improving the overall efficiency of the inspection operation.
[0219] This solution has excellent low-light adaptability and can cope with low-light environments such as cloudy days and evenings. It does not require supplemental lighting and avoids the impact of supplemental lighting reflections on the QR codes on the equipment casing, thus expanding the time range of inspection operations.
[0220] This solution has strong large-angle correction capability, which can cope with the deviation of the inspection robot's shooting angle. It can complete the recognition without the need for precise gimbal alignment, which reduces the requirements for the gimbal positioning accuracy of the inspection robot and reduces the workload of equipment debugging.
[0221] This solution can be directly integrated with existing power inspection and management systems without requiring large-scale modifications to existing inspection robots. It has low deployment costs, strong adaptability, and can be quickly promoted to various outdoor equipment inspection scenarios such as power, municipal, and oil and gas.
[0222] This solution has an extremely low failure rate during long-term continuous operation and can adapt to complex outdoor temperature, humidity, and electromagnetic environments, ensuring the continuity and stability of inspection operations.
[0223] Example verification data comparison table:
[0224] Overall recognition performance Overall recognition success rate Cumulative testing of all complex working conditions in corresponding scenarios 98.62% (10,000 tests) 96.84% (10,000 tests) 99.2% (1000 tests) Production line scenarios: 62.17%; Warehouse scenarios: 58.72%; Inspection scenarios: 31.2%. Specialized working condition identification performance Incomplete QR code recognition success rate Incomplete / damaged ratio: 10%-30% 95.8% 92.1% - (No incomplete test items) Production line scenarios: 21.3%; Warehousing scenarios: 8.7%. High success rate of QR code recognition at large angles Tilt angle 20°-45° 99.1% - (No large-angle test items) 99.3% Production line scenarios: 34.7%; Inspection scenarios: 14%. Large QR code recognition success rate Pixel size 1500×1500-2000×2000 - (No large-size test items) 99.4% - (No large-size test items) Warehousing scenario 27.6% Small QR code recognition success rate Pixel size 100×100-200×200 - (No small-size test items) - (No small-size test items) 99% Inspection scenarios: 19.3% Success rate of identifying scenes with abnormal lighting Low illumination / uneven lighting 100-1200 lux 98.62% 96.84% 98.7% Production line scenarios: 62.17%; Warehouse scenarios: 58.72%; Inspection scenarios: 29.7%. Operating efficiency Average processing time per frame Complete process 142ms 180ms 90ms Production line scenario: 216ms; Warehouse scenario: 320ms; Inspection scenario: 180ms Operational stability Continuous operation failure rate 72 hours / 7 days continuous operation 0.32% 0.41% 0.2% Production line scenarios: 1.76%; Warehousing scenarios: 2.25%; Inspection scenarios: 1.6%. Completion Precision Incomplete QR code completion accuracy Decoding accuracy after incomplete completion 98.3% 98.1% - (No test completion items) No autocomplete function
[0225] Based on the verification data from the embodiments and comparative examples, the technical advantages of this invention compared to existing mainstream QR code recognition solutions are mainly reflected in the following aspects:
[0226] 1. A significant improvement in recognition success rate. This invention achieves an overall recognition success rate of over 96% in three typical scenarios: industrial production lines, warehousing and logistics, and outdoor inspections, with a maximum of 99.2%. In contrast, existing general solutions achieve a success rate of only 31.2%-62.17% under the same conditions. For specific working conditions that existing solutions struggle with, such as incomplete codes, large-angle tilts, size mismatches, and abnormal lighting, this invention improves the recognition success rate by over 80 percentage points, effectively solving the industry pain point of frequent QR code recognition failures under complex conditions.
[0227] 2. Comprehensive expansion of scene and working condition adaptability. This invention can simultaneously adapt to a variety of complex working conditions, including tilt distortion, uneven lighting, a wide size range of 100×100 to 2000×2000 pixels, and up to 30% incompleteness. It covers multiple mainstream application fields such as industrial automation, warehousing and logistics, and outdoor equipment inspection. No manual real-time parameter adjustment is required, while existing solutions can only operate stably under standard ideal working conditions, significantly reducing the deployment and maintenance costs of the solution.
[0228] 3. Significantly optimized operational efficiency and stability. The shortest processing time for a single frame image in this invention is only 90ms, and the longest is no more than 200ms, representing a processing efficiency improvement of up to 50% compared to existing solutions, meeting the real-time recognition requirements of various scenarios. During continuous operation, the failure rate of this invention is only 0.41%, far lower than the 1.6%-2.25% failure rate of existing solutions, supporting 24 / 7 uninterrupted operation and ensuring the continuity of business processes.
[0229] 4. The ability to complete incomplete QR codes fills a gap in existing technology. This invention targets QR codes with a 10%-30% incomplete ratio, achieving a decoding accuracy of over 98% after completion. Existing general solutions lack corresponding incomplete completion functions, and the recognition success rate is less than 10% in severely incomplete scenarios. This significantly reduces manual re-entry and process interruptions caused by QR code damage or stains, further enhancing the automation capability of the entire process.
[0230] In summary, the overall working principle of this invention is as follows:
[0231] This solution adopts a modular, sequentially linked architecture to build a complete processing chain from image acquisition to data output. By processing step by step, it solves various problems of QR code recognition under complex working conditions and achieves stable QR code recognition.
[0232] After the system starts up, the image acquisition module first acquires the original image of the QR code. It is compatible with image input in multiple formats, automatically converts color images into grayscale images in a unified format, and automatically adjusts the exposure parameters of the acquisition device according to the ambient light intensity to ensure that the acquired images have a qualified basic quality.
[0233] The acquired images are transmitted to the image preprocessing module. First, the grayscale adaptive processing unit divides the image into blocks, performing grayscale stretching and threshold adjustment based on the image's own grayscale distribution characteristics. This effectively enhances the contrast between the QR code area and the background, resolving image quality issues caused by uneven lighting. Next, the ROI correction unit extracts the edge feature points of the QR code, calculates its tilt angle and distortion parameters through fitting, and performs rotation correction and distortion correction on the QR code area, restoring the deflected and deformed QR code to a standard, front-view shape. Simultaneously, the multi-specification adaptation unit identifies the type and size of the QR code through feature localization, automatically generating a matching region bounding box to accurately locate the valid area of the QR code and eliminate invalid interference from the background area.
[0234] The preprocessed image is transmitted to the feature extraction module, which performs depth analysis on the corrected QR code image to extract the QR code's position, size, and structural features. It also identifies whether the QR code is damaged, and the location and extent of any damage. The extracted feature parameters are transmitted to the incompleteness completion module and the recognition output module, respectively. If the QR code is complete and without damage, it can directly proceed to the recognition output stage without further processing.
[0235] If the QR code is damaged, the incompleteness module, based on the QR code's own encoding rules and fault tolerance mechanism, combined with the feature information of the complete area, performs logical deduction and restoration of the missing positioning structure and data area, completes the missing content, and generates a complete QR code image.
[0236] The final processed QR code image enters the recognition output module, where the decoding engine parses the QR code information, outputs the corresponding raw data, and saves the entire processing log. If decoding fails, the system returns corresponding processing information and the reason for the failure, facilitating subsequent troubleshooting and adjustments.
[0237] The specific method of using this invention is as follows:
[0238] The use of this solution can be divided into three stages: deployment preparation, daily operation, and anomaly handling. The entire process is simple to operate, adaptable to a variety of application scenarios, and requires no complicated manual debugging.
[0239] 1. In the deployment preparation phase, the system is first deployed to the corresponding computing device. The industrial camera for image acquisition and its auxiliary equipment are connected. The camera's installation position, shooting distance, and basic operating parameters are adjusted according to the actual application scenario to ensure that objects with QR codes can completely enter the camera's shooting range. Next, the system is integrated with the corresponding business systems. The system's output ports are connected to business platforms such as the industrial production line management system and the warehousing and logistics scheduling system. The data transmission format and storage path are set, completing the initial deployment of the system.
[0240] 2. During daily operation, after system startup, a full-link self-check is performed to confirm the normal connection and stable operation of each module. The system then enters automatic operation mode. When an object with a QR code enters the camera's acquisition range, the image acquisition module automatically triggers the acquisition operation to obtain the original image of the QR code. The system automatically follows the preset processing chain, sequentially completing image preprocessing, posture correction, feature extraction, defect completion, and decoding operations, all without manual intervention. After decoding, the system automatically transmits the parsed QR code data to the connected business system, while simultaneously saving the entire processing log, completing a single recognition operation. For different application scenarios, only the camera's acquisition parameters and the compatible QR code type need to be adjusted; the system's processing flow does not need to be modified to adapt to different scenarios.
[0241] 3. During the anomaly handling phase, when the system encounters a decoding failure, it will automatically return the process information and the reason for the failure. Operators can use this information to troubleshoot on-site issues, adjust camera parameters, lighting equipment brightness, or the QR code's placement. Once adjustments are made, the system will resume normal operation. If the QR code damage exceeds the system's processing range, the system will automatically provide corresponding prompts, guiding operators to re-capture the image or manually verify the QR code information.
[0242] The above are merely preferred embodiments of the present invention and are not intended to limit the implementation methods and protection scope of the present invention. Those skilled in the art should recognize that any equivalent substitutions and obvious changes made based on the description and illustrations of the present invention should be included within the protection scope of the present invention.
Claims
1. A machine vision software-based complex working condition two-dimensional code correction and recognition system, characterized in that, The system includes an image acquisition module, an image preprocessing module, a feature extraction module, a partial completion module, and a recognition output module, which are connected in sequence by signals. The image preprocessing module is used to perform grayscale adaptive adjustment and geometric distortion correction on the acquired QR code image. The partial completion module is used to perform logical completion of the QR code partial area by matching the encoding rules according to the QR code features output by the feature extraction module.
2. The complex working condition QR code correction and completion recognition system based on machine vision software according to claim 1, characterized in that, The output of the image acquisition module is connected to the input of the image preprocessing module. The image acquisition module supports multi-format image input from industrial cameras and can automatically convert acquired RGB color images into grayscale images and output them to the image preprocessing module. The grayscale value range of the grayscale image is 0 to 255. The image acquisition module has a built-in adaptive exposure time adjustment unit that adjusts the camera exposure time according to the ambient light intensity. The adjusted exposure time satisfies the formula: in, The initial exposure time, The ambient light intensity is collected in real time. The preset standard reference light intensity, This is the adjusted camera exposure time. 3.The machine vision software-based complex working condition two-dimensional code correction and recognition system according to claim 1, characterized in that, The image preprocessing module includes a grayscale adaptive processing unit, a ROI box correction unit, and a multi-size adaptation unit. The input of the grayscale adaptive processing unit is connected to the output of the image acquisition module, and the output of the grayscale adaptive processing unit is connected to the input of the ROI box correction unit and the multi-size adaptation unit, respectively. The outputs of the ROI box correction unit and the multi-size adaptation unit are both connected to the input of the feature extraction module. The grayscale adaptive processing unit first calculates the mean grayscale value of the acquired image, which satisfies the formula: in, This represents the total number of pixels horizontally in the image. This represents the total number of pixels vertically in the image. Coordinates in the image The grayscale value of the pixel. The overall grayscale mean of the image is used; then, based on the grayscale mean, a local histogram equalization algorithm is used to perform block grayscale stretching and dynamic threshold adjustment on the image to enhance the contrast between the QR code and the background.
4. The machine vision software-based complex working condition two-dimensional code correction and completion identification system according to claim 3, characterized in that, The ROI box correction unit extracts the edges of the QR code based on the geometric transformation algorithm library of machine vision software. The tilt angle of the QR code is calculated by fitting a straight line using the least squares method for each feature point. The tilt angle satisfies the formula: in, , For the first The x and y coordinates of each edge feature point for The mean of the x-coordinates of the edge feature points, for The mean of the ordinates of the edge feature points, The tilt angle of the QR code; Simultaneously calibrating radial distortion parameters of images and Further, based on the tilt angle and the distortion parameters, the region of interest where the two-dimensional code is located is rotated and corrected for distortion, and the correction transformation satisfies the formula: wherein, , is the first characteristic point after correction of the horizontal and vertical coordinates; The correction angle range of the ROI box correction unit is -90° to 90°, and the distortion correction error does not exceed 0.5 pixels.
5. The machine vision software-based complex working condition two-dimensional code correction and completion identification system according to claim 3, characterized in that, The multi-specification adaptation unit uses an adaptive threshold segmentation and feature point clustering localization algorithm to dynamically identify QR codes of different sizes and types, and generate a region of interest bounding box matching the size of the QR code. The QR code types adapted by the multi-specification adaptation unit include QR Code, DM Code ECC 200, Aztec Code and Micro QR Code, and the adapted QR code pixel size ranges from 100×100 to 2000×2000.
6. The complex working condition QR code correction and completion recognition system based on machine vision software according to claim 1, characterized in that, The input end of the feature extraction module is connected to the output end of the image preprocessing module, and the output end of the feature extraction module is connected to the input ends of the incompleteness completion module and the recognition output module, respectively. The feature extraction module performs feature analysis on the corrected QR code image, extracts the QR code's position coordinates, overall size, single module pixel size, positioning graphic position and shape features, and identifies the incomplete area and incompleteness ratio of the QR code, and outputs the extracted feature parameters to the incompleteness completion module. 7.The machine vision software-based complex working condition two-dimensional code correction and recognition system according to claim 1, characterized in that, The input of the incompleteness completion module is connected to the output of the feature extraction module, and the output of the incompleteness completion module is connected to the input of the recognition output module. Based on the encoding rules and fault tolerance mechanism of the QR code, the incompleteness completion module combines the complete area features output by the feature extraction module to logically complete the data bits and positioning graphics of the incomplete area of the QR code with a missing ratio of no more than 30%. The completed QR code image is then output to the recognition output module.
8. A method for correcting and recognizing a complex working condition two-dimensional code based on machine vision software, characterized in that, The complex working condition QR code correction and completion recognition system based on machine vision software as described in any one of claims 1-7 includes the following steps: S1 acquires the original image of the QR code to be recognized, performs standardized preprocessing on the original image to obtain a grayscale image, and adaptively adjusts the camera exposure time for acquisition according to the ambient light intensity. S2 performs grayscale adaptive enhancement, geometric distortion correction, and size adaptation on the grayscale image to obtain a standard-pose QR code target image; S3 extracts feature parameters from the target image of the QR code and identifies the incomplete area and degree of incompleteness of the QR code; S4 uses the encoding rules and fault tolerance mechanism of QR codes to logically complete incomplete areas and obtain a complete QR code image. S5 decodes the complete QR code image and outputs the original QR code data and recognition log. 9.The method according to claim 8, wherein, In step S1, the adaptive adjustment of the camera exposure time satisfies the formula: in, Initial exposure time, The ambient light intensity is collected in real time. The preset standard reference light intensity, This refers to the adjusted camera exposure time. In step S2, the grayscale adaptive enhancement first calculates the overall grayscale mean of the grayscale image. The grayscale mean satisfies the formula: in, This represents the total number of pixels horizontally in the image. This represents the total number of pixels vertically in the image. Coordinates in the image The grayscale value of the pixel. The image is calculated as the overall grayscale mean. Then, based on the grayscale mean, a local histogram equalization algorithm is used to perform block grayscale stretching and dynamic threshold adjustment on the image to adapt to bright and dark scenes with grayscale values ranging from 0 to 208.
10. The method according to claim 8, wherein, In step S2, geometric distortion correction is performed by extracting the edges of the QR code. Using a set of feature points, the tilt angle of the QR code is calculated by fitting a straight line using the least squares method. The tilt angle satisfies the formula: in, , For the first The x and y coordinates of each edge feature point for The mean of the x-coordinates of the edge feature points, for The mean of the ordinates of the edge feature points, The tilt angle of the QR code; Simultaneously calibrate the radial distortion parameters of the image. and Then, based on the tilt angle and distortion parameters, rotation correction and distortion correction are performed on the region of interest where the QR code is located. The correction transformation satisfies the formula: in, , For the first The corrected x and y coordinates of each feature point; The correction angle range is -90° to 90°, and the distortion correction error does not exceed 0.5 pixels; the size adaptation dynamically recognizes QR codes with sizes from 100×100 to 2000×2000 pixels through adaptive threshold segmentation and feature point clustering localization. In step S4, for QR codes with a missing ratio of no more than 30%, the effective data blocks of the complete area are extracted using the highest level of fault tolerance mechanism of QR codes. The data bits and positioning graphics of the missing area are reconstructed through an error correction algorithm. After completion, the integrity of the QR code is verified. If the verification is successful, the complete QR code image is output. In step S5, the decoding engine built into the machine vision software is called to decode the complete QR code image. The total processing time for a single frame image does not exceed 200ms. If decoding fails, a completion log containing information on the missing area, completion parameters, and the reason for failure is returned.