A method for detecting quality of a two-dimensional code with adaptive aperture

CN122965534APending Publication Date: 2026-10-23CHINA WATERBORNE TRANSPORT RES INST
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610790975.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-03
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

[0005]为此,本发明提供一种用于自适应孔径的二维码质量检测方法,用以通过实时分离检测光照波动与运动拖影并动态调整孔径和曝光参数来克服现有技术中由于在高速物流分拣场景下对运动拖影和光照突变缺乏前端自适应能力导致解码实时性差且复杂动态环境下识读成功率偏低的问题

Benefits of technology

[0016]与现有技术相比,本发明的有益效果在于,通过实时采集符号对比度、光照波动幅度和运动模糊程度三个参数,动态识别单一或混合类别的质检影响风险类型,并据此自适应调节孔径与曝光参数,结合连续短曝光图像融合技术,显著提升了强光照突变、高速运动拖影及混合干扰等复杂场景下的二维码解码成功率;同时,基于预设观测周期内各成功解码前后异常时刻的类别分布特征计算自适应度并动态调整解码门限,使系统能够根据实际遭遇的风险类型分布自动优化调控灵敏度,实现了二维码质量检测对多变现场环境的闭环自适应能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122965534A_ABST
    Figure CN122965534A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of two-dimensional code detection, and particularly relates to a two-dimensional code quality detection method for adaptive aperture, comprising: contrast threshold judgment decoding; interference type detection; single interference parameter adjustment, mixed interference and fusion; variation degree judgment decoding; adaptive threshold adjustment. The present application collects three parameters of symbol contrast, illumination fluctuation amplitude and motion blur degree in real time, dynamically identifies single or mixed type of quality inspection influence risk type, and adjusts aperture and exposure parameters adaptively according to the risk type, combines continuous short exposure image fusion technology, significantly improves the two-dimensional code decoding success rate in complex scenes such as strong light mutation, high-speed motion trailing and mixed interference, so that the system can automatically optimize the regulation sensitivity according to the actual encountered risk type distribution, and realizes the closed-loop adaptive ability of two-dimensional code quality detection to the variable field environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of QR code detection technology, and in particular to a method for detecting the quality of QR codes with adaptive aperture. Background Technology

[0002] With the rapid development of e-commerce, smart warehousing, and automated logistics, QR code reading in high-speed logistics sorting lines has become a crucial foundation for package information tracking, route allocation, and sorting control. Because packages are typically in continuous motion during transport, and the sorting site is generally subject to complex factors such as lighting flicker, equipment obstruction, ambient light variations, and differences in reflection from different packaging materials, QR code image quality is prone to fluctuations, leading to decreased reading stability. Furthermore, the factors affecting QR code imaging quality under different operating conditions exhibit dynamic changes and random superposition characteristics, making it difficult for traditional detection methods based on fixed imaging parameters or fixed judgment criteria to balance reading success rate and detection efficiency, easily resulting in misjudgments, missed judgments, and duplicate detections. Therefore, accurately identifying the key factors affecting QR code reading quality in high-speed logistics sorting scenarios and dynamically maintaining the stability and reliability of QR code quality detection results based on actual operating conditions has become a significant technical challenge in the field of QR code quality detection.

[0003] Chinese Patent Publication No. CN110210584A discloses a high-speed dynamic QR code recognition method based on an improved SURF composite algorithm. The method includes: S1) acquiring an image; S2) using a combination of phase correlation algorithm, Harris corner detection and SURF feature point matching algorithm to perform global motion estimation and compensation of the image under dynamic background to obtain a stable image sequence; S3) using a three-frame difference algorithm to detect the moving region of the stable image sequence and extract the moving target; S4) preprocessing the extracted moving target graphic; S5) using an improved Canny algorithm combined with Hough line detection to perform image edge detection and distortion correction; and S6) decoding the acquired image.

[0004] Therefore, the existing technology has the following problems: It relies on phase correlation and feature point matching for global motion estimation and compensation, which is computationally intensive and time-consuming, easily leading to excessive decoding latency and making it difficult to meet the real-time requirements of high-speed logistics sorting lines. It relies on multi-frame image sequences for moving target extraction, which is sensitive to the frame rate and quality consistency of continuous images. It is prone to inter-frame matching errors caused by sudden changes in illumination or motion blur, thus affecting decoding stability. It relies on image post-processing restoration, which cannot suppress interference at the imaging front end. It is prone to decoding failure in complex dynamic environments due to unsatisfactory restoration results, reducing the recognition success rate. Summary of the Invention

[0005] To address this, the present invention provides a QR code quality detection method for adaptive aperture, which overcomes the problems in the prior art where the lack of front-end adaptive capability to motion blur and sudden changes in illumination in high-speed logistics sorting scenarios leads to poor real-time decoding and low reading success rate in complex dynamic environments by separating and detecting illumination fluctuations and motion blur in real time and dynamically adjusting aperture and exposure parameters.

