A Micro QR code positioning method, device, equipment and medium
By determining the number of black and white module transitions of the MicroQR code's locator and edge lines, and fitting clock and non-clock lines, the problem of low positioning accuracy of MicroQR codes was solved, achieving high-precision positioning in complex environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG HUARAY TECH CO LTD
- Filing Date
- 2023-03-31
- Publication Date
- 2026-06-16
AI Technical Summary
The positioning accuracy of MicroQR codes in existing technologies is low, especially when it is difficult to accurately position them on the surface of tiny objects.
By determining the locator of the MicroQR code, candidate clock lines are determined based on the number of black and white module transitions on the edge line. Edge point fitting is performed to obtain the clock lines. The contour corner points are determined by combining the clock lines and non-clock lines, thus achieving precise positioning of the MicroQR code.
It improves the positioning accuracy of MicroQR codes, especially in high-noise and complex environments, enabling accurate identification of the MicroQR code's location.
Smart Images

Figure CN116822546B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of MicroQR code positioning and recognition, and in particular to a MicroQR code positioning method, apparatus, device and medium. Background Technology
[0002] With the development of information technology, the application of QR code recognition is becoming increasingly widespread. Due to its advantages of large information storage capacity, ease of reading, and strong resistance to damage, Quick Response (QR) codes are widely used in mobile payments, express delivery, and automated production lines. However, in some special scenarios, such as on the surface of small objects where the required information storage is small, even the smallest version of the QR code requires a 21*21 module area. Compared to the smallest version of the MicroQR code (11*11 module area), the QR code obviously requires more space. Therefore, within the same spatial area, the MicroQR code has a larger module size in the field of view and better recognition accuracy. The existence of MicroQR codes expands the application areas of QR codes.
[0003] like Figure 1 As shown, a QR code has three locators, a data area, and a correction image. Therefore, the commonly used QR code positioning method first finds the three locators, i.e., the positioning pattern, and then determines the outline of the entire code based on the geometric relationship of the three locators. However, a MicroQR code only has one locator, so the positioning method of a QR code is not applicable to a MicroQR code, resulting in low positioning accuracy of a MicroQR code. Summary of the Invention
[0004] This application provides a MicroQR code positioning method, apparatus, device, and medium to solve the problem of low positioning accuracy of MicroQR codes in the prior art.
[0005] In a first aspect, embodiments of this application provide a MicroQR code positioning method, the method comprising:
[0006] In an image containing the MicroQR code to be identified, determine the locator of the MicroQR code;
[0007] Based on the multiple edge lines of the locator, determine the number of black-and-white module transitions for each edge line; and based on the number of black-and-white module transitions for each edge line, determine the candidate clock lines for the MicroQR code;
[0008] Based on the candidate clock lines, search for the edge points of the locator; fit the candidate clock lines and the edge points to determine the clock lines of the MicroQR code;
[0009] Based on the clock line of the MicroQR code, determine the non-clock line of the MicroQR code;
[0010] The outline corner points of the MicroQR code are determined based on the clock line and the non-clock line of the MicroQR code.
[0011] Secondly, embodiments of this application provide a MicroQR code positioning device, the device comprising:
[0012] The locator determination module is used to determine the locators of the MicroQR code in an image containing the MicroQR code to be identified;
[0013] The candidate clock line determination module is used to determine the number of black-and-white module transitions for each edge line based on the multiple edge lines of the locator; and to determine the candidate clock lines for the MicroQR code based on the number of black-and-white module transitions for each edge line.
[0014] A clock line determination module is used to search for edge points of the locator based on the candidate clock lines; and to fit the candidate clock lines and the edge points to determine the clock lines of the MicroQR code.
[0015] A non-clock line determination module is used to determine the non-clock lines of the MicroQR code based on the clock lines of the MicroQR code.
[0016] The contour corner point determination module is used to determine the contour corner points of the MicroQR code based on the clock line and the non-clock line of the MicroQR code.
[0017] Thirdly, embodiments of this application provide an electronic device, which includes at least a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the steps of the MicroQR code positioning method as described in any of the preceding claims.
[0018] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the MicroQR code positioning method as described in any of the preceding claims.
[0019] In this embodiment, the locator of the MicroQR code is first determined, and then the clock line and non-clock line of the MicroQR code are determined based on the locator, thereby determining the outline corner points of the MicroQR code and realizing the positioning of the MicroQR code. The positioning accuracy of the MicroQR code can be improved by positioning the MicroQR code through its features. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A schematic diagram illustrating the characteristics of a QR code and a MicroQR code;
[0022] Figure 2 A schematic diagram of a MicroQR code positioning process is provided for some embodiments of this application;
[0023] Figure 3 A schematic diagram of MicroQR code features provided for some embodiments of this application;
[0024] Figure 4 A schematic diagram of binarization processing provided for some embodiments of this application;
[0025] Figure 5 A schematic diagram of hole filling provided for some embodiments of this application;
[0026] Figure 6 A schematic diagram of a scan provided for some embodiments of this application;
[0027] Figure 7 A schematic diagram of locator outline acquisition is provided for some embodiments of this application;
[0028] Figure 8 A schematic diagram of a predicted clock line combination is provided for some embodiments of this application;
[0029] Figure 9 A schematic diagram of a clock line edge transition is provided for some embodiments of this application;
[0030] Figure 10 A schematic diagram of clock line caliper positioning is provided for some embodiments of this application;
[0031] Figure 11 A positioning diagram of a locator caliper is provided for some embodiments of this application;
[0032] Figure 12 A schematic diagram of clock line edge straight line fitting provided for some embodiments of this application;
[0033] Figure 13 A schematic diagram of non-clock line edge acquisition is provided for some embodiments of this application;
[0034] Figure 14 A schematic diagram of MicroQR contour vertex acquisition is provided for some embodiments of this application;
[0035] Figure 15 A schematic diagram of a MicroQR code positioning process is provided for some embodiments of this application;
[0036] Figure 16 A schematic diagram of the structure of a MicroQR code positioning device provided for some embodiments of this application;
[0037] Figure 17 This is a schematic diagram of the structure of an electronic device provided for some embodiments of this application. Detailed Implementation
[0038] To make the objectives and implementation methods of this application clearer, the exemplary implementation methods of this application will be clearly and completely described below with reference to the accompanying drawings of the exemplary embodiments of this application. Obviously, the exemplary embodiments described are only some embodiments of this application, and not all embodiments.
[0039] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0040] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.
[0041] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0042] The term "module" refers to any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0043] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
[0044] For ease of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. According to the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.
[0045] Embodiment 1:
[0046] Figure 2 A schematic diagram of the positioning process of a MicroQR code provided for some embodiments of the present application, the process includes:
[0047] S201: In an image containing the MicroQR code to be recognized, determine the locator of the MicroQR code.
[0048] The MicroQR code positioning method provided by the embodiments of the present application is applied to an electronic device, and the electronic device includes, but is not limited to, an image acquisition device (such as a camera), a user device (such as a mobile phone, a tablet computer, a wearable device, etc.), or a barcode scanner (such as a barcode scanner in an industrial environment) and other devices.
[0049] The image containing the MicroQR code to be recognized can be the original image collected by the electronic device.
[0050] Generally, the locator of the MicroQR code has recognizable features. Therefore, by first recognizing the locator through these recognizable features, more accurate positioning of other areas of the MicroQR code can be performed. See Figure 3 , the features of the locator of the MicroQR code include 1 "square inside a square" module. In the "square inside a square" module, A, B, and C each account for 3 modules, 5 modules, and 7 modules respectively, that is, the ratio of black and white modules in the "square inside a square" module is 1:1:3:1:1.
[0051] In one implementation, this step involves binarizing the image containing the MicroQR code to be identified, then scanning the binarized image. The center position of the locator is determined based on the characteristics of the MicroQR code's locator (such as the 1:1:3:1:1 line segment ratio mentioned above), followed by outer contour extraction to finally obtain the MicroQR code's locator. When scanning the binarized image, a pixel-by-pixel scan can be performed along the row and column directions.
[0052] This step may identify one or more candidate locators. If multiple candidate locators are identified, the following steps can be performed separately for each candidate locator.
[0053] S202: Determine the number of black and white module transitions for each edge line based on the multiple edge lines of the locator; and determine the candidate clock lines for the MicroQR code based on the number of black and white module transitions for each edge line.
[0054] In this step, by traversing the edge lines of the locator and calculating the number of black and white module transitions on the edge lines, coarse clock line localization can be completed based on the result of determining whether the edge line is a clock line. If the coarse clock line localization result for a candidate locator does not meet the requirements, i.e., the edge line is not a clock line, it indicates that the candidate locator is not a MicroQR code locator, and the remaining candidate locators are then processed again.
[0055] S203: Search for edge points of the locator based on the candidate clock lines; fit the candidate clock lines and edge points to determine the clock lines of the MicroQR code.
[0056] Based on the coarse positioning in the above steps, this step can perform position estimation and caliper positioning on the black and white modules on the clock edge, extract the caliper calculation results of the estimated module position, determine the edge points of the locator, and then perform edge fitting on the candidate clock lines and edge points of the coarse positioning to obtain the fine positioning results of the two clock line edges of the MicroQR code.
[0057] S204: Determine the non-clock lines of the MicroQR code based on the clock lines of the MicroQR code.
[0058] In one implementation, the side edge point can be obtained by locating the last black module at the edge of the clock line. Then, a line parallel to the opposite edge of the clock line is drawn through the side edge point to determine the straight line information of the non-clock line edge.
[0059] S205: Determine the outline corner points of the MicroQR code based on the clock line and non-clock line of the MicroQR code.
[0060] In this step, the four intersection points of the outline can be obtained by finding the pairwise intersection points of the two clock lines and two non-clock lines of the MicroQR code, thereby determining the outline corner points of the MicroQR code.
[0061] In this embodiment, the locator of the MicroQR code is first determined, and then the clock line and non-clock line of the MicroQR code are determined based on the locator, thereby determining the outline corner points of the MicroQR code and realizing the positioning of the MicroQR code. Positioning the MicroQR code by using its features can improve the positioning accuracy of the MicroQR code.
[0062] Example 2:
[0063] Based on the above embodiments, in this embodiment of the application, determining the locator of the MicroQR code in an image containing the MicroQR code to be identified includes:
[0064] The image containing the MicroQR code to be identified is smoothed and binarized to obtain a binary image;
[0065] A hole-filling algorithm is used to fill the white holes in the black blocks of a binary image to obtain a filled binary image.
[0066] Scan the filled binary image to determine the MicroQR code locators.
[0067] By applying smoothing filters to images containing MicroQR codes to be identified, noise interference can be reduced, thereby improving the accuracy of MicroQR code localization.
[0068] The process of binarizing an image can include image processing algorithms that perform adaptive thresholding.
[0069] Considering situations with high noise or damaged locators, the resulting binary image may not be ideal. Therefore, a hole-filling algorithm can be used to fill the white holes in the black modules of the binary image, resulting in complete black modules and improving the accuracy of MicroQR code localization. For example, the hole-filling algorithm is the floodfill algorithm.
[0070] The process of finding the locator of the MicroQR code in the embodiments of this application is illustrated by the following steps:
[0071] S1.1: Apply a smoothing filter to the original image to reduce noise interference. For example... Figure 4 As shown in (a), the original image refers to the image containing the MicroQR code to be identified.
[0072] S1.2: Using an adaptive threshold segmentation image processing algorithm, perform full... Figure 2 Value-enhanced, resulting in a binary image. The pixel value dstA(x,y) of the pixel at position (x,y) in the binary image satisfies the following formula:
[0073]
[0074] In other words, for each pixel SrcA(x,y) in the image, the mean pixel value Area(x,y) within its neighborhood N*M is calculated. Based on the relationship between SrcA(x,y) and Area(x,y), the resulting pixel value dstA(x,y) at position (x,y) is output. If SrcA(x,y) is less than or equal to Area(x,y), the pixel value at position (x,y) is set to 0; if SrcA(x,y) is greater than Area(x,y), the pixel value at position (x,y) is set to 255. This process is repeated for each pixel in the image to obtain a binary image, such as... Figure 4 As shown in (b) of the diagram.
[0075] S1.3: Fill the white holes in the black module of the binary image using the floodFill algorithm.
[0076] The floodFill algorithm iterates through a binary image to find all white closed contours, and then performs the following judgment on each closed contour: Where AreaHole represents the hole area, and MaxHoleThre is the preset maximum hole area threshold. The hole before filling is shown below. Figure 5 As shown in (a), the filling result of the hole is as follows Figure 5 As shown in (b) of the diagram.
[0077] S1.4: Horizontal scanning, i.e., scanning line by line in the filled binary image to find all line segments {Seg1, Seg2, ..., Segn} where 5 adjacent black and white modules conform to the ratio 1:1:3:1:1. The center point coordinates of each line segment are recorded as {SegPt1, SegPt2, ..., SegPtn}. Figure 6 As shown in (a) in the figure.
[0078] S1.5: Vertical Scan. Starting from the center point of the line segment obtained by the horizontal scan in S1.44, perform upward and downward scans respectively. Taking the upward scan as an example, record the coordinates of the black->white, white->black, and black->white transition points as {VerPt3,VerPt2,VerPt1}. Similarly, record the coordinates of the black-white transition points obtained by the downward scan as {VerPt4,VerPt4,VerPt6}. Figure 6As shown in (b), the black and white module ratio of the vertical scan line segment is calculated based on the position of each black and white change point. The calculation formula is: {VerPt6 y -VerPt5 y VerPt5 y -VerPt4 y :VerPt4 y -VerPt3 y :VerPt3 y -VerPt2 y :VerPt2 y -VerPt1 y Remove vertical line segments that do not satisfy the ratio 1:1:3:1:1.
[0079] Understandable Figure 6 The added markers are only for the convenience of illustrating the scheme, although they are not intended to... Figure 6 The black and white modules of the MicroQR code in the image are obscured, but this does not indicate that the MicroQR code has been modified. This is a general statement here, and will not be repeated in the following figures.
[0080] S1.6: Search for the outer contour of the locator. After the horizontal and vertical scanning filters in S1.4 and S1.5, the remaining valid line segments are searched for and filtered for the outer contour of the locator. Starting from the outermost edge point VerPt1 or VerPt6 (here, the edge point of the vertical scan is used as an example; the edge point of the horizontal scan can also be used in the implementation), the search is performed pixel by pixel along the outer contour, such as... Figure 7 As shown in (a), the search endpoint determination condition satisfies the following formula: If the X and Y coordinates of the current contour point EndPt reach the vicinity of the 8-neighborhood (for example only) of StartPt, then the closed contour is considered successfully located. Record the four corner points of the contour clockwise, denoted as {p1(x1,y1),p2(x2,y2),p3(x3,y3),p4(x4,y4)} as the four corner points of the locator, such as... Figure 7 As shown in (b) in the figure, all candidate locators are saved in this way.
[0081] This process may yield one or more candidate locators in the original image, and the electronic device can then perform subsequent steps for each locator.
[0082] In this embodiment of the application, the location of the MicroQR code can be obtained by smoothing and binarizing the image, filling the hole area of the locator, and then scanning the whole image.
[0083] Example 3:
[0084] Based on the above embodiments, in this embodiment, determining the number of black and white module transitions for each edge line according to the multiple edge lines of the locator includes:
[0085] Based on the four corner points of the locator, determine the two adjacent edge lines of each corner point;
[0086] For each edge line at each corner point, translate the edge line by a first number of modules in the first direction corresponding to the edge line to obtain the translated edge line; extend the translated edge line by a second number of modules in the first direction to obtain the edge extension line corresponding to the translated edge line; on the edge extension line, determine the number of black and white module transitions of the edge line.
[0087] Two adjacent edge lines at a corner point can include a clockwise edge line and a counterclockwise edge line at the corner point. Accordingly, the first direction corresponding to the edge line can include a clockwise direction and / or a counterclockwise direction.
[0088] Considering that there may be some errors in the corner points and edge lines of the determined locator, shifting the edge lines along the first direction by a first number of modules helps improve the accuracy of the positioning. The first number of modules in the example can be no more than one module, for example, but not limited to, a 1 / 2 module.
[0089] The second number of modules can be related to the version of the MicroQR code. For example, the minimum version of the MicroQR code is 11*11 modules. Using the minimum version as a benchmark can guarantee that the corresponding number of black-and-white mutations can be found. Therefore, the second number of modules can be 5 modules.
[0090] The following is an example illustrating part of the coarse positioning process for the MicroQR code clock line:
[0091] S2.1: Predict clock line combinations. Starting from any one of the four corner points of the candidate locator, obtain its two adjacent edge lines. The edge line in the clockwise direction is denoted as ClockLine, and the edge line in the counterclockwise direction is denoted as AntiClockLine. Figure 8 As shown, there are four possible combinations of the four corner points of the candidate locator.
[0092] For each corner point, perform the following processing:
[0093] S2.2: See Figure 9As shown in (a), the edge line at the corner point is shifted inward by 1 / 2 module in a clockwise direction to obtain the edge extension line NewClockLine. Taking the smallest version of MicroQR code as an example of 11*11 modules, NewClockLine is extended by 5 modules in the extension direction. The pixel values passed from the corner point to the end point of the edge extension line are: [pix1,pix2,...,pixn]. Find the contrast change of adjacent pixels on the edge extension line and find the number of black and white jumps. If the i-th pixel pix(i) satisfies Let pix(i) be the position of a black-and-white module transition, where jumpThre is a preset threshold for grayscale change during the transition. In this way, record the total number of black-and-white module transitions along the clockwise edge line: jumpCounts_Clock.
[0094] S2.3: See Figure 9 As shown in (b) of the diagram, similar to S2.2, the total number of black and white module transitions jumpCounts_AntiClock on the counterclockwise edge line of the corner point is found.
[0095] In this embodiment, by traversing the edge lines of the locator and determining the number of transitions between black and white modules on the edge lines, the accuracy of locating MicroQR codes can be improved.
[0096] Example 4:
[0097] Based on the above embodiments, in this embodiment, candidate clock lines for the MicroQR code are determined according to the number of black and white module transitions for each edge line, including:
[0098] The number of transitions between the black and white modules on both edges of the locator is greater than the set number.
[0099] If so, identify the two edge lines as two candidate clock lines for the MicroQR code.
[0100] The electronic device stores a set number of times, which is a characteristic of the number of times the black and white modules on the clock line switch, for example, but not limited to, a set number of 2 times.
[0101] Using the above example, the remaining processes in the coarse positioning of the MicroQR code clock line will be explained. After S2.3 above, the following steps are also included:
[0102] S2.4: Determine whether the number of transitions of the black and white modules on the two edge lines simultaneously satisfies the characteristic of the number of transitions of the black and white modules on the clock line. Taking the smallest version of MicroQR code as an example of an 11*11 module, the judgment rule satisfies the following formula: When the number of transitions of the black and white modules of the two edge lines is greater than 2, it is determined that the two edge lines are on the clock line, and the clock line edge fine positioning processing in the subsequent embodiments can be performed.
[0103] If the edge line combination of a certain corner point does not satisfy the black-and-white transition rule on the clock line, then in S2.1, the two edge lines of the next corner point can be switched and S2.2 to S2.4 can be continued until a locator corner point that satisfies the black-and-white transition rule on the clock line is found. In this way, edge lines that satisfy the black-and-white transition rule on the clock line can be found, that is, combination 1 can be determined from the 4 combinations to satisfy the black-and-white transition rule on the clock line. The locator corner point that satisfies the black-and-white transition rule on the clock line can be used as a contour corner point McPt1 of the MicroQR code, and its two adjacent edges are the positions of the clock edge, completing the coarse positioning of the clock line edge.
[0104] In some cases, the edge combination of all corner points of the candidate locator does not satisfy the black-and-white transition rule on the clock line. In this case, the next candidate locator can be selected, and the process of S2.1 to S2.4 can be repeated.
[0105] In this embodiment, the number of transitions between black and white modules on the edge line can be used to determine whether the edge line is a clock line, thereby completing the coarse positioning of the clock line and improving the accuracy of MicroQR code positioning.
[0106] Example 5:
[0107] Based on the above embodiments, in this embodiment, searching for edge points of the locator according to the candidate clock line includes:
[0108] For two candidate clock lines, estimate the positions of all black modules on each candidate clock line;
[0109] At all black module locations on each candidate clock line, a caliper search is performed to determine the edge points of the black modules on each candidate clock line;
[0110] Determine whether the number of black module edge points on the two candidate clock lines is equal;
[0111] If so, perform a caliper search on each candidate clock line to determine the edge point on each candidate clock line;
[0112] Determine the edge point of the locator based on the edge points on the two candidate clock lines.
[0113] In one implementation, when estimating the positions of all black modules on the candidate clock line, the positions can be estimated based on the equally spaced variation characteristics of black and white modules on the clock line, and the number of black modules can be determined based on the maximum version of the MicroQR code. For example, the maximum version of the MicroQR code is a 17*17 module, and there can be a maximum of 6 black modules on the clock line. Therefore, the positions of 6 black modules can be estimated on the candidate clock line to avoid the impact of missing the estimated positions of black modules.
[0114] When performing a caliper search, the change in pixel grayscale from "white" to "black" can be used as the edge finding result for the caliper. If the MicroQR code to be located is the maximum version, then 6 black module edge points corresponding to black modules can be identified on each candidate clock line, meaning the edge finding result for the caliper is a valid caliper. If the MicroQR code to be located is not the maximum version, and there are fewer than 6 black module edge points corresponding to black modules on each candidate clock line, then the edge finding result for the caliper includes valid calipers and / or invalid calipers.
[0115] The size of the calipers used to place the electronic device can be the same as the current module size. By placing the calipers, edge points can be found.
[0116] The process of precise positioning of the MicroQR code clock line is illustrated with an example, including the following steps:
[0117] S3.1: Based on the coarse positioning of the clock line described above, starting from McPt1, and according to the evenly spaced variation of the black and white modules on the clock line, and taking the largest MicroQR version (17*17 modules) as a reference, estimate the positions of all six black modules on the clock line where the clock edge line is located in a clockwise direction, such as... Figure 10 As shown in (a), the positions of the six predicted black modules are predicted module 1, predicted module 2, ..., predicted module 6.
[0118] S3.2: Calculate the total number of actual black modules on the clock line. At the estimated locations of the black modules, place edge-finding calipers; the caliper size should be the current module size. Figure 10 As shown in (b), the maximum grayscale change of pixels from white to black, Caliper_maxContrast, is used as the edge finding result for each caliper. The caliper search rule satisfies the following formula: Where CaliperThre is the preset caliper threshold, set according to the actual image scene. When an invalid caliper appears, the remaining estimation modules will no longer be searched. The coordinates of the maximum grayscale change of all valid modules are recorded, that is, the positions of the valid edge points {ClockPt1,ClockPt2,...ClockPtn}.
[0119] S3.3: Similar to S3.1 and S3.2, starting from McPt1, estimate the position of the black module on the clock line where the counterclockwise edge line is located, place calipers to find the edge point, and record the effective edge point positions {AntiClockPt1, AntiClockPt2,...AntiClockPtn}. Figure 11 (a) shows the black module edge points on the two candidate clock lines found by the calipers.
[0120] S3.4: Determine if the number of black module edge points on the clockwise and counterclockwise edge lines are equal. If they are equal, it means that the clock line edge point is successfully positioned.
[0121] If they are not equal, it means that the current candidate locator is not a MicroQR code locator. In this case, the next candidate locator can be selected, and the process of S2.1 can be repeated.
[0122] S3.5: Place two calipers on each edge of the locator where the two candidate clock lines are located, such as... Figure 11 As shown in (b), edge search results are recorded. and {AntiClockSignPt1,AntiClockSignPt2}.
[0123] S3.6: For example Figure 12 As shown, by combining all the edge points found on the two clock lines and the locator, a straight line is fitted to obtain Line1 and Line2, thus completing the fine positioning of the clock line edges.
[0124] In this embodiment, based on the coarse positioning of the clock line in the above embodiment, the position of the black and white modules on the clock line is estimated and calipered. The caliper calculation results of the estimated module position are extracted and edge fitting is performed to obtain the fine positioning results of the two clock line edges, thereby improving the accuracy of MicroQR code positioning.
[0125] Example 6:
[0126] Based on the above embodiments, in this embodiment, determining the non-clock lines of the MicroQR code according to the clock lines of the MicroQR code includes:
[0127] For each clock line of the MicroQR code, the side edge of the last black module of that clock line is located to obtain the side edge point of the clock line; based on the side edge point, a parallel line to another clock line is drawn to determine the non-clock line corresponding to the side edge point.
[0128] Taking one of the two clock lines as an example, the outer edge point of the last black module of the clock line can be regarded as the side edge point of the clock line.
[0129] When drawing a parallel line to another clock line based on the side edge point, one can either rotate 90 degrees in a second direction along the direction of the clock line's side edge point and the clock line itself to draw the parallel line, or directly draw a parallel line to the other clock line through the side edge point. Since the parallel line is parallel to the other clock line, the other clock line can also be called the opposite clock line (of the parallel line).
[0130] In one implementation, the parallel line to the clock line on the opposite side can be defined as the non-clock line corresponding to the side edge point.
[0131] In this embodiment, by drawing a parallel line to the opposite side of another clock line at the side edge point of the clock line, the non-clock line of the MicroQR code can be accurately determined, thereby improving the accuracy of MicroQR code positioning.
[0132] Example 7:
[0133] Based on the above embodiments, in this embodiment, drawing a parallel line to another clock line according to the side edge point includes:
[0134] Using the side edge point of the clock line and the direction of the clock line, rotate 90 degrees in the second direction to perform a caliper search and determine the caliper search edge point;
[0135] Use calipers to search for edge points and draw a line parallel to another clock line.
[0136] In MicroQR codes, there are two clock lines, the data area lacks easily identifiable features, and the black and white modules in the data area are related to the presence or absence of data. Therefore, using the black and white modules in the data area to locate the edge lines is not accurate enough. However, in the embodiments of this application, the features of the identified clock lines can be used to locate the two edge lines of the data area, i.e., non-clock lines, to improve the accuracy of MicroQR code positioning.
[0137] The side edge of the clock line can be used as a reference position, and then rotation can be performed in a second direction, with the direction of the clock line as the reference. For example, the second direction can be clockwise and / or counterclockwise.
[0138] In one implementation, the size of the caliper search is 2 modules. The edge point found by the caliper search is located in the clock region. Therefore, the edge point of the caliper search is a key point in the clock region. This key point must exist in the MicroQR code. Therefore, based on this key point, another line parallel to the clock line can be drawn to accurately locate the non-clock line.
[0139] The process of non-clock line positioning of MicroQR codes is illustrated with an example, including the following steps:
[0140] S4.1: Obtain non-clock line edge corner points. For example... Figure 13 As shown in (a), for the clock line edge Line2 in the clockwise direction, with the last valid black module in S3.2, ClockPtn (i.e., the side edge point), as the reference position, rotate 90 degrees clockwise with the Line2 direction as the reference (for example only), place the caliper, the caliper search size is 2 modules, and record the caliper search edge point result AntiCloclkOppsitePt.
[0141] S4.2: As Figure 13 As shown in (b), draw a line parallel to line Line1 through AntiCloclkOppsitePt, and denote it as Line3.
[0142] S4.3: For example Figure 13 As shown in (c), for the counterclockwise clock line edge Line1, with the last valid black module AntiClockPtn in S3.3 as the reference position, the caliper is placed 90 degrees counterclockwise. The caliper search size is 2 modules, and the caliper search edge point result CloclkOppsitePt is recorded.
[0143] S4.4: For example Figure 13 As shown in (b), draw a line parallel to line Line2 through CloclkOppsitePt, denoted as Line4.
[0144] After determining the two clock lines and two non-clock lines, the intersection points of the four fitted edge lines can be calculated pairwise in a clockwise order (for example only). This will ultimately yield the positions of the four contour corner points, as shown below. Figure 14 As shown, the MicroQR code is located.
[0145] In this embodiment of the application, the accuracy of MicroQR code positioning can be improved by using the features of the identified clock line to locate the two edge lines of the data area.
[0146] Example 8:
[0147] Based on the above embodiments, this application provides a specific MicroQR code positioning process, such as... Figure 15 As shown, it includes the following steps:
[0148] S1501: Preprocess the image, for example, the steps shown in S1.1 above.
[0149] S1502: Perform binarization on the preprocessed image to obtain a binary image, as shown in step S1.2 above.
[0150] S1503: Fill holes in the binary image, for example, as shown in step S1.3 above.
[0151] S1504: Perform horizontal and vertical scanning filtering on the image, such as the steps shown in S1.4 and S1.5 above.
[0152] S1505: Perform locator outer contour search filtering to obtain candidate locators, such as the steps shown in S1.6 above.
[0153] S1506: Loop through the clock line combination of the candidate locators, for example, the steps shown in S2.1 above.
[0154] S1507: Determine the number of black-to-white transitions for the two clock lines, and determine whether the number of black-to-white transitions for the two clock lines meets the clock line characteristic requirements, such as the steps shown in S2.2 to S2.4 above. If yes, proceed to S1508; if no, return to S1506.
[0155] S1508: Perform clock line fine positioning, such as the steps shown in S3.1 to S3.3 above.
[0156] S1509: Determine whether the number of consecutive valid calipers on the two clock lines is the same, for example, as shown in step S3.4 above. If yes, proceed to S1510; if no, return to S1505.
[0157] S1510: Perform a caliper search on the edge of the locator where the clock line is located, for example, as shown in step S3.5 above.
[0158] S1511: Perform straight line fitting on the clock line edge, for example, the step shown in S3.6 above.
[0159] S1512: Perform straight line fitting on the non-clock line edges, for example, the steps shown in S4.1 to S4.4 above.
[0160] S1513: Determine the outline corner points of the MicroQR code.
[0161] In this embodiment, the edge is accurately fitted by utilizing the changing characteristics of the black and white modules of two clock lines. At the same time, the non-clock line edges are precisely located according to the principle of parallel opposite sides, thereby achieving precise positioning of the outer contour of the MicroQR code. This enables MicroQR contour positioning in scenarios with high background noise, damaged locators, or complex industrial environments.
[0162] Example 9:
[0163] Based on the same technical concept and the above embodiments, this application provides a MicroQR code positioning device. Figure 16 A schematic diagram of a MicroQR code positioning device is provided for some embodiments of this application, such as... Figure 16 As shown, the device includes:
[0164] Locator determination module 1601 is used to determine the locators of the MicroQR code in an image containing the MicroQR code to be identified;
[0165] The candidate clock line determination module 1602 is used to determine the number of black and white module transitions for each edge line based on the multiple edge lines of the locator; and to determine the candidate clock lines of the MicroQR code based on the number of black and white module transitions for each edge line.
[0166] The clock line determination module 1603 is used to search for edge points of the locator based on candidate clock lines; and to fit the candidate clock lines and edge points to determine the clock lines of the MicroQR code.
[0167] Non-clock line determination module 1604 is used to determine the non-clock lines of the MicroQR code based on the clock lines of the MicroQR code;
[0168] The contour corner point determination module 1605 is used to determine the contour corner points of the MicroQR code based on the clock line and non-clock line of the MicroQR code.
[0169] In one possible implementation, the locator determination module 1601 is specifically used to perform smoothing filtering and binarization processing on the image containing the MicroQR code to be identified to obtain a binary image; to use a hole-filling algorithm to fill the white holes in the black modules in the binary image to obtain a filled binary image; and to scan the filled binary image to determine the locator of the MicroQR code.
[0170] In one possible implementation, the candidate clock line determination module 1602 is specifically used to determine two adjacent edge lines for each of the four corner points of the locator; for each edge line of each corner point, the edge line is translated by a first number of modules in the first direction corresponding to the edge line to obtain a translated edge line; the translated edge line is extended by a second number of modules in the first direction to obtain an edge extension line corresponding to the translated edge line; and the number of black and white module transitions of the edge line is determined on the edge extension line.
[0171] In one possible implementation, the candidate clock line determination module 1602 is specifically used to determine whether the number of black and white module transitions of the two edge lines of the locator is greater than a set number; if so, the two edge lines are determined to be two candidate clock lines of the MicroQR code.
[0172] In one possible implementation, the clock line determination module 1603 is specifically used to estimate the positions of all black modules on each of the two candidate clock lines; perform a caliper search at all the positions of black modules on each candidate clock line to determine the edge points of the black modules on each candidate clock line; determine whether the number of edge points of black modules on the two candidate clock lines is equal; if so, perform a caliper search on each candidate clock line to determine the edge points on each candidate clock line; and determine the edge points of the locator based on the edge points on the two candidate clock lines.
[0173] In one possible implementation, the non-clock line determination module 1604 is specifically used to locate the side edge of the last black module of the clock line of the MicroQR code for each clock line of the MicroQR code, and obtain the side edge point of the clock line; based on the side edge point, draw a line parallel to another clock line to determine the non-clock line corresponding to the side edge point.
[0174] In one possible implementation, the non-clock line determination module 1604 is specifically used to rotate 90 degrees in a second direction with the side edge point of the clock line and the direction of the clock line, perform a caliper search, determine the caliper search edge point, and draw a parallel line to another clock line through the caliper search edge point.
[0175] Example 10:
[0176] Based on the same technical concept, this application also provides an electronic device. Figure 17 This application provides a schematic diagram of an electronic device structure, such as... Figure 17 As shown, it includes: processor 1701, communication interface 1702, memory 1703 and communication bus 1704, wherein processor 1701, communication interface 1702 and memory 1703 communicate with each other through communication bus 1704.
[0177] The memory 1703 stores a computer program, which, when executed by the processor 1701, causes the processor 1701 to perform any of the above embodiments.
[0178] The communication bus mentioned in the above electronic devices can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0179] Communication interface 1702 is used for communication between the above-mentioned electronic device and other devices.
[0180] The memory may include RAM (Random Access Memory) or NVM (Non-Volatile Memory), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0181] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be DSPs (Digital Signal Processors), application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0182] Example 11:
[0183] Based on the same technical concept, embodiments of this application provide a computer-readable storage medium storing a computer program executable by an electronic device. When the program is run on the electronic device, it causes the electronic device to implement any of the above embodiments.
[0184] The aforementioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in an electronic device, including but not limited to magnetic storage such as floppy disks, hard disks, magnetic tapes, MO (magneto-optical disks), optical storage such as CDs, DVDs, BDs, HVDs, etc., and semiconductor storage such as ROMs, EPROMs, EEPROMs, NAND flash (non-volatile memory), SSDs (solid-state drives), etc.
[0185] 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.
[0186] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should 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 illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0187] 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.
[0188] 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.
[0189] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for locating MicroQR codes using a rapid response micro-scale, characterized in that, The method includes: In an image containing the MicroQR code to be identified, determine the locator of the MicroQR code; Based on the multiple edge lines of the locator, determine the number of black-and-white module transitions for each edge line; and based on the number of black-and-white module transitions for each edge line, determine the candidate clock lines for the MicroQR code; Based on the candidate clock lines, search for the edge points of the locator; fit the candidate clock lines and the edge points to determine the clock lines of the MicroQR code; Based on the clock line of the MicroQR code, determine the non-clock line of the MicroQR code; The outline corner points of the MicroQR code are determined by finding the pairwise intersection points of the two clock lines and the two non-clock lines of the MicroQR code.
2. The method as described in claim 1, characterized in that, The step of determining the locator of the MicroQR code in an image containing the MicroQR code to be identified includes: The image containing the MicroQR code to be identified is smoothed and binarized to obtain a binary image; A hole-filling algorithm is used to fill the white holes in the black modules of the binary image to obtain a filled binary image. The MicroQR code locators are determined by scanning the filled binary image.
3. The method as described in claim 1 or 2, characterized in that, The step of determining the number of black-and-white module transitions for each edge line based on the multiple edge lines of the locator includes: Based on the four corner points of the locator, determine the two adjacent edge lines of each corner point; For each edge line of each corner point, the edge line is translated by a first number of modules in the first direction corresponding to the edge line to obtain a translated edge line; the translated edge line is extended by a second number of modules in the first direction to obtain an edge extension line corresponding to the translated edge line; on the edge extension line, the number of black and white module jumps of the edge line is determined.
4. The method as described in claim 3, characterized in that, The step of determining the candidate clock line of the MicroQR code based on the number of black and white module transitions for each edge line includes: The number of black and white module transitions on both edge lines of the locator is determined to be greater than a set number. If so, the two edge lines are determined to be two candidate clock lines of the MicroQR code.
5. The method as described in claim 1 or 2, characterized in that, The step of searching for the edge points of the locator based on the candidate clock lines includes: For two candidate clock lines, estimate the positions of all black modules on each candidate clock line; At all the black module locations on each candidate clock line, a caliper search is performed to determine the edge points of the black modules on each candidate clock line; Determine whether the number of black module edge points on the two candidate clock lines is equal; If so, perform a caliper search on each candidate clock line to determine the edge point on each candidate clock line; The edge point of the locator is determined based on the edge points on the two candidate clock lines.
6. The method as described in claim 1 or 2, characterized in that, Determining the non-clock line of the MicroQR code based on the clock line of the MicroQR code includes: For each clock line of the MicroQR code, the last black module of the clock line is located on the side edge to obtain the side edge point of the clock line; based on the side edge point, a line parallel to another clock line is drawn to determine the non-clock line corresponding to the side edge point.
7. The method as described in claim 6, characterized in that, The step of drawing a parallel line to another clock line based on the side edge point includes: Using the side edge point of the clock line and the direction of the clock line, rotate 90 degrees in the second direction to perform a caliper search and determine the caliper search edge point; Using the calipers to search for edge points, draw a line parallel to another clock line.
8. A miniature, fast-response MicroQR code positioning device, characterized in that, The device includes: The locator determination module is used to determine the locators of the MicroQR code in an image containing the MicroQR code to be identified; The candidate clock line determination module is used to determine the number of black-and-white module transitions for each edge line based on the multiple edge lines of the locator; and to determine the candidate clock lines for the MicroQR code based on the number of black-and-white module transitions for each edge line. A clock line determination module is used to search for edge points of the locator based on the candidate clock lines; and to fit the candidate clock lines and the edge points to determine the clock lines of the MicroQR code. A non-clock line determination module is used to determine the non-clock lines of the MicroQR code based on the clock lines of the MicroQR code. The contour corner point determination module is used to determine the contour corner points of the MicroQR code by finding the intersection points of the two clock lines and the two non-clock lines of the MicroQR code pairwise.
9. An electronic device, characterized in that, The electronic device includes at least a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the steps of the MicroQR code positioning method as described in any one of claims 1-7.
10. A computer storage medium, characterized in that, It stores a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of the MicroQR code positioning method according to any one of claims 1-7.