A grid-based dot code positioning method and system

By dividing the dot code image into grids and performing positioning based on the grid division points and size, the problems of large computational complexity and insufficient precision in dot code positioning are solved, and fast and accurate dot code positioning is achieved.

CN115114947BActive Publication Date: 2025-09-09CN3WM XIAMEN NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210718510.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-23
Publication Date
2025-09-09
Estimated Expiration
2042-06-23

AI Technical Summary

Technical Problem

The existing technology has a large amount of calculation and low efficiency in dot code positioning, and the positioning accuracy is insufficient in the absence of a locator.

Method used

By dividing the dot code image into grids, a single grid area is made to correspond one-to-one with the code point. The grid division points and size are used for positioning, and the presence of a code point is determined based on the number of black pixels in the single grid area. The code point is then converted into a bit matrix for decoding.

Benefits of technology

It realizes accurate and fast positioning without locating symbols, with small calculation amount and strong real-time performance, thus reducing the calculation amount in the process of dot matrix code reading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115114947B_ABST
    Figure CN115114947B_ABST
Patent Text Reader

Abstract

The present invention relates to a grid-based dot code positioning method, comprising: obtaining a dot code image; determining a grid size and at least one grid division point; and dividing the dot code image into a grid based on the grid division points and the grid size, thereby obtaining a plurality of single-grid regions, wherein the single-grid regions are the regions where the code points are located. The present invention divides the dot code image into grids based on the grid division points and the grid size, ensuring a one-to-one correspondence between the single-grid regions and the code points. This method achieves precise and rapid positioning of the dot code without a locator, with minimal computational effort and strong real-time performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a grid-based dot matrix code positioning method and system, and belongs to the field of dot matrix code positioning. Background Art

[0002] Most QR codes have locators (such as QR codes and DM codes) so that the reading device can quickly locate the QR code. Figure 8 As shown. However, in some dot codes (such as dotcode), there is no locator, so it is impossible to determine the area where the dot code is located by the locator. In the absence of locators, the following two methods are usually used for reading:

[0003] The first method is the whole-to-part method, that is, firstly, edge detection is completed for code points in the whole image, such as Figure 9 As shown in the figure, all code points are found as much as possible and the found code points are read. However, since edge detection is required for the entire image, the reading efficiency is significantly reduced when the image size is large.

[0004] The second method is a method from local to global, that is, starting from the specified position of a given image, searching for the first code point that meets the requirements, and using this code point as the starting point to continue searching for the remaining code points along the search direction, such as the patent number 2022105446488.2 "A dot code positioning method and device". However, in the second method, multiple code point searches are required at different starting points and in different directions, which requires a large amount of calculation. In addition, this method requires multiple judgments on the search results based on parameters such as diameter and side length to determine whether its shape and size meet the requirements. There are certain misjudgments and the amount of calculation is large.

[0005] Therefore, a dot code positioning method with less computational effort is needed.

[0006] The patent "A Method and System for Preliminary Positioning of QR Codes" with publication number WO2017036264A1 discloses: S1 binarizes the pixels of the received image containing the QR code; S2 divides the image containing the QR code into at least one grid area containing m rows and n columns of pixels; S3 counts the number of black pixels in each grid area, and assigns a value of 1 to the grid area containing black dots, otherwise, it is assigned a value of 0; S4 marks the image containing the QR code after the grid area is assigned as a non-target area; S5 scans the non-target area row by row and column by column, and marks the union of the grid area where the value of the first consecutive value of 1 in each row is encountered and the grid area where the value of the first consecutive value of 1 in each column is encountered as the target area; S6 determines whether the target area is the area where the QR code is located; if not, go to step S5 to execute; if so, output the row number and column number of the pixel point corresponding to the boundary of the target area. This method uses a fixed-width grid to preliminarily locate the area where the QR code is located, but it cannot locate each code point in the QR code. The grid data has no effect on subsequent decoding and reading, and the positioning accuracy needs to be further improved. Summary of the Invention