[0006] To achieve the above objectives, the present invention provides a method for quality detection of QR codes with adaptive aperture, comprising: The quality detection process of the QR code is determined based on the comparison result between the symbol contrast and the preset decoding threshold. The symbol contrast is extracted from the image of the QR code acquired in real time, and the quality detection process is carried out with preset aperture and preset exposure parameters. Based on the judgment result that does not meet the decoding conditions, the risk type of quality inspection impact is determined according to the amplitude of light fluctuation and the degree of motion blur. The amplitude of light fluctuation is determined based on the ambient light intensity within the preset light intensity collection period, and the degree of motion blur is determined based on the edge energy of the QR code. Based on the quality inspection impact risk type determined to be a single category, the current preset aperture and preset exposure parameters are adjusted accordingly. The single category of quality inspection impact risk type includes sudden changes in strong light and high-speed motion blur. Based on the quality inspection impact risk type determined to be a mixed category, the current preset aperture and preset exposure parameters are adjusted accordingly, and the fusion of two consecutive short exposure images is initiated to improve the symbol contrast. The risk of quality inspection impact is determined based on the degree of contrast change, so as to perform decoding or output a non-conforming result. The degree of contrast change is determined based on the symbol contrast after each adjustment. The preset decoding threshold is adjusted based on the degree of adaptability, wherein the degree of adaptability is determined based on the type of quality inspection impact risk that occurs within a preset judgment time before and after each successful decoding within a preset observation period.

[0007] Furthermore, the process of extracting the symbol contrast includes: The sign contrast is determined based on the mean grayscale values ​​of the dark and light colors, where, The dark grayscale mean is the average pixel grayscale value of all dark module regions, and the light grayscale mean is the average pixel grayscale value of all light module regions. Each dark module region and each light module region is obtained by locating and finding the image in the acquired image.

[0008] Furthermore, the process of determining the amplitude of the illumination fluctuation includes: The illumination fluctuation amplitude is determined based on the intensity range and the reference intensity, wherein... The light intensity range is determined based on the difference between the maximum and minimum values ​​of ambient light intensity within a preset light intensity acquisition period. The reference light intensity is determined based on the average light intensity within a preset light intensity acquisition period. The maximum and minimum values ​​are obtained by extracting the ambient light intensity continuously recorded within the preset light intensity acquisition period.

[0009] Furthermore, the process of determining the degree of motion blur includes: The degree of motion blur is determined based on the edge widening level, wherein the edge widening level is obtained by comparing the widening width of the gradient energy along the motion direction with a preset clear edge width, and the widening width of the gradient energy along the motion direction is obtained by detecting the gradient direction histogram of the module edges in the QR code image.

[0010] Furthermore, based on the judgment result that does not meet the decoding conditions, the process of determining the type of quality inspection impact risk according to the amplitude of illumination fluctuation and the degree of motion blur includes: The type of risk impact from quality inspection is determined based on the risk category, wherein... The risk category is determined based on the comparison results of the illumination fluctuation amplitude and the preset illumination fluctuation threshold, and the comparison results of the motion blur degree and the preset motion blur threshold. When the amplitude of the illumination fluctuation exceeds the preset illumination fluctuation threshold and the degree of motion blur does not exceed the preset motion blur threshold, the risk category is determined to be a strong illumination change. When the degree of motion blur exceeds the preset motion blur threshold and the amplitude of illumination fluctuation does not exceed the preset illumination fluctuation threshold, the risk category is determined to be high-speed motion blur. When both the amplitude of the illumination fluctuation and the degree of motion blur exceed their respective thresholds, the risk category is determined to be a mixed category.

[0011] Furthermore, the process of adjusting the current preset aperture and preset exposure parameters based on the quality inspection impact risk type determined to be a single category includes: Based on the quality inspection impact risk type of the sudden change in strong light, the preset aperture is increased and the exposure gain in the preset exposure parameters is decreased. Based on the quality inspection impact risk type of the high-speed motion blur, the exposure time in the preset aperture and the preset exposure parameters is reduced.

[0012] Furthermore, the process of adjusting the current preset aperture and preset exposure parameters based on the quality inspection impact risk type determined to be a mixed category, and initiating the fusion of two consecutive short exposure images, includes: Based on the risk type of the mixed category, the preset aperture is adjusted to a preset medium aperture, and the exposure time in the preset exposure parameters is adjusted to a preset medium duration, and the fusion of two consecutive short exposure images is initiated.

[0013] Furthermore, the process of determining the degree of contrast variation includes: The absolute value of the relative deviation between the symbol contrast after each adjustment and the symbol contrast before the corresponding adjustment is calculated to obtain the degree of contrast change.

