Quick-response-code image generation method and apparatus, quick-response-code image recognition method and apparatus, and electronic device and storage medium
By introducing background patterns and auxiliary positioning patterns into QR code images, the problems of low efficiency and poor accuracy of QR code images are solved, and the robustness of recognition and anti-interference ability are improved.
Patent Information
- Application Number
- PCT/CN2025/089817
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-20
- Filing Date
- 2025-04-18
- Publication Date
- 2025-08-28
AI Technical Summary
The existing QR code image recognition technology has problems such as low efficiency, poor accuracy and weak anti-interference ability, especially when the camera shooting angle is offset, it is easy to lead to misreading of coded information.
When generating a QR code image, a background pattern and at least three auxiliary positioning patterns are added. The background pattern coincides with the center of the QR code pattern and is larger than the QR code pattern. The auxiliary positioning pattern corresponds to the corner points of the QR code pattern, and the main direction is determined by detecting these patterns during identification to obtain preset information.
It improves the accuracy and efficiency of QR code image recognition, enhances anti-interference ability, and ensures accurate decoding even when shooting angles are offset.
Smart Images

Figure CN2025089817_28082025_PF_FP_ABST
Abstract
Description
Two-dimensional code image generation, recognition method, device, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese application No. CN202410189323.3, filed on February 20, 2024, the entire contents of which are hereby incorporated by reference for all purposes. Technical Field
[0003] The present application relates to the field of visual navigation technology, and more specifically, to a two-dimensional code image generation and recognition method, device, electronic device and storage medium. Background Art
[0004] QR code images have the characteristics of large information storage, strong error correction ability, and obvious corner features. These characteristics make QR code images very suitable as visual navigation signs for autonomous mobile devices, used to assist autonomous mobile devices in visual navigation.
[0005] QR code image recognition technology involves capturing a QR code image with a camera and then reading the coded information stored in the coded area of the QR code. However, because the camera captures the QR code image at a random angle, the captured QR code image is likely to be angularly offset from the camera. For example, the captured QR code image may be upside down relative to the camera. In this case, the coded area in the QR code image is inverted, resulting in incorrect coded information read from the coded area.
[0006] To address the aforementioned angle offset issue, visual navigation technology can be combined to identify a positioning pattern within the QR code image. Based on this positioning pattern, the primary direction of the QR code image can be determined. This primary direction is defined as the direction in which the QR code image is not angularly offset from the camera. The encoded information in the encoded area is then read based on this primary direction, thus avoiding incorrectly reading the encoded information.
[0007] At present, the positioning pattern in the QR code image is usually an L-shaped pattern, as shown in Figure 1, and the L-shaped pattern is directly added to the edge of the QR code pattern as the angle positioning feature of the QR code. However, the inventors found in long-term research that: since the L-shaped pattern does not have symmetry, if the L-shaped pattern in the QR code image is outside the shooting field of view, it will be impossible to locate the main direction of the QR code image, and it is impossible to achieve accurate decoding of the coding area. In addition, the detection of the L-shaped pattern is close to the boundary distance of the QR code pattern, and it is easy to fail to detect, the stability is not high, and the anti-interference ability is weak. In addition, the image processing technology currently used in visual navigation has a large amount of calculation, and the efficiency of recognizing QR code patterns is low. In other words, the current QR code image recognition efficiency is low, the accuracy is poor, and the anti-interference ability is weak. Summary of the Invention
[0008] The embodiments of the present application propose a two-dimensional code image generation and recognition method, device, electronic device and storage medium to improve the current problems of low efficiency, poor accuracy and weak anti-interference ability of two-dimensional code image recognition.
[0009] In a first aspect, embodiments of the present application provide a method for generating a two-dimensional code image. The method comprises: obtaining a two-dimensional code pattern, the two-dimensional code pattern including preset information; generating a background pattern for the two-dimensional code pattern, the background pattern coinciding with the center of the two-dimensional code pattern and being larger than the size of the two-dimensional code pattern; and generating at least three auxiliary positioning patterns outside the background pattern to obtain a two-dimensional code image, wherein the auxiliary positioning patterns correspond to corner points of the two-dimensional code pattern.
[0010] In a second aspect, an embodiment of the present application provides a two-dimensional code image recognition method. The two-dimensional code image recognition method is used to identify a two-dimensional code image generated using the two-dimensional code image generation method of the present application. The two-dimensional code image recognition method includes: identifying an area to be detected in a captured image, wherein the area to be detected is centered on the center of the two-dimensional code pattern and has the same size as the two-dimensional code image; detecting a background pattern and at least three auxiliary positioning patterns in the area to be detected; determining the main direction of the two-dimensional code pattern based on the detection results; and obtaining preset information based on the main direction.
[0011] In a third aspect, embodiments of the present application provide a device for generating a two-dimensional code image. The device includes: a coding pattern acquisition module for acquiring a two-dimensional code pattern, wherein the two-dimensional code pattern includes preset information; a background pattern generation module for generating a background pattern for the two-dimensional code pattern, wherein the background pattern coincides with the center of the two-dimensional code pattern and is larger than the size of the two-dimensional code pattern; and an auxiliary pattern generation module for generating at least three auxiliary positioning patterns outside the background pattern to obtain a two-dimensional code image, wherein the auxiliary positioning patterns correspond to corner points of the two-dimensional code pattern.
[0012] In a fourth aspect, an embodiment of the present application provides a two-dimensional code image recognition device. The two-dimensional code image recognition device is used to identify a two-dimensional code image generated by the two-dimensional code image generation method in the present application. The two-dimensional code image recognition device includes: an area detection module for identifying an area to be detected in a captured image, wherein the area to be detected is centered on the center of the two-dimensional code pattern and has the same size as the size of the two-dimensional code image; a pattern detection module for detecting a background pattern and at least three auxiliary positioning patterns in the area to be detected; a direction determination module for determining the main direction of the two-dimensional code pattern based on the detection result; and an information decoding module for obtaining preset information based on the main direction.
[0013] In a fifth aspect, an embodiment of the present application provides an electronic device comprising: a memory and a processor, wherein an application is stored in the memory, and when the processor calls the application, the QR code image generation method or the QR code image recognition method provided in the embodiment of the present application is executed.
[0014] In a sixth aspect, an embodiment of the present application provides an autonomous mobile device, which includes: a memory and a processor, wherein an application is stored in the memory, and when the processor calls the application, the two-dimensional code image recognition method provided by the embodiment of the present application is executed.
[0015] In the seventh aspect, an embodiment of the present application provides a computer-readable storage medium, on which program code is stored. When the program code is called by a processor, the processor executes the QR code image generation method or the QR code image recognition method provided in the embodiment of the present application.
[0016] The two-dimensional code image generation, recognition method, device, electronic device and storage medium provided in the embodiment of the present application, based on the two-dimensional code pattern, background pattern and at least three auxiliary positioning patterns, generate a two-dimensional code image, and the generated two-dimensional code image adds a background pattern and at least three auxiliary positioning patterns compared to the conventional two-dimensional code pattern. Wherein, at least three auxiliary positioning patterns are arranged outside the background pattern, so that there is a certain distance between the two-dimensional code pattern in the auxiliary positioning pattern and the background pattern, thereby improving the accuracy, efficiency and stability of identifying the auxiliary positioning pattern. In addition, at least three auxiliary positioning patterns correspond to at least three corner points of the two-dimensional code pattern respectively, and have symmetry. Even if part of the auxiliary positioning pattern exceeds the shooting field of view, at least three auxiliary positioning patterns can be supplemented based on symmetry, thereby realizing the main direction positioning of the two-dimensional code image, and the anti-interference ability is strong, which can improve the robustness of the two-dimensional code image recognition. Therefore, the two-dimensional code image generation, recognition method, device, electronic device and storage medium provided in the present application can solve the problems that the current two-dimensional code image recognition efficiency is low, the accuracy is poor and the anti-interference ability is weak. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of this application, not all embodiments. All other embodiments and drawings obtained by ordinary technicians in this field based on the embodiments of this application without creative work are within the scope of protection of this application.
[0018] FIG1 is a schematic diagram of a related two-dimensional code image provided by an exemplary embodiment of the present application;
[0019] FIG2 is a schematic diagram of a flow chart of a method for generating a QR code image according to an embodiment of the present application;
[0020] FIG3 is a schematic diagram of a QR code pattern provided in one embodiment of the present application;
[0021] FIG4 is a schematic diagram of a QR code pattern provided in another embodiment of the present application;
[0022] FIG5 is a schematic diagram of a QR code pattern provided in another embodiment of the present application;
[0023] FIG6 is a schematic diagram of a QR code pattern and a background pattern provided in one embodiment of the present application;
[0024] FIG7 is a schematic diagram of a QR code pattern and a background pattern provided by another embodiment of the present application;
[0025] FIG8 is a schematic diagram of a QR code image provided by an embodiment of the present application;
[0026] FIG9 is a schematic diagram of a QR code image provided by another embodiment of the present application;
[0027] FIG10 is a schematic diagram of a QR code image provided by another embodiment of the present application;
[0028] FIG11 is a schematic flow chart of a method for generating a QR code image according to another embodiment of the present application;
[0029] FIG12 is a schematic diagram of a QR code image provided in yet another embodiment of the present application;
[0030] FIG13 is a schematic diagram of a QR code image provided in another embodiment of the present application;
[0031] FIG14 is a schematic diagram of a QR code image provided by yet another embodiment of the present application;
[0032] FIG15 is a flow chart of a method for recognizing a two-dimensional code image according to an embodiment of the present application;
[0033] FIG16 is a schematic diagram of a first angle provided by an exemplary embodiment of the present application;
[0034] FIG17 is a schematic structural diagram of a device for generating a two-dimensional code image according to an embodiment of the present application;
[0035] FIG18 is a schematic diagram of the structure of a two-dimensional code image recognition device provided in an embodiment of the present application;
[0036] FIG19 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
[0037] FIG20 is a schematic structural diagram of an autonomous mobile device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0039] Referring to FIG. 2 , FIG. 2 is a flow chart illustrating a method for generating a QR code image according to an embodiment of the present application. The method can be applied to electronic devices. As shown in FIG. 2 , the method can include steps S110 to S130.
[0040] Step S110: Acquire a two-dimensional code pattern, where the two-dimensional code pattern includes preset information.
[0041] In an embodiment of the present application, the QR code pattern includes a positioning pattern and a dot pattern. The positioning pattern is used to identify the main direction of the QR code pattern, and the main direction may be the direction in which the QR code image does not have an angular offset compared to the camera. The dot pattern is used to record preset information. Among them, the preset information can be determined according to the actual application scenario of the QR code image. For example, if the QR code pattern is applied to a visual navigation scenario, the preset information may be the position information of the QR code pattern, for example, the posture information of the QR code in the visual navigation scenario.
[0042] In some embodiments, the two-dimensional code pattern may be a DM (Data Matrix) two-dimensional code, and the positioning pattern may be an L-shaped pattern. As shown in FIG3 , the L-shaped pattern overlaps with two adjacent boundaries of the dot matrix pattern.
[0043] In other embodiments, the positioning pattern may be a pattern obtained by combining three patterns of predetermined shapes. As shown in FIG4 , the QR code pattern may be a QR (Quick Response) QR code, and the pattern of predetermined shape may be a pattern obtained by combining three rectangular patterns, wherein the centers of the three rectangular patterns coincide and the sizes of the three rectangular patterns are different, and the colors of the innermost and outermost rectangular patterns (e.g., black) are opposite to the color of the middle rectangular pattern (e.g., white). As shown in FIG5 , the pattern of predetermined shape may be a pattern obtained by combining three circular patterns, wherein the centers of the three circular patterns coincide and the sizes of the three circular patterns are different, and the colors of the innermost and outermost circular patterns (e.g., black) are opposite to the color of the middle circular pattern (e.g., white).
[0044] In some embodiments, the preset information can be input by the user. After obtaining the preset information, a dot pattern corresponding to the preset information can be generated based on the preset information, and then the positioning pattern and the dot pattern can be combined to obtain a QR code pattern. In other embodiments, the positioning pattern in the QR code pattern can also be directly generated based on the preset information.
[0045] Step S120: generating a background pattern for the two-dimensional code pattern, where the background pattern coincides with the center of the two-dimensional code pattern and has a size larger than that of the two-dimensional code pattern.
[0046] The background pattern refers to the pattern that serves as the background for the QR code pattern. In other words, the QR code pattern is the foreground pattern compared to the background pattern, meaning it floats above the background pattern. Setting the background pattern size larger than the QR code pattern prevents the corners of the QR code pattern from contacting the background pattern's boundaries, thereby improving the accuracy and efficiency of identifying the background pattern and the QR code pattern.
[0047] In some embodiments, the background pattern can be a circular pattern. For example, a circular pattern with a diameter greater than the diagonal length of the QR code pattern can be generated with the center of the QR code pattern as the center of the circle. This pattern serves as the background pattern of the QR code pattern. This prevents the corners of the QR code pattern from contacting the boundary of the circular pattern, thereby improving the accuracy and efficiency of identifying the background pattern and the QR code pattern. In addition, compared to other patterns, the circular pattern is not affected by camera lens distortion, which can improve the background pattern's anti-interference ability.
[0048] In some embodiments, the background pattern and the QR code pattern are set to different colors. The dot pattern and the finder pattern in the QR code pattern are typically the same color. In some embodiments, the color of the QR code pattern can be obtained, and then the background pattern is set to a different color from the QR code pattern to facilitate distinguishing the background pattern from the QR code pattern, thereby improving the accuracy and efficiency of identifying the background pattern and the QR code pattern.
[0049] For example, the background pattern and the QR code pattern can be set to opposite colors of black and white. For example, in Figure 6 , the QR code pattern is white and the circular background pattern is black. In Figure 7 , the QR code pattern is black and the circular background pattern is white. It is understood that the black rectangle in Figure 7 is drawn to facilitate the display of the white circle and can be understood as part of the rectangular base described below.
[0050] Step S130: generating at least three auxiliary positioning patterns outside the background pattern to obtain a two-dimensional code image, wherein the auxiliary positioning patterns correspond to corner points of the two-dimensional code pattern.
[0051] Each auxiliary positioning pattern corresponds to a corner point of the QR code pattern, so that at least three auxiliary positioning patterns are symmetrical. Even if some auxiliary positioning patterns exceed the shooting field of view, at least three auxiliary positioning patterns can be completed based on symmetry, thereby realizing the main direction positioning of the QR code image. It has strong anti-interference ability and can improve the robustness of QR code image recognition.
[0052] It should be understood that in order to ensure that the main direction of the QR code pattern can be accurately located, the number of auxiliary positioning patterns should be at least three. Three, four, five, etc. auxiliary positioning patterns can be set, but setting too many auxiliary positioning patterns will increase the detection time of the auxiliary positioning patterns. Preferably, three or four auxiliary positioning patterns can be set.
[0053] In some embodiments, as shown in Figure 8, three auxiliary positioning patterns are generated outside the background pattern, wherein the center line of the three auxiliary positioning patterns is an isosceles right triangle and the midpoint of the hypotenuse of the isosceles right triangle coincides with the center of the QR code pattern, thereby facilitating the positioning of the three corner points of the QR code pattern according to the three auxiliary positioning patterns, thereby determining the offset angle and main direction of the QR code pattern.
[0054] In some embodiments, as shown in FIG9 , four auxiliary positioning patterns are generated outside the background pattern, wherein the center line of the four auxiliary positioning patterns is a rectangle and the center of the rectangle coincides with the center of the two-dimensional code pattern, and the distances between the four auxiliary positioning patterns are the same. Setting four auxiliary positioning patterns can facilitate locating the four corner points of the two-dimensional code pattern according to the four auxiliary positioning patterns, thereby determining the offset angle and the main direction of the two-dimensional code pattern. It should be understood that the four auxiliary positioning patterns are more symmetrical and have stronger anti-interference capabilities than the three auxiliary positioning patterns. It is preferred to set four auxiliary positioning patterns so that each auxiliary positioning pattern corresponds to a corner point of the two-dimensional code pattern, thereby improving the anti-interference capability of the two-dimensional code image and the efficiency and accuracy of identifying the main direction of the two-dimensional code pattern as much as possible, and the difficulty of detecting the auxiliary positioning patterns is not high.
[0055] In some embodiments, the auxiliary positioning pattern can be set as a circular pattern. This can improve the background pattern's anti-interference ability by leveraging the fact that circular patterns are less affected by camera lens distortion than other patterns. For example, as shown in Figure 9, at least three circular patterns can be generated outside the background pattern as auxiliary positioning patterns. The auxiliary positioning patterns can be the same color as the background pattern, facilitating the simultaneous recognition of the background pattern and the auxiliary positioning patterns, thereby improving pattern recognition efficiency.
[0056] In other embodiments, as shown in FIG10 , at least three auxiliary positioning patterns of preset shapes can be generated outside the background pattern, wherein each auxiliary positioning pattern of the preset shape can include two circular patterns with overlapping centers, different sizes, and different colors. For example, as shown in FIG10 , the color of the outer circular pattern of the two circular patterns can be the same as the color of the background pattern, that is, black, and the color of the inner circular pattern can be different from the color of the outer circular pattern, for example, white. In this case, the auxiliary positioning pattern of the preset shape can be regarded as a circular ring pattern, and the inner circular pattern with an inverted color is embedded in the outer circular pattern, which can enhance the anti-interference ability of the auxiliary positioning pattern and enhance the robustness of the auxiliary positioning pattern.
[0057] In some embodiments, as shown in Figures 8 to 10, the auxiliary positioning pattern and the background pattern can both be set as circular patterns, which can facilitate the identification of the background pattern and the auxiliary positioning pattern together, improve the pattern recognition efficiency, and simultaneously utilize the characteristic of the circular pattern that is not affected by camera distortion to improve the anti-interference ability of the auxiliary positioning pattern and the background pattern.
[0058] Based on step S110 to step S130, a two-dimensional code image can be generated based on the two-dimensional code pattern, the background pattern and at least three auxiliary positioning patterns. The generated two-dimensional code image has a background pattern and at least three auxiliary positioning patterns added to the conventional two-dimensional code pattern. Wherein, at least three auxiliary positioning patterns are arranged outside the background pattern, so that there is a certain distance between the auxiliary positioning pattern and the two-dimensional code pattern in the background pattern, thereby improving the accuracy, efficiency and stability of identifying the auxiliary positioning patterns. In addition, at least three auxiliary positioning patterns correspond to at least three corner points of the two-dimensional code pattern respectively, and have symmetry. Even if part of the auxiliary positioning pattern exceeds the shooting field of view, at least three auxiliary positioning patterns can be supplemented based on symmetry, thereby realizing the main direction positioning of the two-dimensional code image, and having strong anti-interference ability, which can improve the robustness of two-dimensional code image recognition. Therefore, the two-dimensional code image generation method provided by the present application can solve the problems of low efficiency, poor accuracy and weak anti-interference ability of current two-dimensional code image recognition.
[0059] To facilitate printing and unify the QR code image, in some embodiments, as shown in FIG11 , the QR code image generation method may further include the following steps S140: generating a rectangular base for the QR code image to obtain a QR code pattern, wherein the rectangular base includes a QR code pattern, a background pattern, and at least three auxiliary positioning patterns.
[0060] The rectangular base can be set to a different color from the background pattern and the auxiliary positioning pattern, thereby facilitating the distinction between the rectangular base and the background pattern and the auxiliary positioning pattern, thereby improving the efficiency and accuracy of identifying the background pattern and the auxiliary positioning pattern. For example, as shown in Figure 12, if the background pattern and the auxiliary positioning pattern are black, the rectangular base can be set to white or colorless. As shown in Figure 13, if the background pattern and the auxiliary positioning pattern are white, the rectangular base can be set to black.
[0061] In some embodiments, as shown in Figures 12 to 14, a reference line segment can be generated on the perpendicular bisectors of the four sides of the rectangular base, and the reference line segment does not overlap with the QR code pattern. The reference line segment is used to help relevant personnel accurately paste the QR code image, thereby improving the accuracy of the position of the QR code image. For example, when the QR code image is made into a printed matter and affixed to the ground or wall or displayed on a display device, the actual position of the QR code can be determined based on the correspondence between the reference line segment and other position markers outside the QR code image, so that the position of the QR code image can be adjusted to improve the accuracy of the position of the QR code image. For example, the reference line segment in the QR code image made into a printed matter can be aligned with the position marker on the ground as much as possible, thereby improving the accuracy of the position of the QR code. It should be understood that in order to facilitate viewing of the reference line segment, as shown in Figures 12 to 14, the color of the reference line segment should be set to a different color from the background pattern.
[0062] In some embodiments, as shown in Figures 12 to 14, an information string can be generated on a rectangular base, and the information string does not overlap with the QR code pattern. Among them, the information string can be used for information related to the QR code pattern, such as the location information, name, photo and other information of the QR code pattern. The information string is used to prevent errors in the installation position of the QR code image during the installation of the QR code image. For example, when relevant personnel install the QR code image, they can directly use the information string to distinguish the QR code images corresponding to different positions to prevent relevant personnel from confusing the QR code images that should be installed in different positions. It should be understood that in order to facilitate viewing the information string, as shown in Figures 12 to 14, the color of the information string should be set to a different color from the rectangular base.
[0063] In some embodiments, as shown in Figures 12 to 14, reference line segments can be generated on the perpendicular bisectors of the four sides of the rectangular base, where the reference line segments do not overlap with the QR code pattern. An information string can also be generated on the rectangular base, where the information string does not overlap with the QR code pattern. The information string can overlap or not overlap with the reference line segments.
[0064] See Figure 15, which is a flow chart of the two-dimensional code image recognition method provided in an embodiment of the present application. The two-dimensional code image recognition method is used to identify a two-dimensional code image generated by the two-dimensional code image generation method in the present application. The two-dimensional code image recognition method can be applied to electronic devices or autonomous mobile devices. Autonomous mobile devices may include but are not limited to automated guided vehicles (AGVs) and autonomous mobile robots (AMRs). The two-dimensional code image recognition method may include steps S210 to S240.
[0065] Step S210: Identify the area to be detected in the captured image, wherein the area to be detected is centered on the center of the QR code pattern and has the same size as the size of the QR code image.
[0066] The image can be captured by a camera on the autonomous mobile device. The camera should be mounted in a position corresponding to the location where the QR code image is mounted. For example, if the QR code image is mounted on the ground, the camera should be mounted in a position that ensures that the camera can capture the QR code image on the ground.
[0067] After capturing an image using a camera, the autonomous mobile device can detect whether the captured image contains a QR code pattern. If the captured image contains a QR code pattern, a detection area can be determined based on the center of the QR code pattern. The detection area has the same base size as the QR code image. If the captured image does not contain a QR code pattern, the autonomous mobile device can continue capturing images.
[0068] For example, corner extraction can be performed on the captured image to generate a corner density map. Based on the shape and size of the image in the corner density map, it is determined whether the image in the corner density map includes a QR code pattern. If a QR code pattern is included, a graphic morphological dilation can be performed on the portion corresponding to the QR code pattern, and a circumscribed rectangle can be fitted based on the expanded graphic. The center of the circumscribed rectangle is obtained, and the area to be detected is determined at the center of the circumscribed rectangle. For example, the area to be detected can be the same shape and size as the base of the QR code image, or it can be a rectangular area of the same size as the print size of the QR code image.
[0069] Among them, the Fast (Features from accelerated segment test) corner extraction method can be adopted to perform corner extraction on the captured image to obtain a corner map. The principle of the Fast corner extraction method is to take a detection point in the image, and determine whether the detection point is a corner point based on the pixel points in the surrounding neighborhood with the point as the center. That is to say, if a certain number of pixels around a pixel have different pixel values from the point, it is considered to be a corner point. It should be understood by those skilled in the art that in addition to the Fast corner extraction method, other corner extraction methods can also be used to perform corner extraction operations on the third layer image, such as the Scale Invariant Feature Transform (SIFT) algorithm or the Harris algorithm.
[0070] After obtaining the corner map, at least one connected domain in the corner map can be determined. The connected domain of an image refers to an area in the image consisting of pixels with the same pixel value and adjacent positions. Connected domain analysis refers to finding independent connected domains in an image and marking them. Generally, a connected domain contains only one pixel value. In order to prevent the influence of pixel value fluctuations on the extraction of different connected domains, the embodiment of the present application can first perform binary division on the pixels in the corner map, and then use the image after binary division to perform connected domain analysis to improve the accuracy of the determined connected domain.
[0071] In some embodiments, after obtaining the corner point map, the corner point map may be divided into grids, and the number of corner points included in each grid is determined as the grayscale value of each grid to form a corner point density map.
[0072] In other embodiments, in order to improve accuracy, the corner point density map can be subjected to binary segmentation, hole filling and opening operations in sequence to form a binary corner point density map, in which there are only two types of pixels, black and white. The connected domain analysis method can be used to perform connected domain segmentation on the binary corner point density map to obtain at least one connected domain.
[0073] Connected domain analysis methods may include, but are not limited to, two-pass scanning and seed filling methods. In the embodiment of the present application, connected domain search based on the angle density map can effectively cope with the lighting changes that affect the captured image in actual working scenes, thereby improving the robustness of QR code image positioning.
[0074] Among them, the binary segmentation method may include but is not limited to the Otsu's method (OTSU) threshold segmentation algorithm, the adaptive threshold segmentation algorithm, the maximum entropy threshold segmentation algorithm, and the iterative threshold segmentation algorithm. Among them, OTSU uses the idea of clustering to divide the grayscale of the image into two parts according to the grayscale level, so that the grayscale value difference between the two parts is maximized and the grayscale difference between each part is minimized, and a suitable grayscale level is found for division by calculating the variance. The OTSU algorithm is simple in calculation and is not affected by the brightness and contrast of the image. Therefore, preferably, the OTSU algorithm can be used to perform binary segmentation on the corner density map with the minimum probability of misclassification.
[0075] Hole filling refers to the process of filling holes. A hole is a background area bounded by foreground pixels. Hole filling is the process of closing a hole.
[0076] Image opening refers to the process of sequentially eroding and dilating an image. Erosion removes noise, but also compresses the image. Dilation of the eroded image removes noise while preserving the original image. The aforementioned hole filling operations are often closed operations, meaning they close the holes. Denoising, on the other hand, generally involves opening operations, filtering out small white noise points. Opening operations can be used to eliminate small objects, separate objects at fine points, and smooth the boundaries of larger objects without changing their area.
[0077] In some embodiments, to facilitate image processing, distortion correction may be performed on the captured image first, and then the image after distortion correction may be binarized before corner extraction.
[0078] It should be understood that, ideally, when the camera captures a complete QR code image, the area to be detected should include the QR code pattern, at least three auxiliary positioning patterns, and the background pattern. However, in actual shooting, due to factors such as the camera's shooting angle or range, the determined area to be detected may not include the complete QR code pattern, at least three auxiliary positioning patterns, and the background pattern. It may include only the QR code pattern, or the QR code pattern, two auxiliary positioning patterns, and the background pattern.
[0079] The computational complexity of step S210 is small, and the captured images can be screened, and only the images including the QR code pattern are processed in subsequent steps S220 to S240, without processing the images not including the QR code pattern, thereby reducing unnecessary calculations and time consumption and saving system power consumption.
[0080] Step S220: Detecting a background pattern and at least three auxiliary positioning patterns in the area to be detected.
[0081] The specific detection method used can be determined based on the shapes of the background pattern and at least three auxiliary positioning patterns. For example, for circular patterns, the EDCircle algorithm can be used to detect circular patterns. For rectangular patterns, the EDLine algorithm can be used to detect line segments, then fit closed line segments, and detect rectangular patterns based on their dimensions.
[0082] In some embodiments, the background pattern and at least three auxiliary positioning patterns are all circular patterns (or ring patterns), and a circle detection algorithm, such as the EDCircle algorithm, can be used. In the area to be detected, the background pattern and at least three auxiliary positioning patterns are detected simultaneously according to the sizes of the background pattern and at least three auxiliary positioning patterns, thereby improving the detection efficiency of the background pattern and at least three auxiliary positioning patterns.
[0083] In some other embodiments, if the background pattern and the at least three auxiliary positioning patterns are circles of different shapes, the background pattern and the at least three auxiliary positioning patterns may be detected separately.
[0084] Step S230: Determine the main direction of the QR code pattern according to the detection result.
[0085] The detection results here include the detection results of the background pattern and at least three auxiliary positioning patterns. As previously mentioned, the main direction of the QR code pattern can refer to the direction in which the QR code image is not angularly offset relative to the camera. In other words, in the main direction of the QR code pattern, the preset information can be correctly decoded from the dot pattern of the QR code pattern.
[0086] In some embodiments, the role of the background pattern is to dynamically determine the mapping relationship between pixel coordinates and physical coordinates, thereby facilitating the calculation of subsequent steps and improving the accuracy of the calculation. If a background pattern is detected, the mapping relationship between pixel coordinates and physical coordinates is determined based on the background pattern; based on the mapping relationship, the main direction of the QR code pattern is determined. For example, if the background pattern is a circular pattern, the diameter of the background pattern can be obtained as a reference for dynamically calculating the physical proportion of the pixels of the graphic, that is, the mapping relationship between pixel coordinates and physical coordinates can be calculated based on the diameter of the background pattern. For details on how to calculate the mapping relationship, please refer to the relevant technology and will not be described in detail here.
[0087] In some embodiments, if at least three auxiliary positioning patterns are detected, a first angle is determined based on the at least three auxiliary positioning patterns; a second angle of the QR code pattern is determined based on the positioning pattern in the QR code pattern; and a main direction of the QR code pattern is determined based on the first angle and the second angle.
[0088] The first angle is the angle corresponding to the middle auxiliary positioning pattern when the centers of any three adjacent auxiliary positioning patterns among the at least three auxiliary positioning patterns are sequentially connected. As shown in Figure 16, when the centers (i.e., the centers of the circles) of any three adjacent auxiliary positioning patterns 1-3 are connected, the angle θ corresponding to auxiliary positioning pattern 2 is the first angle.
[0089] The second angle is the angle of the positioning pattern. As shown in Figure 3, if the positioning pattern in the QR code is an L-shaped pattern, the angle between the two sides of the L-shaped pattern can be the second angle. As shown in Figure 4, if the positioning pattern is a combination of three predetermined shapes, then similar to the first angle, the second angle is the angle corresponding to the center positioning pattern when the centers of the three positioning patterns are connected in sequence.
[0090] For example, the difference between the first angle and the second angle can be calculated. The difference is the offset angle of the QR code pattern, that is, the required rotation angle. The QR code pattern can be rotated according to the difference to obtain the main direction of the QR code pattern. It is understandable that the difference can also be used as the main direction of the QR code pattern.
[0091] In some embodiments, if two auxiliary positioning patterns are detected, at least three auxiliary positioning patterns are completed based on the positional relationship between the three auxiliary positioning patterns; a first angle is determined based on the at least three auxiliary positioning patterns; a second angle of the QR code pattern is determined based on the positioning pattern in the QR code pattern; and a main direction of the QR code pattern is determined based on the first angle and the second angle.
[0092] In some embodiments, if fewer than two auxiliary positioning patterns are detected, the positioning pattern within the QR code pattern can be detected, and the primary direction of the QR code pattern can be determined based on the positioning pattern within the QR code pattern. For example, as shown in FIG3 , if the positioning pattern is an L-shaped pattern, the EDLine algorithm can be used to detect line segments within the area to be detected. Based on the positional relationship between the line segments and the length relationship between the line segments, a pair of line segments with an L-shaped shape and a length equal to the length of the two sides of the L-shaped pattern are selected as the L-shaped pattern. Edge gradient detection can be performed on the L-shaped pattern to fit a more accurate L-shaped pattern.
[0093] Step S240: Based on the main direction, obtain preset information.
[0094] In some embodiments, if at least three auxiliary positioning patterns are detected, the four corner points of the QR code pattern are determined based on the at least three auxiliary positioning patterns. Based on the four corner points, a decoding area for the QR code pattern is determined. The decoding area includes a dot pattern. For example, the decoding area may be a rectangular area formed by connecting lines of the four corner points. Based on the main direction, the dot pattern in the decoding area is decoded to obtain the preset information, thereby ensuring that the dot pattern is decoded in the main direction of the QR code pattern and the correct preset information is obtained.
[0095] In some embodiments, if two auxiliary positioning patterns are detected, at least three auxiliary positioning patterns are completed; based on the at least three auxiliary positioning patterns, the four corner points of the QR code pattern are determined; based on the four corner points, the decoding area of the QR code pattern is determined, and the decoding area includes a dot matrix pattern; based on the main direction, the dot matrix pattern in the decoding area is decoded to obtain preset information, thereby ensuring that the dot matrix pattern is decoded in the main direction of the QR code pattern to obtain correct preset information.
[0096] It should be understood that no matter how many auxiliary positioning patterns there are on the QR code image, as long as two auxiliary positioning patterns are identified, the four auxiliary positioning patterns can be completed based on the positional relationship of the center lines of the four auxiliary positioning patterns forming a rectangle. The four auxiliary positioning patterns correspond to the four corner points of the QR code pattern respectively.
[0097] In some embodiments, if fewer than two auxiliary positioning patterns are detected, the decoding area of the QR code pattern is determined based on the positioning pattern in the QR code pattern, and the decoding area includes a dot matrix pattern; based on the main direction, the dot matrix pattern in the decoding area is decoded to obtain preset information, thereby ensuring that the dot matrix pattern is decoded in the main direction of the QR code pattern to obtain correct preset information.
[0098] Since the positioning pattern in the QR code pattern has a certain positional relationship with the four corner points of the QR code pattern, the four corner points of the QR code pattern can be inferred based on the positioning pattern. As shown in Figure 3, if the positioning pattern is an L-shaped pattern, the four corner points of the QR code pattern can be inferred based on the size and shape (known) of the L-shaped pattern and the QR code pattern. As shown in Figure 3, the QR code pattern is a square, where two adjacent sides of the square are solid line L sides, and the other two sides are dotted line L sides. When the solid line L side and its position are obtained, the four corner points of the QR code pattern can be inferred based on the positional relationship and length relationship between the solid line L side and the dotted line L side. The rectangular area formed by the four corner points is the decoding area.
[0099] After obtaining the decoding area, the grayscale value of the code block in the decoding area can be sampled to obtain a dot pattern. Based on the main direction, a decoding method corresponding to the encoding method of the dot pattern can be adopted to decode the dot pattern to obtain preset information, such as the position information of the QR code pattern.
[0100] Based on steps S210 to S240, at least three auxiliary positioning patterns are set outside the background pattern, so that there is a certain distance between the auxiliary positioning pattern and the two-dimensional code pattern in the background pattern, thereby improving the accuracy, efficiency and stability of identifying the auxiliary positioning pattern. In addition, at least three auxiliary positioning patterns correspond to at least three corner points of the two-dimensional code pattern respectively, and have symmetry. Even if some auxiliary positioning patterns exceed the shooting field of view, at least three auxiliary positioning patterns can be supplemented based on symmetry, thereby realizing the main direction positioning of the two-dimensional code image, having strong anti-interference ability, and can improve the robustness of two-dimensional code image recognition. Therefore, the two-dimensional code image recognition method provided by the present application can solve the problems of low efficiency, poor accuracy and weak anti-interference ability of current two-dimensional code image recognition.
[0101] Referring to Figure 17 , Figure 17 is a schematic diagram of the structure of a QR code image generation device provided in an embodiment of the present application. The QR code image generation device 100 can be applied to electronic devices. The QR code image generation device 100 includes a coding pattern acquisition module 110 , a background pattern generation module 120 , and an auxiliary pattern generation module 130 .
[0102] The coding pattern acquisition module 110 is configured to acquire a two-dimensional code pattern, where the two-dimensional code pattern includes preset information.
[0103] The background pattern generating module 120 is configured to generate a background pattern of the two-dimensional code pattern. The background pattern coincides with the center of the two-dimensional code pattern and has a size larger than that of the two-dimensional code pattern.
[0104] The auxiliary pattern generating module 130 is configured to generate at least three auxiliary positioning patterns outside the background pattern to obtain a two-dimensional code image, wherein the auxiliary positioning patterns correspond to corner points of the two-dimensional code pattern.
[0105] In some embodiments, the background pattern generating module 120 is further configured to set the background pattern and the QR code pattern to different colors.
[0106] In some embodiments, the background pattern generating module 120 is further configured to generate a circular pattern with a diameter greater than the diagonal length of the QR code pattern, with the center of the QR code pattern as the center of the circle, as the background pattern of the QR code pattern.
[0107] In some embodiments, the auxiliary pattern generation module 130 is also used to generate four auxiliary positioning patterns outside the background pattern, wherein the center line connecting the four auxiliary positioning patterns is a rectangle; or to generate three auxiliary positioning patterns outside the background pattern, wherein the center line connecting the three auxiliary positioning patterns is an isosceles right triangle.
[0108] In some embodiments, the auxiliary pattern generating module 130 is further configured to generate at least three circular patterns outside the background pattern as auxiliary positioning patterns.
[0109] In some embodiments, the auxiliary pattern generation module 130 is further configured to generate at least three auxiliary positioning patterns of preset shapes outside the background pattern, wherein each auxiliary positioning pattern of preset shape includes two circular patterns with overlapping centers, different sizes, and different colors.
[0110] In some embodiments, the QR code image generating device 100 further includes a base generating module, which is used to generate a rectangular base of the QR code image to obtain a QR code pattern, wherein the rectangular base includes a QR code pattern, a background pattern, and at least three auxiliary positioning patterns.
[0111] In some embodiments, the base generation module is further used to generate reference line segments on the perpendicular bisectors of the four sides of the rectangular base, where the reference line segments do not overlap with the QR code pattern; and / or to generate information character strings on the rectangular base, where the information character strings do not overlap with the QR code pattern.
[0112] Those skilled in the art will clearly understand that the two-dimensional code image generation method and apparatus provided in the embodiments of the present application can implement the two-dimensional code image generation method provided in the embodiments of the present application. The specific working process of the above-described device and module can refer to the corresponding process of the method in the embodiments of the present application, and will not be repeated here.
[0113] In the embodiments provided in the present application, the coupling, direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication coupling through some interfaces, devices or modules, and may be electrical, mechanical or other forms, and the embodiments of the present application do not impose specific limitations on this.
[0114] In addition, the functional modules in the embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0115] Referring to Figure 18 , Figure 18 is a schematic diagram of the structure of a QR code image recognition device provided in an embodiment of the present application. The QR code image recognition device 200 is used to recognize a QR code image generated using the QR code image generation method of the present application. The QR code image recognition device 200 can be applied to electronic devices or autonomous mobile devices. Autonomous mobile devices may include, but are not limited to, automated guided vehicles (AGVs) or automated mobile robots (AMRs). The QR code image recognition device 200 includes a region detection module 210, a pattern detection module 220, a direction determination module 230, and an information decoding module 240.
[0116] The area detection module 210 is used to identify the area to be detected in the captured image, wherein the area to be detected is centered on the center of the QR code pattern and has the same size as the size of the QR code image.
[0117] The pattern detection module 220 is configured to detect a background pattern and at least three auxiliary positioning patterns in the area to be detected.
[0118] The direction determination module 230 is configured to determine the main direction of the QR code pattern according to the detection result.
[0119] The information decoding module 240 is configured to obtain preset information based on the main direction.
[0120] In some embodiments, the direction determination module 230 is further configured to, if at least three auxiliary positioning patterns are detected, determine a first angle based on the at least three auxiliary positioning patterns; or, if two auxiliary positioning patterns are detected, to complement the at least three auxiliary positioning patterns and determine the first angle based on the at least three auxiliary positioning patterns; determine a second angle of the QR code pattern based on the positioning pattern in the QR code pattern; and determine a primary direction of the QR code pattern based on the first and second angles. The information decoding module 240 is further configured to determine four corner points of the QR code pattern based on the at least three auxiliary positioning patterns; determine a decoding area of the QR code pattern based on the four corner points, the decoding area comprising a dot pattern; and decode the dot pattern in the decoding area based on the primary direction to obtain preset information.
[0121] In some embodiments, the direction determination module 230 is further configured to determine the primary direction of the QR code pattern based on the positioning pattern in the QR code pattern if the number of detected auxiliary positioning patterns is less than two. The information decoding module 240 is further configured to determine a decoding area of the QR code pattern based on the positioning pattern in the QR code pattern, the decoding area including a dot pattern; and decode the dot pattern in the decoding area based on the primary direction to obtain preset information.
[0122] In some embodiments, the direction determination module 230 is further configured to determine a mapping relationship between pixel coordinates and physical coordinates based on a background pattern if a background pattern is detected; and determine a main direction of the QR code pattern based on the mapping relationship.
[0123] In some embodiments, the area detection module 210 is also used to detect whether the captured image includes a QR code pattern; if it is detected that the captured image includes a QR code pattern, the area to be detected is determined based on the center of the QR code pattern, and the area to be detected has the same base size as the QR code image.
[0124] Those skilled in the art will clearly understand that the two-dimensional code image recognition method and apparatus provided in the embodiments of the present application can implement the two-dimensional code image recognition method provided in the embodiments of the present application. The specific working process of the above-described device and module can refer to the corresponding process of the method in the embodiments of the present application, and will not be repeated here.
[0125] In the embodiments provided in the present application, the coupling, direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication coupling through some interfaces, devices or modules, and may be electrical, mechanical or other forms, and the embodiments of the present application do not impose specific limitations on this.
[0126] In addition, the functional modules in the embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0127] Referring to Figure 19, which is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, the electronic device 300 may include a memory 310 and a processor 320. The memory 310 stores an application program, and the processor 320 executes the QR code image generation method or QR code image recognition method provided in an embodiment of the present application when calling the application program.
[0128] The memory 310 may include a random access memory (RAM) or a read-only memory (ROM). The memory 310 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 310 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, and the like. The data storage area may store data created by the electronic device 300 during use, and the like.
[0129] The processor 320 may include one or more processing cores. The processor 320 uses various interfaces and lines to connect various parts of the entire electronic device 300 and is used to run or execute instructions, programs, code sets, or instruction sets stored in the memory 310, as well as call and execute data stored in the memory 310, perform various functions of the electronic device 300, and process data.
[0130] The processor 320 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 320 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to handle wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 320, but may be implemented separately through a communication chip.
[0131] Referring to Figure 20, which is a schematic diagram of the structure of an autonomous mobile device provided in an embodiment of the present application, the autonomous mobile device 400 may include a memory 410 and a processor 420. The memory 410 stores an application program, and the processor 420 executes the QR code image recognition method provided in an embodiment of the present application when calling the application program.
[0132] The memory 410 may include RAM or ROM. The memory 410 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 310 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, and the like. The data storage area may store data generated by the autonomous mobile device 400 during use, and the like.
[0133] The processor 420 may include one or more processing cores. The processor 420 connects various components within the autonomous mobile device 400 using various interfaces and lines. The processor 420 is used to run or execute instructions, programs, code sets, or instruction sets stored in the memory 410, and to call and execute data stored in the memory 410, thereby performing various functions of the autonomous mobile device 400 and processing data.
[0134] Processor 420 can be implemented using at least one of the following hardware forms: a DSP, an FPGA, or a PLA. Processor 420 may integrate one or a combination of a CPU, a GPU, and a modem. The CPU primarily handles the operating system, user interface, and application programs. The GPU is responsible for rendering and drawing display content; the modem handles wireless communications. It is understood that the modem may not be integrated into processor 420, but may be implemented as a separate communications chip.
[0135] An embodiment of the present application also provides a computer-readable storage medium having program code stored thereon. When a processor calls the program code, the two-dimensional code image generation method or the two-dimensional code image recognition method provided in the embodiment of the present application is executed.
[0136] The computer-readable storage medium may be an electronic memory such as a flash memory, an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a hard disk, or a ROM.
[0137] In some embodiments, the computer-readable storage medium includes a non-volatile computer-readable medium (Non-Transitory Computer-Readable Storage Medium, referred to as Non-TCRSM). The computer-readable storage medium has storage space for program codes that execute any method step in the above method. These program codes can be read from or written into one or more computer program products. The program code can be compressed in an appropriate form.
[0138] 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 aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for generating a two-dimensional code image, characterized in that: include: Obtaining a QR code pattern, wherein the QR code pattern includes preset information; Generate a background pattern for the QR code pattern, where the background pattern coincides with the center of the QR code pattern and is larger than the size of the QR code pattern; At least three auxiliary positioning patterns are generated outside the background pattern to obtain a two-dimensional code image, wherein the auxiliary positioning patterns correspond to corner points of the two-dimensional code pattern.
2. The method according to claim 1, characterized in that The generating of the background pattern of the two-dimensional code pattern comprises: Set the background pattern and QR code pattern to different colors.
3. The method according to claim 1-2, characterized in that The generating of the background pattern of the two-dimensional code pattern comprises: With the center of the QR code pattern as the center of the circle, a circular pattern with a diameter greater than the diagonal length of the QR code pattern is generated as the background pattern of the QR code pattern.
4. The method according to any one of claims 1 to 3, characterized in that The generating of at least three auxiliary positioning patterns outside the background pattern includes: Generate four auxiliary positioning patterns outside the background pattern, wherein a line connecting the centers of the four auxiliary positioning patterns forms a rectangle; or Three auxiliary positioning patterns are generated outside the background pattern, wherein a line connecting the centers of the three auxiliary positioning patterns forms an isosceles right triangle.
5. The method according to any one of claims 1 to 3, characterized in that The generating of at least three auxiliary positioning patterns outside the background pattern includes: At least three circular patterns are generated outside the background pattern as auxiliary positioning patterns.
6. The method according to any one of claims 1 to 3, characterized in that The generating of at least three auxiliary positioning patterns outside the background pattern includes: At least three auxiliary positioning patterns of preset shapes are generated outside the background pattern, wherein each auxiliary positioning pattern of preset shape includes two circular patterns with overlapping centers, different sizes and different colors.
7. The method according to claims 1-6, characterized in that The method further comprises: A rectangular base of a two-dimensional code image is generated to obtain a two-dimensional code pattern, wherein the rectangular base includes the two-dimensional code pattern, a background pattern, and at least three auxiliary positioning patterns.
8. The method according to claims 1-7, characterized in that The rectangular base for generating a two-dimensional code image includes: Generate reference line segments on the perpendicular bisectors of the four sides of the rectangular base, where the reference line segments do not overlap with the QR code pattern; and / or An information string is generated on a rectangular base, and the information string does not overlap with the QR code pattern.
9. The method according to claims 1-8, characterized in that The two-dimensional code pattern includes a positioning pattern and a dot matrix pattern. The positioning pattern is used to identify the main direction of the two-dimensional code pattern, and the dot matrix pattern is used to record preset information.
10. A two-dimensional code image recognition method, characterized in that: The two-dimensional code image includes a two-dimensional code pattern, a background pattern, and at least three auxiliary positioning patterns, the two-dimensional code pattern includes preset information, the background pattern coincides with the center of the two-dimensional code pattern and is larger than the size of the two-dimensional code pattern, and the auxiliary positioning patterns correspond to corner points of the two-dimensional code pattern and do not overlap with the background pattern. The method includes: Identify an area to be detected in the captured image, wherein the area to be detected is centered on the center of the QR code pattern and has the same size as the QR code image; In the area to be detected, detecting a background pattern and at least three auxiliary positioning patterns; Determine the main direction of the QR code pattern based on the detection results; Based on the main direction, preset information is obtained.
11. The method according to claim 10, characterized in that The two-dimensional code pattern includes a positioning pattern for identifying a main direction of the two-dimensional code pattern, and determining the main direction of the two-dimensional code pattern according to the detection result includes: If at least three auxiliary positioning patterns are detected, determining a first angle based on the at least three auxiliary positioning patterns; or if two auxiliary positioning patterns are detected, completing at least three auxiliary positioning patterns, and determining the first angle based on the at least three auxiliary positioning patterns; Determining a second angle of the QR code pattern according to a positioning pattern in the QR code pattern; A main direction of the two-dimensional code pattern is determined according to the first angle and the second angle.
12. The method according to claims 10-11, characterized in that The two-dimensional code pattern further includes a dot pattern for recording preset information, and obtaining the preset information based on the main direction includes: Determine four corner points of the QR code pattern based on at least three auxiliary positioning patterns; Determine a decoding area of the two-dimensional code pattern according to the four corner points, wherein the decoding area includes a dot pattern; Based on the main direction, the dot pattern in the decoding area is decoded to obtain preset information.
13. The method according to claims 10-12, characterized in that The two-dimensional code pattern includes a positioning pattern, and determining the main direction of the two-dimensional code pattern according to the detection result includes: If fewer than two auxiliary positioning patterns are detected, determining the main direction of the QR code pattern based on the positioning pattern in the QR code pattern; The acquiring of preset information based on the main direction includes: Determining a decoding area of the two-dimensional code pattern according to a positioning pattern in the two-dimensional code pattern, wherein the decoding area includes a dot pattern; Based on the main direction, the dot pattern in the decoding area is decoded to obtain preset information.
14. The method according to claims 10-13, characterized in that Determining the main direction of the QR code pattern according to the detection result includes: If a background pattern is detected, a mapping relationship between pixel coordinates and physical coordinates is determined based on the background pattern; Based on the mapping relationship, the main direction of the two-dimensional code pattern is determined.
15. The method according to claims 10-14, characterized in that The identifying the area to be detected in the captured image includes: Detecting whether the captured image includes a QR code pattern; If it is detected that the captured image includes a QR code pattern, an area to be detected is determined based on the center of the QR code pattern, and the area to be detected has the same base size as the QR code image.
16. A two-dimensional code image generating device, characterized in that: include: A coding pattern acquisition module, configured to acquire a two-dimensional code pattern, wherein the two-dimensional code pattern includes preset information; A background pattern generating module, configured to generate a background pattern for the QR code pattern, wherein the background pattern coincides with the center of the QR code pattern and is larger than the size of the QR code pattern; The auxiliary pattern generation module is used to generate at least three auxiliary positioning patterns outside the background pattern to obtain a two-dimensional code image, wherein the auxiliary positioning patterns correspond to the corner points of the two-dimensional code pattern.
17. A two-dimensional code image recognition device, characterized in that: The two-dimensional code image includes a two-dimensional code pattern, a background pattern, and at least three auxiliary positioning patterns, the two-dimensional code pattern includes preset information, the background pattern coincides with the center of the two-dimensional code pattern and is larger than the size of the two-dimensional code pattern, and the auxiliary positioning patterns correspond to the corner points of the two-dimensional code pattern and do not overlap with the background pattern. The device includes: An area detection module is used to identify an area to be detected in the captured image, wherein the area to be detected is centered on the center of the QR code pattern and has the same size as the QR code image; A pattern detection module, configured to detect a background pattern and at least three auxiliary positioning patterns in an area to be detected; A direction determination module, used to determine the main direction of the QR code pattern based on the detection results; The information decoding module is used to obtain preset information based on the main direction.
18. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores an application program, and the processor can implement the method according to any one of claims 1 to 9 or 11 to 15 when calling the application program.
19. An autonomous mobile device, characterized in that: include: A memory and a processor, wherein the memory stores an application program, and the processor can implement the method according to any one of claims 11 to 15 when calling the application program.
20. A computer-readable storage medium, characterized in that The computer-readable storage medium stores program code, and when the processor calls the program code, it can implement the method according to any one of claims 1 to 9 or 11 to 15.
Citation Information
Patent Citations
Two-dimensional code generation method and device for positioning mobile robot, and two-dimensional code identification method and device for positioning mobile robot
CN108154209A
Two-dimensional code generation and analysis method, device and equipment and readable storage medium
CN110288069A
Two-dimensional code image generation method and device, two-dimensional code image recognition method and device, electronic equipment and storage medium
CN118278446A
Two-dimensional code detection system and two-dimensional code detection program
US20070187512A1