[0007] In order to overcome the problems existing in the prior art, the present invention designs a grid-based dot code positioning method. According to the grid segmentation points and grid size, the dot code image is divided into grids, so that the single grid area corresponds one-to-one with the code point. In the absence of a locator, the dot code can be accurately and quickly positioned with low computational complexity and strong real-time performance.

[0008] In order to achieve the above object, the present invention adopts the following technical solutions:

[0009] A grid-based dot code positioning method comprises the following steps:

[0010] Get dot matrix code image;

[0011] determining a grid size and at least one grid division point;

[0012] According to the grid division points and grid size, the dot code image is divided into grids to obtain several single grid areas, which are the areas where the code points are located.

[0013] Furthermore, the method further includes: determining whether a code point exists in a single grid area; and converting the dot code image into a bit matrix according to whether a code point exists in each single grid area.

[0014] Furthermore, the determination of whether a code point exists within a single grid area is specifically as follows:

[0015] Traverse all pixels in a single grid area. If the number of black pixels is greater than the threshold, it is considered that a code point exists in the single grid area.

[0016] Furthermore, the method further includes: converting the bit matrix into a bit stream; and decoding the bit stream to obtain a decoding result.

[0017] Furthermore, the method further includes performing binarization processing on the dot matrix code image.

[0018] Furthermore, the grid size is the minimum spacing between code points in the dot code.

[0019] Furthermore, according to the preset geometric conditions, a blank pattern is searched in the dot matrix code image; and according to the position and size of the blank pattern, the grid size and grid segmentation points are determined.

[0020] Furthermore, the method further includes: dividing the dot matrix code image into a plurality of partitions, searching for a blank pattern in each partition; and determining the grid size and grid segmentation points according to the positions and average sizes of the plurality of blank patterns.

[0021] Furthermore, searching for a blank pattern in the dot code image according to a preset geometric condition specifically includes the following steps:

[0022] Select an initial point; determine whether all pixels in the neighborhood of the initial point are white pixels; if all pixels are white pixels, further search for black pixels at the edge of the neighborhood and determine whether the distance from the neighborhood center to the black pixels meets the requirements. If so, the neighborhood is considered a blank pattern.

[0023] Furthermore, the selecting of the initial point specifically includes the following steps:

[0024] Traverse a row of pixels, find several pixel blocks, and record the distance d between the pixel blocks; traverse with distance d as the step size. If at least one pixel block is found, take the white pixel point traversed with distance d as the step size as the starting point.

[0025] Furthermore, the selecting of the initial point specifically includes the following steps:

[0026] Traverse the pixel points in a certain row, find several pixel blocks, and calculate the minimum spacing d1 between each pixel block; traverse the pixel points in a certain column, find several pixel blocks, and calculate the minimum spacing d2 between each pixel block; calculate the coordinates of the initial point based on the center point coordinates of the pixel blocks, the minimum spacing d1 and the minimum spacing d2.

[0027] Furthermore, the step of determining the grid size and grid division points according to the position and size of the blank pattern specifically includes the following steps:

[0028] Calculate the grid size based on the side length or diameter of the blank pattern;

[0029] The center point of the blank pattern is used as the grid division point.

[0030] Technical Solution 2

[0031] A grid-based dot code positioning system, comprising:

[0032] Reading module, used to obtain dot matrix code image;

[0033] The positioning module is used to determine the grid size and at least one grid division point, and divide the grid on the dot code image according to the grid division point and the grid size to obtain a number of single grid areas; the single grid area is the area where the code point is located.

[0034] Compared with the prior art, the present invention has the following characteristics and beneficial effects:

[0035] 1. The present invention divides the dot code image into grids according to the grid segmentation points and grid size, so that the single grid area corresponds to the code point one by one, and realizes the accurate and fast positioning of the dot code without a locator, with low calculation amount and strong real-time performance.