[0014] Furthermore, the process of determining whether to eliminate the risk of quality inspection impact based on the degree of contrast change, in order to perform decoding or output non-conforming quality results, includes: Based on the judgment result that the degree of contrast change is greater than the preset effective improvement threshold and the adjusted symbol contrast reaches the current preset decoding threshold, it is determined that the risk of quality inspection impact is eliminated and decoding is performed. Based on the comparison results where the degree of change is less than or equal to the preset effective improvement threshold, it is determined that the quality inspection impact risk cannot be eliminated and a quality non-compliance result is output.

[0015] Furthermore, the process of adjusting the preset decoding threshold based on adaptivity includes: The adaptiveness is determined based on the category distribution characteristics of the abnormal moments corresponding to each successful decoding. Each abnormal moment is determined based on the type of quality inspection impact risk that occurs within the preset judgment time before and after the corresponding successful decoding. The category distribution characteristics include the proportion of moments belonging to a single category, the proportion of moments belonging to a mixed category, and the proportions of strong light abrupt change and high-speed motion trail in a single category. The preset decoding threshold is adjusted based on the comparison between the adaptiveness and the preset adaptive threshold.

[0016] Compared with existing technologies, the beneficial effects of this invention are as follows: by collecting three parameters in real time—symbol contrast, illumination fluctuation amplitude, and motion blur degree—it dynamically identifies single or mixed categories of quality inspection impact risk types and adaptively adjusts the aperture and exposure parameters accordingly. Combined with continuous short-exposure image fusion technology, it significantly improves the QR code decoding success rate in complex scenarios such as sudden changes in strong illumination, high-speed motion blur, and mixed interference. At the same time, based on the category distribution characteristics of abnormal moments before and after each successful decoding within a preset observation period, it calculates the adaptability and dynamically adjusts the decoding threshold, enabling the system to automatically optimize and control sensitivity according to the actual risk type distribution encountered, thus realizing the closed-loop adaptive capability of QR code quality inspection to changing on-site environments. Attached Figure Description

[0017] Figure 1 This is a flowchart of the QR code quality detection method for adaptive aperture in this embodiment; Figure 2 This is a flowchart for extracting symbol contrast in this embodiment; Figure 3 This is a flowchart for determining the amplitude of illumination fluctuations in this embodiment; Figure 4 This is a flowchart for adjusting the current preset aperture and preset exposure parameters in this embodiment. Detailed Implementation

[0018] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.

[0019] Please see Figure 1 The diagram shows a flowchart of a QR code quality detection method for adaptive aperture in this embodiment. This embodiment provides a QR code quality detection method for adaptive aperture, including: Step S1: Based on the comparison result between the symbol contrast (used to characterize the degree of brightness difference) and the preset decoding threshold, determine whether the QR code quality detection process meets the decoding conditions. The quality inspection process involves reading the QR codes on moving packages in the high-speed logistics sorting line and decoding the images acquired using preset aperture and preset exposure parameters. The preset aperture is the initial aperture value used to control the amount of light entering the lens and the depth of field. The preset exposure parameters include the initial exposure time and exposure gain, used to control the image brightness. The symbol contrast is extracted from the QR code images acquired in real time through the imaging sensor during the quality inspection process. The preset decoding threshold is determined statistically based on the lowest decodeable contrast under different movement speeds and lighting conditions of packages in the high-speed logistics sorting line. Since the symbol contrast is usually not lower than 0.5 when the package movement speed is less than one meter per second and the lighting is stable, stable decoding is possible when the package movement speed is not lower than two meters per second or when it encounters flickering lighting and shadows, the symbol contrast will drop below 0.4. Therefore, this embodiment selects the intermediate value of 0.45 as the preset decoding threshold to avoid excessive intervention under normal operating conditions.

[0020] In this embodiment, when the symbol contrast is greater than or equal to the preset decoding threshold, the current quality inspection process is determined to meet the decoding conditions, and QR code decoding is performed; when the symbol contrast is less than the preset decoding threshold, the current quality inspection process is determined to not meet the decoding conditions, and the process proceeds to the subsequent quality inspection impact risk type determination process.

