A method, device, medium and product for evaluating a two-dimensional code
By combining static feature analysis and dynamic disturbance testing, a comprehensive evaluation value for QR codes is generated, which solves the problem of inaccurate prediction of QR code decoding performance in complex dynamic environments and ensures the reliability and stability of industrial production lines.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGYIN SAIYING ELECTRON CO LTD
- Filing Date
- 2026-01-10
- Publication Date
- 2026-05-29
Smart Images

Figure CN122113950A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to a method, device, medium, and product for QR code level assessment. Background Technology
[0002] With the deep integration of the digital economy and IoT technology, QR codes have evolved from a convenient tool in daily consumption to a key data port connecting the physical world and digital information, playing a core role in specific operational scenarios such as industrial automation and high-speed logistics sorting. Among these, industrial production lines, as typical high-speed, high-throughput operating environments, have extremely high requirements for the real-time performance and reliability of QR code information reading. Therefore, ensuring the readability of QR codes in complex and dynamic environments is particularly urgent.
[0003] Existing QR code quality assessment schemes typically acquire a single static image, analyze the integrity of key structural features such as the paperclip and version number, and combine this with the decoding results to determine the quality level. However, industrial production line environments are complex (e.g., high-speed movement, changing lighting, and varying scanning angles). Relying solely on the structural integrity of static images for assessment can lead to a sharp drop in recognition performance when QR codes enter dynamic scanning environments due to motion blur, reflections, and other factors, potentially causing production interruptions or data traceability failures. Summary of the Invention
[0004] In view of this, this application provides a QR code level assessment method, device, medium, and product to solve the above problems.
[0005] Firstly, a QR code level assessment method is provided, applied to an image processing system. This method includes:
[0006] Obtain the original digital image of the QR code to be evaluated;
[0007] Static feature analysis is performed on the original digital image, and a static structure benchmark score is calculated and generated.
[0008] Based on the original digital image, a dynamic perturbation image set is obtained through a preset digital perturbation transformation matrix. The digital perturbation transformation matrix contains multiple sets of transformation parameters.
[0009] Iterate through each perturbation image sample in the dynamic perturbation image set, perform a preset decoding operation on each perturbation image sample, and calculate a decoding success metric that characterizes the degree of decoding success.
[0010] The dynamic robustness score is obtained by weighting the decoding success metric based on the static structural benchmark score.
[0011] The static structural benchmark score and the dynamic robustness score are combined using a pre-defined weighted fusion function to calculate the final evaluation value.
[0012] The above technical solution derives a static structure benchmark score and a decoding success metric in parallel from the original digital image; it then weights the decoding success metric using the static structure benchmark score to obtain a dynamic robustness score; finally, it weights and fuses the static structure benchmark score and the dynamic robustness score to calculate the final evaluation value. This evaluation value solves the technical problem in the background technology that relying solely on static image structure evaluation cannot accurately predict the actual decoding performance of QR codes in complex dynamic environments such as high-speed movement and changes in lighting. By combining static analysis and dynamic disturbance testing, the evaluation value provided by the embodiments of this application can more scientifically quantify the robustness of QR codes in dynamic scanning scenarios, providing an accurate basis for ensuring the reliability of reading on industrial production lines, thereby avoiding the risk of production interruption or data traceability failure due to inaccurate evaluation.
[0013] Optionally, static feature analysis is performed on the original digital image, and a static structure benchmark score is calculated, specifically including:
[0014] Analyze the original digital image to determine the effective grayscale range of the original digital image;
[0015] The effective grayscale range is divided by a preset step size or number to obtain a binarized threshold sequence, which contains multiple grayscale threshold points from small to large.
[0016] The original digital image is binarized using each grayscale threshold point to generate a binarized image, and the binarized image is then decoded. One binarized image corresponds to one grayscale threshold point.
[0017] Count all successfully decoded grayscale threshold points to obtain the set of successful decoding thresholds;
[0018] The static structure baseline score is calculated based on the number of grayscale threshold points in the successfully decoded threshold set, or the width between the largest and smallest grayscale threshold points in the successfully decoded threshold set.
[0019] The above technical solution tests the decoding capability of QR codes within an effective grayscale range using a series of binarization thresholds from low to high, ultimately deriving a static structural benchmark score. This score is calculated based on the number of successfully decoded threshold points or their distribution width, thereby quantifying the tolerance of the QR code image to different binarization processes.
[0020] Optionally, the original digital image is analyzed to determine the effective grayscale range of the original digital image, specifically including:
[0021] Preliminary image segmentation is performed on the original digital image to obtain the black and white module regions within the paperclip in the original digital image;
[0022] The original grayscale values corresponding to the black module regions in the original digital image are statistically analyzed to obtain the set of grayscale values of the black modules.
[0023] The original gray values corresponding to the white module regions in the original digital image are statistically analyzed to obtain the set of gray values for the white modules.
[0024] Calculate the average gray value of the set of gray values of the black module to obtain the average gray value of the black point;
[0025] Calculate the average gray value of the white module's gray value set to obtain the average white point gray value;
[0026] The range between the average black point gray value and the average white point gray value is defined as the effective gray range.
[0027] The above technical solution calculates the average grayscale value of the black and white modules by analyzing the paperclip region in the QR code image. Using these two average values, an effective grayscale range is determined, ensuring that subsequent binarization tests are conducted within a range directly related to the actual grayscale level of the current image, thus improving the relevance and efficiency of the evaluation.
[0028] Optionally, based on the original digital image, a dynamic perturbation image set is obtained through a preset digital perturbation transformation matrix, specifically including:
[0029] The motion blur kernel in the digital perturbation transformation matrix is applied to the original digital image to generate a motion blur sample set. The motion blur kernel contains different direction and intensity parameters.
[0030] The affine transformation matrix in the digital perturbation transformation matrix is applied to the original digital image to generate a geometric transformation sample set. The affine transformation matrix contains different rotation, scaling and shearing parameters.
[0031] The illumination adjustment parameters in the digital perturbation transformation matrix are applied to the original digital image to generate an illumination change sample set. The illumination adjustment parameters include brightness adjustment values and contrast adjustment values.
[0032] The motion blur sample set, geometric transformation sample set, and illumination change sample set are merged according to a preset staggered merging strategy to obtain a dynamic perturbation image set.
[0033] The above technical solution generates a dynamically perturbed image set by applying three specific digital perturbations to the original digital image: motion blur, affine transformation (including rotation, scaling, and shearing), and illumination adjustment. Its core advantage lies in the fact that by employing a pre-defined staggered merging strategy to merge the generated sample sets, the final dynamically perturbed image set exhibits a more uniform distribution of perturbation types. This uniformly distributed test sequence can more realistically simulate scenarios where QR codes encounter different types of challenges (such as motion immediately followed by illumination changes) in practical applications, making subsequent robustness evaluation results more relevant and valuable for real-world application.
[0034] Optionally, each perturbed image sample in the dynamic perturbed image set is traversed, a preset decoding operation is performed on each perturbed image sample, and a decoding success metric representing the degree of decoding success is calculated, specifically including:
[0035] Using a preset decoding resolution sequence, for each perturbed image sample, starting from the lowest resolution level in the decoding resolution sequence, the perturbed image samples are scaled and decoded sequentially.
[0036] For each perturbed image sample, if the perturbed image sample is successfully decoded in the sequentially executed decoding operation, the target minimum resolution level of the first successful decoding of the perturbed image sample is determined, and the decoding contribution score corresponding to the target minimum resolution level is retrieved from the preset decoding contribution score lookup table. The decoding contribution score lookup table contains a resolution level column and a decoding contribution score column, and when the values in the resolution level column are arranged in ascending order, the corresponding values in the decoding contribution score column are arranged in descending order.
[0037] If the perturbation image sample fails to decode at all resolution levels, then the decoding contribution of the perturbation image sample is determined to be zero.
[0038] The decoding contribution scores of all perturbed image samples are accumulated, and the accumulated result is used as a measure of successful decoding.
[0039] The above technical solution calculates a decoding success metric by sequentially attempting to decode each perturbed image at multiple resolution levels from low to high. A decoding contribution score is assigned to each sample, which is inversely proportional to the lowest resolution at which the first successful decoding occurs (i.e., the lower the resolution required for decoding, the higher the score). Finally, all scores are summed to obtain a quantitative indicator that reflects the overall decoding difficulty.
[0040] Optionally, the decoding success metric is weighted based on the static structural benchmark score to obtain a dynamic robustness score, specifically including:
[0041] Multiple weight configuration files are preset, and each weight configuration file assigns a different set of intensity weight values to different types of transformation parameters;
[0042] The static structure benchmark score is compared with multiple preset benchmark score thresholds to determine the threshold range into which the static structure benchmark score falls.
[0043] Based on the threshold range, a weight configuration file is selected from multiple weight configuration files according to the preset mapping rules to obtain the intensity weight required for the current evaluation;
[0044] Based on the successful decoding metric and the obtained strength weights, a dynamic robustness score is calculated using a preset weighting algorithm.
[0045] The above technical solution implements an adaptive weighted processing mechanism. Based on the score range of the static structure benchmark score, a set of specific strength weights is selected and obtained from multiple weight configuration files through preset mapping rules. The final dynamic robustness score is calculated using this set of selected strength weights and decoding success metric, so that the dynamic evaluation standard can be adjusted according to the quality of the static structure.
[0046] Optionally, the static structural benchmark score and the dynamic robustness score are combined using a preset weighted fusion function to calculate the final evaluation value, specifically including:
[0047] The static structural baseline score is normalized to obtain the first normalized value;
[0048] The dynamic robustness score is normalized to obtain a second normalized value;
[0049] Using a preset mapping function, based on the first normalized value and the second normalized value, the first weight coefficient corresponding to the first normalized value and the second weight coefficient corresponding to the second normalized value are determined, wherein the sum of the first weight coefficient and the second weight coefficient is one.
[0050] The first normalized value and the second normalized value are weighted and summed according to the first weight coefficient and the second weight coefficient to obtain the final evaluation value.
[0051] The above technical solution calculates the final evaluation value through a dynamic weighted fusion process. The static and dynamic scores are normalized, and then these two normalized values are used as input. A mapping function determines their respective proportions (weight coefficients) in the final weighted sum, ultimately yielding a comprehensive evaluation score where the sum of the two weight coefficients is one.
[0052] Secondly, embodiments of this application provide an electronic device, including a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, and both the user interface and the network interface are used to communicate with other devices. The processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method described in any of the above.
[0053] Thirdly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed, perform the method described in any of the above-mentioned embodiments.
[0054] Fourthly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on a server, cause the server to perform the method described in the first aspect and any possible implementation thereof.
[0055] It is understood that the electronic device provided in the second aspect, the computer-readable storage medium provided in the third aspect, and the computer program product provided in the fourth aspect are all used to execute the methods provided in the embodiments of this application. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods, and will not be repeated here.
[0056] In summary, implementing one or more technical solutions provided in this application has at least the following technical effects or advantages:
[0057] This method derives a static structural benchmark score and a decoding success metric in parallel from the original digital image. The decoding success metric is then weighted using the static structural benchmark score to obtain a dynamic robustness score. Finally, the static structural benchmark score and the dynamic robustness score are weighted and fused to calculate the final evaluation value. This evaluation value addresses the technical problem in previous techniques that relied solely on static image structure evaluation, failing to accurately predict the actual decoding performance of QR codes in complex dynamic environments such as high-speed motion and changing lighting. By combining static analysis with dynamic perturbation testing, the evaluation value provided by this method can more scientifically quantify the robustness of QR codes in dynamic scanning scenarios, providing a precise basis for ensuring the reliability of reading on industrial production lines, thereby avoiding the risk of production interruptions or data traceability failures due to inaccurate evaluation. Attached Figure Description
[0058] Figure 1 This is an exemplary system architecture diagram of applying a QR code level assessment method of this application;
[0059] Figure 2 This is a flowchart illustrating a QR code level assessment method in an embodiment of this application;
[0060] Figure 3This is a schematic diagram of the structure of an electronic device disclosed in the application embodiment.
[0061] Explanation of reference numerals in the attached figures: 100, System architecture; 101, First terminal device; 102, Second terminal device; 103, Third terminal device; 104, Network; 105, Server; 301, Processor; 302, Communication bus; 303, User interface; 304, Network interface; 305, Memory. Detailed Implementation
[0062] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0063] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.
[0064] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0065] Figure 1 An exemplary system architecture diagram is shown, illustrating an embodiment of a QR code level assessment method applicable to this application.
[0066] like Figure 1 As shown, the system architecture 100 may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0067] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as model training applications, video recognition applications, web browser applications, social platform software, etc.
[0068] Terminal devices 101, 102, and 103 can be either hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with displays, including but not limited to smartphones, tablets, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III) players, MP4 (Moving Picture Experts Group Audio Layer IV) players, laptops, and desktop computers, etc. When terminal devices 101, 102, and 103 are software, they can be installed in the aforementioned electronic devices. They can be implemented as multiple software programs or software modules (e.g., multiple software programs or software modules used to provide distributed services) or as a single software program or software module. No specific limitations are imposed here.
[0069] When terminals 101, 102, and 103 are hardware devices, video capture devices can also be installed on them. These video capture devices can be various devices capable of capturing video, such as cameras, sensors, etc. Users can use the video capture devices on terminals 101, 102, and 103 to capture video.
[0070] Server 105 can be a server that provides various services, such as a backend server for processing data displayed on terminal devices 101, 102, and 103. The backend server can analyze and process the received data and can feed back the processing results (such as recognition results) to the terminal devices.
[0071] It should be noted that a server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software programs or software modules (e.g., multiple software programs or software modules used to provide distributed services), or as a single software program or software module. No specific limitations are made here.
[0072] It should be understood that Figure 1The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included. In particular, if the target data does not need to be obtained remotely, the above system architecture may exclude the network and include only terminal devices or servers.
[0073] Figure 2 This is a flowchart illustrating a QR code level assessment method according to an embodiment of this application. This method can be implemented using a computer program or a microcontroller. The computer program can be integrated into an application or run as a standalone utility application. The specific steps of a QR code level assessment method are described in detail below.
[0074] S201: Obtain the original digital image of the QR code to be evaluated.
[0075] In this embodiment, the original digital image refers to a QR code electronic image acquired by an image acquisition device without any algorithm enhancement or preprocessing. It represents the most authentic initial state of the QR code at the moment of acquisition and is the sole data source for all subsequent static and dynamic analyses. For example, an 8-bit grayscale image with a resolution of 1920x1080 taken by an industrial camera.
[0076] Specifically, on an industrial automated production line, when an item with a QR code passes through a designated workstation, a sensor triggers a high-speed camera to capture an image containing the QR code. This image is directly transmitted to the processing system without any preprocessing operations such as sharpening, noise reduction, or contrast adjustment, to ensure the objectivity of the evaluation and the fidelity to the real environment. This unmodified image serves as the raw digital image upon which all subsequent evaluation steps are based.
[0077] S202: Perform static feature analysis on the original digital image and calculate the static structure benchmark score.
[0078] For example, the system determines the effective grayscale range of the image, which is defined by analyzing the average grayscale value of the black and white modules within the QR code's paperclip, for example, calculating the range as [75, 195]. Based on a preset step size (e.g., 10) or number (e.g., 13), this range is divided to obtain a binary threshold sequence arranged from smallest to largest, such as [75, 85, 95...195]. The system iterates through each grayscale threshold point in this sequence, using it to binarize the original digital image and attempting to decode it. All successfully decoded threshold points are included in a set of successfully decoded thresholds. Based on the number of threshold points in this set, or the width between the largest and smallest thresholds in the set, a numerical value is calculated; this value is the static structure baseline score.
[0079] In one possible implementation, static feature analysis is performed on the original digital image, and a static structural benchmark score is calculated. Specifically, this includes: analyzing the original digital image to determine its effective grayscale range; dividing the effective grayscale range by a preset step size or number to obtain a binarized threshold sequence, which contains multiple grayscale threshold points from smallest to largest; using each grayscale threshold point to binarize the original digital image to generate a binarized image, and performing a decoding operation on the binarized image, where one binarized image corresponds to one grayscale threshold point; counting all successfully decoded grayscale threshold points to obtain a set of successfully decoded threshold points; and calculating the static structural benchmark score based on the number of grayscale threshold points in the set of successfully decoded threshold points, or the width between the largest and smallest grayscale threshold points in the set of successfully decoded threshold points.
[0080] In this embodiment, the static structure benchmark score is a quantified value used to represent the inherent structural quality of the original digital image of the QR code. This score measures the tolerance of the original digital image to binarization processing by testing the decoding success of the image at a series of different binarization thresholds. A higher score indicates a more robust static quality of the original digital image, for example, a score of 92 in a percentage evaluation system.
[0081] Specifically, the process begins with the analysis of the original digital image to determine its effective grayscale range, which refers to the range of grayscale values in the image that are meaningful for decoding, for example, [80, 200] determined by calculation. Next, this range is divided by a preset step size (e.g., 5) or number of steps to obtain a binary threshold sequence containing multiple grayscale threshold points arranged in ascending order, such as [80, 85, 90, ..., 200]. Subsequently, the system iterates through this sequence, using each grayscale threshold point to binarize the original digital image, generating a corresponding binary image, and immediately performs a decoding operation on this binary image. All grayscale threshold points that allow successful decoding are counted, forming a successful decoding threshold set, for example {105, 110, ..., 185}. Based on the width between the largest and smallest grayscale threshold points in this set (185-105=80), or the total number of threshold points in the set, a final value is calculated; this value is the static structure baseline score.
[0082] Further, in a preferred embodiment, the specific method for calculating the static structure benchmark score based on the width of the successful decoding threshold set can be implemented using the following formula: S_static = W_success / W_total × 100, where S_static represents the final static structure benchmark score; W_success represents the width between the maximum and minimum grayscale threshold points in the successful decoding threshold set (e.g., 185-105=80); and W_total represents the total width of the effective grayscale intervals (e.g., 200-80=120). Therefore, the example static structure benchmark score can be calculated as: S_static = (80 / 120) × 100 ≈ 66.7 points. This normalized calculation method ensures the fairness and comparability of the final scores.
[0083] In one possible implementation, the original digital image is analyzed to determine the effective grayscale range of the original digital image. Specifically, this includes: performing preliminary image segmentation on the original digital image to obtain the black module region and the white module region within the paperclip in the original digital image; statistically analyzing the original grayscale values corresponding to the black module regions in the original digital image to obtain a set of black module grayscale values; statistically analyzing the original grayscale values corresponding to the white module regions in the original digital image to obtain a set of white module grayscale values; calculating the average grayscale value of the black module grayscale value set to obtain the average black point grayscale value; calculating the average grayscale value of the white module grayscale value set to obtain the average white point grayscale value; and determining the range between the average black point grayscale value and the average white point grayscale value as the effective grayscale range.
[0084] In this embodiment, the effective grayscale range refers to a numerical range defined by the average grayscale value of the black and white modules in the QR code image, used to represent the grayscale threshold range that is meaningful for decoding. This range provides a data-driven operational boundary closely related to the current image characteristics for subsequent binarization tests, such as a grayscale range determined to be [75, 195].
[0085] Specifically, this process determines the effective grayscale range by analyzing the original digital image. The system performs preliminary image segmentation to locate and obtain the black and white module regions within the QR code paperclip (i.e., the positioning graphic) in the image. The system traverses these identified regions, counting the original grayscale values of all pixels within them, forming separate sets of grayscale values for the black and white modules. By calculating the arithmetic mean of all values in the black module grayscale value set, the average black point grayscale value (e.g., 75) is obtained; similarly, by calculating the average of the white module grayscale value set, the average white point grayscale value (e.g., 195) is obtained. The range between this average black point grayscale value and the average white point grayscale value is determined as the effective grayscale range for subsequent processing.
[0086] S203: Based on the original digital image, a dynamic perturbation image set is obtained through a preset digital perturbation transformation matrix. The digital perturbation transformation matrix contains multiple sets of transformation parameters.
[0087] In this embodiment, the preset digital perturbation transformation matrix is not a mathematical matrix in the traditional sense, but rather a structured dataset or configuration file that predefines multiple sets of transformation parameters for simulating real-world dynamic disturbances. This matrix, as a set of instructions, precisely specifies the type of perturbation to be applied to the original digital image and the specific intensity of each perturbation. For example, it can be a JSON (JavaScript Object Notation) array or an XML (Extensible Markup Language) file, where each element represents an independent transformation operation. In this way, the evaluation method can generate a set of dynamically perturbed images for testing in a standardized and repeatable manner.
[0088] In one possible implementation, a dynamic perturbation image set is obtained based on the original digital image using a preset digital perturbation transformation matrix. Specifically, this includes: applying a motion blur kernel from the digital perturbation transformation matrix to the original digital image to generate a motion blur sample set, where the motion blur kernel contains different direction and intensity parameters; applying an affine transformation matrix from the digital perturbation transformation matrix to the original digital image to generate a geometric transformation sample set, where the affine transformation matrix contains different rotation, scaling, and shearing parameters; applying illumination adjustment parameters from the digital perturbation transformation matrix to the original digital image to generate an illumination change sample set, where the illumination adjustment parameters include brightness adjustment values and contrast adjustment values; and merging the motion blur sample set, the geometric transformation sample set, and the illumination change sample set according to a preset interleaving and merging strategy to obtain the dynamic perturbation image set.
[0089] In this embodiment, the dynamic perturbation image set refers to a collection of multiple QR code images processed by a specific digital algorithm, used to represent the state of the original QR code under various simulated complex dynamic environments. This image set is the basic test material for evaluating the dynamic robustness of the QR code; for example, a set containing 30 images, including 10 samples each simulating motion blur, geometric deformation, and illumination changes.
[0090] Specifically, this process generates a dynamic perturbation image set based on the original digital image and a preset digital perturbation transformation matrix. The system applies a preset motion blur kernel (a convolution kernel used to produce linear blur effects on an image, containing different direction and intensity parameters) from the matrix to the original digital image, generating a motion blur sample set. A preset affine transformation matrix (a mathematical tool used to perform geometric transformations such as rotation, scaling, and shearing, containing different rotation, scaling, and shearing parameters) from the matrix is applied to the original digital image, generating a geometric transformation sample set. Preset illumination adjustment parameters (including brightness and contrast adjustment values) from the matrix are applied to the original digital image, generating an illumination change sample set. The previously generated motion blur sample set, geometric transformation sample set, and illumination change sample set are merged according to a preset staggered merging strategy. For example, using a polling method, one sample is sequentially taken from each of the motion blur sample set, geometric transformation sample set, and illumination change sample set, and placed into the final dynamic perturbation image set in this order. This process is repeated until all samples have been taken. In this way, different types of perturbation samples are evenly distributed in the final test set, thus collectively obtaining the final dynamic perturbation image set.
[0091] In another feasible approach, the aforementioned motion blur sample set, geometric transformation sample set, and illumination change sample set can be merged in a preset order (e.g., first all motion blur samples, then all geometric transformation samples, and finally all illumination change samples) to obtain the final dynamic perturbation image set.
[0092] To illustrate more clearly, the preset digital perturbation transformation matrix can be a structured data format, such as a JSON array or an XML file. Each element in this data structure defines a specific perturbation transformation. An example is shown below:
[0093] [{"type": "motion_blur", "intensity": 15, "angle": 45},
[0094] {"type": "motion_blur", "intensity": 20, "angle": 90},
[0095] {"type": "affine", "rotation": 5, "scale": 1.0, "shear": 0},
[0096] {"type": "affine", "rotation": 0, "scale": 0.9, "shear": 0.05},
[0097] {"type": "lighting", "brightness": 20, "contrast": 1.0},
[0098] {"type": "lighting", "brightness": 0, "contrast": 0.85}]
[0099] This data structure is an array, where each object (i.e., each row in the example) defines an independent perturbation operation to generate a dynamic perturbation image sample. Each object contains a "type" field, indicating the basic type of perturbation and the specific parameter key-value pairs associated with that type. The example primarily includes three perturbation types: Motion Blur (motion_blur): This type simulates the blurring effect produced when a QR code moves at high speed on a production line; the "intensity" parameter controls the intensity of the blur (simulating motion speed), and the "angle" parameter controls the direction of the blur (simulating motion trajectory). Affine Transformation (affine): This type simulates geometric deformation caused by factors such as changes in scanning angle and distance; it defines the specific transformation through a set of parameters, such as "rotation" controlling the rotation angle, "scale" controlling the scaling ratio, and "shear" controlling the degree of shearing deformation. Lighting Adjustment (lighting): This type simulates uneven lighting, overexposure, or reflections in the environment; the "brightness" parameter adjusts the overall brightness of the image, and the "contrast" parameter adjusts the image contrast. For example, in the first line, "type": "motion_blur": defines the type of this perturbation as "motion blur". "intensity": 15: defines the intensity or length of the motion blur as 15 pixels. The larger the value, the more obvious the blur effect and the faster the simulated motion speed. "angle": 45: defines the direction of the motion blur as a 45-degree angle.
[0100] By using such a configuration set, this evaluation method can systematically generate a series of test images that reflect the complex dynamic environment of the real world in a repeatable and standardized manner, providing a data foundation for subsequent dynamic robustness evaluation. During execution, the evaluation method sequentially reads each object in the structure and performs corresponding transformation operations on the original digital image based on its "type" field and corresponding parameter values, thereby generating a set of dynamically perturbed images.
[0101] S204: Traverse each perturbation image sample in the dynamic perturbation image set, perform a preset decoding operation on each perturbation image sample, and calculate a decoding success metric that characterizes the degree of decoding success.
[0102] In this embodiment, the preset decoding operation does not refer to a single decoding attempt, but rather to a standardized, multi-level decoding test procedure. Its core purpose is to quantify the difficulty of decoding, not just success or failure. This procedure is defined by two key preset data sets: first, a decoding resolution sequence, which specifies the multiple resolution levels to be tried sequentially during testing (e.g., [240p, 360p, 480p]); and second, a decoding contribution score lookup table, which pre-assigns a score to each resolution level, with higher scores for lower resolutions (e.g., {240p: 100 points, 360p: 75 points}), thus rewarding robust performance in successfully decoding at lower resolutions. The decoding success metric is calculated by summing the decoding contribution scores obtained by each sample in the dynamic perturbation image set after performing the aforementioned preset decoding operation. This decoding success metric, as a single numerical value, comprehensively quantifies the overall decoding performance of the QR code under all simulated dynamic scenarios.
[0103] In one possible implementation, each perturbed image sample in the dynamic perturbed image set is traversed, a preset decoding operation is performed on each perturbed image sample, and a decoding success metric representing the degree of decoding success is calculated. Specifically, this includes: for each perturbed image sample, starting from the lowest resolution level in the preset decoding resolution sequence, the perturbed image samples are scaled and decoded sequentially; for each perturbed image sample, if the perturbed image sample is successfully decoded in the sequentially executed decoding operations, the target lowest resolution level for the first successful decoding of the perturbed image sample is determined, and the decoding contribution score corresponding to the target lowest resolution level is retrieved from a preset decoding contribution score lookup table, wherein the decoding contribution score lookup table contains a resolution level column and a decoding contribution score column, and when the values in the resolution level column are arranged in ascending order, the corresponding values in the decoding contribution score column are arranged in descending order; if the perturbed image sample fails to decode at all resolution levels, the decoding contribution score of the perturbed image sample is determined to be zero; the decoding contribution scores of all perturbed image samples are accumulated, and the accumulated result is used as the decoding success metric.
[0104] In this embodiment, the decoding success metric is an accumulated score used to represent the overall difficulty of successfully decoding the QR code after experiencing a series of dynamic perturbations. The higher the metric, the better the overall decoding performance of the QR code in a simulated complex dynamic environment. For example, by testing 30 perturbation samples, the accumulated total score is 2100.
[0105] Specifically, the process calculates a decoding success metric by iterating through each perturbed image sample in the dynamically perturbed image set. For a single sample, the system tests against a pre-defined sequence of decoding resolutions arranged from low to high (e.g., [240p, 360p, 480p, 720p]). The test starts at the lowest resolution level in the sequence (i.e., 240p), scaling the sample and performing the decoding operation. If decoding fails, the system continues to try the next higher resolution level. If a sample fails to decode at 240p but succeeds at 360p, the target lowest resolution level for its first successful decoding is determined to be 360p. Subsequently, the system retrieves the decoding contribution score corresponding to 360p, i.e., 75 points, from a pre-defined decoding contribution score lookup table (e.g., {240p: 100 points, 360p: 75 points, 480p: 50 points, 720p: 25 points}). If another sample fails to decode at all resolution levels, its decoding contribution score is determined to be zero. After performing the above operations on all samples, the decoding contribution score obtained for each sample is accumulated, and the final sum is the decoding success metric.
[0106] S205: The decoding success metric is weighted based on the static structural benchmark score to obtain the dynamic robustness score.
[0107] In this embodiment, weighted processing is an adaptive evaluation mechanism. Its core idea is that the static quality of the QR code (reflected by the static structure benchmark score) should determine the evaluation standard for its dynamic performance test. To this end, the system pre-defines multiple weight configuration profiles, each representing a different evaluation standard (e.g., lenient, standard, strict), assigning different intensity weight coefficients to different types of dynamic perturbations (e.g., motion blur, geometric transformation). The dynamic robustness score is the final dynamic performance score obtained by recalculating the original decoding success metric according to the most suitable evaluation standard (i.e., the weight configuration profile) dynamically selected based on the static score. This score therefore reflects not only the result of the dynamic test but also an assessment of its static quality.
[0108] In one possible implementation, a dynamic robustness score is obtained by weighting the decoding success metric based on the static structural benchmark score. Specifically, this includes: pre-setting multiple weight configuration profiles, each assigning a different set of strength weight values to different types of transform parameters; comparing the static structural benchmark score with multiple pre-set benchmark score thresholds to determine the threshold range into which the static structural benchmark score falls; selecting a weight configuration profile from the multiple weight configuration profiles according to the threshold range using a pre-set mapping rule to obtain the strength weights required for the current evaluation; and calculating the dynamic robustness score using a pre-set weighting algorithm based on the decoding success metric and the obtained strength weights.
[0109] In this embodiment, the dynamic robustness score is a weighted numerical value used to represent the performance of the QR code in a simulated dynamic environment. The calculation method of this score is adaptively adjusted based on the static structural quality of the QR code, so that it is not a direct reflection of the dynamic test results, but rather a comprehensive evaluation result that combines static quality as a priori conditions; for example, it may achieve a score of 88 out of 100.
[0110] Specifically, this weighted processing is based on the static structure benchmark score and the decoding success metric. The system pre-defines multiple weight configuration profiles; for example, profile A (for low static scores) assigns lower weights to motion blur, while profile C (for high static scores) assigns higher weights. The calculated static structure benchmark score (e.g., 92 points) is compared with multiple pre-defined benchmark score thresholds (e.g., 50 and 80 points) to determine the threshold range it falls into (i.e., the "above 80 points" range). Based on this threshold range, profile C is selected from the multiple weight configuration profiles using a pre-defined mapping rule (e.g., the "above 80 points" range corresponds to profile C), and the required strength weights for the current evaluation are obtained from it. Based on the previously calculated decoding success metric and the newly obtained set of strength weights, a pre-defined weighting algorithm (e.g., weighted summation of scores for different perturbation types) is used to calculate the final dynamic robustness score.
[0111] For example, the preset weight configuration profiles can be stored in a table format as follows, where each profile assigns specific intensity weight values to different types of transformation parameters:
[0112] File Name Corresponding static interval Motion blur weights Geometric transformation weights Light variation weight File A (Relaxed) 0-50 0.8 1.0 1.0 File B (Standard) 51-80 1.0 1.0 1.2 File C (Strict) 81-100 1.2 1.1 1.3
[0113] When the static structure baseline score is 92, the system selects "File C" according to the mapping rules, and obtains the intensity weights required for the current evaluation as follows: motion blur 1.2, geometric transformation 1.1, and illumination change 1.3.
[0114] Furthermore, after obtaining the strength weights, the preset weighting algorithm can calculate the dynamic robustness score using the following exemplary formula:
[0115]
[0116] Among them, S dynamic The final dynamic robustness score is represented by N; N represents the total number of perturbed samples; M represents the total number of perturbed samples. i W represents the decoding contribution score of the i-th perturbation sample; i W is the intensity weight obtained from the selected weight configuration file, corresponding to the type of the i-th perturbation sample. For example, if the i-th sample is a motion-blurred sample, then W... iThe value is 1.2 (assuming file C is selected). This algorithm achieves adaptive adjustment of the dynamic evaluation difficulty by weighting the raw contribution score of each sample.
[0117] S206: The static structural benchmark score and the dynamic robustness score are combined using a preset weighted fusion function to calculate the final evaluation value.
[0118] In this embodiment, the preset weighted fusion function is the final core calculation step in the evaluation process, which merges the scores from the static and dynamic dimensions into a final score. The key feature of this function lies in its dynamic weighting mechanism: instead of using fixed weights (e.g., 50% each) for summation, it dynamically generates a set of weight coefficients based on the relative magnitudes of the input static structural benchmark score and the dynamic robustness score, using a preset mapping rule. This mechanism enables a more intelligent fusion strategy, such as assigning higher weights to poorly performing items to ensure the evaluation results fully expose the shortcomings of the QR code. The final evaluation value is the unique numerical value representing the overall performance of the QR code, calculated through this dynamic weighting. It comprehensively reflects the quality of the QR code under ideal printing conditions and its decoding reliability in complex real-world application scenarios.
[0119] In one possible implementation, the static structural benchmark score and the dynamic robustness score are used to calculate the final evaluation value through a preset weighted fusion function. Specifically, this includes: normalizing the static structural benchmark score to obtain a first normalized value; normalizing the dynamic robustness score to obtain a second normalized value; determining a first weight coefficient corresponding to the first normalized value and a second weight coefficient corresponding to the second normalized value based on the first and second normalized values using a preset mapping function, wherein the sum of the first and second weight coefficients is one; and weighting the first and second normalized values according to the first and second weight coefficients to obtain the final evaluation value.
[0120] In this embodiment, the final evaluation value refers to a single numerical value that integrates both static quality and dynamic robustness, used to represent the final rating of the overall performance of the QR code. This is a comprehensive score after normalization and dynamic weighting, which can fully reflect the overall performance of the QR code in the real world, for example, obtaining a score of 85.6 out of 100.
[0121] Specifically, the process calculates the final evaluation value using a pre-defined weighted fusion function. The system normalizes the static structural benchmark score (e.g., 80 points) and the dynamic robustness score (e.g., 88 points) by scaling them to a uniform range (e.g., 0 to 1), resulting in a first normalized value (0.80) and a second normalized value (0.88). These two normalized values are then used as inputs, and a pre-defined mapping function dynamically determines their respective first and second weighting coefficients.
[0122] For example, the preset mapping function for determining the weight coefficients based on the first normalized value and the second normalized value can be implemented using the following inverse weighting formula: W e1 =V2 / (V1+V2)and W e2 =V1 / (V1+V2), where V1 and V2 are the first and second normalized values, respectively, and W e1 and W e2 These are the corresponding first and second weighting coefficients. Taking V1=0.80 and V2=0.88 as an example, the calculated weighting coefficient is: W e1 =0.88 / (0.80+0.88)≈0.524, W e2 =0.80 / (0.80+0.88)≈0.476 (It can be seen that V1, with a lower score, received a higher weight W) e1 The final evaluation value is: V final =V1×W e1 +V2×W e2 =0.80×0.524+0.88×0.476≈0.838. This function precisely implements the integration idea of focusing on the weakest link.
[0123] This embodiment also discloses an electronic device, as shown in the reference. Figure 3 The electronic device may include: at least one processor 301, at least one communication bus 302, user interface 303, network interface 304, and at least one memory 305.
[0124] The communication bus 302 is used to enable communication between these components.
[0125] The user interface 303 may include a display screen and a camera. Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0126] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0127] The processor 301 may include one or more processing cores. The processor 301 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 305, and by calling data stored in memory 305. Optionally, the processor 301 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 301 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 301 and may be implemented as a separate chip.
[0128] The memory 305 may include random access memory (RAM) or read-only memory. Optionally, the memory 305 may include a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 305 may also be at least one storage device located remotely from the aforementioned processor 301. Figure 3 As shown, the memory 305, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for a QR code level assessment method.
[0129] exist Figure 3In the electronic device shown, the user interface 303 is mainly used to provide an input interface for the user and to obtain the user input data; while the processor 301 can be used to call an application program stored in the memory 305 for a QR code level evaluation method. When executed by one or more processors 301, the electronic device executes one or more methods as described in the above embodiments.
[0130] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0131] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0132] In some embodiments of this application, a computer-readable storage medium is provided, including instructions that, when executed on the electronic device, cause the electronic device to perform a QR code level assessment method according to an embodiment of this application.
[0133] In some embodiments of this application, a computer program product is also provided, which, when run on an electronic device, causes the electronic device to execute a QR code level assessment method according to an embodiment of this application.
[0134] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the shown or discussed mutual couplings or direct couplings or communication connections may be through some service interfaces; indirect couplings or communication connections between apparatuses or units may be electrical or other forms.
[0135] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0136] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0137] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory 305 and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory 305 includes various media capable of storing program code, such as a USB flash drive, external hard drive, magnetic disk, or optical disk.
[0138] The foregoing description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Those skilled in the art will readily conceive of other embodiments of this disclosure upon considering the disclosure in this specification. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are considered exemplary only, and the scope of this application is defined by the claims.
Claims
1. A method for evaluating the level of a QR code, characterized in that, Applied to an image processing system, the method includes: Obtain the original digital image of the QR code to be evaluated; Static feature analysis is performed on the original digital image, and a static structure benchmark score is calculated and generated; Based on the original digital image, a dynamic perturbation image set is obtained through a preset digital perturbation transformation matrix, wherein the digital perturbation transformation matrix contains multiple sets of transformation parameters; Iterate through each perturbation image sample in the dynamic perturbation image set, perform a preset decoding operation on each perturbation image sample, and calculate a decoding success metric that characterizes the degree of decoding success. The decoding success metric is weighted based on the static structural benchmark score to obtain a dynamic robustness score; The static structural benchmark score and the dynamic robustness score are combined using a preset weighted fusion function to calculate the final evaluation value.
2. The method according to claim 1, characterized in that, The step of performing static feature analysis on the original digital image and calculating and generating a static structure benchmark score specifically includes: The original digital image is analyzed to determine the effective grayscale range of the original digital image; The effective grayscale range is divided by a preset step size or number to obtain a binarized threshold sequence, which contains multiple grayscale threshold points from small to large. The original digital image is binarized using each of the grayscale threshold points to generate a binarized image, and the binarized image is then decoded. Each binarized image corresponds to one grayscale threshold point. By counting all successfully decoded grayscale threshold points, a set of successfully decoded thresholds is obtained; The static structure baseline score is calculated based on the number of grayscale threshold points in the successful decoding threshold set, or the width between the maximum and minimum grayscale threshold points in the successful decoding threshold set.
3. The method according to claim 2, characterized in that, The step of analyzing the original digital image to determine the effective grayscale range of the original digital image specifically includes: Perform preliminary image segmentation on the original digital image to obtain the black and white module regions within the paperclip in the original digital image; The original grayscale values corresponding to the black module region in the original digital image are statistically analyzed to obtain the set of grayscale values of the black module. The original grayscale values corresponding to the white module region on the original digital image are statistically analyzed to obtain the set of grayscale values of the white module. Calculate the average gray value of the set of gray values of the black module to obtain the average gray value of the black point; Calculate the average gray value of the set of gray values of the white module to obtain the average gray value of the white point; The range between the average black point grayscale value and the average white point grayscale value is determined as the effective grayscale interval.
4. The method according to claim 1, characterized in that, The process of obtaining a dynamic perturbation image set based on the original digital image using a preset digital perturbation transformation matrix specifically includes: The motion blur kernel in the digital perturbation transformation matrix is applied to the original digital image to generate a motion blur sample set, wherein the motion blur kernel contains different direction and intensity parameters; The affine transformation matrix in the digital perturbation transformation matrix is applied to the original digital image to generate a geometric transformation sample set. The affine transformation matrix contains different rotation, scaling, and shearing parameters. The illumination adjustment parameters in the digital perturbation transformation matrix are applied to the original digital image to generate an illumination change sample set. The illumination adjustment parameters include brightness adjustment values and contrast adjustment values. The motion blur sample set, the geometric transformation sample set, and the illumination change sample set are merged according to a preset staggered merging strategy to obtain the dynamic perturbation image set.
5. The method according to claim 1, characterized in that, The process of traversing each perturbed image sample in the dynamic perturbed image set, performing a preset decoding operation on each perturbed image sample, and calculating a decoding success metric representing the degree of decoding success specifically includes: Using a preset decoding resolution sequence, for each perturbed image sample, starting from the lowest resolution level in the decoding resolution sequence, the perturbed image sample is scaled sequentially and the decoding operation is performed. For each of the perturbed image samples, if the perturbed image sample is successfully decoded in the sequentially executed decoding operations, the target minimum resolution level of the first successful decoding of the perturbed image sample is determined, and the decoding contribution score corresponding to the target minimum resolution level is retrieved from a preset decoding contribution score lookup table. The decoding contribution score lookup table includes a resolution level column and a decoding contribution score column, and when the values in the resolution level column are arranged in ascending order, the corresponding values in the decoding contribution score column are arranged in descending order. If the perturbed image sample fails to decode at all resolution levels, then the decoding contribution of the perturbed image sample is determined to be zero. The decoding contribution scores of all the perturbed image samples are accumulated, and the accumulated result is used as the decoding success metric.
6. The method according to claim 1, characterized in that, The dynamic robustness score is obtained by weighting the decoding success metric based on the static structural benchmark score, specifically including: Multiple weight configuration files are preset, and each weight configuration file assigns a different set of intensity weight values to different types of transformation parameters; The static structure benchmark score is compared with multiple preset benchmark score thresholds to determine the threshold range into which the static structure benchmark score falls. Based on the threshold range, a weight configuration file is selected from the multiple weight configuration files according to a preset mapping rule to obtain the intensity weight required for the current evaluation; The dynamic robustness score is calculated using a preset weighting algorithm based on the successful decoding metric and the obtained strength weight.
7. The method according to claim 1, characterized in that, The step of calculating the final evaluation value by combining the static structural benchmark score and the dynamic robustness score using a preset weighted fusion function specifically includes: The static structural baseline score is normalized to obtain the first normalized value; The dynamic robustness score is normalized to obtain a second normalized value; Using a preset mapping function, based on the first normalized value and the second normalized value, a first weight coefficient corresponding to the first normalized value and a second weight coefficient corresponding to the second normalized value are determined, wherein the sum of the first weight coefficient and the second weight coefficient is one. The first normalized value and the second normalized value are weighted and summed according to the first weight coefficient and the second weight coefficient to obtain the final evaluation value.
8. An electronic device, characterized in that, Including processor and memory; The memory is used to store computer program code, the computer program code including computer instructions, and the processor invokes the computer instructions to cause the electronic device to perform the method as described in any one of claims 1-7.
9. A computer-readable storage medium storing computer instructions, characterized in that, When the computer instructions are executed on the electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1-7.
10. A computer program product, characterized in that, When the computer program product is run on an electronic device, it causes the electronic device to perform the method as described in any one of claims 1-7.