A general decoding method and system for ring-coded flags
By filtering the valid encoded images of the ring-coded markers and generating the transition point sequence, the problem of the ring-coded marker decoding relying on the code value-pattern correspondence was solved, achieving accurate decoding under deformed and unknown conditions, and improving the robustness and efficiency of decoding.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-10
AI Technical Summary
Existing decoding methods for ring-shaped coded marks require a correspondence between code values and coded patterns, which makes decoding difficult and results in low decoding accuracy when the coded pattern is deformed.
By acquiring the standard encoded image of the ring-shaped encoded mark, setting constraints to filter valid encoded images, generating a sequence of transition points using the pixel transition positions of the ring, assigning code values according to consistency conditions, and establishing an encoding knowledge base for decoding.
Accurate decoding was achieved under conditions of unknown code value-pattern correspondence and coded pattern deformation, improving the robustness and efficiency of decoding.
Smart Images

Figure CN121213688B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of encoding and decoding technology, and specifically to a general decoding method and system for ring-shaped encoded tags. Background Technology
[0002] Industrial close-range photogrammetry, characterized by its non-contact nature, high precision, and high efficiency, is widely used for measuring the dimensions and positions of various industrial equipment and workpieces. Close-range photogrammetry technology involves image acquisition, camera calibration, feature extraction and matching, and 3D reconstruction. The features used are categorized into artificial and natural features. Natural features are obtained through image feature extraction techniques, while artificial features refer to manually affixed coded and non-coded markers. In industrial photogrammetry where high precision is required, coded markers are essential. This is because most objects being measured lack sufficient high-precision features to perform photogrammetric tasks, and it is also necessary to ensure high-precision measurement.
[0003] The circular coding mark is a common coding mark, consisting of a central circle and concentric coding rings. It is divided into N-digit codes according to the angle, where the different distributions of white and black rings represent different code values. This coding method is widely used in various photogrammetry tasks.
[0004] In related technologies, the decoding method for this type of coded marker involves detecting the pixel intensity of each bit to generate an N-bit binary sequence, and then calculating a unique code value (assignment) through this cyclic sequence. However, this decoding method requires a correspondence between the code value and the coded pattern for decoding. Once this correspondence is unknown, decoding becomes difficult, especially when dealing with many circular coded markers with different code value-pattern correspondences, further increasing the decoding difficulty. Moreover, the decoding accuracy is even lower when conditions such as high shooting tilt cause distortion of the coded pattern. Summary of the Invention
[0005] This application provides a general decoding method for circular coded marks, which solves the technical problems in related technologies where decoding methods require a correspondence between code values and coded patterns, leading to decoding difficulties and low decoding accuracy when the coded pattern is deformed.
[0006] This application provides a general decoding method for ring-coded flags, which includes the following steps:
[0007] Obtain a standard encoded image including a ring-shaped encoded marker to be decoded, wherein the ring-shaped encoded marker includes a central circle and a ring concentric with the central circle, and the position of the central circle is used as the position of the ring-shaped encoded marker;
[0008] Based on the circular coding mark, constraints are set, and the standard coded images are filtered to obtain valid coded images;
[0009] Using the pixel transition positions of the ring band in the ring-shaped coding mark as transition points, a sequence of transition points is generated based on the effective coded image;
[0010] Identify the transition point sequence and assign code values to complete the decoding;
[0011] The process of identifying the transition point sequence and assigning code values to complete the decoding includes:
[0012] The consistency condition is set as whether the positional difference between the two transition point sequences is less than a predetermined threshold; if the positional difference between the two transition point sequences is less than the predetermined threshold, the consistency condition is satisfied.
[0013] Filter all transition point sequences in the coding knowledge base, determine whether there is a transition point sequence that satisfies the consistency condition with the transition point sequence to be identified, and then assign code values. The coding knowledge base includes the identified transition point sequences and their corresponding code values.
[0014] If it does not exist, a new code value is assigned to the transition point sequence to be identified;
[0015] If it exists, and there is one, then assign the code value corresponding to the transition point sequence that satisfies the consistency condition to the transition point sequence to be identified;
[0016] If there are more than one, then assign the code value corresponding to the transition point sequence with the smallest error to the transition point sequence to be identified;
[0017] Update the encoding knowledge base by adding the valid encoded image corresponding to the transition point sequence into the code value corresponding library.
[0018] In one embodiment, the general decoding method for ring-coded flags further includes: calculating the merging support rate to merge redundant code values;
[0019] The calculation of the merge support rate to merge redundant code values includes:
[0020] A dictionary is created to record the code values of all identified transition point sequences and possible combinations of code values to be merged. This combination is used as the key of the dictionary, and the frequency of merging of this combination is used as the count value of this key in the dictionary.
[0021] If there is more than one transition sequence that satisfies the consistency condition with the transition sequence to be identified, increment the count value of that combination by 1.
[0022] Once all code values have been allocated, the ratio of the count of all possible code value combinations to the total number of codes in that combination is used as the merging support rate.
[0023] If the merge support rate is greater than the set value, the code values corresponding to the two transition point sequences that meet the consistency condition will be merged.
[0024] In one embodiment, acquiring the standard encoded image including the ring-coded marker to be decoded includes:
[0025] Obtain an image of the marker points covering the single ring-coded marker to be decoded;
[0026] The standard coded image is obtained by performing an affine transformation on the marker image.
[0027] In one implementation, acquiring the marker point image covering a single ring-coded marker to be decoded includes:
[0028] Obtain the original image including the ring-coded marker to be decoded;
[0029] The center circle of the annular coding mark in the original image is located for the first time, and a cropped image is generated. The cropped image is a square with a side length of S, centered on the center of the ellipse corresponding to the center circle located in the first step. The cropped image completely covers the annular coding mark.
[0030] The formula for calculating the side length S is: , k It is 1.1-1.3;
[0031] in, m 1 represents the major axis of the ellipse corresponding to the image of the central circle located in the first positioning. D 1 represents the diameter of the central circle of the circular coding mark. D 3 represents the outer diameter of the ring band of the circular coding mark;
[0032] Based on Otsu's method, the first cropped image is degenerated into a binary image. A second positioning is performed through contour constraint check. The position of the ellipse corresponding to the center circle image obtained in the second positioning is used as the position of the ring-shaped coded mark, and the first cropped image is used as the mark point image.
[0033] In one embodiment, performing an affine transformation on the marker point image to obtain the standard coded image includes:
[0034] The parameters of the outer boundary ellipse of the ring zone are determined based on the boundary ellipse fitting algorithm: all contour points in the binary image are searched, and contour points between the inner boundary ellipse and the outer boundary ellipse with a tangential-radial feature angle of less than 30° are identified. The remaining contour points are fitted with ellipses using the RANSAC method to obtain the optimized parameters of the outer boundary ellipse of the ring zone.
[0035] The affine transformation relationship is calculated based on the outer boundary ellipse parameters of the annulus: the minimum enclosing rectangle of the ellipse corresponding to the outer diameter of the annulus is calculated, and the four vertices of the rectangle are matched one-to-one with the four vertices of the square image after the affine transformation, which is taken as the affine transformation relationship.
[0036] The affine transformation relation is applied to the marker image to obtain the standard coded image.
[0037] In one implementation, the contour constraint check includes:
[0038] According to the length threshold in sequence Roundness threshold Area ratio threshold Inclination threshold The filtering is performed using the following formulas for each threshold:
[0039] ;
[0040] ;
[0041] ;
[0042] ;
[0043] in, It is the area of the outline. contour_length It is the length of the outline. ellipse_ area It is the area of the ellipse. MA, ma It is the length of the major and minor axes of the ellipse. ma≤MA .
[0044] In one implementation, before the center circle of the ring-coded mark in the original image is located for the first time, the original image is subjected to contrast enhancement and gamma correction.
[0045] In one implementation, the step of setting constraints based on the ring-shaped coding flag and filtering the standard coded images to obtain valid coded images includes:
[0046] Determine the ratio of the outer diameter, inner diameter, and central circle diameter of the ring-shaped coding mark;
[0047] The constraints include: pixels inside the center circle are white; pixels between the center circle and the inner diameter of the ring are black; and the proportion of white pixels on the inner circumference of the ring is greater than a predetermined threshold.
[0048] The standard encoded images are selected, and those that meet the constraints are designated as valid encoded images.
[0049] In one embodiment, determining the ratio of the outer diameter, inner diameter, and central circle diameter of the ring-shaped coding mark includes:
[0050] The process involves traversing the center circle of the circular encoding mark and sequentially searching for pixel transition positions as transition points along the radial direction.
[0051] A circular area is used as the sampling circle, and the pixels within the sampling circle are used as the pixel values at that location. The proportion of white to the total number is recorded as the confidence level. When the confidence level exceeds the set value, it is recorded as white; otherwise, it is recorded as black. The location of the pixel transition is used as the transition radius value.
[0052] The frequency of the transformation radius values is statistically analyzed to obtain the ratio of the outer diameter, inner diameter, and central circle diameter of the ring.
[0053] This application also provides a universal decoding system for ring-coded flags, which applies the universal decoding method for ring-coded flags as described in any of the preceding claims, and includes:
[0054] The encoding generation module is configured to: acquire a standard encoded image including a ring-shaped encoded marker to be decoded, the ring-shaped encoded marker including a central circle and a ring concentric with the central circle;
[0055] The encoding filtering module is configured to: filter the standard encoded images to obtain valid encoded images based on constraints set by the circular encoding flag;
[0056] The sequence generation module is configured to: use the pixel transition positions of the ring band in the ring-shaped coding mark as transition points, and generate a sequence of transition points based on the effective coded image;
[0057] The sequence recognition module is configured to: recognize the transition point sequence and assign code values;
[0058] The identification of the transition point sequence and the allocation of code values include:
[0059] The consistency condition is set as whether the positional difference between the two transition point sequences is less than a predetermined threshold; if the positional difference between the two transition point sequences is less than the predetermined threshold, the consistency condition is satisfied.
[0060] Filter all transition point sequences in the coding knowledge base, determine whether there is a transition point sequence that satisfies the consistency condition with the transition point sequence to be identified, and then assign code values. The coding knowledge base includes the identified transition point sequences and their corresponding code values.
[0061] If it does not exist, a new code value is assigned to the transition point sequence to be identified;
[0062] If it exists, and there is one, then assign the code value corresponding to the transition point sequence that satisfies the consistency condition to the transition point sequence to be identified;
[0063] If there are more than one, then assign the code value corresponding to the transition point sequence with the smallest error to the transition point sequence to be identified;
[0064] Update the encoding knowledge base by adding the valid encoded image corresponding to the transition point sequence into the code value corresponding library.
[0065] The beneficial effects of the technical solutions provided in this application include:
[0066] This application provides a general decoding method for ring-coded markers. It uses constraints to filter standard coded images to obtain effective coded images suitable for decoding. Then, it uses the pixel transition positions of the ring band in the ring-coded marker as transition points to generate a sequence of transition points. Since the pixel intensity gradient changes significantly at the transition points, this method of generating corresponding sequences by only tracking the changes in the ring band boundary in the ring-coded marker is more efficient. Furthermore, it determines whether the transition point sequence meets consistency conditions to identify similar codes, assigning different code values according to different situations to achieve general decoding. Even without knowing the code value-pattern correspondence or under unfavorable conditions such as high tilt angles or low imaging quality, accurate decoding can be achieved, ensuring robustness. Attached Figure Description
[0067] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0068] Figure 1 This is a flowchart of a general decoding method for ring-coded flags according to an embodiment of the present invention.
[0069] Figure 2 This is a schematic diagram of a ring-shaped coded mark in one embodiment of the present invention.
[0070] Figure 3 This is a schematic diagram illustrating a sequence of multiple transition points that satisfy the consistency condition in one embodiment of the present invention.
[0071] Figure 4 This is a schematic diagram of a sequence of multiple transition points that satisfy the consistency condition in another embodiment of the present invention. Detailed Implementation
[0072] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0073] This application provides a general decoding method for circular coded markers, which can solve the technical problems in related technologies where decoding methods require a correspondence between code values and coded patterns for decoding, leading to decoding difficulties and low decoding accuracy when the coded pattern is deformed.
[0074] like Figure 1 As shown, Figure 1 This is a flowchart of a general decoding method for ring-coded flags according to an embodiment of the present invention.
[0075] This embodiment provides a general decoding method for ring-coded flags, which includes the following steps:
[0076] Step S1: Obtain a standard encoded image including the ring-shaped encoded mark to be decoded. The ring-shaped encoded mark includes a central circle and a ring concentric with the central circle. The position of the central circle is used as the position of the ring-shaped encoded mark.
[0077] Step S2: Based on the ring coding mark, set constraints and filter standard coded images to obtain valid coded images;
[0078] Step S3: Using the pixel transition positions of the ring band in the ring-coded mark as transition points, generate a sequence of transition points based on the effective coded image;
[0079] Step S4: Identify the transition point sequence and assign code values to complete the decoding;
[0080] Step S4: Identify the transition point sequence and assign code values to complete the decoding, including:
[0081] Step S41: Set the positional difference between two transition point sequences as a consistency condition; if the positional difference between the two transition point sequences is less than the set threshold, the consistency condition is satisfied.
[0082] Step S42: Filter all transition point sequences in the coding knowledge base, determine whether there is a transition point sequence that satisfies the consistency condition with the transition point sequence to be identified, and then assign code values. The coding knowledge base includes the identified transition point sequences and their corresponding code values.
[0083] If it does not exist, a new code value is assigned to the transition point sequence to be identified;
[0084] If it exists, and there is one, then assign the code value corresponding to the transition point sequence that satisfies the consistency condition to the transition point sequence to be identified;
[0085] If there are more than one, then assign the code value corresponding to the transition point sequence with the smallest error to the transition point sequence to be identified;
[0086] Step S43: Update the coding knowledge base and put the valid coded image corresponding to the transition point sequence into the code value corresponding library.
[0087] This embodiment provides a general decoding method for ring-coded markers. It uses constraints to filter standard coded images, obtaining effective coded images suitable for decoding. Then, it uses the pixel transition positions of the ring band in the ring-coded marker as transition points to generate a sequence of transition points. Since the pixel intensity gradient changes significantly at the transition points, this method of generating corresponding sequences by only tracking the changes in the ring band boundary in the ring-coded marker is more efficient. Furthermore, it determines whether the transition point sequence meets consistency conditions to identify similar codes. Different code values are assigned according to different situations, achieving general decoding. Even without knowing the code value-pattern correspondence or under unfavorable conditions such as high tilt angles or low imaging quality, accurate decoding can be achieved, ensuring robustness.
[0088] The following provides a detailed explanation of each step.
[0089] like Figure 2 As shown, Figure 2 This is a schematic diagram of a ring-shaped coded mark in one embodiment of the present invention, wherein, Figure 2 (a) in the image is a schematic diagram of a certain ring-shaped coded mark before imaging. Figure 2 (b) in the figure is a schematic diagram of the image of the ring-shaped coded mark.
[0090] A circular coded marker consists of a central circle and concentric rings. The central circle provides the location of the marker. Different pixels (e.g., black or white) on the concentric rings are encoded with N bits according to their angle; for example, black represents 0 and white represents 1. The coded patterns formed by the black or white rings at different positions represent different sequences, providing code values that can be decoded according to specific rules. Therefore, the decoding process for a circular coded marker is as follows: using the position of the central circle as the location of a single circular coded marker, and decoding its coded pattern to obtain the corresponding code value.
[0091] like Figure 2 As shown in (a), the measured diameters of the physical target before imaging a certain ring-shaped coded marker are: the diameter of the central circle, the inner diameter of the ring, and the outer diameter of the ring (i.e., the diameters of the three circular regions from the center outwards in the figure). D 1. D 2.D 3. After imaging, the ring-shaped coded mark yields three ellipses e1, e2, and e3.
[0092] In one embodiment, step S1, obtaining a standard encoded image including the ring-shaped encoded marker to be decoded, includes:
[0093] Step S11: Obtain the marker point image covering the single ring-coded marker to be decoded.
[0094] Step S12: Perform an affine transformation on the marker image to obtain the standard coded image.
[0095] After affine transformation, the image can be scaled to a uniform size and then used as a standard encoded image.
[0096] The above method yields standardized coded images, facilitating subsequent identification of coded patterns.
[0097] In one embodiment, step S11, obtaining a marker point image covering a single ring-shaped coded marker to be decoded, includes:
[0098] Step S111: Obtain the original image including the ring-coded mark to be decoded.
[0099] Specifically, the image captured, including the ring-shaped coded marker to be decoded, is used as the original image. The image coordinate system is used as the original image coordinate system. According to the OpenCV coordinate system definition, the top left corner is (0,0), and the bottom corner is (0,0). y The positive direction of the axis is to the right. x In the positive direction of the axis, the coordinate value increases by 1 for every pixel.
[0100] Step S113: Locate the center circle of the ring-shaped coding mark in the original image for the first time, and crop out a cropped image. The cropped image is a square with a side length of S, centered on the center of the ellipse corresponding to the center circle located in the first step. The cropped image completely covers the ring-shaped coding mark.
[0101] In the original image coordinate system, the center contour of the central circle of the ring-shaped coded mark in the original image is located for the first time, that is, the first positioning. The imaging process will project the central circle into an ellipse. The ellipse corresponding to the central circle located in the first positioning is initially identified. After cropping, a larger cropped image is obtained. The image coordinate system is coordinate system 1.
[0102] The formula for calculating the side length S is: , k It is 1.1-1.3;
[0103] in, m 1 represents the major axis of the ellipse corresponding to the image of the central circle located in the first positioning. D1 represents the diameter of the central circle of the circular coding mark. D 3 represents the outer diameter of the ring band of the circular coding mark;
[0104] Specifically, assuming D 3 / D 1 = This represents the ratio of the outer diameter of the ring to the diameter of the central circle. A rough estimate can be obtained by measuring the ring-shaped coding mark. Value, then (pixels).
[0105] In the formula for calculating side length S k Values such as 1.2 can be used to ensure that the cropped image is large enough to completely cover the circular coded mark, thus avoiding the influence of detection errors.
[0106] Step S114: Based on Otsu's method, the first cropped image is degenerated into a binary image. The second positioning is performed by contour constraint check. The position of the ellipse corresponding to the center circle image after the second positioning is used as the position of the ring code mark. The first cropped image is used as the mark point image.
[0107] Specifically, the influence of irrelevant areas other than the ring-shaped coded marker has been eliminated through the first positioning and cropping. The cropped image is degenerated into a binary image based on Otsu's method. Contour search and contour constraint check are performed to obtain the contour corresponding to the central ellipse, resulting in a marker point image covering the single ring-shaped coded marker to be decoded.
[0108] The above scheme employs a secondary positioning method to process the local image of the refined circular coding mark, minimizing interference with the Otsu method and ensuring the accuracy of the method.
[0109] In one embodiment, the contour constraint check includes:
[0110] According to the length threshold in sequence Roundness threshold Area ratio threshold Inclination threshold The filtering is performed using the following formulas for each threshold:
[0111] ;
[0112] ;
[0113] ;
[0114] ;
[0115] in, It is the area of the outline. contour_length It is the length of the outline. ellipse_ area The area of the ellipse is obtained by calling OpenCV's ellipse fitting function on this contour. MA, ma It is the length of the major and minor axes of the ellipse. ma≤MA .
[0116] In one embodiment, before the first positioning of the center circle of the ring-shaped coded mark in the original image, the method further includes: step S112, performing contrast enhancement and gamma correction on the original image.
[0117] Contrast enhancement is achieved by applying CLAHE (Contrast Limited Adaptive Histogram Equalization) to the original image. CLAHE divides the original image into many small regions (tiles), performing histogram equalization within each region. The histogram of each region is then constrained to prevent over-enhancing contrast and thus avoid noise. Finally, interpolation is used to eliminate boundary effects between adjacent regions, resulting in a smooth finish. This technique effectively enhances the local contrast of the image without introducing excessive noise. After contrast enhancement, gamma correction is performed by building and applying a gamma lookup table, making the decoding robust to overexposed and underexposed images.
[0118] The above method preprocesses the original image, making it robust to handle various scenarios.
[0119] Of course, when the standard coded image is obtained in step S13, contrast enhancement and gamma correction can also be performed on the standard coded image.
[0120] In one embodiment, step S12, performing an affine transformation on the marker image to obtain a standard coded image, includes:
[0121] Step S121: Determine the outer boundary ellipse parameters of the ring zone based on the boundary ellipse fitting algorithm: Find all contour points in the binary image, determine the contour points that are between the inner boundary ellipse and the outer boundary ellipse and whose tangential-radial feature angle is less than 30°, and use the RANSAC method to fit the ellipse to the remaining contour points to obtain the optimized outer boundary ellipse parameters of the ring zone.
[0122] Specifically, the inner boundary ellipse is set to coincide with the center of the ellipse obtained in the first positioning, have the same shape, and be enlarged in size. The outer boundary ellipse is set to coincide with the center of the ellipse obtained in the first positioning, have the same shape, and be enlarged in size. An ellipse that is twice the size of an ellipse. The tangential-radial feature angle is set as the angle between the tangential vector of the contour point and the vector connecting the point to the center of the ellipse obtained from the first positioning.
[0123] Boundary ellipse fitting algorithm is an algorithm used to find the best-fitting ellipse from a given set of boundary point data to describe the distribution characteristics of these points. Principle: The general equation of an ellipse in a Cartesian coordinate system can be expressed as... Where A, B, C, D, E, and F are parameters, and satisfy the following condition: This ensures that the equation represents an ellipse. The core of the boundary ellipse fitting algorithm is to analyze and calculate the given boundary point data to determine this set of parameters so that the obtained ellipse can fit these boundary points as accurately as possible, that is, to minimize a certain metric of the distance from these points to the ellipse.
[0124] RANSAC (Random Sample Consensus) is a parameter estimation and data processing method primarily used to robustly estimate the parameters of a mathematical model from observation datasets containing a large amount of noise and outliers. The core idea of RANSAC is to select a minimal subset from a given dataset through random sampling, assuming this subset consists of "interiors" (i.e., data points that conform to the model). These interiors are used to estimate the model parameters. The estimated model is then used to test other points in the dataset to determine if they are interiors. After multiple iterations, the model containing the most interiors is selected as the final estimation result. Thus, even with a large number of outliers in the dataset, relatively accurate model parameters can be found through multiple sampling and validation. RANSAC is highly robust to outliers, accurately estimating model parameters even with a large amount of noise and outliers; it does not require prior knowledge of the proportion of outliers in the dataset, automatically adapting to the characteristics of the data through iteration; and the algorithm is simple, easy to understand, and easy to implement.
[0125] Step S122: Calculate the affine transformation relationship based on the outer boundary ellipse parameters of the ring zone: Since the imaging process will project the central circle into an ellipse, calculate the minimum enclosing rectangle of the ellipse corresponding to the outer diameter of the ring zone, and match the four vertices of the rectangle with the four vertices of the square image after the affine transformation, as the affine transformation relationship.
[0126] Step S123: Apply the affine transformation relation to the marker image to obtain the standard coded image.
[0127] The above scheme calculates the affine transformation relationship based on the optimized outer boundary ellipse parameters of the ring zone and performs target image reconstruction. Compared with the traditional method of positioning by imaging the ellipse through the central circle, it is more accurate and can calculate a more accurate affine transformation relationship. The resulting standard coded image is a standard pattern for decoding, which is a distortion-free pattern after affine correction.
[0128] In one embodiment, step S2, setting constraints based on the ring-shaped coding flag and filtering standard coded images to obtain valid coded images, includes:
[0129] Step S21: Determine the ratio of the outer diameter, inner diameter, and central circle diameter of the ring-shaped coding mark.
[0130] Since the actual ratio of the outer diameter, inner diameter, and central circle diameter of the coded pattern can change after imaging due to errors caused by image processing, edge recognition, affine transformation, etc., this application provides an adaptive coding parameter detection method to determine the ratio of the outer diameter, inner diameter, and central circle diameter of the ring-shaped coded mark, so as to avoid affecting subsequent decoding.
[0131] In one embodiment, step S21, determining the ratio of the outer diameter, inner diameter, and central circle diameter of the ring-shaped coding mark, includes:
[0132] Step S211: Traverse around the center circle of the ring-shaped coding mark, and sequentially find the pixel transition positions as transition points in the radial direction.
[0133] Specifically, the process involves traversing the entire circle around the center of the ring-shaped coding mark, with 1° intervals, and for each angle, sequentially searching for pixel transition positions as transition points along the radial direction originating from the coding center.
[0134] Step S212: Use a circular area as the sampling circle, and use the pixels within the sampling circle as the pixel values at that location. Record the proportion of white to the total number as the confidence level. If the confidence level exceeds the set value, it is recorded as white; otherwise, it is recorded as black. Use the location of the pixel transition as the transition radius value.
[0135] Specifically, instead of using the pixel value at that exact location, a statistical sampling method is used to sample pixels within a small circle each time. This avoids the influence of noise and ensures robust results. A relatively small radius is used for the sampling circle. The confidence level is determined by the proportion of high grayscale (white) values to the total number of pixels. A value with a confidence level exceeding 90% is recorded as white; otherwise, it is recorded as black. The transition radius is used at the point of black-to-white transition. Ideally, at a given angle, a radial transition from white to black can be found from the inside out. r 1. From black to white r 2. From white to black r3. Three transformation radius values. Record the three transformation radius values (integers) obtained at each angle, resulting in three lists of length 360. The value corresponding to the angle where no transformation radius was found is set to -1.
[0136] Step S213: Count the frequency of the transformation radius values to obtain the ratio of the outer diameter, inner diameter and central circle diameter of the ring.
[0137] Specifically, the accurate proportion is obtained by statistically counting the frequency of transformation radii. After removing -1 from each list, K-means clustering is used to identify the major ones. r 2 and r 3 values are used to obtain the centroid of each cluster and calculate the standard deviation of the cluster with the largest number of samples. If the standard deviation is greater than 3, the centroid of each cluster is determined. max_std If the value is 5, the pattern is considered invalid; otherwise, proceed from... r 2 and r The center point of the 3 largest clusters is used as r 2 and r The maximum cluster has 3 values, and the number of samples corresponding to the largest cluster is no less than 20. r It exists at every angle; if the standard deviation is greater than 1... max_std =5, then the pattern is considered invalid. max_std Determined based on image quality.
[0138] The above scheme allows for the adaptive search to accurately obtain the outer diameter, inner diameter, and central circle diameter of the corresponding ring after imaging the coded pattern; and the use of local confidence circle sampling to detect pixel intensity improves the accuracy of determining the transition point.
[0139] Step S22: Set the following constraints: pixels inside the center circle are white; pixels between the center circle and the inner diameter of the ring are black; the proportion of white pixels on the inner circumference of the ring is greater than a predetermined threshold.
[0140] Specifically, the codes are filtered based on the following necessary constraints:
[0141] 1. Pixels inside the center circle are white; 2. Pixels between the center circle and the inner diameter of the coding ring are black; 3. The proportion of white pixels on the inner circumference of the coding ring is greater than the threshold. Since the common coding bit length is usually more than ten bits, we take 1 / 20 as the threshold.
[0142] Step S23: Filter standard coded images. Standard coded images that meet the constraints are considered valid coded images.
[0143] The above scheme utilizes the constraints provided by the distribution pattern of the encoding pattern to perform encoding legality checks and select standard encoded images to obtain valid encoded images suitable for decoding.
[0144] Step S3: Using the pixel transition positions of the ring band in the ring-coded mark as transition points, generate a sequence of transition points based on the effective coded image.
[0145] Specifically, by sampling along the inner circumference of the ring using the aforementioned confidence circle (step S21), the angles of each transition point on the circumference are obtained, and a first and last repetition check is performed to ensure that the first and last elements of the sequence are not repeated, thus generating a unique corresponding sequence with an even number of sequence lengths, namely the transition point sequence.
[0146] Step S4: Identify the transition point sequence and assign code values to complete the decoding, including:
[0147] Step S41: Set the positional difference between two transition point sequences as a consistency condition; if the positional difference between the two transition point sequences is less than the set threshold, the consistency condition is satisfied.
[0148] Specifically, the same encoded pattern corresponds to a sequence array and its rightward circular shift with the first and last elements connected. Composed of multiple parts, total n The set of arrays. Therefore, when identifying the transition point sequence, a consistency condition is first set. Based on the consistency condition, it is determined whether two coding patterns are consistent. That is, it is determined whether there are any sequences in the second sequence set that are very similar to all positions of the first sequence (less than a set threshold). If so, they are classified as similar codes. This consistency condition is a necessary condition for determining that they are the same coding pattern.
[0149] To ensure robustness, the threshold set in the consistency condition should be set within a reasonable range based on the actual image conditions. If the threshold is set too strictly, the same ring-shaped coded marker may be mistakenly identified as two, especially when the tilt angle of the ring-shaped coded marker is too large or the affine transformation is inaccurate due to low image quality. If the threshold is set too leniently, a sequence generated by one coded pattern may be judged as similar to sequences generated by multiple other coded patterns.
[0150] Step S42: Filter all transition point sequences in the coding knowledge base, determine whether there is a transition point sequence that satisfies the consistency condition with the transition point sequence to be identified, and then assign code values. The coding knowledge base includes the identified transition point sequences and their corresponding code values.
[0151] If it does not exist, a new code value is assigned to the transition point sequence to be identified;
[0152] If it exists, and there is one, then assign the code value corresponding to the transition point sequence that satisfies the consistency condition to the transition point sequence to be identified;
[0153] If there exists more than one, then assign the code value corresponding to the transition point sequence with the smallest error (the smallest error means that the sum of the errors of each element of the two error sequences to be calculated is the smallest) to the transition point sequence to be identified.
[0154] like Figure 3 As shown, Figure 3 This is a schematic diagram illustrating a sequence of multiple transition points that satisfy the consistency condition in one embodiment of the present invention.
[0155] Specifically, Figure 3 (a) and Figure 3 (b) in the coding knowledge base represents the coding patterns corresponding to two different transition point sequences, which have been assigned different code values; Figure 3 In the diagram, (c) represents the coding pattern corresponding to the transition sequence to be identified, but the transition sequence to be identified satisfies the consistency requirement with the two different transition sequences. By assigning the code value corresponding to the transition sequence with the smallest error to the transition sequence to be identified, the error of assigning the same code value to different codes is avoided.
[0156] Step S43: Update the coding knowledge base and put the valid coded image corresponding to the transition point sequence into the code value corresponding library.
[0157] The above scheme first pre-screens matching code values based on consistency conditions, and then adaptively adjusts code values according to similarity conditions and the decoding order of the encoded patterns. The code values corresponding to the encoded patterns are not fixed; those decoded first are assigned smaller code values, and those decoded later are assigned larger code values. Compared to traditional methods that require a known correspondence between code values and encoded patterns, and where there is a one-to-one correspondence, the decoding process provided in this application does not require a code pattern-code value correspondence, achieving universal decoding and providing stronger decoding capabilities.
[0158] In one embodiment, the general decoding method for ring-coded flags further includes: step S5, calculating the merging support rate to merge redundant code values;
[0159] Step S5, calculating the merge support rate to merge redundant code values includes:
[0160] Step S51: Build a dictionary, record the code values of all identified transition point sequences as possible combinations of code values to be merged, use the combination as the key of the dictionary, and use the frequency of merging the combination as the count value of the key in the dictionary.
[0161] Step S52: When there is more than one transition point sequence that satisfies the consistency condition with the transition point sequence to be identified, increment the count value of the combination by 1.
[0162] Step S53: After all code values have been allocated, the ratio of the count of all possible code value combinations to the total number of codes in that combination is used as the merging support rate.
[0163] If the merge support rate is greater than a set value (e.g., 80%), then the code values corresponding to the two transition point sequences that meet the consistency condition will be merged.
[0164] like Figure 4 As shown, Figure 4 This is a schematic diagram of a sequence of multiple transition points that satisfy the consistency condition in another embodiment of the present invention.
[0165] Specifically, Figure 4 (a) and Figure 4 (b) represents two transition point sequences in the coding knowledge base that have been assigned different code values, but they correspond to the same coding pattern. Figure 4 In the diagram, (c) represents the encoding pattern corresponding to the transition sequence to be identified. The transition sequence to be identified satisfies the consistency requirement with the previous two transition sequences. Redundancy in assigning different code values to the same code is reduced by merging redundant code values.
[0166] The above scheme calculates the merging support rate to merge redundant code values assigned to the same code. It is accurate in recognizing coded patterns deformed by conditions such as high shooting tilt. It can effectively avoid the error of assigning the same code value to different codes and minimize the redundancy of assigning different code values to the same code, resulting in higher decoding accuracy. Even under conditions such as high image interference noise, overexposure or underexposure, excessive tilt, and target aging and peeling, it still has robustness and achieves accurate decoding.
[0167] Furthermore, after decoding, when saving the decoding result provided in this application embodiment, the secondary positioning image in coordinate system 2 is converted back to the original image coordinate system. For example, if the origin of each image is the upper left corner point, then the point in coordinate system 2 ( x,y To convert to the original image coordinate system, it is necessary to locate the coordinates of the origin of the image in the original image coordinate system.
[0168] This application also provides a universal decoding system for ring-coded flags, which, when applied to the above-described universal decoding method for ring-coded flags, includes:
[0169] The encoding generation module is configured to: acquire a standard encoded image including a ring-shaped encoded marker to be decoded, wherein the ring-shaped encoded marker includes a central circle and a ring concentric with the central circle;
[0170] The encoding filtering module is configured to: filter standard encoded images to obtain valid encoded images based on constraints set by the circular encoding flag;
[0171] The sequence generation module is configured to generate a sequence of transition points based on the valid coded image, using the pixel transition positions of the ring band in the ring-coded marker as transition points.
[0172] The sequence recognition module is configured to: recognize transition point sequences and assign code values;
[0173] Identify the transition point sequence and assign code values including:
[0174] The consistency condition is set as whether the positional difference between two transition point sequences is less than a predetermined threshold; if the positional difference between two transition point sequences is less than the predetermined threshold, the consistency condition is satisfied.
[0175] Filter all transition point sequences in the coding knowledge base, determine whether there is a transition point sequence that satisfies the consistency condition with the transition point sequence to be identified, and then assign code values. The coding knowledge base includes the identified transition point sequences and their corresponding code values.
[0176] If it does not exist, a new code value is assigned to the transition point sequence to be identified;
[0177] If it exists, and there is one, then assign the code value corresponding to the transition point sequence that satisfies the consistency condition to the transition point sequence to be identified;
[0178] If there are more than one, then assign the code value corresponding to the transition point sequence with the smallest error to the transition point sequence to be identified;
[0179] Update the coding knowledge base and add the valid coded image corresponding to the transition point sequence to the corresponding code value library.
[0180] The functions of each module correspond to the steps in the method described above, and will not be repeated here.
[0181] Through experiments, the method and system provided in this application have been verified to identify 1363 results when 60 ring-shaped coded markers are pasted in a certain scene. Among them, 8 non-coded markers were misidentified. Under the experimental conditions, no errors occurred where the same code value corresponded to different codes, and only one case occurred where the same code was assigned different code values. This demonstrates that the method provided in this application has robustness under complex lighting conditions such as darkness and overexposure, and can still accurately identify ring-shaped coded markers at high tilt angles (0-65 degrees).
[0182] It should be noted that the sequence numbers of the embodiments in this application are merely for descriptive purposes and do not represent the superiority or inferiority of the embodiments. The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. The terms "first," "second," and "third," etc., are used to distinguish different objects, etc., and do not represent a sequential order, nor do they limit "first," "second," and "third" to different types.
[0183] In the description of the embodiments of this application, terms such as "exemplary," "for example," or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplary," "for example," or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary," "for example," or "for instance" is intended to present the relevant concepts in a concrete manner.
[0184] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.
[0185] In some processes described in the embodiments of this application, multiple operations or steps are included in a specific order. However, it should be understood that these operations or steps may not be executed in the order they appear in the embodiments of this application, or they may be executed in parallel. The sequence number of the operation is only used to distinguish the different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed sequentially or in parallel, and these operations or steps may be combined.
[0186] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A general decoding method for annular coded markings, characterized in that, It comprises the following steps: Obtaining a standard encoding image comprising a ring-shaped encoding mark to be decoded, the ring-shaped encoding mark comprising a center circle and a ring band concentric with the center circle, taking the position of the center circle as the position of the ring-shaped encoding mark; Setting a constraint condition based on the ring-shaped encoding mark, screening the standard encoding image to obtain an effective encoding image; Taking the pixel transition position of the ring band in the ring-shaped encoding mark as a transition point, generating a transition point sequence from the effective encoding image; Identifying the transition point sequence and assigning a code value to complete decoding; The identification of the transition point sequence and the assignment of the code value to complete decoding comprise: Setting a consistency condition that whether the bit sequence difference of two transition point sequences is less than a predetermined threshold value; if the bit sequence difference of two transition point sequences is less than the set threshold value, the consistency condition is met; Screening all transition point sequences in the encoding knowledge base to determine whether there is a transition point sequence that meets the consistency condition with the transition point sequence to be identified, and then assigning a code value, wherein the encoding knowledge base comprises the identified transition point sequence and its corresponding code value; If not, assign a new code value to the transition point sequence to be identified; If there is one, assign the code value corresponding to the transition point sequence that meets the consistency condition to the transition point sequence to be identified; If there is more than one, assign the code value corresponding to the transition point sequence with the smallest error to the transition point sequence to be identified; Updating the encoding knowledge base and putting the effective encoding image corresponding to the transition point sequence into the code value corresponding library.
2. A general decoding method for annular coded markings according to claim 1, characterized in that, The general decoding method for the ring-shaped encoding mark further comprises calculating a merging support rate to merge redundant code values; The calculation of the merging support rate to merge redundant code values comprises: Establishing a dictionary to record the code values of all identified transition point sequences as possible merging code value combinations, taking the combination as the key of the dictionary, and taking the frequency of supporting the combination merging as the count value of the key in the dictionary; When there is more than one transition point sequence that meets the consistency condition with the transition point sequence to be identified, the count value of the combination is increased by 1; After all code values are assigned, the ratio of the count value of all possible merging code value combinations to the total number of codes in all code values in the combination is taken as the merging support rate; If the merging support rate is greater than a set value, the code values corresponding to two transition point sequences that meet the consistency condition are merged.
3. A general decoding method for annular coded marks according to claim 1, characterized in that, The obtaining of the standard encoding image comprising the ring-shaped encoding mark to be decoded comprises: Obtaining a mark point image covering a single ring-shaped encoding mark to be decoded; Performing affine transformation on the mark point image to obtain the standard encoding image.
4. A general decoding method for annular coded marks according to claim 3, characterized in that, The obtaining of the mark point image covering a single ring-shaped encoding mark to be decoded comprises: Obtaining an original image comprising a ring-shaped encoding mark to be decoded; Performing a first positioning on the center circle of the ring-shaped encoding mark in the original image to crop a first cropped image, the first cropped image being a square with a side length of S, with the center of the ellipse corresponding to the imaged center circle as the center, the first cropped image completely covering the ring-shaped encoding mark; The calculation formula of the side length S is: , k is 1.1-1.3; wherein, m 1 is the long axis of the ellipse corresponding to the first located center circle imaging, D 1 is the diameter of the center circle of the ring-shaped code mark, D 3 is the outer diameter of the ring belt of the ring-shaped code mark; the first cropped image is degraded into a binary image based on the OTSU method, a second positioning is performed through a contour constraint check, and a position of an ellipse corresponding to the center circle after imaging by the second positioning is taken as the position of the ring-shaped code mark, the first cropped image being taken as the mark point image.
5. A general decoding method for annular coded markings according to claim 4, characterized in that, the affine transformation of the mark point image to obtain the standard code image comprises: determining ring band outer boundary ellipse parameters based on a boundary ellipse fitting algorithm: finding all contour points in the binary image, determining contour points between the inner boundary ellipse and the outer boundary ellipse and having a tangent-radial feature included angle value less than 30°, and fitting an ellipse to the remaining contour points using a RANSAC method to obtain optimized ring band outer boundary ellipse parameters; calculating an affine transformation relationship based on the ring band outer boundary ellipse parameters: calculating a minimum enclosing rectangle of a ring band outer diameter corresponding ellipse, and taking the four corners of the rectangle in one-to-one correspondence with the four corners of the square image after affine transformation as the affine transformation relationship; applying the affine transformation relationship to the mark point image to obtain the standard code image.
6. The universal decoding method for annular coded markings according to claim 4, characterized in that, the contour constraint check comprises: sequentially according to length threshold , roundness threshold , area ratio threshold , inclination threshold , the screening formula of each threshold is as follows: ; ; ; ; wherein, is the area of the profile, contour_length is the length of the profile, ellipse_area is the area of the ellipse, MA, ma is the length of the major and minor axes of the ellipse, ma≤MA .
7. The universal decoding method for annular coded markings according to claim 4, characterized in that, Before the first positioning of the center circle of the ring-shaped code mark, the original image is subjected to contrast enhancement and gamma correction.
8. The universal decoding method for annular coded markings according to claim 1, characterized in that, the setting of a constraint condition based on the ring-shaped code mark and the screening of the standard code image to obtain an effective code image comprises: determining the proportions of the ring band outer diameter, the inner diameter and the center circle diameter in the ring-shaped code mark; the setting of the constraint condition comprises: the pixels inside the center circle are white; the pixels between the center circle and the ring band inner diameter are black; the proportion of the number of white pixels on the ring band inner circumference to the total number is greater than a predetermined threshold value; the screening of the standard code image, the standard code image meeting the constraint condition being taken as the effective code image.
9. A general decoding method for annular coded markings according to claim 8, characterized in that, the determination of the proportions of the ring band outer diameter, the inner diameter and the center circle diameter in the ring-shaped code mark comprises: traversing around the center circle of the ring-shaped code mark, and sequentially finding pixel transition positions as transition points in the radial direction; taking a circular region as a sampling circle, taking the pixels inside the sampling circle as the pixel values at the positions, taking the proportion of white pixels to the total number as a confidence degree, taking white when the confidence degree exceeds a set value, and taking black otherwise, and taking the positions of the pixel transition points as transition radius values; counting the frequency of the transition radius values to obtain the proportions of the ring band outer diameter, the inner diameter and the center circle diameter.
10. A general decoding system for annularly coded markings, applying the general decoding method for annularly coded markings according to any one of claims 1 to 9, characterized in that It comprises: an encoding generation module configured to: acquire a standard code image including a ring-shaped code mark to be decoded, the ring-shaped code mark including a center circle and a ring band concentric with the center circle; an encoding screening module configured to: set a constraint condition based on the ring-shaped code mark, and screen the standard code image to obtain an effective code image; a sequence generation module configured to: take pixel transition positions of the ring band in the ring-shaped code mark as transition points, and generate a transition point sequence according to the effective code image; a sequence identification module configured to: identify the transition point sequence, and assign code values. The identifying the transition point sequence and assigning a code value comprises: Setting a consistency condition that whether the bit sequence difference value of two transition point sequences is less than a predetermined threshold value; if the bit sequence difference value of two transition point sequences is less than the set threshold value, the consistency condition is satisfied; Screening all transition point sequences in the coding knowledge base to determine whether there is a transition point sequence that satisfies the consistency condition with the to-be-identified transition point sequence, and then assigning a code value, wherein the coding knowledge base comprises the identified transition point sequence and the corresponding code value; If not, assigning a new code value to the to-be-identified transition point sequence; If there is one, assigning the code value corresponding to the transition point sequence that satisfies the consistency condition to the to-be-identified transition point sequence; If there is more than one, assigning the code value corresponding to the transition point sequence with the minimum error to the to-be-identified transition point sequence; Updating the coding knowledge base and putting the valid coded image corresponding to the transition point sequence into the code value corresponding library.
Citation Information
Patent Citations
Ring coded mark point decoding recognition method based on coded ring sampling
CN108764004A
Annular coding mark point extraction and identification method based on multi-feature relaxation constraint
CN115731312A