[0021] Step S2: Based on the judgment result that the decoding conditions are not met, it is determined that the current quality inspection process has entered a non-stationary imaging state. Then, the type of quality inspection impact risk is determined according to the illumination fluctuation amplitude, which is used to characterize the drastic change of ambient light intensity per unit time, and the degree of motion blur, which is used to characterize the severity of edge blurring caused by relative motion of the QR code image. The amplitude of illumination fluctuation is determined based on the ambient light intensity within a preset light intensity acquisition period, and the degree of motion blur is determined based on the edge energy of the QR code. The ambient light intensity is obtained based on the exposure feedback loop of the ambient light sensor or imaging sensor to characterize the dynamic characteristics of the current scene's illumination. The edge energy is obtained based on the image gradient detection of the QR code to characterize the edge widening level caused by motion blur. The preset light intensity acquisition period is determined based on the flicker period of the strobe lighting in the high-speed logistics sorting line and the duration of the package shadow sweep. It is usually set between 10 milliseconds and 100 milliseconds. Since the strobe lighting period is 20 milliseconds and the shadow sweep lasts for 30 milliseconds, and 40 milliseconds is greater than 30 milliseconds and is the smallest integer multiple of 20 milliseconds, it is set to 40 milliseconds in this embodiment to simultaneously and completely capture the brightness changes of the strobe fluctuation and the shadow sweep.

[0022] Step S3: Adjust the current preset aperture and preset exposure parameters based on the quality inspection impact risk type determined to be a single category. The single category of quality inspection impact risk type includes sudden changes in strong light and high-speed motion blur. Based on the quality inspection impact risk type determined to be a mixed category, the current preset aperture and preset exposure parameters are adjusted accordingly, and the fusion of two consecutive short exposure images is initiated to improve symbol contrast.

[0023] Step S4: Determine whether to eliminate the risk of quality inspection impact based on the degree of contrast change, which characterizes the improvement of symbol contrast after each adjustment relative to before adjustment, so as to perform decoding or output unqualified results. The degree of contrast change is determined based on the symbol contrast after each adjustment.

[0024] Step S5: Adjust the preset decoding threshold based on the adaptive degree used to characterize the distribution concentration and diversity of quality inspection impact risk types that appear within the preset observation period. The adaptive degree is determined based on the quality inspection impact risk types that appear within the preset judgment time before and after each successful decoding within the preset observation period.

[0025] In the non-stationary imaging state of a high-speed logistics sorting line, contrast attenuation is attributed to single or mixed interference by separating and detecting illumination fluctuations and motion blur. Matched aperture and exposure adjustments and short exposure fusion are then performed to ensure that the control direction is consistent with the physical cause of the interference source, avoiding parameter conflicts. Simultaneously, based on the distribution of actual interference types before and after each successful decoding, the frequency and proportion of strong illumination abrupt changes caused by strobe lighting or shadow sweeping, motion blur caused by high-speed conveyor belts, and mixed interferences in the high-speed logistics sorting line are determined. Among them, the concentration of single interference reflects the bias of the working condition, while the increase in the proportion of mixed interference reflects the normalization of compound interference. It is necessary to maintain or increase the threshold to avoid premature parameter saturation or conflict. Thus, by adjusting the concentration and diversity of the distribution, the decoding threshold is adaptively drifted according to the statistical characteristics of the working condition, reducing ineffective control and detection delay while ensuring decoding success rate.

[0026] Please see Figure 2 As shown, this is a flowchart of the symbol contrast extraction process in this embodiment. In this embodiment, the process of extracting symbol contrast includes: Calculate the difference between the mean grayscale values ​​of light and dark colors to obtain the grayscale difference used to characterize the absolute value of the brightness difference between modules; Calculate the sum of the average grayscale values ​​of the light and dark colors to obtain the grayscale sum used to characterize the total brightness between modules; Calculate the ratio of grayscale difference to grayscale sum to obtain the sign contrast, where, The dark grayscale mean is the average pixel grayscale value of all dark module regions, and the light grayscale mean is the average pixel grayscale value of all light module regions. Each dark module region and each light module region is obtained by locating and finding the image in the acquired image.

[0027] By normalizing the symbol contrast to a fixed range using the ratio of grayscale difference to grayscale sum, the contrast measurement is decoupled from the absolute value of global ambient illumination. At the same time, the grayscale averaging operation of all modules can dilute extreme pixel values ​​caused by local smudges or uneven printing, thereby ensuring that the symbol contrast only reflects the inherent reflection differences between QR code modules. This avoids false fluctuations introduced by overall illumination drift or surface defects in subsequent threshold determination, and ensures that the adaptive aperture control is triggered only for the true contrast attenuation caused by sudden changes in illumination or motion blur.

[0028] Please see Figure 3 As shown, this is a flowchart for determining the illumination fluctuation amplitude in this embodiment. In this embodiment, the process of determining the illumination fluctuation amplitude includes: The difference between the maximum and minimum ambient light intensity within a preset light intensity acquisition period is calculated to obtain the light intensity range, which characterizes the instantaneous range of light intensity variation. The maximum and minimum values ​​are obtained by extracting the instantaneous values ​​of ambient light intensity continuously recorded within a preset light intensity acquisition period; Calculate the average ambient light intensity within a preset light intensity acquisition period to obtain a reference light intensity that characterizes the overall light intensity level; Calculate the ratio of the light intensity range to the reference light intensity to obtain the light intensity fluctuation range.

