Positioning method and device for DPM bar code and bar code recognition equipment
By performing two-level classification and block processing on DPM barcodes, the positioning accuracy and robustness in complex scenarios are improved, solving the problem of inaccurate positioning in existing technologies and achieving efficient identification under harsh conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-12
- Publication Date
- 2026-04-03
AI Technical Summary
In existing technologies, the morphology-based DPM barcode positioning method has low positioning accuracy in complex scenarios, especially in cases of unknown scale, severe soiling, or complex backgrounds where accurate identification is difficult.
A two-level classification strategy is adopted. First, most background interference is eliminated by coarse classification of boundary point images. Then, the second feature of candidate image blocks is used for fine classification. Finally, barcode image blocks are merged to determine the DPM barcode positioning area.
It improves the accuracy and robustness of DPM barcode positioning in complex scenarios, and can reliably extract boundary features under harsh conditions such as uneven lighting and surface reflection, significantly reducing false detection rate and false negative rate.
Smart Images

Figure CN121787447A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of barcode recognition technology, such as a positioning method and apparatus for DPM barcodes, and a barcode recognition device. Background Technology
[0002] Direct Part Mark (DPM) codes, as a permanent marking technology, play a crucial role in demanding fields such as manufacturing, medical devices, aerospace, and food traceability due to their wear-resistant and corrosion-resistant properties. This technology primarily employs DM (Data Matrix) and Dot Code systems. DM codes are widely used in various industrial parts, while Dot Code has developed a specific application ecosystem in industries such as tobacco in Europe. However, precisely because of its direct marking on the component surface, DPM codes are highly susceptible to damage from oil stains, scratches, oxidation, or physical coverings throughout their lifecycle. Furthermore, complex industrial environments (such as uneven lighting, surface reflections, background texture interference, and changes in imaging perspective) further exacerbate the difficulty of reliable identification. In related technologies, DPM barcodes mainly rely on image morphology for barcode positioning, using pre-defined structural elements for operations such as dilation and erosion to enhance the barcode area and suppress noise.
[0003] In the process of implementing the embodiments of this disclosure, at least the following problems were found in the related art: Morphology-based DPM positioning methods heavily rely on barcode scale information. When faced with DPM barcodes of unknown scale, severely damaged, or complex backgrounds, the positioning accuracy of DPM barcodes is low.
[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.
[0006] This disclosure provides a method and apparatus for locating DPM barcodes, as well as a barcode recognition device, to improve the positioning accuracy of DPM barcodes in complex scenarios.
[0007] In some embodiments, a method for locating DPM barcodes includes: obtaining a boundary point image containing a DPM barcode, and dividing the boundary point image into multiple image blocks; performing coarse classification on the image blocks based on a first feature of each image block to determine candidate image blocks in the image blocks; performing fine classification on the candidate image blocks based on a second feature to determine barcode image blocks in the candidate image blocks; and merging the barcode image blocks to determine the DPM barcode location area.
[0008] In some embodiments, the positioning device for DPM barcodes includes a processor and a memory storing program instructions, the processor being configured to execute the aforementioned positioning method for DPM barcodes when the program instructions are executed.
[0009] In some embodiments, the barcode recognition device includes: a barcode recognition device body; and the aforementioned positioning device for DPM barcodes, disposed on the barcode recognition device body.
[0010] The positioning method and apparatus for DPM barcodes and the barcode recognition device provided in this disclosure can achieve the following technical effects: In this disclosed technical solution, firstly, a boundary point image containing the DPM barcode is obtained, and the boundary point image is divided into multiple image blocks. Then, based on the first feature of each image block, the image blocks are coarsely classified to determine candidate image blocks within the image blocks. Next, based on the second feature of the candidate image blocks, fine classification is performed to determine the barcode image blocks within the candidate image blocks. Finally, the barcode image blocks are merged to determine the DPM barcode positioning area. Thus, using the first feature of the block image for coarse classification effectively eliminates most background interference. Then, using the second feature of the candidate image blocks for fine classification achieves accurate identification of the barcode blocks. Finally, the identified barcode image blocks are merged to determine the complete DPM barcode positioning area, thereby achieving the positioning of the DPM barcode. Through a two-level classification strategy from coarse to fine and a block-based processing mechanism, the positioning accuracy and robustness of DPM barcodes in complex scenarios are improved.
[0011] The above general description and the description below are exemplary and illustrative only and are not intended to limit this application. Attached Figure Description
[0012] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations and drawings do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are shown as similar elements. The drawings are not to be scaled. And wherein: Figure 1 This is a schematic flowchart of a positioning method for DPM barcodes provided in an embodiment of this disclosure; Figure 2 This is a flowchart illustrating another positioning method for DPM barcodes provided in an embodiment of this disclosure; Figure 3 This is a flowchart illustrating another positioning method for DPM barcodes provided in an embodiment of this disclosure; Figure 4 This is a flowchart illustrating another positioning method for DPM barcodes provided in an embodiment of this disclosure; Figure 5 This is a schematic diagram of extracting boundary points of a DPM barcode according to an embodiment of this disclosure; Figure 6 This is a gradient histogram of the boundary points of an image block provided in an embodiment of this disclosure; Figure 7 This is a schematic diagram of the structure of a positioning device for DPM barcodes provided in an embodiment of this disclosure; Figure 8 This is a schematic diagram of the structure of a barcode recognition device provided in an embodiment of this disclosure. Detailed Implementation
[0013] To provide a more detailed understanding of the features and technical content of the embodiments of this disclosure, the implementation of the embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for illustrative purposes only and are not intended to limit the embodiments of this disclosure. In the following technical description, for ease of explanation, several details are used to provide a full understanding of the disclosed embodiments. However, one or more embodiments may still be implemented without these details. In other cases, well-known structures and devices may be simplified in their depiction to simplify the drawings.
[0014] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this disclosure described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.
[0015] Unless otherwise stated, the term "multiple" means two or more. In embodiments of this disclosure, the character " / " indicates that the preceding and following objects are in an "OR" relationship. For example, A / B means: A or B. The term "and / or" describes an association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B. The term "correspondence" can refer to an association or binding relationship; A corresponding to B means that there is an association or binding relationship between A and B.
[0016] Combination Figure 1As shown, this disclosure provides a positioning method for DPM barcodes, including the following steps: S101, obtain the boundary point image containing the DPM barcode, and divide the boundary point image into multiple image blocks.
[0017] Here, the boundary point image is a binarized image obtained after processing the original acquired image using an edge detection algorithm. These edge detection algorithms include Canny, Sobel, and Laplacian. Alternatively, boundary point extraction can be performed based on image waveform analysis to obtain the boundary point image.
[0018] Optionally, the image blocks are divided as follows: the number of barcode modules in each image block is fixed.
[0019] For example, each image block contains 5×5 barcode modules. Assuming the barcode module size is 4×4 pixels, the image block size is calculated as: 5 modules × 4 pixels / module = 20×20 pixels. For a 400×300 pixel boundary point image: number of horizontal image blocks: 400÷20 = 20 image blocks; number of vertical image blocks: 300÷20 = 15 image blocks; total division: 20×15 = 300 image blocks.
[0020] Each block contains the same number of barcode modules, ensuring that the boundary point density and gradient direction features are comparable across different blocks.
[0021] Alternatively, the image blocks can be divided as follows: with a fixed image block size, an image pyramid is performed on the boundary point image to determine the number of barcode modules in each image block.
[0022] In some possible implementations, an image pyramid is performed on the boundary point image to determine the number of barcode modules within each image block. This includes: determining a fixed image block size and constructing an image pyramid from the input boundary point image; at each image pyramid level, dividing the current-scale boundary point image into a grid using the fixed image block size to obtain multiple image blocks; estimating the number of barcode modules contained in each image block and evaluating different barcode module counts to determine the most suitable initial number of barcode modules. The initial number of barcode modules is the number of barcode modules within each image block.
[0023] In practical applications, constructing an image pyramid involves starting with the original boundary point image and generating boundary point images at multiple scales through Gaussian blur and downsampling operations. The pyramid can contain 3-5 levels, with scale factors typically powers of 2 (e.g., 1:1, 1:2, 1:4, etc.), and each pyramid level represents a boundary point image at a different observation scale.
[0024] By using pyramid multi-scale analysis, the physical size or imaging ratio of the boundary point image can be known in advance, and the most suitable feature extraction scale for the number of barcode modules can be found automatically, thereby improving classification accuracy.
[0025] Optionally, image blocks are divided as follows: with fixed boundary point image sizes, an image pyramid is performed on the image blocks to determine the number of barcode modules in each image block.
[0026] In some possible implementations, an image pyramid is performed on the image blocks to determine the number of barcode modules within each image block, including: Determine the fixed boundary point image size and construct a block pyramid for the image blocks. At each block pyramid level, divide the fixed-size boundary point image into multiple image blocks using the current level's block size. Estimate the number of barcode modules contained in each image block and evaluate different barcode module numbers to determine the optimal number of second barcode modules. The number of second barcode modules is the number of barcode modules within each image block.
[0027] By combining fixed image size with block pyramids, the accuracy of feature extraction is ensured while maintaining computational efficiency.
[0028] S102, perform coarse classification of image blocks based on the first feature of each image block to determine candidate image blocks in the image blocks.
[0029] The first feature includes boundary point density, average gradient magnitude, local contrast, or grayscale variance.
[0030] S103, perform fine classification based on the second feature of the candidate image block to determine the barcode image block in the candidate image block.
[0031] The second feature includes the boundary point gradient direction histogram, LBP (Local Binary Pattern) histogram, or Haar-like feature.
[0032] S104, merge the barcode image blocks to determine the DPM barcode positioning area.
[0033] After merging the barcode image blocks, calculate the minimum bounding rectangle of the final merged connected region. This rectangular region is the located DPM barcode position, and output the rectangle coordinates (x, y, width, height).
[0034] The method for locating DPM barcodes provided in this disclosure first obtains a boundary point image containing the DPM barcode and divides it into multiple image blocks. Then, based on a first feature of each image block, a coarse classification is performed to determine candidate image blocks. Next, based on a second feature of the candidate image blocks, a fine classification is performed to determine the barcode image blocks within the candidate image blocks. Finally, the barcode image blocks are merged to determine the DPM barcode location area. In this way, coarse classification using the first feature of the block image effectively eliminates most background interference. Then, fine classification using the second feature of the candidate image blocks achieves accurate identification of the barcode blocks. Finally, the identified barcode image blocks are merged to determine the complete DPM barcode location area, thereby achieving DPM barcode location. Through a two-level classification strategy from coarse to fine and a block-based processing mechanism, the accuracy and robustness of DPM barcode location in complex scenarios are improved.
[0035] In some embodiments, obtaining a boundary point image containing a DPM barcode includes: determining a local segmentation threshold for the boundary points of the DPM barcode on each scan line in the acquired image containing the DPM barcode; based on the local segmentation threshold, traversing the acquired image along a preset direction to determine the boundary points of the DPM barcode; and integrating all boundary points to obtain a boundary point image.
[0036] In practical applications, an adaptive thresholding method is used to dynamically calculate a segmentation threshold suitable for the current local region based on the grayscale variation characteristics of each row (horizontal scan line) or each column (vertical scan line) in the acquired image. Combined with... Figure 5 As shown, along the preset scanning direction, the location points where the grayscale value crosses the local segmentation threshold are accurately found on each scan line. The boundary points detected in all scanning directions are integrated to form a complete binary boundary point image. Through adaptive local threshold segmentation and a systematic scanning strategy, efficient and accurate extraction of DPM barcode boundaries is achieved in complex industrial environments.
[0037] Optionally, determining the local segmentation threshold for boundary points of the DPM barcode on each scan line in the acquired image containing the DPM barcode includes: determining the peaks and valleys of the one-dimensional grayscale data of each scan line in the acquired image based on the image noise level of the acquired image; and calculating the local segmentation threshold on the scan line where the peaks and valleys are located based on the grayscale values of adjacent peaks and valleys.
[0038] In some possible implementations, determining the peaks and troughs of one-dimensional grayscale data for each scan line in the acquired image based on the image noise level includes: calculating the image noise level of the acquired image; determining the current point as a peak when the grayscale value of the current point is greater than that of the left and right adjacent points, and the first difference between the grayscale value of the current point and the grayscale values of the left and right adjacent points is greater than the image noise level; and determining the current point as a trough when the grayscale value of the current point is less than that of the left and right adjacent points, and the second difference between the grayscale value of the current point and the grayscale values of the left and right adjacent points is greater than the image noise level.
[0039] In practical applications, a region with a gradual change in grayscale can be selected from the background area of the acquired image as a noise evaluation sample. The image noise level can be determined by calculating the standard deviation of the grayscale values in the noise evaluation sample region.
[0040] Based on the gray values of adjacent peaks and troughs, calculate the local segmentation threshold on the scan line where the peaks and troughs are located, including calculating the local segmentation threshold according to the following formula: th = (P + V) / 2, or th = α×P + (1-α) ×V Where th is the local segmentation threshold, P is the gray value at the peak position, V is the gray value at the trough position, and α is the weighting coefficient.
[0041] The weighting coefficient α is calculated using the following formula: α= 0.5 + β×(C - N) / (2×max(C, N)) Where C is the local contrast ratio, N is the noise level, β is the adjustment coefficient, and the value of β ranges from [0.2, 0.5], and C =|P - V|.
[0042] Each scan line independently calculates its threshold, automatically adapting to local brightness differences and surface materials with varying reflective properties. Simultaneously, it filters out minute fluctuations through a noise level N, preventing random noise from being misidentified as barcode boundary features, thus maintaining consistent detection performance under different noise conditions.
[0043] Combination Figure 2 As shown, the positioning method for DPM barcodes includes the following steps: S201, determine the local segmentation threshold for the boundary points of the DPM barcode on each scan line in the acquired image containing the DPM barcode.
[0044] S202, based on the local segmentation threshold, traverse the acquired image along a preset direction to determine the boundary points of the DPM barcode.
[0045] S203, integrate all boundary points to obtain a boundary point image.
[0046] S204 divides the boundary point image into multiple image blocks.
[0047] S205, perform coarse classification of image blocks based on the first feature of each image block to determine candidate image blocks in the image blocks.
[0048] S206, perform fine classification based on the second feature of the candidate image block to determine the barcode image block in the candidate image block.
[0049] S207, merge the barcode image blocks to determine the DPM barcode positioning area.
[0050] In this embodiment, by independently calculating the segmentation threshold for each scan line, common industrial vision problems such as uneven illumination, surface reflection, and shadow interference are effectively overcome, ensuring reliable extraction of boundary features even under harsh imaging conditions. Simultaneously, a dual screening strategy of "coarse classification + fine classification" is employed, which can quickly eliminate large-area background interference and precisely identify false targets with similar textures, significantly reducing false detection and false negative rates.
[0051] In some embodiments, the first feature includes boundary point density; coarsely classifying image blocks based on the first feature of each image block to determine candidate image blocks in the image blocks includes: determining the boundary point density of each image block and determining a boundary point density threshold; and selecting image blocks with boundary point densities greater than or equal to the boundary point density threshold as candidate image blocks.
[0052] The boundary point density is calculated using the following formula: T=N edge / S block Where T is the boundary point density, N edge S represents the number of boundary points in an image patch. block This represents the area of the image block.
[0053] Due to its modular structure, the DPM barcode area has a high boundary point density. The boundary point density of the barcode area differs significantly from that of the ordinary background. Using the boundary point density for coarse classification results in higher accuracy.
[0054] In some embodiments, the first feature includes the average gradient magnitude; coarsely classifying the image blocks based on the first feature of each image block to determine candidate image blocks in the image blocks includes: determining the block average gradient magnitude of each image block and determining a block average gradient magnitude threshold; and selecting image blocks whose block average gradient magnitude is greater than or equal to the block average gradient magnitude threshold as candidate image blocks.
[0055] The average gradient magnitude of the block is calculated using the following formula: V=V total / N block Where V is the average gradient magnitude of the block, V total N is the sum of the gradient magnitudes of all pixels within a block of an image. block This represents the total number of pixels in the image block.
[0056] In some embodiments, the first feature includes boundary point density and average gradient magnitude distribution; based on the first feature of each image block, the image blocks are coarsely classified to determine candidate image blocks, including: calculating the boundary point density value and average gradient magnitude of each image block respectively, and normalizing the boundary point density and the average gradient magnitude; obtaining the normalized boundary point density and normalized average gradient magnitude, and calculating a comprehensive score of the normalized boundary point density and normalized average gradient magnitude; and selecting image blocks with a comprehensive score greater than or equal to a comprehensive score threshold as candidate image blocks.
[0057] The overall score can be calculated using the following formula: G = w1×T0 + w2×V0, or G = w1×T0 k + w2×V0 k Where G is the overall score, T0 is the normalized boundary point density, V0 is the normalized average gradient magnitude, w1 and w2 are the weighting coefficients, and k is the enhancement factor greater than 1.
[0058] The weighted scoring strategy, by comprehensively considering the number and quality of edges, significantly improves the accuracy and robustness of coarse classification while maintaining computational efficiency, providing a higher quality set of candidate blocks for subsequent processing stages.
[0059] In some embodiments, the second feature includes a boundary point gradient histogram; fine classification based on the second feature of the candidate image block to determine the barcode image block in the candidate image block includes: obtaining the boundary point gradient histogram of the candidate image block and determining the feature vector corresponding to the boundary point gradient histogram; inputting the feature vector corresponding to the boundary point gradient histogram into the block classification model to obtain the classification result of the candidate image block; and determining the barcode image block according to the classification result of the candidate image block.
[0060] The block classification model can be an SVM-based block classification model. A linear kernel function is used to implement SVM classification training and prediction for the block classification model.
[0061] Optionally, the boundary point gradient direction histogram can be established as follows: the range of gradient direction values of all boundary points is evenly divided into multiple gradient intervals; the target gradient interval is located in the multiple gradient intervals corresponding to the target gradient direction of each boundary point; the number of boundary points in the target gradient interval is counted, and the boundary point gradient direction histogram is generated.
[0062] In practical applications, the gradient direction ranges from [0, 360°] to [0, 180°]. The number of gradient intervals can be 12, 16, 18, or 24. Figure 6 As shown, the intervals are: 0: [0°, 22.5°); 22.5: [22.5°, 45°); 45: [45°, 67.5°); ...; 157.5: [157.5°, 180°).
[0063] In some possible implementations, the gradient direction histogram of boundary points is normalized. Here, the normalized gradient direction histogram of boundary points[i] = original count[i] / total number of boundary points.
[0064] After determining the feature vectors corresponding to the gradient histograms of boundary points, these feature vectors are input into a pre-trained block classification model to obtain the classification results for candidate image blocks. The classification results for candidate image blocks include either classification probability or classification label. If the classification result is a classification probability, a confidence threshold is set, and candidate image blocks with classification probabilities greater than the confidence threshold are designated as barcode image blocks.
[0065] The fine classification scheme based on gradient orientation histograms captures the essential structural features of DPM barcodes, enabling accurate identification of barcode regions in complex backgrounds.
[0066] In some embodiments, the second feature includes an LBP histogram: fine classification based on the second feature of the candidate image blocks to determine barcode image blocks within the candidate image blocks includes: obtaining the LBP histogram of the candidate image blocks and determining the feature vector corresponding to the LBP histogram; inputting the feature vector corresponding to the LBP histogram into a block classification model to obtain the classification result of the candidate image blocks; and determining the barcode image blocks based on the classification result of the candidate image blocks.
[0067] The LBP histogram is constructed as follows: The neighborhood of each pixel in the candidate image block is binarized and binary encoded using the local binary mode operator to generate the basic LBP value; the binary mode with fewer than 2 transitions is classified into 58 uniform modes using uniform mode processing, and the remaining non-uniform modes are merged into 1 category; the distribution of all pixels in these 59 intervals is statistically analyzed to form the original LBP histogram.
[0068] In some possible implementations, the LBP histogram is normalized.
[0069] LBP histograms, with their powerful texture description capabilities and excellent computational properties, provide a reliable feature foundation for the fine classification of DPM barcodes.
[0070] Combination Figure 3 As shown, the positioning method for DPM barcodes includes the following steps: S301, obtain the boundary point image containing the DPM barcode, and divide the boundary point image into multiple image blocks.
[0071] S302, determine the boundary point density of each image block, and determine the boundary point density threshold.
[0072] S303, select image blocks whose boundary point density is greater than or equal to the boundary point density threshold as candidate image blocks.
[0073] S304, obtain the gradient histogram of the boundary points of the candidate image block, and determine the feature vector corresponding to the gradient histogram of the boundary points.
[0074] S305: Input the feature vectors corresponding to the gradient histograms of the boundary points into the block classification model to obtain the classification results of the candidate image blocks.
[0075] S306, Based on the classification results of the candidate image blocks, determine the barcode image blocks.
[0076] S307, merge the barcode image blocks to determine the DPM barcode positioning area.
[0077] In this embodiment, a multi-level processing architecture from coarse to fine is used to achieve efficient and accurate positioning: First, boundary point density features are used for rapid coarse screening, effectively eliminating most background interference and significantly improving processing efficiency; then, gradient direction histograms are combined with machine learning classification to achieve fine identification, making full use of the inherent feature of uniform gradient distribution in the barcode area to ensure strong robustness under complex conditions such as uneven lighting and surface reflection; finally, morphological merging operations are used to reconstruct discrete blocks into complete barcode areas, effectively addressing partial occlusion and scale changes, and effectively improving the positioning accuracy of DPM barcodes in complex scenes.
[0078] In some embodiments, merging barcode image blocks includes: creating a base mask template; marking classification region results on the base mask template according to the barcode image blocks; and performing morphological closing operations on the marked base mask template after marking the classification region results to obtain a merged barcode image.
[0079] In practical applications, creating a base mask template includes: creating a blank binary image with the exact same size as the original DPM-acquired image, and setting all pixel values to 0 (pure black background). Based on the barcode image blocks, the classification region results are marked on the base mask template, including: mapping the region of each barcode image block to the corresponding position in the base mask template; setting the corresponding position of the barcode block to 255 (pure white). Morphological closing operations are performed, including: selecting a structuring element of a preset size based on the block size and expected gap; expanding the white area using the selected structuring element to connect discrete white blocks into a sheet; and shrinking the expanded image using the selected structuring element to maintain the connectivity of the barcode image blocks while eliminating excessive expansion.
[0080] Through simple and efficient morphological operations, missing blocks caused by local misclassification can be filled in, effectively solving the problem of barcode block discretization and ensuring that the barcode area is completely reconstructed, laying a solid foundation for subsequent accurate positioning and decoding.
[0081] Combination Figure 4 As shown, the positioning method for DPM barcodes includes the following steps: S401, determine the local segmentation threshold for the boundary points of the DPM barcode on each scan line in the acquired image containing the DPM barcode.
[0082] S402, based on the local segmentation threshold, traverse the acquired image along a preset direction to determine the boundary points of the DPM barcode.
[0083] S403 integrates all boundary points to obtain a boundary point image.
[0084] S404 divides the boundary point image into multiple image blocks.
[0085] S405, determine the boundary point density of each image block, and determine the boundary point density threshold.
[0086] S406, Image blocks with boundary point density greater than or equal to the boundary point density threshold are selected as candidate image blocks.
[0087] S407, obtain the gradient histogram of the boundary points of the candidate image block, and determine the feature vector corresponding to the gradient histogram of the boundary points.
[0088] S408 inputs the feature vectors corresponding to the gradient histograms of boundary points into the block classification model to obtain the classification results of candidate image blocks.
[0089] S409, Based on the classification results of the candidate image blocks, determine the barcode image block.
[0090] S410, merge the barcode image blocks to determine the DPM barcode positioning area.
[0091] In this embodiment, a local adaptive thresholding method is first used to extract boundary points, ensuring reliable acquisition of the barcode outline even under uneven lighting conditions. Then, candidate blocks are quickly filtered using boundary point density features, significantly improving processing efficiency. Next, a gradient orientation histogram combined with a machine learning model is used to achieve fine classification, effectively distinguishing real barcodes from background interference. Finally, morphological merging is used to obtain the complete positioning region. This scheme possesses strong environmental adaptability, excellent anti-interference capability, and high computational performance, completely overcoming the shortcomings of traditional methods, such as strong dependence on scale information and weak positioning ability in complex backgrounds.
[0092] Combination Figure 7 As shown, this disclosure provides a positioning device (e.g., a computer, controller, etc.) 700 for DPM barcodes, including a processor 70 and a memory 71, and may also include a communication interface 72 and a bus 73. The processor 70, communication interface 72, and memory 71 can communicate with each other via the bus 73. The communication interface 72 can be used for information transmission. The processor 70 can call logical instructions in the memory 71 to execute the positioning method for DPM barcodes described in the above embodiments.
[0093] Furthermore, the logic instructions in the aforementioned memory 71 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0094] The memory 71, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this disclosure. The processor 70 executes functional applications and data processing by running the program instructions / modules stored in the memory 71, that is, it implements the positioning method for DPM barcodes in the above method embodiments.
[0095] The memory 71 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 71 may include high-speed random access memory and may also include non-volatile memory.
[0096] The positioning device for DPM barcodes provided in this disclosure uses a first feature of the block image for coarse classification, effectively eliminating most background interference. Then, it uses a second feature of the candidate image blocks for fine classification, achieving accurate identification of barcode blocks. Finally, the identified barcode image blocks are merged to determine the complete DPM barcode positioning area, thereby achieving DPM barcode positioning. Through a two-level classification strategy from coarse to fine and a block-based processing mechanism, the positioning accuracy and robustness of DPM barcodes in complex scenarios are improved.
[0097] Combination Figure 8 As shown, this embodiment of the present disclosure provides a barcode recognition device 800, including: a barcode recognition device body 80; and the aforementioned positioning device 700 for DPM barcodes, disposed on the barcode recognition device body 80.
[0098] This disclosure provides a computer-readable storage medium storing computer-executable instructions configured to perform the above-described positioning method for DPM barcodes.
[0099] This disclosure provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions that, when executed by a computer, cause the computer to perform the above-described positioning method for DPM barcodes.
[0100] The aforementioned computer-readable storage medium may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0101] The technical solutions of this disclosure can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more 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 method described in this disclosure. The aforementioned storage medium can be a non-transitory storage medium, including: a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and other media capable of storing program code; it can also be a transient storage medium.
[0102] The foregoing description and accompanying drawings fully illustrate embodiments of the present disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and features of some embodiments may be included or substituted for parts and features of other embodiments. The scope of the embodiments of this disclosure includes the entire scope of the claims and all available equivalents of the claims. While the terms “first,” “second,” etc., may be used in this application to describe elements, these elements should not be limited by these terms. These terms are used only to distinguish one element from another. For example, a first element may be called a second element without changing the meaning of the description, and similarly, a second element may be called a first element, provided that all occurrences of “first element” are consistently renamed and all occurrences of “second element” are consistently renamed. First and second elements are both elements, but may not be the same element. Moreover, the terminology used in this application is only for describing embodiments and is not intended to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “the” are intended to also include the plural forms. Similarly, the term “and / or” as used herein means including one or more of the associated listed any and all possible combinations. Additionally, when used herein, the terms “comprise” and its variations “comprises” and / or “comprising” refer to the presence of stated features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase “comprising an…” does not exclude the presence of additional identical elements in the process, method, or apparatus that includes said element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, the relevant parts can be referred to the description of the method section.
[0103] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0104] The methods and products disclosed in the embodiments herein (including but not limited to devices and equipment) can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units may be merely 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. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms. 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 implement this embodiment according to actual needs. In addition, the functional units in the embodiments of this disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0105] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
Claims
1. A positioning method for DPM barcodes, characterized in that, include: Obtain the boundary point image containing the DPM barcode, and divide the boundary point image into multiple image blocks; Based on the first feature of each image block, the image blocks are coarsely classified to determine the candidate image blocks in the image blocks; Based on the second feature of the candidate image block, a fine classification is performed to determine the barcode image block in the candidate image block; The barcode image blocks are merged to determine the DPM barcode positioning area.
2. The positioning method according to claim 1, characterized in that, Obtain an image of the boundary points containing the DPM barcode, including: Determine the local segmentation threshold for the boundary points of the DPM barcode on each scan line in the acquired image containing the DPM barcode; Based on the local segmentation threshold, the acquired image is traversed along a preset direction to determine the boundary points of the DPM barcode. Integrate all boundary points to obtain a boundary point image.
3. The positioning method according to claim 2, characterized in that, Determine the local segmentation threshold for boundary points of the DPM barcode on each scan line in the acquired image containing the DPM barcode, including: Based on the image noise level of the acquired image, determine the peaks and troughs of the one-dimensional grayscale data of each scan line in the acquired image. Calculate the local segmentation threshold on the scan line where the peak and trough are located based on the gray values of adjacent peaks and troughs.
4. The positioning method according to claim 1, characterized in that, The image is divided into blocks as follows: The number of barcode modules within each image block is fixed; or, With a fixed image block size, perform an image pyramid on the boundary point image to determine the number of barcode modules within each image block; or... With fixed boundary point image sizes, perform an image pyramid on the image blocks to determine the number of barcode modules within each image block.
5. The positioning method according to claim 1, characterized in that, The first feature includes the boundary point density; Based on the first feature of each image block, a coarse classification of the image blocks is performed to determine candidate image blocks within the image blocks, including: Determine the boundary point density for each image block and determine the boundary point density threshold; Image blocks with boundary point density greater than or equal to the boundary point density threshold are selected as candidate image blocks.
6. The positioning method according to claim 1, characterized in that, The second feature includes the gradient histogram of boundary points; Based on the second feature of the candidate image blocks, further classification is performed to determine the barcode image blocks within the candidate image blocks, including: Obtain the gradient histogram of the boundary points of the candidate image block, and determine the feature vector corresponding to the gradient histogram of the boundary points; The feature vectors corresponding to the gradient histograms of boundary points are input into the block classification model to obtain the classification results of candidate image blocks; Based on the classification results of candidate image blocks, the barcode image blocks are determined.
7. The positioning method according to claim 6, characterized in that, Construct the gradient direction histogram for boundary points as follows: The gradient direction value range of all boundary points is evenly divided into multiple gradient intervals; Locate the target gradient interval among multiple gradient intervals corresponding to the target gradient direction of each boundary point; Count the number of boundary points in the target gradient interval and generate a histogram of gradient directions at the boundary points.
8. The positioning method according to any one of claims 1 to 7, characterized in that, Merging barcode image blocks includes: Create a basic mask template; Based on the barcode image blocks, mark the classification region results on the base mask template; After marking the classification region results, morphological closing operations are performed on the marked base mask template to obtain the merged barcode image.
9. A positioning device for DPM barcodes, comprising a processor and a memory storing program instructions, characterized in that, The processor is configured to perform the positioning method for DPM barcodes as described in any one of claims 1 to 8 when executing the program instructions.
10. A barcode recognition device, characterized in that, include: Barcode recognition device body; The positioning device for DPM barcodes as described in claim 9 is disposed on the body of the barcode recognition device.