[0036] 2. The present invention determines whether a code point exists in a single grid area based on the number of black pixels in the area, and converts the dot code image into a bit matrix based on this. There is no need to determine the shape and size of the code points, further reducing the amount of calculation in the dot code reading process.

[0037] 3. The present invention determines the grid size and grid division points by the position and size of the blank pattern. The advantage is that the grid size and position can be flexibly determined according to the actual situation of the dot matrix code, ensuring accurate positioning of each code point in the dot matrix code.

[0038] 4. The present invention extracts multiple blank image samples from the dot code image partition to jointly control the calculation size, thereby increasing the size tolerance of the grid to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is a flow chart of the present invention;

[0040] Figure 2 It is the dot matrix code image to be read;

[0041] Figure 3 yes Figure 2 Schematic diagram of the binarization result;

[0042] Figure 4 yes Figure 3 Schematic diagram of the result of dividing into 4 partitions;

[0043] Figure 5 is a schematic diagram of the initial point;

[0044] Figure 6 It is a blank pattern schematic diagram;

[0045] Figure 7 It is a blank pattern schematic diagram;

[0046] Figure 8 It is a schematic diagram of the mesh division results;

[0047] Figure 9 This is a schematic diagram of the locator of the QR code and DM code in the prior art;

[0048] Figure 10 Schematic diagram of edge detection results of dot matrix code images in the prior art. DETAILED DESCRIPTION

[0049] The present invention will be described in more detail below with reference to the embodiments.

[0050] Example 1

[0051] A grid-based dot code positioning method comprises the following steps:

[0052] Get the dot matrix code image.

[0053] Binarize the dot code image.

[0054] At least one blank pattern is searched based on preset geometric conditions (such as the side length and shape of the blank pattern). The side length or diameter of the blank pattern is the minimum spacing between code points in the dot matrix code.

[0055] Based on the position and size of the blank pattern, the grid size and at least one grid division point are determined. Based on the grid size and grid division points, the dot code image is divided into a grid, so that the code points in the dot code fall within the grid. A single grid area corresponds one-to-one with a code point, and the single grid area is the area where the code point is located. Specifically, the grid is divided through the center point of the blank pattern, with the grid length being half the blank pattern side length or the radius.

[0056] The beneficial effects of this embodiment are: dividing the grid on the dot code image according to the grid division points and grid size, making the single grid area correspond to the code point one-to-one, and realizing accurate and fast positioning of the dot code in the absence of a locator, with low calculation amount and strong real-time performance.

[0057] Example 2

[0058] A method for reading a dot matrix code comprises the following steps:

[0059] Get the dot matrix code image.

[0060] According to preset geometric conditions, at least one blank pattern is searched in the dot matrix code image.

[0061] According to the position and size of the blank pattern, the dot code image is divided into grids to obtain several single grid areas, which are the areas where the code points are located.

[0062] Determine whether there is a code point in a single grid area: traverse all pixels in the single grid area. If the number of black pixels is greater than the number threshold (in this embodiment, the number threshold is 1 / 2 of the total number of pixels in the grid area), it is considered that there is a code point in the single grid area.

[0063] The dot code image is converted into a bit matrix according to whether there is a code point in each single grid area: if there is a code point in the single grid area, the grid corresponds to data 1; otherwise, the grid corresponds to data 0.

[0064] The bit matrix is ​​converted into a bit stream; and the bit stream is decoded to obtain a decoding result.

[0065] The improvement of this embodiment lies in that: the presence of a code point is determined based on the number of black pixels in a single grid area, and the dot code image is converted into a bit matrix based on this. There is no need to determine the shape and size of the code points, further reducing the amount of calculation in the dot code reading process.

[0066] Example 3

[0067] Furthermore, the dot matrix code image is divided into four partitions, and a blank pattern is searched in each partition according to a preset geometric condition, specifically including the following steps:

[0068] Select an initial point in a certain partition: traverse the pixel points in the i-th row, regard n pixel points with consecutive pixel values ​​of 0 as a pixel block, and calculate the minimum spacing d1 between each pixel block (take the spacing between the center points of the pixel blocks); traverse the pixel points in the j-th column, regard multiple pixel points with consecutive pixel values ​​of 0 as a pixel block, and calculate the minimum spacing d2 between each pixel block; let the coordinates of the center point of a pixel block be (x, y), then take (x+d1 / 2, y+d2 / 2) as the coordinates of the initial point.

[0069] In this embodiment, d1=d2 and the neighborhood is a square of d1xd2; determine whether all pixels in the neighborhood of the initial point are white pixels. If all pixels in the neighborhood are white pixels, further determine whether there are black pixels and whether the distances from the neighborhood center to the black pixels are equal. If they are equal, the neighborhood is considered a blank pattern; otherwise, a new initial point is selected. Finally, a blank pattern is found in each partition, such as Figure 7 shown.

[0070] Example 4

[0071] Different from the third embodiment, in this embodiment, searching for a blank pattern in a dot matrix code image according to a preset geometric condition specifically includes the following steps:

[0072] Select the initial point: traverse the pixel points in a row, regard n pixel points with consecutive pixel values ​​of 0 as a pixel block, and find several pixel blocks; record the distance d between pixel blocks; take the center point of a found pixel block as the starting point, traverse along the column direction with a step length of distance d. If at least one pixel block can be found, take the first white pixel point visited during the traversal with a step length of distance d as the initial point.

[0073] Determine whether all pixels in the neighborhood of the initial point are white pixels; if all pixels are white pixels, further search for black pixels at the edge of the neighborhood and determine whether the distance from the neighborhood center to the black pixels meets the requirements. If so, the neighborhood is regarded as a blank pattern; otherwise, reselect an initial point.

[0074] Example 5

[0075] A grid-based dot code positioning method comprises the following steps:

[0076] 1. Get the first image, such as Figure 2 As shown, the number of pixels of its width is PX and the number of pixels of its height is PY, which contains the dot matrix code A to be read.

[0077] 2. Binarize the first image to obtain the second image, such as Figure 3 shown.

[0078] 3. Divide the second image into four partitions, such as Figure 4 shown.

[0079] 4. If Figure 5 As shown in the figure, in the first partition, the pixels in a row are traversed. Multiple pixels with consecutive 0 values ​​are considered a pixel block. The distance between the first pixel block and the second pixel block is recorded as d. Starting from the center point of the first pixel block, traverse in the column direction with a step length of d. At least one pixel block is found. Therefore, the first pixel with a value of 255 found by traversing with a step length of d is used as the starting point.

[0080] 5. If Figure 6 As shown, a blank pattern is searched from the initial point: the pixel values ​​of the pixels in the neighborhood of the initial point are determined to be 255 (in this embodiment, the neighborhood is a 3x3 square); black pixels at the edge of the neighborhood are further searched and the distance between the center point of the neighborhood and the black pixels is determined to be equal; the neighborhood is then regarded as a blank pattern.

[0081] 6. Follow the steps in steps 4 and 5 to search for blank patterns in the other three partitions and obtain the center point and side length of each blank pattern:

[0082] The center point of the blank pattern in the first partition is C0: (23, 49), R0: 3 pixels;

[0083] The center point of the blank pattern in the second partition is C1: (191, 21), R1: 3 pixels;

[0084] The center point of the blank pattern in the third partition is C2: (23,118), R2: 3 pixels;

[0085] The center point of the blank pattern in the fourth partition is C3: (143,145), R3: 3 pixels.

[0086] 7. Calculate the average side length of the four blank patterns R = (R0+R1+R2+R3) / 4.

[0087] 8. If Figure 8 As shown, starting from the center point of the blank image, the grid side length is set to R / 2, and the grid is divided on the second image.

[0088] 9. Convert the second image into a bit matrix based on whether there are black code points in each grid.