[0029] By dividing the instantaneous range of light intensity variation by the overall level, the amplitude of light fluctuation becomes a relative quantity independent of absolute brightness, thereby eliminating the influence of the overall intensity of ambient light on fluctuation judgment. In high-speed logistics sorting lines, regardless of whether it is under daytime window incident light or nighttime artificial lighting environment, this ratio can uniformly reflect the degree of relative light intensity jump caused by flickering or shadow sweeping, ensuring that subsequent risk type judgment is not interfered with by differences in absolute brightness.

[0030] Specifically, the process of determining the degree of motion blur includes: Based on a clear edge widening level, the motion blur is determined to be no blur; based on an unclear edge widening level, the motion blur is determined to be severe ghosting. The blurry edge widening level is determined based on the comparison result of the widening width being greater than the preset sharp edge width; the sharp edge widening level is determined based on the comparison result of the widening width being less than or equal to the preset sharp edge width; the preset sharp edge width is used to characterize the inherent transition width of the module edge in the absence of motion blur, and is determined based on the point spread function and optical resolution calibration of the imaging system. It is usually set between 1 and 3 pixels. Since the exposure time of the imaging sensor and the conveyor belt speed in the high-speed logistics sorting line determine the critical widening of motion blur, when the widening width exceeds 2 pixels, it begins to significantly affect decoding. Therefore, in this embodiment, it is set to 2 pixels, which can distinguish between the sharp edge determined by the static optical system and the additional widening caused by relative motion.

[0031] In this embodiment, the gradient energy broadening width along the motion direction is obtained by detecting the gradient direction histogram of the module edge in the QR code image. The main direction in the detected gradient direction histogram is taken as the motion direction, and the gradient magnitude is curve-fitted along this direction, with the half-width at half-maximum (WHM) as the broadening width.

[0032] Motion blur is caused by relative displacement during exposure time, resulting in a uniform tail of edge energy along the direction of motion. This tail manifests as a broadening of the amplitude distribution in the gradient domain, with its half-width at half-maximum (HWHM) equal to the displacement distance and independent of illumination intensity. The preset sharp edge width is the inherent transition width of the static optical system. By comparing the detected broadened HWHM with this inherent width, the excess portion is the additional broadening caused by motion, thus obtaining the degree of blur that reflects only the relative intensity of motion, forming two independent judgment criteria with respect to illumination fluctuation amplitude.

[0033] Specifically, based on the judgment result that does not meet the decoding conditions, the process of determining the type of quality inspection impact risk according to the amplitude of illumination fluctuation and the degree of motion blur includes: The types of risks affecting quality inspection are determined based on risk categories. Risk categories are classified based on the comparison results of illumination fluctuation amplitude and preset illumination fluctuation threshold, and the comparison results of motion blur degree and preset motion blur threshold.

[0034] In this embodiment, the preset illumination fluctuation threshold is determined based on the critical value between the normal light intensity jump amplitude caused by flickering illumination and the light intensity drop amplitude when a shadow sweeps across. The typical fluctuation amplitude of flickering illumination is about 20% of the average light intensity, while the light intensity drop amplitude when a shadow sweeps across usually exceeds 40%. Therefore, setting the threshold to 30% of the average light intensity can both exclude normal flicker fluctuations and capture sudden changes caused by shadow sweeps across.

[0035] In this embodiment, the preset motion blur threshold is a severe motion blur state. When the motion blur level is severe motion blur, it is considered to exceed the preset motion blur threshold; when the motion blur level is no blur, it is considered not to exceed the threshold, which can ensure that the classification criteria strictly correspond to the physical state.

[0036] In this embodiment, when the amplitude of illumination fluctuation exceeds the preset illumination fluctuation threshold and the degree of motion blur does not exceed the preset motion blur threshold, the risk category is determined to be a strong illumination change. When the degree of motion blur exceeds the preset motion blur threshold and the amplitude of illumination fluctuation does not exceed the preset illumination fluctuation threshold, the risk category is determined to be high-speed motion blur. When both the amplitude of illumination fluctuations and the degree of motion blur exceed their respective thresholds, the risk category is determined to be a mixed category.

[0037] Illumination fluctuations can alter the grayscale distribution of the entire image, while motion blur only changes the spatial distribution of edge energy; the detection results of the two are independent of each other. By setting two thresholds and comparing the out-of-limit states, the cause of decoding failure can be identified as a single or combined interference, thus providing a unique direction for adjusting aperture and exposure parameters and eliminating the risk of performing reverse adjustments due to misjudging the interference source.

