Adaptive two-dimensional code beacon identification method and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NAT INNOVATION INST OF DEFENSE TECH PLA ACAD OF MILITARY SCI
- Filing Date
- 2026-06-11
- Publication Date
- 2026-08-07
AI Technical Summary
[0009]然而,该方法在实际应用中仍面临若干挑战与局限性:定位精度高度依赖摄像头分辨率、焦距参数及图像处理算法的准确性,在远距离或低分辨率条件下难以满足高精度需求
[0022]本发明的有益效果如下:大范围场景时,系统根据不同的距离和环境条件来选择使用不同的二维码组合来识别信标。当设备靠近信标时,使用单个二维码进行识别,而当设备距离信标较远时,单个二维码可能由于距离远、图像模糊或视角变化而难以识别,可以使用多个二维码组合来提高识别性能。
Smart Images

Figure CN122528931A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision, and in particular to an adaptive QR code beacon recognition method and system. Background Technology
[0002] Visual SLAM (VSLAM) is an important branch of SLAM technology. It primarily utilizes cameras to capture environmental images and analyzes visual information in consecutive image frames to achieve simultaneous localization and map building for mobile devices. Current VSLAM systems increasingly emphasize real-time performance and robustness in practical applications, aiming to improve the positioning accuracy of devices in complex and dynamic environments to meet the needs of scenarios such as rapid movement and real-time navigation. This provides reliable technical support for applications such as autonomous driving, service robots, and augmented reality (AR).
[0003] To further improve positioning performance, multi-sensor fusion methods have become a mainstream trend in research and application. Among them, visual-inertial odometry (VIO) can provide continuous and stable pose estimation in scenarios with limited visual information or rapid movement by fusing data from cameras and inertial measurement units (IMUs). However, VIO systems still face the problem of accumulated errors (drift), especially in long-term operation or environments with missing textures.
[0004] To overcome this challenge, introducing external auxiliary positioning information has become an effective means. A beacon is a device that can emit specific signals or identifiers, such as a Wi-Fi node, Bluetooth beacon, or visible light communication marker, which can provide an absolute position reference indoors or in a pre-defined environment. Combining beacon positioning with VIO can effectively correct system drift and achieve global consistency constraints on pose, thereby significantly improving positioning accuracy and system stability.
[0005] Especially in cost-sensitive devices such as AR / VR headsets that often employ low-precision IMUs, visual inertial systems (VIS) incorporating beacon information are of greater practical value. For example, using QR codes as visual beacons is not only flexible and cost-effective in deployment but also provides highly reliable absolute pose observation. Therefore, this invention employs a QR code positioning scheme, combined with a VIO framework, to enhance the system's adaptability and positioning reliability in diverse environments, providing a more accurate and robust solution for applications such as mobile robots and intelligent navigation.
[0006] Today, QR codes are widely used in various aspects of daily life, and their technology is becoming increasingly mature. Current research mainly focuses on target detection and recognition, dynamic tracking, and applications in assisted positioning systems. With its advantages of low cost, ease of deployment, and customizable information, QR codes are very suitable as location markers in indoor positioning systems. By generating QR codes with unique codes, they can be used as waypoints to store corresponding spatial coordinates or other navigation information, thereby achieving digital marking of physical spaces.
[0007] QR code beacon positioning is a positioning method that uses QR codes as visual markers, captures images with a camera, and then identifies and decodes them to obtain the device's position and orientation information. This technology is simple to implement and flexible to deploy, and has already seen initial applications in scenarios such as guided robots, warehousing and logistics, and AR interaction.
[0008] A typical implementation process usually includes the following steps: placing QR code tags with known location information in the environment, the mobile device capturing images containing the QR code through a camera, using image processing algorithms to detect and identify the QR code area, decoding the QR code content, obtaining its preset identity number or location data, and combining the camera imaging model (such as the PnP algorithm) to calculate the device's pose relative to the QR code to achieve positioning.
[0009] However, this method still faces several challenges and limitations in practical applications: Positioning accuracy is highly dependent on camera resolution, focal length parameters, and the accuracy of image processing algorithms, making it difficult to meet high-precision requirements at long distances or under low-resolution conditions. The device must directly "see" the QR code to complete positioning; any obstruction, viewpoint shift, or motion blur will render the positioning function ineffective. If the physical location of the QR code changes and the system fails to update in time, it will lead to incorrect positioning results, affecting overall reliability. In densely packed QR code environments, multiple QR codes may simultaneously enter the field of view; the system must be able to accurately distinguish target codes to avoid misidentification. Complex lighting conditions such as strong light reflection, shadow coverage, or low illumination can affect image quality, leading to detection failures or decoding errors. If the QR code carries sensitive location information, there is a risk of unauthorized reading or counterfeiting; encryption or access control mechanisms must be introduced for protection. System reliability depends on the availability of each QR code; damage, contamination, or obstruction of individual tags may cause localized positioning interruptions.
[0010] Despite the aforementioned limitations, QR code beacon positioning remains valuable in scenarios where high positioning accuracy is not required due to its advantages such as low cost, ease of implementation, and lack of need for additional communication infrastructure. However, for applications demanding higher accuracy, greater robustness, and more complex environments, single QR code positioning is no longer sufficient. Summary of the Invention
[0011] To address the problems existing in the current technology, this invention proposes an improved scheme that integrates multi-source information based on traditional QR code beacon positioning. The aim is to improve the positioning accuracy, environmental adaptability and overall reliability of the system, overcome the bottlenecks of the current technology, and expand its application potential in fields such as intelligent navigation and augmented reality.
[0012] To achieve the above objectives, the present invention provides an adaptive QR code beacon recognition method, the method comprising the following steps: S1. Image input; the image includes a QR code as a beacon; QR code recognition is performed on the image; S2. Use QR codes to estimate camera position; S3. Determine the accuracy of the QR code combination. If the accuracy is not higher than the set threshold, proceed to step S4; if the accuracy is higher than the set threshold, proceed to step S5. S4. Combine the pyramid QR codes to form a larger QR code, and return to step S2; S5. Determine the ID information encoded in the combined QR code and output the camera position.
[0013] Furthermore, multiple QR codes are arranged within the target area so that new QR code positioning can be adaptively formed in situations of long distance and blurred vision.
[0014] Furthermore, the adaptive recognition box can automatically adjust its size based on the recognition accuracy.
[0015] Furthermore, for multiple QR codes within each recognition frame, their information is combined to form a new QR code; the new QR code contains information about the location and identification of the recognition frame, as well as verification information.
[0016] Furthermore, an image of the target area is captured using a camera, and QR code recognition is implemented in the software.
[0017] Furthermore, depending on the distance between the camera and the target and the degree of visual blur, it is possible to choose whether to use all the QR codes within the recognition frame of different sizes to form the positioning information, or to use only a portion of them.
[0018] On the other hand, an adaptive QR code beacon recognition system includes an image acquisition and preprocessing module, a QR code marker positioning module, a QR code marker encoding and decoding module, and a camera pose estimation module.
[0019] Furthermore, after the camera acquires an image containing a QR code, the image acquisition and preprocessing module preprocesses the image to obtain a processed image. The image preprocessing includes grayscale conversion, binarization, and filtering.
[0020] Furthermore, the QR code marking and positioning module is used to locate the position of the QR code in the image area and segment the QR code area.
[0021] Furthermore, the internal encoding of the QR code is decoded by the QR code marking encoding and decoding module to identify its unique number, and then the preset absolute position information corresponding to the QR code is queried and obtained. After the QR code is decoded, the unique number of the identified QR code can be determined, and the position and attitude of the camera in the world coordinate system can be estimated by the multi-QR code camera pose estimation module.
[0022] The beneficial effects of this invention are as follows: In large-scale scenarios, the system selects different QR code combinations to identify beacons based on different distances and environmental conditions. When the device is close to the beacon, a single QR code is used for identification. However, when the device is far from the beacon, a single QR code may be difficult to identify due to the distance, image blur, or change in viewing angle. Multiple QR code combinations can be used to improve recognition performance.
[0023] This invention proposes a technical solution for adaptive QR code beacon recognition in VINS (Visual-Inertial Navigation System). It refers to using QR codes as beacons and adaptively processing beacon recognition at long distances. The aim of adaptive QR code beacon recognition is to address the issue that traditional VINS systems typically use beacons with specific shapes or textures and high contrast for positioning and navigation. However, these beacons may not be clearly identifiable at long distances. By using combinations of QR codes to construct larger beacons, better recognition performance can be provided at long distances, allowing the system to achieve accurate positioning at greater distances. VINS systems often require adaptive beacon positioning to adjust the recognition and positioning algorithms according to different distances and viewing angles. By using combinations of QR codes, the beacon recognition algorithm can be adaptively adjusted according to the size and arrangement of the beacons, thereby improving the system's positioning performance in various scenarios. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of the adaptive pyramid recognition process; Figure 2 This is a diagram illustrating QR code combination recognition; Figure 3 This is a schematic diagram of grayscale processing; Figure 4 This is a schematic diagram of the binarization process; Figure 5 This is a schematic diagram of the QR code image decoding process; Figure 6 This is a schematic diagram of coordinate transformation; Figure 7This is a schematic diagram of the overall QR code recognition process; Figure 8 This is a diagram of a QR code. Detailed Implementation
[0025] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0027] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0028] The following combination Figures 1-8 Specific embodiments of the present invention will be described in detail below. It should be understood that the specific embodiments described herein are for illustrative and explanatory purposes only and are not intended to limit the present invention.
[0029] Machine vision QR code systems include Checkerboard, Chessboard, ArUco Tag, and AprilTag, each with its own advantages and disadvantages. Checkerboard and Chessboard are primarily used for camera calibration, accurately correcting camera distortion and intrinsic parameters. Their geometry is very simple, making them easy to manufacture and use. They do not require unique identifiers, thus their information capacity is unlimited. However, they are not suitable for object pose estimation or position tracking because they lack unique identifiers. ArUco Tag and AprilTag both have unique identifiers, making them suitable for identifying and locating multiple objects. They typically have high-contrast black and white patterns, making them easy to detect and recognize. They can be used for pose estimation, i.e., determining the position and orientation of an object. Due to the presence of unique identifiers, their information capacity is limited, making them unsuitable for storing large amounts of data. Generating and detecting these tags requires additional computation, potentially making them more complex than some other tags. This invention selects AprilTag as the identification code. AprilTag has high information density, employs complex error-correcting code technology, and possesses superior resistance to distortion and contamination, making it the most widely used code type in industrial applications. The AprilTag QR code consists of an outer black border and an inner coded section. The inner section uses binary encoding, with each block being either black or white. Different black and white grid distributions form different numbers, such as... Figure 8 As shown.
[0030] This invention provides an adaptive QR code beacon recognition method and system. The core concept is that, when facing a large-scale scene, the system selects different QR code combinations to recognize the beacon based on different distances and environmental conditions. When the device is close to the beacon, a single QR code is used for recognition. However, when the device is far from the beacon, a single QR code may be difficult to recognize due to distance, image blur, or changes in viewing angle. Therefore, multiple QR code combinations can be used to improve recognition performance.
[0031] The adaptive QR code beacon recognition method and system based on VINS (Visual-Inertial Navigation System) of the present invention uses QR codes as beacons and performs adaptive processing for beacon recognition in long-distance situations. In traditional VINS systems, beacons with specific shapes or textures and high contrast are typically used for positioning and navigation. However, these beacons may not be clearly identifiable at long distances. The present invention constructs larger beacons by combining QR codes, which can provide better recognition performance at long distances and allow the system to achieve accurate positioning at greater distances. VINS systems typically require adaptive beacon positioning to adjust the recognition and positioning algorithms according to different distances and viewing angles. By using QR code combinations, the beacon recognition algorithm can be adaptively adjusted according to the size and arrangement of the beacons, thereby improving the positioning performance of the system in various scenarios.
[0032] like Figure 1 As shown, the adaptive QR code beacon recognition method according to the present invention includes the following steps: S1. Image input; the image includes a QR code as a beacon; QR code recognition is performed on the image.
[0033] The core of S1 is to first detect all visible QR codes (single or multiple) after capturing an image of the target area with a camera. Subsequent steps determine whether to perform combined processing based on the number, distribution, and accuracy of the detected QR codes.
[0034] S2. Use QR codes to estimate camera position; Operation logic: Based on the QR code (single or combined QR codes) identified by S1, combined with its preset physical world coordinates (calibrated and stored during deployment), the camera pose (rotation matrix + translation vector) relative to the QR code is calculated through the PnP algorithm, and then mapped to the camera position in the world coordinate system.
[0035] Dependency: If only one QR code is identified, the estimation is based on that single QR code; if multiple QR codes are identified, the camera position is estimated for each QR code separately, and then the average value is calculated using formula (4-15) to obtain the initial estimation result (as the basis for subsequent accuracy judgment).
[0036] S3. Determine the accuracy of the QR code combination. If the accuracy is not higher than the set threshold, proceed to step S4; if the accuracy is higher than the set threshold, proceed to step S5.
[0037] The priority of the precision judgment logic in step S3 is as follows: Priority: First determine the recognition accuracy of a single QR code, then determine the accuracy of the combination.
[0038] Specific procedures: 1. If the recognition accuracy of a single QR code in the image is greater than or equal to the set threshold, then the estimated result of that QR code is directly used to enter S5; 2. If the accuracy of all individual QR codes is less than the threshold, or multiple QR codes are recognized (even if the accuracy of some individual codes meets the threshold, we can try to combine them to improve robustness), then calculate the accuracy of the combined QR codes. 3. If the combination accuracy is greater than or equal to the threshold, proceed to S5; if it is still less than the threshold, proceed to S4.
[0039] The threshold is dynamically adjusted according to the application scenario. For industrial positioning (such as robot assembly), the preferred threshold is ≤0.05m; for general navigation (such as AR navigation), the preferred threshold is ≤0.1m; and for long-distance scenarios (such as drone navigation), it can be relaxed to ≤0.3m. The threshold needs to be determined through calibration experiments during system deployment (e.g., collecting multiple sets of real camera positions and estimated values, and setting the threshold after statistically analyzing the error distribution).
[0040] The accuracy calculation method is as follows: The accuracy index is defined as "the deviation between the estimated camera position and the true position" (unit: meters), and the calculation logic is as follows: 1. Precision of a single QR code: Let the preset world coordinates of QR code i be ( , , The camera position estimated by the PnP algorithm is: Then, the single precision is: 2. Accuracy of Combined QR Codes: Assuming the combined code contains k QR codes, the estimated position of each individual QR code is... The estimated position after combination is (Formula 4-15), then the combination accuracy in The mean of the preset coordinates for k QR codes (representing the center reference coordinates of the combined area).
[0041] S4. Combine the pyramid QR codes to form a larger QR code, and return to step S2; Among them, "pyramid QR code combination" refers to a hierarchical combination strategy of "from small to large and expanding layer by layer" to cluster multiple QR codes according to their spatial distribution, forming combined QR codes of different scales (similar to the hierarchical structure of a pyramid, with the bottom layer being a single QR code, the middle layer being a small-scale combination, and the top layer being the largest-scale combination).
[0042] Implementation method: 1. Level 1: A single QR code (basic unit); 2. Middle layer (Level 2): Combinations of 2-4 QR codes with a spatial distance ≤ a preset threshold (e.g., 0.5m); 3. Level 3: The maximum combination of all QR codes within the target area (as shown in the attached image). Figure 2 (The entire combination of 8 QR codes).
[0043] The rules for combining and expanding QR codes are as follows: The expansion logic is: "gradually increasing, prioritizing adjacent combinations," rather than jumping directly to the maximum combination: 1. If the current combination consists of 3 QR codes (insufficient precision), prioritize adding 1 QR code adjacent to the combined area (expanding to 4), and recalculate the combination precision; 2. If the accuracy is still insufficient after expansion, continue to add adjacent QR codes (such as 6 or 8) until the maximum combination size is reached; 3. If the maximum combined accuracy is still insufficient, the system will output a "positioning accuracy insufficient" warning (which can be combined with IMU data for smoothing).
[0044] The relationship between the number of combinations and precision is as follows: More data does not necessarily mean higher accuracy; there is a phenomenon of diminishing marginal returns. 1. When the number of combinations increases from 1 to 4, the accuracy is significantly improved (the increase in redundant information offsets the noise effect of a single QR code). 2. When the number exceeds 6, the accuracy improvement is less than 5% (because too many QR codes may introduce errors due to spatial dispersion). 3. Core constraint: The combined QR codes must meet the requirement of "dense spatial distribution and no obstruction" (information that obstructs the QR code will be automatically removed and will not participate in the combination).
[0045] S5. Determine the ID information encoded in the combined QR code and output the camera position.
[0046] The combined QR code ID information: The newly generated combined QR code ID is "basic ID + combination level + member ID", for example "COM-Level2-001&002&003" (COM represents combination, Level2 represents middle-level combination, and 001-003 are member QR code IDs); the ID also contains a check bit (based on the Reed-Solomon algorithm, occupying 8 bits) to verify the integrity of the combined information.
[0047] Camera position output: Outputs the estimated world coordinate system position after combination. With accompanying accuracy indicators (For the upper-level system to determine whether it is available).
[0048] Figure 1The correspondence between the "pyramid recognition process" and the steps mentioned above is as follows: 1. Image input → S1 (QR code recognition); 2. Use QR code to estimate camera position → S2; 3. Combinatorial accuracy judgment → S3; 4. Pyramid Combination → S4; 5. Output camera position → S5.
[0049] Figure 1 The logic of "returning to step S2" means that the "camera position estimation based on the combined QR code" is re-executed after combination, rather than repeating the initial single QR code estimation.
[0050] In this invention, the specific implementation method for the QR code layout design is as follows: Multiple QR codes are arranged within the target area so that new QR code positioning can be adaptively formed in situations of long distance and blurred vision.
[0051] Adaptive recognition box: The size of the recognition box is automatically adjusted according to the recognition accuracy.
[0052] Adaptive recognition bounding box adjustment logic: Core objective: To dynamically adjust the selection range based on the current recognition accuracy, ensuring that the combined QR codes satisfy both "information redundancy" and do not introduce "invalid noise".
[0053] Adjustment process: 1. Initial recognition box size: By default, it covers all visible QR codes within the camera's field of view (automatically initialized based on image boundaries and QR code distribution density; for example, if there are 8 QR codes within the field of view, the initial box is the smallest bounding rectangle of the 8 QR codes). 2. Accuracy feedback adjustment: If the current combination precision If the value is less than 0.8 (excessive precision), then reduce the recognition box (remove the 1-2 QR codes furthest from the center) and recalculate the precision (to avoid redundant calculations). If the current combination precision If the threshold is too high (insufficient accuracy), the recognition box will be expanded (incorporating QR codes from adjacent areas until the maximum field of view is reached). 3. Adjust the calculation method: Let the side length of the current recognition box be... (in pixels), with a precision deviation of -Threshold, then the adjusted side length ,in The scaling factor (default) (This can be achieved through calibration adjustments to ensure a smooth adjustment range).
[0054] Unlike traditional "fixed-size recognition boxes", the adaptive recognition box of this invention achieves "matching recognition range with accuracy requirements" through a "precision feedback-dynamic adjustment" closed loop, solving the contradiction of "large box required for long distances but prone to noise" and "small box required for short distances but prone to missing QR codes".
[0055] QR code combination: For multiple QR codes within each recognition frame, their information is combined to form a new QR code. This new QR code may contain information about its location and identification within the recognition frame, as well as possible verification information to ensure accuracy. For example... Figure 2 As shown: 1. Figure 2 It contains 8 AprilTag QR codes (ID: 001-008), arranged in a 2×4 matrix (the physical spacing during deployment is 0.3m). 2. The recognition box is divided into 3 levels: Inner frame (red): Contains two adjacent QR codes (001+002), suitable for medium distance scenarios (5-8m distance between camera and QR code); Middle layer frame (blue): Contains 4 QR codes (001-004), suitable for medium to long distance scenarios (8-12m); Outer frame (green): Contains 8 QR codes (001-008), suitable for long-distance scenarios (12-20m); 3. Combination Logic: The QR code information in each frame is used to generate a new combined QR code through "bit concatenation + check encoding" (e.g., after the outer frame is combined, the generated ID is: COM-Level3-001-008, which contains the average position of 8 QR codes, member ID and Reed-Solomon check bit).
[0056] For step S1, QR code recognition: The camera captures an image of the target area, and the software recognizes the QR codes. Once multiple QR codes within the recognition frame are recognized, they are combined to form new location information.
[0057] Adaptive to long-distance and blurred vision: Depending on the distance between the camera and the target and the degree of visual blur, the system chooses whether to use all QR codes within different sized recognition boxes to form location information, or to use only a portion of them. This adaptability is achieved through image quality assessment and distance estimation.
[0058] The adaptive combination strategy for long-distance / blurred gaze is as follows: 1. Rules for selecting QR codes in the recognition box The core principle is to "prioritize QR codes that are unobstructed, have low distortion, and are taken at close range." Specific selection criteria are as follows (weighted from highest to lowest): 1) Occlusion level: Remove QR codes with an occlusion area greater than 30% (the integrity of the QR code border is determined by edge detection); 2) Distortion level: Remove QR codes with distortion coefficient > 0.1 (image distortion value is calculated based on camera intrinsic parameters); 3) Rotation angle: Prioritize QR codes with a rotation angle < 30° (excessive rotation angle can easily lead to decoding errors; judge by the order of QR code corner points); 4) Spatial distance: Prioritize combining QR codes with a spatial distance ≤ 0.5m (to ensure the compactness of the combined area and reduce coordinate discrepancy error).
[0059] Figure 2 Example selection logic: When the camera is 15m away (long distance), all 8 QR codes are unobstructed and the distortion level is <0.08. In this case, the outer frame (8 codes) combination is selected. If QR code 007 is obstructed (obstruction area 40%), it is automatically removed and the remaining 7 QR codes combination is selected. If QR codes 007-008 are obstructed, the middle frame (001-004) combination is selected.
[0060] 2. Handling methods for insufficient combination accuracy Processing flow: 1) Replace the subset of combinations: Prioritize replacing "low-quality QR codes" (such as QR codes with high distortion or long distance). For example, if the original combination is 001+003+005 (insufficient precision), then replace it with the adjacent 002+004+006 (no distortion and closer distance). 2) Increase the number of combinations: If the accuracy is still insufficient after replacing the subset, add adjacent QR codes (e.g., expand from 3 to 5) without obstruction. 3) Degradation processing: If the accuracy of all combination methods is insufficient, switch to the "single QR code + IMU fusion" mode (using IMU data to smooth camera position drift, suitable for temporary occlusion or extreme long distance scenarios).
[0061] 3. Processing logic for only recognizing 2 QR codes First, estimate the accuracy of each QR code individually. If the accuracy of any single QR code is greater than or equal to the threshold, then use that single QR code. If all are less than the threshold, then directly combine the two QR codes (no need to expand layer by layer, since there are only two and no more intermediate layers). Calculate the combined accuracy and then determine whether to proceed to S5.
[0062] Consider incorporating sufficient redundancy into the design to improve positioning accuracy. This can be achieved by increasing the number of small regions or adding verification information.
[0063] The term "number of small regions" refers to the number of pre-defined "QR code clustering units" within the target area. For example, a 10m × 10m target area can be divided into four 2.5m × 2.5m small regions, with 3-4 QR codes deployed in each small region. Its purpose is to increase the number of small regions, enabling "local combination" (e.g., combining QR codes only within a specific small region), avoiding coordinate dispersion errors caused by large-scale combination, and improving redundancy (if a QR code in one small region is damaged, it can be switched to an adjacent small region for combination).
[0064] For data transmission and processing: Once new positioning information is generated, it can be transmitted to the system for processing to obtain the camera's position and orientation.
[0065] This method can improve the positioning accuracy in large-scale scenarios at long distances. By combining multiple QR codes to obtain more accurate positioning information, it can improve the positioning performance of smart wearables and robots, and help them better cope with complex environments and challenging positioning tasks.
[0066] The adaptive QR code beacon recognition system according to the present invention includes an image acquisition and preprocessing module, a QR code marker positioning module, a QR code marker encoding and decoding module, and a camera pose estimation module.
[0067] In step S1, the camera acquires an image containing a QR code, inputs the image into the image acquisition and preprocessing module, and preprocesses the image to obtain the processed image.
[0068] Specifically, the image acquisition and preprocessing process is as follows: Images contain rich information, and processing most of them would often result in a large computational burden. Furthermore, camera imaging is easily affected by ambient lighting, potentially leading to noisy images. Therefore, preprocessing the acquired images removes irrelevant features and noise, improving the accuracy of QR code recognition and accelerating computation. Image preprocessing includes grayscale conversion, binarization, and filtering.
[0069] S1.1 Grayscale Most color images we see are composed of the three primary colors: red, green, and blue. These color images contain data from three channels, requiring significantly more computation to process than grayscale images. Recognizing QR codes primarily involves identifying the arrangement of black and white squares within an image. Since the two colors have vastly different grayscale values, grayscale images can effectively recognize QR codes without affecting accuracy. Figure 3 As shown. Furthermore, converting an image to grayscale can improve the speed of subsequent image processing. When converting an RGB image to grayscale, an averaging algorithm or a weighted averaging algorithm is typically used.
[0070] The formula for the averaging algorithm is: (4-1) The formula for the weighted average method is: (4-2) Gray represents the grayscale value of a pixel, while R, G, and B are the values of the three channels of a color image: red, green, and blue, respectively. Human vision has varying sensitivities to color, and the result calculated using a weighted average method better matches the grayscale values perceived by humans. Therefore, a weighted average algorithm is used to convert images to grayscale. The effect of grayscale conversion on a QR code image is shown in the figure.
[0071] S1.2 Binarization After grayscale processing of the QR code image, binarization is required to extract the QR code information from the image. This involves converting the grayscale value of all pixels in the image to either 0 or 255, resulting in only two possibilities: black and white. Figure 4 As shown, in order to obtain the desired processing effect, a suitable threshold needs to be determined to distinguish and classify black and white pixels. The gray values of the pixels in the grayscale image are compared with the determined threshold. Pixels with values less than the threshold are converted to 0 pixels, and pixels with values greater than the threshold are converted to 255 pixels, as shown in Equation (2-7). (4-3) f(x,y) and g(x,y) represent the pixel values before and after binarization, respectively, and T represents the selected threshold. Typically, the threshold determination is inevitably affected by environmental factors such as lighting and the camera itself. Therefore, the classic Otsu's method (maximum inter-class variance) in adaptive thresholding is used to determine the threshold, which is less affected by lighting conditions. The binarization effect on the QR code image is shown in the figure.
[0072] S1.3 Filter During the acquisition of QR code images, noise is present in the acquired images due to environmental factors, sensor characteristics, and image transmission. The noise primarily originates from the optical acquisition system and typically manifests as isolated pixels in the image. Noise blurs the image, hindering feature extraction and matching. To improve image quality and facilitate subsequent processing, pre-filtering is necessary. The template coefficients of a Gaussian filter are related to the distance between the target pixel and surrounding pixels. A pixel's weight increases as it gets closer to the target pixel, and decreases as it gets farther away. This effectively suppresses noise that follows a normal distribution. The weight coefficient equation for a Gaussian filter is: (4-4) In step S2, the QR code is located in the image area by the QR code marking and positioning module, and the QR code area is segmented out.
[0073] To parse the location information contained in a QR code, its position within the image region must first be determined. Each QR code marker is surrounded by a black border, which speeds up the detection of the QR code marker. The Sobel edge detection algorithm can be used to extract the outer contour of the QR code. If a straight line of the QR code border is detected, the QR code region will be segmented for subsequent decoding and pose calculation.
[0074] In step S5, after detecting and segmenting the QR code region in the image, the QR code marking encoding and decoding module needs to decode its internal encoding to identify its unique number, and then query and obtain the preset absolute position information corresponding to the QR code. A QR code is essentially a data encoding and storage carrier in two-dimensional space. By mapping digital information into a matrix pattern composed of black and white pixel units according to specific encoding rules, it achieves the visual storage of information.
[0075] The system of this invention uses AprilTag QR codes, which are composed of regularly arranged black and white cells. Each tag has a unique internal pattern and corresponds to a unique identifier (ID), thereby ensuring that it can be accurately identified and distinguished in the deployment environment.
[0076] Specifically, the AprilTag code used is a 9×9 grid structure, with a fixed black border around the outside to assist in positioning and orientation determination. After removing the border, the central area is a 5×5 effective data area containing 25 bits of binary encoded information. The Reed-Solomon error correction algorithm is used during decoding, which has strong error tolerance and can correct up to 8 error bits, effectively improving the decoding success rate under adverse conditions such as image blur, partial occlusion, or uneven lighting.
[0077] The QR code decoding process mainly includes: image preprocessing, binarization, grid sampling, bit extraction, verification and error correction, etc., and the overall process is as follows: Figure 5 As shown.
[0078] Figure 5 Decoding process description: Process steps: Image preprocessing → Binarization → Grid sampling → Bit extraction → Verification and error correction → Output ID information Decoding Target: The combined QR code is decoded as a whole. Reason: The combined QR code has encoded the IDs and location information of multiple members into a unified binary matrix (using "bit concatenation" technology: each member's QR code has an ID of 16 bits, location information of 24 bits, and a check bit of 8 bits, with a total length of k×40+8, where k is the number of combinations). During decoding, this unified matrix is directly parsed, eliminating the need to decode the individual member QR codes (improving efficiency).
[0079] Through this process, the system can reliably recover the ID information encoded by the QR code from the acquired image, providing reliable data support for subsequent pose estimation and localization.
[0080] In addition, because QR code symbols may rotate in the environment, QR codes also have a certain verification capability and the ability to still be recognized and decoded when rotated.
[0081] In step S5, the method for estimating camera pose using multiple QR code markers is as follows: Once the QR code is decoded, its unique identifier can be determined. The physical world coordinates corresponding to each QR code during deployment are pre-calibrated and stored in the system configuration file. Based on this known information, the position and orientation of the camera in the world coordinate system can be further estimated using the multi-QR code camera pose estimation module.
[0082] Since the QR code markers used have known and fixed physical dimensions, and by combining their projection shape, size and position in the image, the rotation matrix and translation vector of the QR code coordinate system relative to the camera coordinate system can be calculated using visual geometry methods, thus realizing the mapping from image observation to three-dimensional pose.
[0083] The design of a QR code has a clear directional characteristic; regardless of its rotation or placement in space, the order of its four corner points can be uniquely determined. Therefore, after recognition in a two-dimensional image, the pixel coordinates of the four corner points of the QR code can be accurately extracted and denoted as follows: , , , At the same time, the pixel coordinates of the center point of the QR code The coordinates of the four corner points can be obtained, and the calculation relationship is as follows: (4-5) Meanwhile, when placing QR code markers and measuring their positions, the three-dimensional world coordinates corresponding to the center of each QR code marker and the side length of the marker are recorded. This allows us to obtain the three-dimensional coordinates of the four corner points of the marker, thus obtaining several 3D to 2D point pairs. The PnP method can then be used to estimate the camera pose.
[0084] The PnP method can be used to obtain the rotation and translation matrices between the QR code coordinate system and the camera coordinate system. The final goal is to obtain the camera's position in the world coordinate system. The transformation relationships between the coordinate systems are as follows: Figure 6 As shown.
[0085] Let C be the camera coordinate system, M be the QR code coordinate system, and W be the world coordinate system. We can obtain: (4-14) In the formula, T represents the transformation, R is the rotation matrix, t is the translation matrix, and the subscripts AB indicate a transformation from coordinate system B to coordinate system A. For example: T WC —Transformation between camera coordinate system and world coordinate system.
[0086] When estimating camera position based on QR codes, multiple QR codes may be identified in a single image frame. Let (xi, yi, zi) be the estimated camera position for a particular QR code. Assuming the number of identified QR codes is n, the estimated camera position is: (4-15) This concludes the introduction to QR code-based camera location estimation. The entire process, from QR code recognition and localization to QR code-based camera location estimation, is as follows: Figure 7 As shown.
[0087] Figure 7 and Figure 1 The correspondence is as follows: 1. Obtain the original image → Figure 1 "S1 Image Input"; 2. Image preprocessing (grayscale conversion, binarization, median filtering) → Figure 1 The prerequisite steps for "S1 QR code recognition"; 3. Identify and determine the QR code area → Figure 1 "S1 QR code recognition"; 4. Decoding → Figure 1 The follow-up steps of "S1 QR code recognition" (obtaining the QR code ID); 5. Given the three-dimensional coordinates of the QR code → Figure 1 The input conditions for "S2 QR code to estimate camera position"; 6. PnP method for estimating camera position → Figure 1 "S2 QR code to estimate camera position"; 7. If the accuracy meets the standard → Figure 1 The "S5"; if the accuracy is not up to standard → Figure 1 The "S4→S2" loop.
[0088] Traditional VINS systems typically use beacons with specific shapes or textures and high contrast for localization and navigation. However, these beacons may not be clearly identifiable at long distances. By using QR code combinations to construct larger beacons, better recognition performance can be provided at long distances, allowing the system to achieve accurate localization at greater distances. VINS systems often require adaptive beacon localization to adjust recognition and localization algorithms based on different distances and viewing angles. By using QR code combinations, the beacon recognition algorithm can be adaptively adjusted according to the size and arrangement of the beacons, thereby improving the system's localization performance in various scenarios.
[0089] Adaptive beacon recognition provides accurate external positioning and navigation in both indoor and outdoor environments. This is crucial for applications requiring precise positioning, such as drone navigation, mobile robots, and autonomous driving. Adaptive QR code beacon recognition can provide accurate camera pose estimation and depth information across a wide range of scenes, enabling correct alignment of virtual objects with real-world environments and providing a more realistic user experience. Adaptive QR code beacon recognition technology can provide accurate positioning and navigation in industrial automation and machine vision applications, such as robot positioning, assembly, and monitoring. By using QR code combination and adaptive technology, it provides beacon recognition capabilities at long distances, offering important support for various applications requiring accurate positioning and navigation.
[0090] The key technical point lies in proposing multi-beacon adaptive processing based on the use of QR codes as beacons in traditional visual inertial navigation systems (VINS). This solves the problem that traditional VINS systems typically only use single beacons, avoiding multi-target conflicts. Furthermore, the combination of multiple beacons prevents single beacon failures due to contamination or occlusion, significantly improving stability. By using QR code combinations to construct larger beacons, better recognition performance can be provided at long distances, preventing the problem of unclear beacon identification at such distances. It also allows the system to achieve accurate positioning at greater distances. VINS systems typically require adaptive beacon localization to adjust recognition and localization algorithms according to different distances and viewing angles. By using QR code combinations, the beacon recognition algorithm can be adaptively adjusted according to the size and arrangement of the beacons, thereby improving the system's positioning performance in various scenarios.
[0091] The innovation of this invention lies in proposing a multi-beacon adaptive combination processing scheme, which greatly improves recognition stability and application scenarios. Compared with "fixed combination" (such as always combining all QR codes), the pyramid combination has the following advantages: 1. Adaptive distance: Use smaller combinations at close range (to reduce computation), and use larger combinations at long range (to improve recognition rate); 2. Anti-occlusion: When there is partial occlusion, small combinations of unoccluded areas can be used without sacrificing the overall positioning; 3. Accuracy balance: Avoid discrepancy errors caused by too many combinations, and also avoid redundancy caused by too few combinations.
[0092] Any process or method described in the flowcharts of this invention or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, which can be implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device. The computer-readable medium can be any medium containing a program for storage, communication, propagation, or transmission for use by the execution system, apparatus, or device, including read-only memory, magnetic disks, or optical disks.
[0093] In the description of this specification, references to terms such as "embodiment," "example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, those skilled in the art can combine or combine the different embodiments or examples described in this specification and the features therein without causing contradiction.
[0094] While embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions, and alterations to the above embodiments within the scope of the present invention.
Claims
1. An adaptive QR code beacon recognition method, characterized in that, The method includes the following steps: S1. Image input; the image includes a QR code as a beacon; QR code recognition is performed on the image; S2. Use QR codes to estimate camera position; S3. Determine the accuracy of the QR code combination. If the accuracy is not higher than the set threshold, proceed to step S4; if the accuracy is higher than the set threshold, proceed to step S5. S4. Combine the pyramid QR codes to form a larger QR code, and return to step S2; S5. Determine the ID information encoded in the combined QR code and output the camera position.
2. The adaptive QR code beacon recognition method according to claim 1, characterized in that, Multiple QR codes are arranged within the target area so that new QR code positioning can be adaptively formed in situations of long distance and blurred vision.
3. The adaptive QR code beacon recognition method according to claim 2, characterized in that, The adaptive recognition box can automatically adjust its size according to the recognition accuracy.
4. The adaptive QR code beacon recognition method according to claim 3, characterized in that, For each recognition box containing multiple QR codes, their information is combined to form a new QR code; the new QR code contains information about the location and identification of the recognition box, as well as verification information.
5. The adaptive QR code beacon recognition method according to claim 4, characterized in that, Use a camera to capture images of the target area and implement QR code recognition in the software.
6. The adaptive QR code beacon recognition method according to claim 4, characterized in that, Depending on the distance between the camera and the target and the degree of visual blur, the system may choose to use all QR codes within the recognition frame of different sizes to form location information, or only use a portion of them.
7. An adaptive QR code beacon recognition system, used to implement the adaptive QR code beacon recognition method according to any one of claims 1-6; characterized in that, The system includes an image acquisition and preprocessing module, a QR code marker positioning module, a QR code marker encoding and decoding module, and a camera pose estimation module.
8. The adaptive QR code beacon recognition system according to claim 7, characterized in that, After the camera acquires an image containing a QR code, the image acquisition and preprocessing module preprocesses the image to obtain a processed image. The image preprocessing includes grayscale conversion, binarization, and filtering.
9. The adaptive QR code beacon recognition system according to claim 8, characterized in that, The QR code marking and positioning module is used to locate the position of the QR code in the image area and segment the QR code area.
10. The adaptive QR code beacon recognition system according to claim 9, characterized in that, The QR code encoding and decoding module decodes the internal code of the QR code to identify its unique number, and then queries and obtains the preset absolute position information corresponding to the QR code. After the QR code is decoded, the unique number of the identified QR code can be determined, and the position and attitude of the camera in the world coordinate system can be estimated by the multi-QR code camera pose estimation module.