[0089] 10. Decode the bit matrix according to the decoding rules to obtain the decoding result.

[0090] Example 6

[0091] A grid-based dot code positioning system, comprising:

[0092] Reading module, used to obtain dot matrix code image;

[0093] A pre-processing module is used to perform binarization processing on the dot matrix code image;

[0094] The positioning module is used to determine the grid size and at least one grid division point based on the position and size of the blank pattern, and to divide the grid on the dot code image according to the grid division point and the grid size to obtain a plurality of single grid areas; the single grid area is the area where the code point is located.

[0095] Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

Claims

1. A grid-based dot code positioning method, characterized in that: The following steps are involved: Get dot matrix code image; determining a grid size and at least one grid division point; According to the grid division points and grid size, the dot code image is divided into grids to obtain several single grid areas, which are the areas where the code points are located; The method also includes searching for blank patterns in the dot code image according to preset geometric conditions; determining the grid size and grid segmentation points according to the position and size of the blank patterns; The method of searching for a blank pattern in a dot matrix code image according to a preset geometric condition specifically includes the following steps: Select an initial point; determine whether all pixels in the neighborhood of the initial point are white pixels; if all pixels are white pixels, further search for black pixels at the edge of the neighborhood and determine whether the distance from the neighborhood center to the black pixels meets the requirements. If so, the neighborhood is considered a blank pattern.

2. A grid-based dot code positioning method according to claim 1, characterized in that: Also includes: Determine whether there is a code point in a single grid area; Convert the dot code image into a bit matrix according to whether there is a code point in each single grid area; Converting the bit matrix into a bit stream; Decode the bit stream to obtain a decoding result.

3. A grid-based dot code positioning method according to claim 2, characterized in that: The determination of whether a code point exists in a single grid area is specifically as follows: Traverse all pixels in a single grid area. If the number of black pixels is greater than the threshold, it is considered that a code point exists in the single grid area.

4. A grid-based dot code positioning method according to claim 1, characterized in that: The grid size is the minimum spacing between code points in the dot matrix code.

5. The grid-based dot code positioning method according to claim 1, characterized in that: The method also includes: dividing the dot matrix code image into several partitions, searching for a blank pattern in each partition respectively; and determining the grid size and grid segmentation points according to the positions and size averages of the several blank patterns.

6. The grid-based dot code positioning method according to claim 1, characterized in that: The selecting of the initial point specifically includes the following steps: Traverse a row of pixels, find several pixel blocks, and record the distance d between the pixel blocks; traverse with distance d as the step size. If at least one pixel block is found, take the white pixel point traversed with distance d as the step size as the starting point.

7. The grid-based dot code positioning method according to claim 1, characterized in that: Determining the grid size and grid division points according to the position and size of the blank pattern specifically includes the following steps: Calculate the grid size based on the side length or diameter of the blank pattern; The center point of the blank pattern is used as the grid division point.

8. A grid-based dot code positioning system, characterized in that: include: Reading module, used to obtain dot matrix code image; A positioning module is used to determine a grid size and at least one grid division point, and to divide the grid on the dot code image according to the grid division point and the grid size to obtain a plurality of single grid areas; the single grid area is the area where the code point is located; It is also used to find blank patterns in the dot code image according to preset geometric conditions; determine the grid size and grid division points according to the position and size of the blank pattern; The method of searching for a blank pattern in a dot matrix code image according to a preset geometric condition specifically includes the following steps: Select an initial point; determine whether all pixels in the neighborhood of the initial point are white pixels; if all pixels are white pixels, further search for black pixels at the edge of the neighborhood and determine whether the distance from the neighborhood center to the black pixels meets the requirements. If so, the neighborhood is considered a blank pattern.

Citation Information

Patent Citations

  • Two-dimensional code preliminary positioning method and system

    WO2017036264A1

  • Rectangular anti-fake label, reading method and system

    CN105373822A