[0038] Please see Figure 4 As shown, this is a flowchart of adjusting the current preset aperture and preset exposure parameters in this embodiment. In this embodiment, the process of adjusting the current preset aperture and preset exposure parameters based on the quality inspection impact risk type determined to be a single category includes: Based on the risk type of quality inspection impact caused by sudden changes in strong light, the preset aperture is increased and the exposure gain in the preset exposure parameters is decreased. The increase in the preset aperture is positively correlated with the current light fluctuation amplitude, and the decrease in the exposure gain is positively correlated with the current light fluctuation amplitude. Based on the quality inspection impact risk type of high-speed motion blur, the exposure time in the preset aperture and preset exposure parameters is reduced. The reduction of the preset aperture is positively correlated with the current motion blur level, and the reduction of the exposure time is positively correlated with the current motion blur level.

[0039] To address sudden changes in strong lighting, increasing the aperture increases the amount of light entering the camera to compensate for the decrease in light intensity, while decreasing the gain suppresses the risk of overexposure in high-brightness areas. The adjustment range of both increases monotonically with the increase in the amplitude of lighting fluctuations, making the compensation force proportional to the amplitude of the brightness jump. To address motion blur, decreasing the aperture increases the depth of field to reduce edge widening caused by defocusing, while shortening the exposure time reduces the relative displacement distance to suppress the length of the trail. The adjustment range of both increases monotonically with the increase in the width of the edge widening, making the suppression force proportional to the speed of motion.

[0040] Specifically, the process of adjusting the current preset aperture and preset exposure parameters based on the identified mixed-category quality inspection impact risk type, and initiating the fusion of two consecutive short-exposure images, includes: Based on the risk type of the mixed category, the preset aperture is adjusted to the preset medium aperture, and the exposure time in the preset exposure parameters is adjusted to the preset medium duration. Then, the fusion of two consecutive short exposure images is started to perform pixel-level weighted averaging fusion of the two consecutively acquired short exposure images according to preset weights to obtain a fused image. Here, the preset medium aperture is the arithmetic mean of the current preset aperture and the minimum working aperture of the system, and the preset medium duration is the arithmetic mean of the current exposure time and the shortest safe exposure time of the system.

[0041] To address the conflicting nature of the two single adjustment directions under mixed interference, the aperture and exposure time are set to intermediate values ​​between the two single adjustment targets. This achieves a balance between suppressing motion blur and compensating for abrupt changes in illumination, preventing the aggravation of one interference due to bias towards the other. Based on this compromise parameter, two consecutive short exposures are fused. Utilizing the incoherence of motion blur in different exposure frames and the inter-frame differences in illumination changes, the effective contrast of the QR code module is enhanced through the coherent superposition of multiple frame signals, while simultaneously suppressing random noise and residual interference.

[0042] Specifically, the process of determining the degree of contrast change includes: Calculate the absolute value of the relative deviation between the symbol contrast after each adjustment and the symbol contrast before the corresponding adjustment, in order to obtain the degree of contrast change.

[0043] In high-speed logistics sorting lines, the original contrast of QR codes on different packages varies due to differences in printing quality and material reflectivity, and the absolute difference cannot be uniformly used to measure the degree of improvement. By using the absolute value of the relative deviation of the contrast of the symbols before and after adjustment, the degree of contrast change is decoupled from the current contrast level. This allows for the use of a unified preset effective improvement threshold to determine whether the control is effective, avoiding misjudgments caused by the original contrast being too high or too low.

[0044] Specifically, the process of determining whether to eliminate the risk of quality inspection impact based on the degree of contrast change, in order to perform decoding or output a non-conforming quality result, includes: Based on the judgment result that the degree of contrast change is greater than the preset effective improvement threshold and the adjusted symbol contrast reaches the current preset decoding threshold, it is determined that the risk of quality inspection impact is eliminated and decoding is performed. Based on comparison results where the degree of change is less than or equal to a preset effective improvement threshold, it is determined that the risk of quality inspection impact cannot be eliminated and a quality non-conformity result is output. The preset effective improvement threshold is determined based on extensive experimental statistics and is typically set between 0.1 and 0.2. When the threshold is below 0.1, even slight fluctuations are considered effective, leading to the system misjudging a small increase in contrast after a single adjustment as effective but not reaching a decodeable level, causing decoding failure. When the threshold is above 0.3, the contrast improvement ratio is difficult to achieve under mild interference, causing the system to prematurely output "unacceptable," wasting repair opportunities. In typical tests on high-speed logistics sorting lines, when the absolute value of the relative deviation exceeds 0.15, the decoding success rate is close to 90%, and further adjustments offer limited benefits. Therefore, this embodiment sets it to 0.15 to achieve the optimal trade-off between decoding success rate and adjustment costs.

