One-dimensional bar code quality multidimensional characterization parameter system and defect visualization method
By using a multi-dimensional characterization parameter system for one-dimensional barcode quality, combined with reflectivity curves and digital images, a defect visualization map is generated, which solves the problem of decoding differences for the same barcode by different scanning devices and improves the adaptability and decoding efficiency of scanning devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ARTICLE NUMBERING CENT OF CHINA
- Filing Date
- 2026-05-09
- Publication Date
- 2026-06-30
AI Technical Summary
Due to differences in scanning principles, existing barcode scanning devices may exhibit varying quality levels for the same barcode, resulting in differences in decoding capabilities between laser scanning and image scanning. Furthermore, there is a lack of comprehensive analysis and visualization methods for defect analysis.
A multi-dimensional characterization parameter system for one-dimensional barcode quality is adopted. By combining reflectance curves and digital images, units are divided and weight values are determined to generate a defect visualization map. The decodeability of laser and image scanning is comprehensively considered, and the defect diagnosis results are weighted using the weight values.
It enables comprehensive examination and visualization of barcode defects, and the output results are easy for users to process. It comprehensively reflects the usability of barcodes under different scanning methods, and improves the adaptability of scanning devices and decoding efficiency.
Smart Images

Figure CN122311264A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology applicable to management, supervision or prediction purposes, and in particular to a multi-dimensional characterization parameter system for one-dimensional barcode quality and a defect visualization method. Background Technology
[0002] QR code scanning, a technology that uses optical devices to identify barcode information, has become deeply integrated into all aspects of life, becoming an indispensable part of people's daily routines. Its applications cover almost all sectors, including clothing, food, housing, transportation, government affairs, healthcare, and education. It breaks down the barriers between online and offline, making information transmission and transaction processes more efficient and convenient. At the same time, it also places higher demands on the quality of barcodes.
[0003] In practical applications, barcode quality depends on the scanning device (such as a barcode scanner or mobile phone). Different devices operate on different principles, meaning even the same barcode can exhibit varying quality. For instance, laser scanning uses a laser beam to scan the barcode, converting the light signal into an electrical signal by recognizing the different reflection intensities of the laser light from the black and white stripes, and then decoding it into digital information. This makes laser scanning insensitive to color, but sensitive to reflectivity. Image scanning, on the other hand, relies on color contrast, which can lead to situations where laser scanning is decodable while image scanning is not, or vice versa. Furthermore, barcodes can be used in diverse scenarios, and barcodes designed specifically for a particular scenario may be too limiting in their application.
[0004] Therefore, how to combine different scanning conditions to provide a defect analysis method for barcodes that can achieve comprehensive analysis and output visualized results has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides a multi-dimensional characterization parameter system for one-dimensional barcode quality and a defect visualization method to at least partially solve the above-mentioned technical problems.
[0006] The embodiments of this application adopt the following technical solutions: In a first aspect, embodiments of this application provide a multi-dimensional characterization parameter system for one-dimensional barcode quality and a defect visualization method, the method comprising: Based on the data collected by scanning the target code, a reflectance curve and a digital image are constructed; the target code is a one-dimensional barcode. Along the reading direction of the target code, the target code is divided based on the reflectivity curve to obtain several first units, such that each first unit contains at least one target peak and target valley represented by the reflectivity curve; the target valley is the valley that is closest to the target peak along the reading direction and whose reflectivity difference from the target peak is greater than a preset global threshold. Along the reading direction, the target code is divided based on the digital image to obtain several second units, such that each second unit contains an adjacent bar and a space; If the target code is determined to be undecodeable based on the reflectivity curve and decodeable based on the digital image, a first weight value is determined for each first unit; the first weight value is positively correlated with the overlap of the range to which the first unit and its corresponding second unit belong on the target code, and negatively correlated with the number of second units corresponding to the first unit; A defect visualization map is generated; the defect visualization map is obtained by weighting the defect diagnosis results obtained based on the traditional parameters of the target code with the reciprocal of the first weight.
[0007] In an optional embodiment of this specification, the method further includes: If the target code is determined to be decodable based on the reflectivity curve and undecodable based on the digital image, a material investigation alarm is issued.
[0008] In an optional embodiment of this specification, the method further includes: The first weight value is also positively correlated with the distance between the first unit and the nearest identifier on the target code; the identifier includes at least one of: a start character, a stop character, a middle separator, and a check character; and / or, The conventional parameters include at least one of the following: symbol contrast (SC), minimum edge contrast (ECmin), modulation density (MOD), defect degree (DEFECT), and decoding degree (DECODABILITY).
[0009] In an optional embodiment of this specification, the method further includes: According to the area ratio on the digital image, each pixel on the digital image is divided into a first group with higher gray values and a second group with lower gray values. Determine the median average gray value; the median average gray value is the average of the median gray value of the first group and the median gray value of the second group. The first weight value when the difference between the intermediate average gray value and the global average gray value of the digital image is greater than a preset difference threshold is greater than the first weight value when the difference between the intermediate average gray value and the global average gray value of the digital image is not greater than the difference threshold.
[0010] In an optional embodiment of this specification, the method further includes: The global threshold T new The calculation method is as follows: n is the total number of peak-to-trough pairs on the reflectivity curve; Peak i It is the reflectivity represented by the crest in the i-th crest-trough pair; Valley i It is the reflectance represented by the trough in the i-th peak-trough pair.
[0011] In an optional embodiment of this specification, the method further includes: For each of the first units, its fractal dimension is determined based on the reflectance band corresponding to it on the reflectance curve; the fractal dimension characterizes the defects caused by at least one of stains, ink diffusion, and edge blurring. The fractal dimensions of each of the first units are arranged sequentially according to the reading direction to obtain a one-dimensional defect distribution sequence; For each of the second units, its planar information dimension is determined based on the information it expresses on the digital image; the planar information dimension characterizes defects caused by at least one of local ink spot loss, paper texture interference, and scratches. The planar information dimension of each of the second units is mapped to the digital image to obtain a two-dimensional defect distribution matrix; The defect diagnosis result is obtained based on the one-dimensional defect distribution sequence, the two-dimensional defect distribution matrix, and the traditional parameters.
[0012] In an optional embodiment of this specification, the method further includes: The one-dimensional defect distribution sequence and the two-dimensional defect distribution matrix are aligned and fused to obtain a comprehensive anomaly index for each first unit; the comprehensive anomaly index is positively correlated with the values of the corresponding data in the one-dimensional defect distribution sequence and the two-dimensional defect matrix of its respective first unit; Using a preset color mapping function, based on the value of the comprehensive anomaly index, channel values are reallocated to each pixel of the digital image to obtain a defect location heatmap; The traditional parameters are added as annotations to the defect location heatmap to obtain the defect diagnosis results.
[0013] In an optional embodiment of this specification, the method further includes: The reciprocal of the first weight is used to weight the channel values of each pixel in the defect diagnosis result to obtain the defect visualization map.
[0014] In an optional embodiment of this specification, the method further includes: If the target code is determined to be decodable based on both the reflectance curve and the digital image, a reference image is determined; the reference image is a digital image of the target code acquired in an ideal state. For each of the second units, at least one adjacent second unit is grouped together; The portion of the digital image corresponding to the group is used as a reference image; Determine whether a portion matching the reference image can be found on the reference image; If not, the second unit is regrouped until a part matching the reference image can be found; Determine the second weight value for the second unit; the second weight value is positively correlated with the number of times the second unit is divided into groups. A defect visualization map is generated; the defect visualization map is obtained by weighting the defect diagnosis results obtained based on the traditional parameters of the target code with the second weight.
[0015] In an optional embodiment of this specification, the method further includes: When the group for the second unit contains a specifier and no part matching the reference image can be found in this query, the second weight value of the second unit is determined to be the maximum value.
[0016] Secondly, embodiments of this application also provide a one-dimensional barcode quality multi-dimensional characterization parameter system and defect visualization device, the device being used to implement the method steps in the first aspect.
[0017] Thirdly, embodiments of this application also provide an electronic device, including: Processor; and A memory configured to store computer-executable instructions, which, when executed, cause the processor to perform the steps of the method described in the first aspect.
[0018] Fourthly, embodiments of this application also provide a computer-readable storage medium storing one or more programs that, when executed by an electronic device including multiple applications, cause the electronic device to perform the steps of the method described in the first aspect.
[0019] The above-described technical solutions adopted in the embodiments of this application can achieve the following beneficial effects: The method provided in this manual can selectively and purposefully choose the scanning method that best reflects barcode defects, based on the evaluation of whether the barcode is decodable, and considering both laser scanning and image scanning methods. It then focuses on visualizing the defects exhibited by the barcode using that specific scanning method. Therefore, the method in this manual examines a more comprehensive range of scanning scenarios, and the output results are easier for users to process. Furthermore, when the method determines that defects are more prominent in laser scanning scenarios, it uses the second unit employed in image scanning to comprehensively quantify the barcode's readability and compatibility with laser scanning devices. This reflects whether the barcode is usable under the combined effects of different scanning methods, i.e., the degree of comprehensive impact caused by barcode defects. Attached Figure Description
[0020] Figure 1 A schematic diagram illustrating a multi-dimensional characterization parameter system and defect visualization method for one-dimensional barcode quality provided in the embodiments of this specification; Figure 2 A schematic diagram illustrating the process of generating a digital image from a target code in a one-dimensional barcode quality multi-dimensional characterization parameter system and defect visualization method provided in the embodiments of this specification; Figure 3 A schematic diagram illustrating the effect of symmetrical flipping based on reflectivity curves in a one-dimensional barcode quality multi-dimensional characterization parameter system and defect visualization method provided in the embodiments of this specification; Figure 4 A schematic diagram illustrating the display effect of a one-dimensional barcode quality multi-dimensional characterization parameter system and defect visualization method provided in the embodiments of this specification; Figure 5 This is a schematic diagram of the structure of an electronic device in an embodiment of this specification. Detailed Implementation
[0021] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. Similar elements in different embodiments are referred to by related similar element reference numerals. In the following embodiments, many details are described to facilitate a better understanding of the present application. However, those skilled in the art will readily recognize that some features may be omitted in different situations, or may be replaced by other elements, materials, or methods. In some cases, certain operations related to the present application are not shown or described in the specification. This is to avoid obscuring the core parts of the present application with excessive description. For those skilled in the art, detailed description of these related operations is not necessary; they can fully understand the related operations based on the description in the specification and general technical knowledge in the art.
[0022] Furthermore, the features, operations, or characteristics described in the specification can be combined in any suitable manner to form various embodiments. At the same time, the steps or actions in the method description can be rearranged or adjusted in a manner obvious to those skilled in the art. Therefore, the various orders in the specification and drawings are only for the clear description of a particular embodiment and do not imply a necessary order, unless otherwise stated that a particular order must be followed.
[0023] The serial numbers assigned to components in this document, such as "first" and "second," are used only to distinguish the described objects and have no sequential or technical meaning. The terms "connection" and "linkage" used in this application, unless otherwise specified, include both direct and indirect connections (linkages).
[0024] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0025] The methods described in this manual are applicable to verification processes in R&D and / or production scenarios. The purpose of implementing these methods is to verify the quality and degree of defects of barcodes. The barcode quality described here is not limited to the quality specifications of relevant national standards; rather, it refers to the relative quality exhibited when the barcode is scanned by a scanning device (such as the composite imaging detector described in this manual), and the two work together. Defects described here are also relative concepts, referring to factors affecting decoding efficiency caused by the barcode's own characteristics and the interaction between the barcode and the scanning device when the barcode is scanned.
[0026] Taking the verification stage in a production scenario as an example, a manufacturer designs a barcode for its product, which needs to be printed on the surface of the product packaging. After the product enters the sales stage, when the barcode scanning device scans the barcode printed on the product packaging, the decodability of the barcode is affected by multiple factors, including the material of the product packaging, the ink used to print the barcode, the product's storage environment, and the storage time, as well as the scanning method of the scanning device itself. The method described in this manual allows for a comprehensive and quantitative analysis of the impact of these factors.
[0027] Furthermore, the barcode quality examined by the methods described in this specification may not be entirely due to objective factors; it may also be intentionally caused by the tester in order to test the robustness of the barcode.
[0028] like Figure 1 As shown, the one-dimensional barcode quality multi-dimensional characterization parameter system and defect visualization method in this specification include the following steps: S100: Data collected by scanning the target code is used to construct reflectivity curves and digital images.
[0029] The target code in this manual is a one-dimensional barcode, which needs to be detected and analyzed using the methods described herein. The ideal barcode designed by the designer is the reference code, representing the original state of the barcode to be printed on the product. However, due to limitations such as printing conditions, there may be differences between the target code and the reference code.
[0030] The barcode scanning described in this manual can be achieved using a composite imaging scanner, which is a barcode scanning instrument that integrates laser scanning and image scanning. This can be achieved by cascading together machines capable of performing both laser scanning and image scanning, based on relevant technologies.
[0031] The reflectivity curves in this specification characterize the reflectivity of the target code at different locations under laser illumination; black (bars) and white (spaces) have different reflectivity to the laser. The horizontal axis of the reflectivity curve represents the various positions of the target code along the reading direction, and the vertical axis represents the detected reflectivity of that position to the laser.
[0032] The digital images in this manual (the process of generating digital images from object code is as follows) Figure 2 (As shown) represents the pixel matrix obtained from data acquisition at different positions of the target code. Since the digital image is a grayscale image, the grayscale values of different pixels on the digital image may differ.
[0033] It is evident that composite imaging detectors can characterize the quality of target codes to a certain extent by using different target code recognition methods and from different dimensions, considering the information transmission and compatibility between the target code and the target code, thus preparing for subsequent quantification.
[0034] S102: Along the reading direction of the target code, the target code is divided based on the reflectivity curve to obtain several first units.
[0035] The barcode reading direction refers to the scanning path direction of the scanning device when recognizing the barcode, i.e., from left to right or from right to left, and whether the barcode itself supports bidirectional reading. In this specification, even if the barcode supports bidirectional reading, unidirectional reading is used as the test benchmark. The barcode in this specification includes a start character and an end character. In one optional embodiment, the reading direction refers to starting from the start character and ending at the end character. In other optional embodiments, the reading direction can be customized according to actual needs.
[0036] Each first unit in this specification includes at least one target peak (high reflectivity to laser, which can be empty) and a target valley (low reflectivity to laser, which can be a bar) represented by the reflectivity curve. The first units are arranged sequentially along the reading direction of the target code, thus there is no overlap between the first units. The target valley is the valley closest to the target peak along the reading direction of the target code, and whose reflectivity difference from the target peak is greater than a preset global threshold. That is, target valleys and target peaks appear in pairs; ideally, a combination of a target valley and a target peak corresponds exactly to an adjacent bar and an empty space.
[0037] In an optional embodiment of this specification, the global threshold can be an empirical value set by researchers based on expert experience, which can be adjusted according to actual needs during operation. In this embodiment, the setting of the global threshold is more flexible and more suitable for the research and development environment.
[0038] In another optional embodiment of this specification, the global threshold T new The calculation method is as follows: n is the total number of peak-to-trough pairs on the reflectivity curve; Peak i It is the reflectivity represented by the crest in the i-th crest-trough pair; Valley i It is the reflectance represented by the trough in the i-th peak-trough pair.
[0039] In this embodiment, the setting of the global threshold is more standardized and more suitable for production testing environments.
[0040] S104: Along the reading direction, the target code is divided based on the digital image to obtain several second units.
[0041] The division of the second unit ensures that each second unit is arranged sequentially along the reading direction of the target code, with no overlap between them. In the displayed content of the digital image, each second unit contains an adjacent bar and a space. Ideally, the displayed content of the digital image and the target code are strictly matched. However, if the target code has quality defects, this matching degree may decrease, causing the second unit to correspond to a bar and a space in the digital image, but not necessarily in the target code.
[0042] S106: If the target code is determined to be undecorable based on the reflectivity curve and decorable based on the digital image, a first weight value is determined for each of the first units.
[0043] Transducibility refers to whether the printing quality of a barcode symbol meets standards, enabling scanning equipment to decode it accurately and stably. It characterizes whether physical characteristics such as the width, contrast, and edge sharpness of the bars and spaces are within a recognizable range. The degree of translatability required to be considered translatable is determined based on actual needs. In related technologies, any techniques capable of determining translatability are applicable to this specification, where conditions permit. It is understood that because the decoding methods based on reflectance curves and digital images differ, the conditions and / or methods for determining translatability based on reflectance curves may differ from those based on digital images.
[0044] The determination that the target code is undecipherable based on the reflectivity curve indicates that the target code exhibits low quality under laser scanning, and defects significantly interfere with the quality. Conversely, the determination that the target code is decipherable based on the digital image indicates that the target code exhibits high quality under image scanning, and defects less significantly interfere with the quality.
[0045] At this point, a more comprehensive quantitative analysis of the defects exhibited in the interaction between the target code and the laser scanning equipment should be conducted to provide direction for subsequent improvements. Therefore, the first weight is determined for the first unit, rather than examining the weight of the second unit. The first weight corresponds one-to-one with the first unit; the number of first weights equals the number of first units. The first weight is a value greater than 0 and less than 1. A value equal to 1 indicates that the target code is approaching an ideal state, with problems primarily stemming from the interaction with the laser scanning equipment, and limited room for improvement. The greater the deviation from 1, the less ideal the target code's state, with the interaction with the laser scanning equipment being a secondary concern.
[0046] The first weight value in this specification is positively correlated with the overlap between the areas of the first unit and its corresponding second unit on the target code (whether it is a laser scanning device or an image scanning device, it is related to factors such as the color of the target code and whether there is dirt attached; that is, under the two scanning methods, some influencing factors are common, so the second unit obtained by the image-based division method can also characterize some defects of the first unit. If the overlap between the corresponding first unit and the second unit on the target code is high, it indicates that the bars and spaces are clearer, less affected by negative factors, and the problem of the barcode itself may not be the main factor), and is also related to... The number of second units corresponding to the first unit is negatively correlated (indicating that the target code has a problem affecting the generation of the reflectivity curve, causing one bar in the first unit to correspond to multiple bars in the second unit, and / or one empty space in the first unit to correspond to multiple empty spaces in the second unit. Ideally, one first unit corresponds to only one second unit. The correspondence between the two can be described as follows: if the bars they each contain are the same or have a similarity greater than a preset similarity threshold, and the empty spaces they each contain are also the same or have a similarity greater than a preset similarity threshold, then the two correspond. That is to say, ideally, the two correspond to the same region in the target code, then the correspondence between the two is more stringent).
[0047] In an optional embodiment of this specification, the first weight value is also positively correlated with the distance between the first unit and the nearest identifier on the target code; the identifier includes at least one of: a start character, a stop character, an intermediate separator, and a check character. In the technical logic of this specification, the step of determining the first weight value indicates the existence of factors affecting laser scanning and decoding of the target code. Typically, the identifiers on the barcode are strictly defined by relevant standards, and their settings assist the reading device in decoding the barcode; therefore, their impact on the decoding result is crucial. If a first unit is very close to the identifier and the first unit has a defect, the defect will inevitably affect the identifier. Defects in the identifier (such as soiling) may be the key reason for the inability to decode, and therefore deserve more attention. In this case, it is necessary to improve the ability of the first weight value to characterize defects.
[0048] In a further optional embodiment of this specification, if the target code is determined to be decodable based on the reflectivity curve and the target code is determined to be undecodable based on the digital image, indicating that the defect is more likely caused by the material of the object on which the target code is printed, a material inspection alarm is issued.
[0049] S108: Generate a visual map of defects.
[0050] The defect visualization map is obtained by weighting the defect diagnosis results based on the traditional parameters of the target code with the reciprocal of the first weight.
[0051] Taking the reciprocal of the first weight amplifies the negative impact caused by the defect, making its display more vivid on the defect visualization map.
[0052] In an optional embodiment of this specification, the conventional parameters include at least one of: symbol contrast (SC), minimum edge contrast (ECmin), modulation density (MOD), defect degree (DEFECT), and decoding degree (DECODABILITY). These parameters are all specified in the corresponding national standards, and any technical means capable of calculating these parameters in related technologies are applicable to this specification, where conditions permit. The defect diagnosis result characterizes the defect quantization value on each pixel of the target code corresponding to the digital image. The defect quantization value can be based on conventional parameters and expert experience annotation; the object weighted using the first weight is the defect quantization value. In other optional embodiments, the defect diagnosis result can also be displayed graphically based on other forms of data processing methods. In this case, the first weight serves to amplify the channel values of certain pixels with obvious defects in the image display of the defect diagnosis result, thus highlighting them.
[0053] The method provided in this manual can selectively and purposefully choose the scanning method that best reflects barcode defects, based on the evaluation of whether the barcode is decodable, and considering both laser scanning and image scanning methods. It then focuses on visualizing the defects exhibited by the barcode using that specific scanning method. Therefore, the method in this manual examines a more comprehensive range of scanning scenarios, and the output results are easier for users to process. Furthermore, when the method determines that defects are more prominent in laser scanning scenarios, it uses the second unit employed in image scanning to comprehensively quantify the barcode's readability and compatibility with laser scanning devices. This reflects whether the barcode is usable under the combined effects of different scanning methods, i.e., the degree of comprehensive impact caused by barcode defects.
[0054] In an optional embodiment of this specification, further factors are considered in determining the first weight, such as the impact of barcode color on decodability. Barcode color may change due to environmental factors, or in some cases, it may be a color chosen by the designer for aesthetic purposes.
[0055] In this embodiment, pixels in the digital image are divided into a first group with higher grayscale values and a second group with lower grayscale values according to their area proportions on the digital image. The number of pixels in the first group is the same as the number of pixels in the second group. Then, an intermediate average grayscale value is determined; the intermediate average grayscale value is the average of the median grayscale values of the first group and the median grayscale values of the second group. The first weight value is greater than the first weight value when the difference between the intermediate average grayscale value and the global average grayscale value of the digital image (the average grayscale value of all pixels) is greater than the first weight value when the difference between the intermediate average grayscale value and the global average grayscale value of the digital image is not greater than the difference threshold.
[0056] Only in extreme cases, i.e., when the grayscale data is symmetrical, will the difference between the intermediate average grayscale value and the global average grayscale value of the digital image (i.e., the absolute value of the result obtained by subtracting the two) be small, but this situation is almost impossible. This is especially true when image scanning is determined to be readable. If the difference is small, it indicates that the digital image is also at risk of negatively impacting readableness, a risk often caused by color. In this embodiment, the first weight not only characterizes the quality of cooperation between the target code and the laser scanner, but also characterizes the implicit risks it brings to image scanning, achieving a multi-dimensional, composite characterization.
[0057] In an optional embodiment of this specification, the process of determining the defect diagnosis result may be: S200: For each of the first units, determine its fractal dimension (FD) based on the reflectance band corresponding to it on the reflectance curve. 1D The fractal dimension represents a defect caused by at least one of stains, ink diffusion, or blurred edges. The fractal dimensions of each of the first units are arranged sequentially according to the reading direction of the target code to obtain a one-dimensional defect distribution sequence.
[0058] The specific process for determining the fractal dimension can be as follows: For each first unit corresponding to the reflectivity band, calculate its fractal dimension. Specifically, the box-counting method can be used: First, normalize the unit band curve and place it under a grid of different scales ε. Then, calculate the minimum number of boxes N(ε) required to cover the curve at each scale. Afterwards, the fractal dimension FD is calculated. 1D It is obtained by fitting the slope of the point (log(1 / ε), log N(ε)) in double logarithmic coordinates, i.e. .
[0059] According to calculations and statistics, normal, clear bars or spaces have relatively stable reflectance curves, and FD...1D The value typically falls within the range of 1.0 to 1.4. Changes can occur when defects such as stains, ink spread, or blurred edges are present. In such cases, the curve may exhibit high-frequency jitter or asymmetrical distortion, leading to changes in FD (Firmware Depth). 1D The value increased significantly to around 1.4 or even higher.
[0060] The process of obtaining the one-dimensional defect distribution sequence can be as follows: traverse all first elements and obtain the FD of each first element. 1D The value is correlated with its position in the target code, forming a one-dimensional "one-dimensional defect distribution sequence". Simultaneously, the element symmetry index (US) of the first element can be calculated to further assist in defect classification. The formula for calculating the element symmetry index (US) is: RMSE is the root mean square error between the reflectance curve of the unit cell and its centrally symmetrically flipped curve. The closer US is to 1, the more symmetrical the unit cell shape. The effect of this symmetrical flipping is as follows: Figure 3 As shown.
[0061] S202: For each of the second units, determine its planar information dimension (FD) based on the information it represents on the digital image. 2D (surface dimension).
[0062] The planar information dimension in this specification represents a defect caused by at least one of the following: local ink spot loss, paper texture interference, or scratches.
[0063] Specifically, based on the decoding information and the unit boundaries of the second unit, the digital image of the acquired target code is precisely divided into image regions (ROIs) corresponding to each bar / space.
[0064] For the grayscale image of each ROI in the second unit, calculate its planar information dimension. Determine the complexity and non-uniformity of the grayscale distribution in two-dimensional space. Specifically, the differential box-counting method is used: First, normalize the grayscale values of the M×M pixel ROI and divide it into multiple s×s sub-blocks (s being the scale). Then, within each sub-block, let the maximum grayscale value be G. max The minimum value is G min The number of "boxes" required to cover the grayscale surface of this sub-block is: , where ceil is rounded up and floor is rounded down.
[0065] Then, summing n(r) over all sub-blocks yields the total number of boxes N(s). Finally, the fractal dimension FD in two dimensions is calculated. 2D It is obtained by fitting the slope of the point (log(1 / s), log N(s)) in double logarithmic coordinates, i.e. .
[0066] The printed units have uniform grayscale distribution, FD 2D The value is relatively low. When there are two-dimensional spatial defects such as local ink spot loss, paper texture interference, and scratches, the grayscale distribution becomes complex, and FD... 2D The value will increase. This analysis is related to one-dimensional FD. 1D The analysis forms cross-validation of spatial dimensions. For example, an ink stain may simultaneously lead to the FD of the corresponding cell. 1D (Complex waveforms) and FD 2D (Disordered texture) are all abnormal.
[0067] S204: Map the planar information dimension of each of the second units to the digital image to obtain a two-dimensional defect distribution matrix.
[0068] S206: The defect diagnosis result is obtained based on the one-dimensional defect distribution sequence, the two-dimensional defect distribution matrix, and the traditional parameters.
[0069] In an optional embodiment of this specification, the process of obtaining the defect diagnosis result may be as follows: The one-dimensional defect distribution sequence and the two-dimensional defect distribution matrix are aligned and fused to obtain a comprehensive anomaly index for each first unit. The comprehensive anomaly index is positively correlated with the values of the corresponding data in both the one-dimensional defect distribution sequence and the two-dimensional defect distribution matrix of its respective first unit. Specifically, the one-dimensional defect sequence and the two-dimensional defect distribution matrix are aligned and fused. A comprehensive anomaly index (CAI) is calculated for each second unit. The calculation formula is: , of which FD 1D _norm and FD 2D norm represents the normalized FD. 1D With FD 2D Value. In cases where the first and second units cannot be completely one-to-one corresponded, the second unit shall be taken as the standard, because due to the influence of the reflectance curve, the first unit may not be accurate, while the second unit is relatively more accurate.
[0070] Using a preset color mapping function, channel values are reassigned to each pixel of the digital image based on the value of the Comprehensive Anomaly Index (CAI), resulting in a defect location heatmap. Specifically, based on the CAI value of each second unit, a color is assigned to it through a continuous color mapping function (e.g., from blue [CAI=0] through green to red [CAI=1]). This color is then rendered onto the image area of the corresponding second unit with a certain transparency (e.g., 50%), forming a defect location heatmap. This heatmap visually displays the precise location of the defect and the severity of its continuity.
[0071] Then, the traditional parameters are added to the defect location heatmap with annotations to obtain the defect diagnosis results.
[0072] This achieves the quantitative output and visualization of quality defects.
[0073] In a further optional embodiment, the reciprocal of the first weight is used to weight the channel values of each pixel in the defect diagnosis result, making the defects represented by color more prominent, thereby obtaining the defect visualization map.
[0074] Furthermore, the determination of translatability may also result in a situation where both the reflectance curve and the digital image indicate that the target code is translatable. In this case, in an optional embodiment of this specification, a reference image can be determined. The reference image is a digital image of the target code acquired under ideal conditions.
[0075] For each second unit, it and at least one adjacent second unit are grouped together. The portion of the digital image corresponding to the group is used as a reference image. It is determined whether a matching portion can be found in the reference image (matching is determined by similarity; if the similarity is greater than a corresponding threshold, it is considered a match). If not, the second unit is regrouped; this continues until a matching portion can be found. As groups are continuously regrouped, the area of the corresponding portion in the digital image gradually increases, thus increasing the chance of achieving a similarity-based match.
[0076] Then, a second weight value is determined for the second unit. This second weight value is positively correlated with the number of times the second unit is divided into groups. The more times the groups are redefined, the greater the deviation between the global features of the target code displayed by the second unit on the digital image and the actual characteristics. Generally, image-based scanning methods are more robust. Even if the digital image indicates decodable codes, the possibility of hidden defects in the target code cannot be ruled out. These defects may cause problems for different types of equipment or be sensitive to the environment, thus affecting the scanning effect. This embodiment can uncover such defects by assessing the accuracy of the global features of the target code displayed by the second unit across the entire digital image. A larger second weight value indicates a more severe defect.
[0077] Next, a defect visualization map is generated; the defect visualization map is obtained by weighting the defect diagnosis results obtained based on the traditional parameters of the target code with the second weight. The second weight also makes the visualization of defects more prominent. Furthermore, when the group divided for the second unit contains a specifier, and no part matching the reference image can be found in the current query, the second weight value of the second unit is determined to be the maximum value.
[0078] In an optional embodiment, image sizing analysis may be performed before visualization output: for the digital image, a gradient-based subpixel edge detection algorithm is used to precisely determine the coordinates of the left and right boundaries of each bar in the image (e.g., locating to the 100.25th pixel column). Based on the barcode's code system, encoding rules, and a physical reference point determined from the digital image or reflectance curve, such as the first bar boundary of the start character, the ideal theoretical boundary position of each bar / space is calculated. The display effect is as follows. Figure 4 As shown.
[0079] Calculate the boundary position deviation (EPD): And calculate the width relative deviation (WRD): for the j-th module, .
[0080] The traditional parameters (SC, etc.), one-dimensional defect distribution sequence, two-dimensional defect distribution matrix, boundary position deviation and other information are summarized, and a preset process knowledge base is called (which stores rules such as "if the left edge is generally blurred and the WRD of the left strip is too large, then the printing pressure is determined to be light on the left and heavy on the right") to generate a textualized diagnostic summary and adjustment suggestions.
[0081] In this embodiment, the visualization output includes: a baseline image displaying the original barcode image; a generated defect location heatmap overlaid on the baseline image in a semi-transparent manner; boundary position deviations plotted as green dashed lines, with red arrows pointing from the standard boundary to the measured boundary at cells with significant dimensional deviations (WRDs), the arrow length and direction visually indicating the magnitude and sign of the deviation (whether the bar width is too wide or too narrow); and key parameters and diagnostic suggestions listed in a panel format on the side or below the image.
[0082] Furthermore, this specification also provides a one-dimensional barcode quality multi-dimensional characterization parameter system and a defect visualization device, the device being used to implement at least one of the above methods.
[0083] The device is capable of performing the methods in any of the foregoing embodiments and can achieve the same or similar technical effects, which will not be elaborated here.
[0084] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Please refer to it. Figure 5 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and memory. The memory may include main memory, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk drive. Of course, the electronic device may also include other hardware required for other business operations.
[0085] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0086] Memory is used to store programs. Specifically, programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.
[0087] The processor reads the corresponding computer program from non-volatile memory into memory and then runs it, forming a one-dimensional barcode quality multi-dimensional characterization parameter system and defect visualization device at the logical level. The processor executes the program stored in memory and specifically executes any of the aforementioned one-dimensional barcode quality multi-dimensional characterization parameter systems and defect visualization methods.
[0088] The above is as stated in this application. Figure 1The one-dimensional barcode quality multi-dimensional characterization parameter system and defect visualization method disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0089] The electronic device can also perform Figure 1 A multi-dimensional characterization parameter system for one-dimensional barcode quality and a defect visualization method are proposed and implemented. Figure 1 The functions of the embodiments shown are not described in detail here.
[0090] This application also proposes a computer-readable storage medium that stores one or more programs, the programs including instructions that, when executed by an electronic device including multiple applications, perform any of the aforementioned one-dimensional barcode quality multi-dimensional characterization parameter systems and defect visualization methods.
[0091] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0092] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0093] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0094] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0095] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0096] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0097] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0098] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0099] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0100] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A multi-dimensional characterization parameter system for one-dimensional barcode quality and a defect visualization method, characterized in that, The method includes: Based on the data collected by scanning the target code, a reflectance curve and a digital image are constructed; the target code is a one-dimensional barcode. Along the reading direction of the target code, the target code is divided based on the reflectivity curve to obtain several first units, such that each first unit contains at least one target peak and target valley represented by the reflectivity curve; the target valley is the valley that is closest to the target peak along the reading direction and whose reflectivity difference from the target peak is greater than a preset global threshold. Along the reading direction, the target code is divided based on the digital image to obtain several second units, such that each second unit contains an adjacent bar and a space; If the target code is determined to be undecodeable based on the reflectivity curve and decodeable based on the digital image, a first weight value is determined for each first unit; the first weight value is positively correlated with the overlap of the range to which the first unit and its corresponding second unit belong on the target code, and negatively correlated with the number of second units corresponding to the first unit; A defect visualization map is generated; the defect visualization map is obtained by weighting the defect diagnosis results obtained based on the traditional parameters of the target code with the reciprocal of the first weight.
2. The method as described in claim 1, characterized in that, The method further includes: If the target code is determined to be decodable based on the reflectivity curve and undecodable based on the digital image, a material investigation alarm is issued.
3. The method as described in claim 1, characterized in that, The method further includes: The first weight value is also positively correlated with the distance between the first unit and the nearest identifier on the target code; the identifier includes at least one of: a start character, a stop character, a middle separator, and a check character; and / or, The conventional parameters include at least one of the following: symbol contrast (SC), minimum edge contrast (ECmin), modulation density (MOD), defect degree (DEFECT), and decoding degree (DECODABILITY).
4. The method as described in claim 1, characterized in that, The method further includes: According to the area ratio on the digital image, each pixel on the digital image is divided into a first group with higher gray values and a second group with lower gray values. Determine the median average gray value; the median average gray value is the average of the median gray value of the first group and the median gray value of the second group. The first weight value when the difference between the intermediate average gray value and the global average gray value of the digital image is greater than a preset difference threshold is greater than the first weight value when the difference between the intermediate average gray value and the global average gray value of the digital image is not greater than the difference threshold.
5. The method as described in claim 1, characterized in that, The method further includes: The global threshold T new The calculation method is as follows: n is the total number of peak-to-trough pairs on the reflectivity curve; Peak i It is the reflectivity represented by the crest in the i-th crest-trough pair; Valley i It is the reflectance represented by the trough in the i-th peak-trough pair.
6. The method as described in claim 1, characterized in that, The method further includes: For each of the first units, its fractal dimension is determined based on the reflectance band corresponding to it on the reflectance curve; the fractal dimension characterizes the defects caused by at least one of stains, ink diffusion, and edge blurring. The fractal dimensions of each of the first units are arranged sequentially according to the reading direction to obtain a one-dimensional defect distribution sequence; For each of the second units, its planar information dimension is determined based on the information it expresses on the digital image; the planar information dimension characterizes defects caused by at least one of local ink spot loss, paper texture interference, and scratches. The planar information dimension of each of the second units is mapped to the digital image to obtain a two-dimensional defect distribution matrix; The defect diagnosis result is obtained based on the one-dimensional defect distribution sequence, the two-dimensional defect distribution matrix, and the traditional parameters.
7. The method as described in claim 6, characterized in that, The method further includes: The one-dimensional defect distribution sequence and the two-dimensional defect distribution matrix are aligned and fused to obtain a comprehensive anomaly index for each first unit; the comprehensive anomaly index is positively correlated with the values of the corresponding data in the one-dimensional defect distribution sequence and the two-dimensional defect matrix of its respective first unit; Using a preset color mapping function, based on the value of the comprehensive anomaly index, channel values are reallocated to each pixel of the digital image to obtain a defect location heatmap; The traditional parameters are added as annotations to the defect location heatmap to obtain the defect diagnosis results.
8. The method as described in claim 7, characterized in that, The method further includes: The reciprocal of the first weight is used to weight the channel values of each pixel in the defect diagnosis result to obtain the defect visualization map.
9. The method as described in claim 1, characterized in that, The method further includes: If the target code is determined to be decodable based on both the reflectance curve and the digital image, a reference image is determined; the reference image is a digital image of the target code acquired in an ideal state. For each of the second units, at least one adjacent second unit is grouped together; The portion of the digital image corresponding to the group is used as a reference image; Determine whether a portion matching the reference image can be found on the reference image; If not, the second unit is regrouped until a part matching the reference image can be found; Determine the second weight value for the second unit; the second weight value is positively correlated with the number of times the second unit is divided into groups. A defect visualization map is generated; the defect visualization map is obtained by weighting the defect diagnosis results obtained based on the traditional parameters of the target code with the second weight.
10. The method as described in claim 9, characterized in that, The method further includes: When the group for the second unit contains a specifier and no part matching the reference image can be found in this query, the second weight value of the second unit is determined to be the maximum value.