[0045] In high-speed logistics sorting lines, if the contrast change still fails to exceed the effective improvement threshold after multiple adjustments, it indicates that the current interference has exceeded the physical compensation capabilities of the aperture and exposure parameters. Continuing to adjust will only increase ineffective time consumption; directly outputting "unqualified" can avoid invalid detection occupying production line cycles. Conversely, once the contrast change exceeds the threshold and the adjusted symbol contrast reaches the current preset decoding threshold, it means that the adjustment has restored a decodeable contrast level. Immediately executing decoding can minimize the total delay from triggering adjustment to successful recognition.

[0046] Specifically, the process of adjusting the preset decoding threshold based on adaptivity includes: Calculate the proportion of anomalous moments belonging to strong light abrupt changes to the total number of anomalous moments to obtain the proportion of the first category; Calculate the proportion of abnormal moments belonging to high-speed motion trails to the total number of abnormal moments to obtain the proportion of the second category; Calculate the proportion of anomalous moments belonging to the mixed category to the total number of anomalous moments to obtain the proportion of the third category; Calculate the larger of the proportion of the first category and the proportion of the second category to obtain the dominant category proportion, which is used to characterize the degree of dominance of a single category of risk; Calculate the difference between the proportion of the dominant category and the proportion of the third category to obtain the category concentration difference, which is used to characterize the difference in the degree of concentration and complexity of risk distribution; The ratio of the difference in category clusters to the proportion of the dominant category is calculated to obtain the adaptability, where, An abnormal moment is the moment when a quality inspection risk type occurs within the preset judgment time before or after successful decoding. Based on the judgment result that the adaptability is greater than the preset high adaptability threshold, the preset decoding threshold is increased, and the increase is positively correlated with the difference between the adaptability and the high adaptability threshold.

[0047] Based on the determination result that the adaptability is less than the preset low adaptability threshold, the preset decoding threshold is reduced, and the reduction magnitude is positively correlated with the difference between the low adaptability threshold and the adaptability.

[0048] Based on the determination result that the adaptability is between the preset high adaptability threshold and the preset low adaptability threshold, the current preset decoding threshold is kept unchanged.

[0049] By statistically analyzing the occurrence ratios of sudden changes in strong light, high-speed motion trails, and mixed categories during successful decoding, and constructing an adaptive degree based on the proportions of dominant and mixed categories, the system can dynamically adjust the preset decoding threshold according to the long-term distribution characteristics of interference types during the actual operation of the high-speed logistics sorting line. When a single category of risk dominates for a long time, its interference mode has strong stability. By increasing the preset decoding threshold, the system can enter the corresponding control process in advance, and compensation can be completed before the contrast drops to the point where decoding is impossible, thereby reducing the number of subsequent repeated detections. When the proportion of mixed category risk is high, it indicates that the current operating condition is affected by multiple interference factors. Lowering the preset decoding threshold can reduce repeated control and parameter oscillations caused by frequent changes in interference types, thereby achieving a dynamic balance between detection stability and control efficiency, and improving the overall detection stability and operating efficiency of the high-speed logistics sorting line.

[0050] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for quality detection of QR codes with adaptive aperture, characterized in that, include: The quality detection process of the QR code is determined based on the comparison result between the symbol contrast and the preset decoding threshold. The symbol contrast is extracted from the image of the QR code acquired in real time, and the quality detection process is carried out with preset aperture and preset exposure parameters. Based on the judgment result that does not meet the decoding conditions, the risk type of quality inspection impact is determined according to the amplitude of light fluctuation and the degree of motion blur. The amplitude of light fluctuation is determined based on the ambient light intensity within the preset light intensity collection period, and the degree of motion blur is determined based on the edge energy of the QR code. Based on the quality inspection impact risk type determined to be a single category, the current preset aperture and preset exposure parameters are adjusted accordingly. The single category of quality inspection impact risk type includes sudden changes in strong light and high-speed motion blur. Based on the quality inspection impact risk type determined to be a mixed category, the current preset aperture and preset exposure parameters are adjusted accordingly, and the fusion of two consecutive short exposure images is initiated to improve the symbol contrast. The risk of quality inspection impact is determined based on the degree of contrast change, so as to perform decoding or output a non-conforming result. The degree of contrast change is determined based on the symbol contrast after each adjustment. The preset decoding threshold is adjusted based on the degree of adaptability, wherein the degree of adaptability is determined based on the type of quality inspection impact risk that occurs within a preset judgment time before and after each successful decoding within a preset observation period.

2. The QR code quality detection method for adaptive aperture according to claim 1, characterized in that, The process of extracting the symbol contrast includes: The sign contrast is determined based on the mean grayscale values ​​of the dark and light colors, where... The dark grayscale mean is the average pixel grayscale value of all dark module regions, and the light grayscale mean is the average pixel grayscale value of all light module regions. Each dark module region and each light module region is obtained by locating and finding the image in the acquired image.

3. The QR code quality detection method for adaptive aperture according to claim 1, characterized in that, The process of determining the amplitude of the illumination fluctuation includes: The illumination fluctuation amplitude is determined based on the intensity range and the reference intensity, wherein... The light intensity range is determined based on the difference between the maximum and minimum values ​​of ambient light intensity within a preset light intensity acquisition period. The reference light intensity is determined based on the average light intensity within a preset light intensity acquisition period. The maximum and minimum values ​​are obtained by extracting the ambient light intensity continuously recorded within the preset light intensity acquisition period.

4. The QR code quality detection method for adaptive aperture according to claim 1, characterized in that, The process of determining the degree of motion blur includes: The degree of motion blur is determined based on the edge widening level, wherein the edge widening level is obtained by comparing the widening width of the gradient energy along the motion direction with a preset clear edge width, and the widening width of the gradient energy along the motion direction is obtained by detecting the gradient direction histogram of the module edges in the QR code image.

5. The QR code quality detection method for adaptive aperture according to claim 1, characterized in that, Based on the judgment result that does not meet the decoding conditions, the process of determining the type of quality inspection impact risk according to the amplitude of illumination fluctuation and the degree of motion blur includes: The type of risk impact from quality inspection is determined based on the risk category, wherein... The risk category is determined based on the comparison results of the illumination fluctuation amplitude and the preset illumination fluctuation threshold, and the comparison results of the motion blur degree and the preset motion blur threshold. When the amplitude of the illumination fluctuation exceeds the preset illumination fluctuation threshold and the degree of motion blur does not exceed the preset motion blur threshold, the risk category is determined to be a strong illumination change. When the degree of motion blur exceeds the preset motion blur threshold and the amplitude of illumination fluctuation does not exceed the preset illumination fluctuation threshold, the risk category is determined to be high-speed motion blur. When both the amplitude of the illumination fluctuation and the degree of motion blur exceed their respective thresholds, the risk category is determined to be a mixed category.

6. The QR code quality detection method for adaptive aperture according to claim 1, characterized in that, The process of adjusting the current preset aperture and preset exposure parameters based on the quality inspection impact risk type determined to be a single category includes: Based on the quality inspection impact risk type of the sudden change in strong light, the preset aperture is increased and the exposure gain in the preset exposure parameters is decreased. Based on the quality inspection impact risk type of the high-speed motion blur, the exposure time in the preset aperture and the preset exposure parameters is reduced.

7. The QR code quality detection method for adaptive aperture according to claim 1, characterized in that, The process of adjusting the current preset aperture and preset exposure parameters based on the quality inspection impact risk type determined to be a mixed category, and initiating the fusion of two consecutive short exposure images, includes: Based on the risk type of the mixed category, the preset aperture is adjusted to a preset medium aperture, and the exposure time in the preset exposure parameters is adjusted to a preset medium duration, and the fusion of two consecutive short exposure images is initiated.

8. The QR code quality detection method for adaptive aperture according to claim 1, characterized in that, The process of determining the degree of contrast variation includes: The absolute value of the relative deviation between the symbol contrast after each adjustment and the symbol contrast before the corresponding adjustment is calculated to obtain the degree of contrast change.

9. The QR code quality detection method for adaptive aperture according to claim 1, characterized in that, The process of determining whether to eliminate the risk of quality inspection impact based on the degree of contrast change, in order to perform decoding or output non-conforming quality results, includes: Based on the judgment result that the degree of contrast change is greater than the preset effective improvement threshold and the adjusted symbol contrast reaches the current preset decoding threshold, it is determined that the risk of quality inspection impact is eliminated and decoding is performed. Based on the comparison results where the degree of change is less than or equal to the preset effective improvement threshold, it is determined that the quality inspection impact risk cannot be eliminated and a quality non-compliance result is output.

10. The QR code quality detection method for adaptive aperture according to claim 1, characterized in that, The process of adjusting the preset decoding threshold based on adaptivity includes: The adaptiveness is determined based on the category distribution characteristics of the abnormal moments corresponding to each successful decoding. Each abnormal moment is determined based on the type of quality inspection impact risk that occurs within the preset judgment time before and after the corresponding successful decoding. The category distribution characteristics include the proportion of moments belonging to a single category, the proportion of moments belonging to a mixed category, and the proportions of strong light abrupt change and high-speed motion trail in a single category. The preset decoding threshold is adjusted based on the comparison between the adaptiveness and the preset adaptive threshold.

Citation Information

Patent Citations

  • High-speed dynamic QR code identification method based on improved SURF composite algorithm

    CN110210584A