A calibration board detection method in a complex environment
Patent Information
- Application Number
- CN202410651388.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2044-05-24
AI Technical Summary
[0007]本发明所述的复杂环境下的标定板检测方法,通过多层滤波增强了对现实复杂环境的去噪能力,通过逐层增强滤波能力使得大量低噪样本在前层滤波输出节约检测时间,通过候选集合保存各层滤波图像的检测结果,再通过高层补低层融合多层结果,以互补的方式,既降低了高层滤波对角点精度的影响,又保留了高层滤波对高噪场景的检测性能,从而增强了标定板检测算法的检测性能和对复杂现实环境的鲁棒性;另外,迭代解码策略,不依赖特定的形状、编码和校正方案,通过在预设的归一化坐标系迭代码元坐标再以变换矩阵映射到像素域的方式解码,从而以通用性更强的迭代方式来抵抗畸变,其以先验信息决定迭代方向,以归一化坐标系确定迭代步长和迭代边界,迭代耗时少效率高,增强了标定板检测方法对复杂畸变场景的检测能力,并通过在码本加入镜像码以使得标定板的镜面成像解码为镜像码ID,以助于后处理中消除镜像误检;此外,通过码元和非码元像素对比和汉明距离阈值获取连通域四边形的ID和对比度,通过连通域四边形的面积和最大面积的比值、高像素对比阈值和低像素对比阈值的比值加上修正因子,对迭代解码后码值为预设码ID且大于低像素对比阈值的连通域四边形的对比度进行缩放,获取缩放后的修正对比度,并以修正对比度与预设的高像素对比阈值进行对比,输出大于高像素对比阈值的连通域四边形,既防止误检干扰正确检测又提升了正确检测的判别值,以提升标定成功率从而提高目标系统性能。
Smart Images

Figure CN118608620B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual inspection, and in particular to a calibration plate inspection method in complex environments. Background Technology
[0002] Calibration boards are commonly used in the vision field, including robot localization, virtual reality, and automotive driver assistance systems. Their purpose is to calculate the camera's intrinsic and extrinsic parameters using the detected coordinates of the calibration board, thereby establishing the required coordinate system. In practical applications, due to noise in complex environments and lens distortion, calibration board detection often results in false positives and false negatives, leading to calibration failures and impacting the performance of the constructed system.
[0003] To reduce false positives and false negatives, traditional technicians often use image enhancement to process noise and use special shapes, special coding and image correction to resist distortion. For example, a Chinese patent with an application date of November 12, 2018, publication (announcement) number CN109697381A, entitled "A Method for Preprocessing QR Code Images," uses filtering and noise reduction, contrast enhancement, and other methods to preprocess QR code images to locate the QR code position; a Chinese patent with an application date of September 29, 2018, publication (announcement) number CN109285194A, entitled "Camera Calibration Board and Camera Calibration Data Acquisition Method," uses a circular pattern and resists distortion through feature dots, affine transformation, and diffusion; and a Chinese patent with an application date of April 27, 2022, publication (announcement) number CN114742558A, entitled "A Method for Detecting Parking Payment QR Codes Based on Vehicle-Mounted Surround View Fisheye Camera," corrects the distortion of QR codes under fisheye distortion before detection.
[0004] However, in scenarios with increased environmental complexity and distortion, the aforementioned patents may fail to adapt to the scene, resulting in false positives and false negatives. For example, complex noise introduced under different lighting conditions is difficult to remove, and special shapes may be distorted after being squeezed under large distortion at distant ground edges, or the accuracy of the correction algorithm may be insufficient, all of which can lead to false positives and false negatives. Furthermore, the calibration board for special shape encoding is costly and the algorithm design is complex. Summary of the Invention
[0005] The purpose of this invention is to provide a calibration board detection method that can reduce false negatives and missed detections in complex environments, so as to improve the calibration success rate and thus improve the performance of the target system.
[0006] The calibration board testing method under complex environments described in this invention includes the following steps: S1, pre-stored calibration board QR code decoding ID, and preset multi-layer filters with different levels of high and low; S2. Obtain the image of the calibration board, process the image with a multi-layer filter after grayscale conversion, binarize the filtered image, locate the connected components in the image using connected component analysis, and calculate the edges to form a quadrilateral using least squares fitting. S3. Based on the position of the quadrilateral in the connected domain and the prior information on distortion, obtain the offset direction of the pixel coordinates of the quadrilateral in the connected domain relative to the pixel coordinates of the quadrilateral in the undistorted connected domain. S4. Calculate the coordinate transformation matrix between the connected quadrilateral and the preset normalized coordinate system. Iterate the position coordinates of the code element according to the offset direction in the preset normalized coordinate system. Transform the position coordinates of the code element after iteration to the pixel coordinate values of the connected quadrilateral according to the transformation matrix. Then compare the transformed code element pixel values with the non-code element pixel values on the grayscale image to obtain the code value and contrast of the connected quadrilateral after iteration. S5. Compare the code value of the connected quadrilateral after iteration with the ID of the pre-stored calibration board QR code decoding. If the Hamming distance between the two is less than the preset Hamming distance threshold, the connected quadrilateral is successfully decoded and the code value is the pre-stored ID. If the code value is still greater than the preset Hamming distance threshold after the iteration ends, it is not the pre-stored ID. The decoded output is a connected quadrilateral with a code value of the pre-stored ID and a contrast greater than the preset low pixel contrast threshold. S6. Using the relative information between the connected quadrilaterals output in step S5, the contrast of the connected quadrilaterals output in step S5 after iterative decoding is scaled to obtain the corrected contrast of each quadrilateral. The corrected contrast is compared with the preset high pixel contrast threshold, and the connected quadrilaterals with a higher pixel contrast threshold are output. S7. Determine whether the connected quadrilaterals output in step S6 have reached the preset number or whether it is the highest-level filter output. If the preset number is not reached, return to step S2 to increase the filter level layer by layer. If the preset number is reached, compare the results of the filter outputs of each layer, and supplement the lower layer with the results of the higher layers that are different from the lower layers before outputting the calibration board detection result. If it is not the highest-level filter output, return to step S2 to increase the filter level layer by layer. If it is the highest-level filter output, compare the results of the filter outputs of each layer, and supplement the lower layer with the results of the higher layers that are different from the lower layers before outputting the calibration board detection result.
[0007] The calibration board detection method for complex environments described in this invention enhances denoising capabilities in real-world complex environments through multi-layer filtering. By progressively enhancing filtering capabilities layer by layer, a large number of low-noise samples are filtered at the front-layer output, saving detection time. A candidate set stores the detection results of each layer's filtered images, and then multi-layer results are fused through high-layer compensation of low-layer results. This complementary approach reduces the impact of high-layer filtering on corner accuracy while retaining the detection performance of high-layer filtering in noisy scenes, thereby enhancing the detection performance and robustness of the calibration board detection algorithm to complex real-world environments. Furthermore, the iterative decoding strategy does not rely on specific shapes, encoding, or correction schemes. It decodes by iterating symbol coordinates in a preset normalized coordinate system and then mapping them to the pixel domain using a transformation matrix. This provides a more universal iterative approach to resist distortion. It uses prior information to determine the iteration direction and the normalized coordinate system to determine the iteration step size and iteration boundaries. The iteration process is time-efficient and highly effective, enhancing the calibration board detection method's ability to detect complex distortion scenes. By adding a mirror code to the codebook, the mirror image decoding of the calibration board is converted into a mirror code ID, aiding in the elimination of false detections during post-processing. Furthermore, the ID and contrast of connected quadrilaterals are obtained through symbol and non-symbol pixel comparison and Hamming distance thresholding. A correction factor is added to the ratio of the area of the connected quadrilateral to the maximum area, and the ratio of the high-pixel contrast threshold to the low-pixel contrast threshold, to scale the contrast of connected quadrilaterals whose decoded code value is a preset code ID greater than the low-pixel contrast threshold. This scaled-down corrected contrast is then compared with a preset high-pixel contrast threshold, outputting connected quadrilaterals with a value greater than the high-pixel contrast threshold. This prevents false detections from interfering with correct detection and improves the discrimination value of correct detections, thereby increasing the calibration success rate and improving the performance of the target system.
[0008] As a preferred embodiment of the present invention, the higher the number of layers in the multilayer filter, the stronger the filtering capability and the higher the noise reduction capability.
[0009] As a preferred embodiment of the present invention, in step S3, the pixel coordinates of the connected components of the calibration plate images at different positions have different offset directions relative to the undistorted connected components after incorporating distortion prior information.
[0010] As a preferred embodiment of the present invention, the transformation matrix in step S4 is obtained by the four corner points corresponding to the connected quadrilateral and the preset normalized coordinate system. When iterating in the preset normalized coordinate system, the iteration direction is along the coordinate axis direction indicated by the offset direction in S3. The iteration step size corresponds to the unit value of the coordinate system, and the iteration boundary is the edge line of the corresponding four corner points in the normalized coordinate system.
[0011] As a preferred embodiment of the present invention, step S5 further includes simultaneously comparing the code value of the connected quadrilateral with the ID of the mirror code decoded from the pre-stored calibration board QR code. If the Hamming distance between the two is less than a preset Hamming distance threshold and the Hamming distance is less than the Hamming distance between the quadrilateral and the original ID of the pre-stored code, then the iterative decoding ends and the quadrilateral decoding result is the mirror code ID; otherwise, the decoding is performed according to the Hamming distance with the original code ID.
[0012] As a preferred embodiment of the present invention, the scaling of the contrast of all connected quadrilaterals output in step S5 in step S6 to obtain the corrected contrast of each connected quadrilateral specifically involves: calculating the area of all connected quadrilaterals output in step S5, finding the largest area based on the area, and then adding a correction factor to the ratio of the area of the connected quadrilateral to the largest area, the ratio of the high pixel contrast threshold to the low pixel contrast threshold, to obtain the scaled corrected contrast of all connected quadrilaterals output in step S5. The corrected contrast is then compared with the high pixel contrast threshold, and quadrilaterals with a value greater than this threshold are output.
[0013] As a preferred embodiment of the present invention, in step S7, if the number of connected quadrilaterals output by each layer reaches a preset value, all output connected quadrilaterals are sorted in descending order with a scaled and corrected contrast, and only the first preset number of sorted quadrilaterals are output to meet the output number requirement. Attached Figure Description
[0014] Figure 1 This is a flowchart illustrating a calibration board testing method under complex environments according to the present invention. Figure 2 Example diagram of conventional decoding of a connected quadrilateral; Figure 3 This is an example diagram illustrating the iterative decoding process and decoding results of the present invention; Figure 4 A schematic diagram illustrating an example of mirror imaging; Figure 5 This is an example diagram comparing noise with the quadrilateral shape of the calibration board. Detailed Implementation
[0015] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. 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.
[0016] A calibration board testing method under complex environments, such as Figure 1As shown, it includes step S1, pre-stored ID of the calibration board QR code decoding, and preset multi-layer filters with different levels.
[0017] The calibration board is preferably a rectangular calibration board, but it is not limited to calibration boards with ID information. The coded ID of the graphic information identifier only needs to have a certain singularity in the environment to help reduce noise interference.
[0018] Step S2: Obtain the image of the calibration board, process the image with a multi-layer filter after grayscale conversion, binarize the filtered image, locate the connected components in the image using connected component analysis, and calculate the edges to form a quadrilateral using least squares fitting.
[0019] The calibration board image is preprocessed by a multi-layer filter. The purpose of this preprocessing is to process noise after the image is converted to grayscale, in order to suppress the formation of connected components by noise and to prevent the generation of connected components that could damage the calibration board. After filtering, the image is binarized, and the location of the connected components is determined by the connected component region analysis method. A large number of noisy connected components are removed by using basic calibration board properties such as black and white contrast and four sets of edges. For the remaining connected components, the location of the quadrilateral of the connected component is obtained by calculating the intersection of four straight lines through least squares fitting.
[0020] Due to the complexity of lighting and image sharpness in real-world environments, commonly used filtering and denoising methods are not suitable for all conditions. Furthermore, the stronger the filtering capability, the greater the accuracy loss after corner point drift in the calibration board detection. To address this, the calibration board image is preprocessed using a multi-layer filter. For a large number of low-noise scene samples in reality, increasing the number of filtering layers enhances the filtering capability. This helps ensure that the lower-level filtering meets the preset output quantity conditions and outputs detection results, minimizing the need for subsequent higher-level filtering and saving detection time. In addition, since the noise levels on different boards within the same image may vary, the final output compares the results of each layer's filtering, retaining the higher-precision results from lower layers and supplementing them with detectable results from higher layers. This improves the detection rate while minimizing accuracy loss.
[0021] Step S3: Based on the position of the quadrilateral in the connected region and the prior information on distortion, obtain the offset direction of the pixel coordinates of the quadrilateral in the connected region relative to the pixel coordinates of the quadrilateral in the undistorted connected region.
[0022] For all obtained connected quadrilaterals, decoding is required to find those whose ID information error with the pre-stored calibration board QR code decoding meets a threshold, thus determining the calibration board position. Due to the calibration board placement and lens distortion, the connected quadrilaterals are not necessarily rectangles, and the symbols within the connected quadrilaterals may shift, causing decoding failure. Consequently, the calibration board cannot be extracted from the located quadrilaterals, ultimately leading to detection failure. Therefore, it is necessary to obtain the offset direction of the pixel coordinates of the connected quadrilaterals relative to the pixel coordinates of the undistorted connected quadrilaterals, in order to iteratively decode the symbol positions in subsequent iterations.
[0023] Step S4: Calculate the coordinate transformation matrix between the connected quadrilateral and the preset normalized coordinate system. Iterate the position coordinates of the code element according to the offset direction within the preset normalized coordinate system. Transform the position coordinates of the code element after iteration to the pixel coordinate values of the connected quadrilateral according to the transformation matrix. Then, compare the transformed code element pixel values with the non-code element pixel values on the grayscale image to obtain the code value and contrast of the connected quadrilateral after iteration.
[0024] like Figure 2 (a) Let the coordinates of the preset coordinate system be x w , Figure 2 In (b), the actual pixel coordinates are x p Then the preset coordinates of the quadrilateral corner point ABCD can be determined by... Figure 2 (a) It is stipulated that ABCD in Figure 2 (b) The pixel coordinates have been obtained by straight line fitting, and the homography matrix H can be solved by using these four pairs of points through singular value decomposition and other methods.
[0025] After obtaining the homography matrix H, the equation is as follows: It can be used Figure 2 Given the preset coordinates of all points in (a), calculate their positions in... Figure 2 (b) The corresponding pixel coordinates, which can then be used Figure 2 (a) The non-code parts of the black and white dots are in Figure 2 (b) The threshold θ is obtained by linearly weighting the average pixel values.
[0026] For the blue dot, i.e., the code element Figure 2 (b) The pixel value is compared with the threshold θ to obtain a string of binary code values. The average difference between the data bits and the threshold θ can be used as the contrast value c for post-processing. Figure 2 (b) It can be seen that the symbol position deviation is large and decoding error occurs before iterative decoding.
[0027] Therefore, the goal of iterative decoding is to make the decoded sampling points approximate the true distribution, using methods such as... Figure 3(a) shows the iteration method in the preset normalized coordinate system grid, that is, the unit value of the iteration is 1 / z of the unit grid value of the preset coordinate system, the iteration boundary is the edge line where the four points ABCD are located, and the number of iterations is t.
[0028] Regarding the direction of iteration, taking barrel distortion as an example, in Figure 3 (a) shows Figure 3 (b) The iteration direction when the calibration plate is located to the right of the barrel distortion image. Barrel distortion is a type of radial distortion, and its commonly used distortion formula is: Where k is the distortion coefficient, x and y are the normalized coordinates of the pixel, and r is the distance between the pixel and the origin.
[0029] Step S5: Compare the code value of the connected quadrilateral after iteration with the ID of the pre-stored calibration board QR code decoding. If the Hamming distance between the two is less than the preset Hamming distance threshold, the connected quadrilateral is successfully decoded and the code value is the pre-stored ID. If the code value is still greater than the preset Hamming distance threshold after the iteration ends, it is not the pre-stored ID. After decoding, output the connected quadrilateral with the code value of the pre-stored ID and the contrast greater than the preset low pixel contrast threshold.
[0030] This calibration board detection method does not rely on a specific correction method; that is, it does not estimate distortion coefficients. Instead, it determines the iteration direction solely through prior knowledge of the connected quadrilateral positions and distortion, thereby reducing the number of iterations and shortening the iteration time. Combined with the commonly used radial barrel distortion formula, where pixels expand outwards from the center, therefore... Figure 2 (b) The decoding point calculated based on the homography matrix will be offset downwards and to the left relative to the actual symbol position, therefore it will be in... Figure 3 In the iteration direction of (a), y is upward and x is to the right. If the calibration board is located on the left side of the image, the iteration direction is y upward and x to the left. After each iteration, a code value can be obtained. Since the symbol orientation of the connected quadrilateral is uncertain, the obtained code values will be reordered by rotating 90 degrees three times, thus obtaining four decoded values. These are compared with the pre-stored ID of the calibration board's QR code decoding. The Hamming distance between the two values is less than the preset Hamming distance threshold β, indicating successful decoding and termination of the iteration. Figure 2 (b) and Figure 3 (b), Figure 3 (b) The sampling point distribution after iterative decoding is correct, and the decoding is correct.
[0031] by Figure 3 (a) Example of a coordinate system: For barrel distortion, the sampling formula for iterative decoding is as follows: Where d x and d y Representing the iteration direction, `leftquad` indicates that when the connected quadrilateral is on the left side of the image, dx = -1 in the preset coordinate system. Iterate to the left; if it is rightquad, then the connected quadrilateral has dx = 1 on the right side. Iterate to the right; while dy = -1 is always true. Iterate upwards. The left and right positions of the image are the information after the quadrilateral of the connected region is located. The iteration direction can be determined based on the left and right positions and the prior information of distortion. In the formula, iter is the iteration step number, which is greater than or equal to 0, and g and l are multiples of the preset coordinate system unit value 1 / z, which is the iteration step size.
[0032] As the number of iterations increases, the distance the data point in the preset coordinate system moves within the preset coordinate system increases. After each movement, the homography matrix H obtained from the previous four pairs of points is mapped to the pixel coordinate system for sampling and decoding. The iteration boundary is the boundary line where ABCD is located. The iteration termination condition is to compare the decoded code value with the ID of the pre-stored calibration board QR code decoding. The Hamming distance between the two is less than the preset Hamming distance threshold β, or the iteration boundary is reached, or the iteration steps end.
[0033] Therefore, QR code boards with small distortions will be extracted in the preceding iteration steps, while those with large distortions will be extracted in subsequent iteration steps. It is evident that the iterative decoding method of this calibration board detection approach allows for easy setting of iteration unit values, clear iteration boundaries, and easy determination of the iteration direction from prior knowledge. This prevents the number of iterations t from becoming excessively large, thus reducing iteration time. Furthermore, this method is less affected by image resolution, the distance of the calibration board, and the degree of distortion.
[0034] Step S5 further includes simultaneously comparing the code value of the connected quadrilateral with the ID of the mirror code decoded from the pre-stored calibration board QR code. If the Hamming distance between the two is less than the preset Hamming distance threshold β, and the Hamming distance is less than the Hamming distance between the quadrilateral and the original ID of the pre-stored code, then the iterative decoding ends, and the decoding result of this quadrilateral is the mirror code ID; otherwise, it is decoded according to the Hamming distance with the original code ID. Since only connected quadrilaterals decoded into the original ID of the pre-stored code and with a contrast greater than the preset low pixel contrast threshold are output, connected quadrilaterals decoded into the mirror code ID will not be output.
[0035] Typically, decoding only requires comparing the Hamming distance with the pre-stored calibration board QR code ID. However, in practical applications, the image formed by the calibration board on the mirror surface is as follows: Figure 4As shown, since the Hamming distance error between the mirror image and the pre-stored calibration board QR code ID is relatively small during decoding, it is difficult to remove as a false detection. Therefore, the code value of the connected quadrilateral is compared with the mirror code ID of the pre-stored calibration board QR code during comparison. During decoding, the mirror image is extracted as the ID of the mirror code instead of the pre-stored code because the Hamming distance with the mirror code is smaller. This helps to filter it out by ID in the post-processing scheme, thereby eliminating false detections of mirror images. The connected quadrilaterals that are successfully decoded iteratively can be represented by a set Q. At this time, the connected quadrilaterals in the set Q have their corresponding decoding IDs and connected quadrilateral pixel contrast c. Due to iterative decoding, the set Q has removed the noise with large Hamming distances after decoding, and only the connected quadrilaterals with Hamming distances less than the Hamming distance threshold β are retained. Therefore, the decoding ID of the connected quadrilaterals in the set is the code value of the laid calibration board or the code value of the mirror code.
[0036] Based on the above analysis, the initial screening strategy before iterative decoding is: set a low-pixel contrast threshold c. l Only retain pixels with a contrast value greater than the low pixel contrast threshold c. l The set Q1 is obtained by combining the decoded ID information with the connected quadrilaterals of the pre-stored calibration board QR code ID. At this point, set Q1 has removed the connected quadrilaterals of the mirror code that are below the low pixel contrast threshold, thereby greatly reducing the number of candidate samples and removing mirror code false detections.
[0037] Step S6 uses the relative information between the connected quadrilaterals output in step S5 to scale the contrast of the connected quadrilaterals output in step S5 after iterative decoding, so as to obtain the corrected contrast of each quadrilateral. The corrected contrast is compared with the preset high pixel contrast threshold, and the connected quadrilaterals with a higher contrast value than the high pixel contrast threshold are output.
[0038] Since, in addition to the calibration board, noise may also have high pixel contrast and be decoded into a pre-stored calibration board QR code ID, for example... Figure 5 As shown in (a), after the initial screening, the candidate connected quadrilateral set Q1 is still affected by noise false detections. Therefore, a high pixel contrast threshold c is set. h A secondary screening of the dataset is performed. Due to varying lighting conditions or other factors in complex environments, the high pixel contrast threshold c is easily generated. h The value is uncertain, and if noise falsely detects a value in set Q1 and its contrast is greater than that of the calibration board, the noise will suppress the calibration board, leading to false detections and missed detections. Therefore, comparing the noise with the quadrilateral of the calibration board is as follows: Figure 5 As shown.
[0039] exist Figure 5 The actual area of noise in (a) is not large; it has been enlarged in the figure for illustration purposes. Figure 5 (b) In practice, if the low pixel contrast threshold is used as described above, cl After filtering with ID information, the noise level will not be that high. Figure 5 (b) is intended to visually represent noise characteristics, namely elongated or clustered quadrilaterals with small areas and some trapezoidal shapes. However, due to the influence of distortion on the quadrilaterals of the calibration board, the shapes of the quadrilaterals of the calibration board also vary. Therefore, the contrast of all connected component quadrilaterals after initial screening is scaled to obtain the corrected contrast of each connected component quadrilateral after scaling. Specifically, the area of all connected component quadrilaterals after initial screening is calculated, and the largest area is found based on the area. Then, the corrected contrast of all connected component quadrilaterals after initial screening is obtained by adding a correction factor to the ratio of the area of the connected component quadrilateral to the largest area, the ratio of the high pixel contrast threshold to the low pixel contrast threshold, and so on. The corrected contrast is then compared with the high pixel contrast threshold, and quadrilaterals with a value greater than this threshold are output.
[0040] Specifically, the area 'a' of the quadrilateral candidate connected regions of set Q1 is calculated. i Find the maximum area a among them. max , with a max Using the maximum area value after initial screening and ID screening as the benchmark, the weighting factor is calculated and the contrast of each quadrilateral is scaled. The formula is as follows: in This is a relative value of the area. It is the high-low contrast threshold ratio, and f is a correction factor. Its purpose is to make the c of the true quadrilateral with a relatively higher area among the candidate connected quadrilaterals in Q1 higher. i Enhanced, while the relatively low area of the noise quadrilateral c i It is attenuated. i c represents the pixel contrast of the i-th connected quadrilateral. i,new This is the corrected contrast after scaling the i-th connected quadrilateral.
[0041] Due to the previously screened sample c i Greater than or equal to the low pixel contrast threshold c l Then (c i *c h ) / c l Since the pixel contrast threshold ch is greater than the high pixel contrast threshold ch, controlling the relative area ratio and correction factor allows control over the degree of enhancement and attenuation, so that the pixel contrast threshold c after amplification of the true value by this formula is obtained. i,new Above the high pixel contrast threshold c h Corrected contrast c after noise attenuation i,new Below the high pixel contrast threshold c h And the high pixel contrast threshold c can be fixed according to the degree of control. h .
[0042] In practical use, such as Figure 5 As shown in (a), (b), and (c), noise with a relatively small area can attenuate rapidly and thus not interfere with the calibration board, but if... Figure 5 The asymmetrical arrangements shown in (d) and (e) will result in calibration plates that are far apart being relatively opposite to a. max The attenuation is too drastic and thus suppressed if the area is too small. Therefore, the attenuation is limited to areas with an absolute area smaller than a. set Only then is the contrast attenuated; otherwise, the contrast c is corrected. i,new Equal to the original c i The enhancement is still performed according to the formula, so this method is also applicable to asymmetric scenarios and attenuates noise. set The detection distance can be determined by the usage environment.
[0043] Post-processing finally uses a high-pixel contrast threshold c h For the connected quadrilaterals of set Q1, the corrected contrast c after scaling is applied. i,new Filtering is performed, specifically the corrected contrast c after scaling. i,new Greater than c h The connected quadrilaterals are entered into the final output quadrilateral set Q. f This effectively solves the problem of false noise detection.
[0044] Step S7 determines whether the connected quadrilaterals output in step S6 have reached a preset number or whether it is the highest-level filter output. If the preset number is not reached, the process returns to step S2 to increase the filter level layer by layer. If the preset number is reached, the results of the filter outputs of each layer are compared, and the results of higher layers that are different from those of lower layers are added to the lower layers before the calibration board detection result is output. If it is not the highest-level filter output, the process returns to step S2 to increase the filter level layer by layer. If it is the highest-level filter output, the results of the filter outputs of each layer are compared, and the results of higher layers that are different from those of lower layers are added to the lower layers before the calibration board detection result is output.
[0045] If the number of connected quadrilaterals output at each layer reaches a preset value, all output connected quadrilaterals are sorted in descending order using a scaled, corrected contrast, and only the first preset number of sorted quadrilaterals are output to meet the output requirement. In set Q... f Corrected contrast after scaling c i,new Sort the quadrilaterals in descending order and output the top n connected quadrilaterals, where n is a preset number. If there are fewer than n quadrilaterals, output all of them. Finally, obtain the detection calibration result of the image after the i-th layer filtering, denoted as s. i The number of plates it contains is p, where p is less than or equal to n.
[0046] After obtaining the filtering results s of each layer iSubsequently, if only the detection result of the high-level strong filter with the largest value of i is output, it may cause a certain board to miss the filtering layer most suitable for the current scene, that is, miss the board output at the lower level. This is because the noise experienced by boards at different positions in the same image may be different, that is, the spatial inconsistency of noise, and the corner accuracy of the high-level filtering result is lower than that of the low-level filtering. Therefore, the filtering results before the final output are stored in a set S, then S={s1,s2,...,s k}. Where s k To achieve the preset number value or the highest level filter output result, since the preset number value is n, s i The number of plates contained in the filter is p. Therefore, when i < k, p < n; when i = k, p ≤ n, which means that the filter will enter the next layer of filtering before reaching the preset number. The preset maximum number of filtering layers is m. Then k ≤ m, which means that the last layer will not be greater than the preset maximum number of filtering layers.
[0047] After obtaining set S, s i The center point of each of the four corner points of a board represents its position. The Euclidean distance between the center points of all boards in set S is calculated. Boards with an Euclidean distance less than a threshold δ are considered to be the same board. The board with the smallest corresponding layer number i is retained as the final output of the detection results and placed into set S. f In, and for s f The panel in the middle is adjusted to correct the contrast after scaling. i,new Sort the data in descending order and keep only the top n boards as the final result, where n is the preset output number; if there are fewer than n boards, no further filtering is performed and the data is directly output as the final result.
[0048] The above embodiments are only used to illustrate the detailed solutions of the present invention. The present invention is not limited to the above detailed solutions, that is, it does not mean that the present invention must rely on the above detailed solutions to be implemented. Those skilled in the art should understand that any improvements to the present invention, equivalent substitutions of the raw materials of the product of the present invention, addition of auxiliary components, selection of specific methods, etc., all fall within the protection scope and disclosure scope of the present invention.
Claims
1. A calibration board testing method under complex environments, comprising the following steps: S1, pre-stored calibration board QR code decoding ID, and preset multi-layer filters with different levels of high and low; S2. Obtain the image of the calibration board, process the image with a multi-layer filter after grayscale conversion, binarize the filtered image, locate the connected components in the image using connected component analysis, and calculate the edges to form a quadrilateral using least squares fitting. S3. Based on the position of the quadrilateral in the connected domain and the prior information on distortion, obtain the offset direction of the pixel coordinates of the quadrilateral in the connected domain relative to the pixel coordinates of the quadrilateral in the undistorted connected domain. S4. Calculate the coordinate transformation matrix between the connected quadrilateral and the preset normalized coordinate system. Iterate the position coordinates of the code element according to the offset direction in the preset normalized coordinate system. Transform the position coordinates of the code element after iteration to the pixel coordinate values of the connected quadrilateral according to the transformation matrix. Then compare the transformed code element pixel values with the non-code element pixel values on the grayscale image to obtain the code value and contrast of the connected quadrilateral after iteration. S5. Compare the code value of the connected quadrilateral after iteration with the ID of the pre-stored calibration board QR code decoding. If the Hamming distance between the two is less than the preset Hamming distance threshold, then the connected quadrilateral is successfully decoded and the code value is the pre-stored ID. If the code value is still greater than the preset Hamming distance threshold after the iteration ends, then it is not the pre-stored ID. The decoded output code value is a connected quadrilateral with a pre-stored ID and a contrast greater than the preset low pixel contrast threshold. S6. Using the relative information between the connected quadrilaterals output in step S5, the contrast of the connected quadrilaterals output in step S5 after iterative decoding is scaled to obtain the corrected contrast of each quadrilateral. The corrected contrast is compared with the preset high pixel contrast threshold, and the connected quadrilaterals with a higher pixel contrast threshold are output. S7. Determine whether the connected quadrilaterals output in step S6 have reached the preset number or whether it is the highest-level filter output. If the preset number is not reached, return to step S2 to increase the filter level layer by layer. If the preset number is reached, compare the results of the filter outputs of each layer, and supplement the lower layer with the results of the higher layers that are different from the lower layers before outputting the calibration board detection result. If it is not the highest-level filter output, return to step S2 to increase the filter level layer by layer. If it is the highest-level filter output, compare the results of the filter outputs of each layer, and supplement the lower layer with the results of the higher layers that are different from the lower layers before outputting the calibration board detection result.
2. The calibration plate testing method under complex environments according to claim 1, characterized in that, The higher the number of layers in the multilayer filter, the stronger the filtering capability and the higher the noise reduction capability.
3. The calibration plate testing method under complex environments according to claim 1, characterized in that, In step S3, the pixel coordinates of the connected components in the calibration board images at different locations, after incorporating the distortion prior information, have different offset directions relative to the distortion-free connected components.
4. The calibration plate testing method under complex environments according to claim 1, characterized in that, The transformation matrix in step S4 is obtained by the four corner points corresponding to the connected quadrilateral and the preset normalized coordinate system. When iterating in the preset normalized coordinate system, the iteration direction is along the coordinate axis direction indicated by the offset direction in S3. The iteration step size corresponds to the unit value of the coordinate system, and the iteration boundary is the edge line of the corresponding four corner points in the normalized coordinate system.
5. The calibration board testing method under complex environments according to claim 1, characterized in that, Step S5 further includes simultaneously comparing the code value of the connected quadrilateral with the ID of the mirror code decoded from the pre-stored calibration board QR code. If the Hamming distance between the two is less than the preset Hamming distance threshold and the Hamming distance is less than the Hamming distance between the quadrilateral and the original ID of the pre-stored code, then the iterative decoding ends and the quadrilateral decoding result is the mirror code ID; otherwise, the decoding is performed according to the Hamming distance with the original code ID.
6. The calibration board testing method under complex environments according to claim 1, characterized in that, In step S6, scaling the contrast of all connected quadrilaterals output in step S5 to obtain the corrected contrast of each connected quadrilateral is specifically done as follows: calculate the area of all connected quadrilaterals output in step S5, find the largest area among them, and then add a correction factor to the ratio of the area of the connected quadrilateral to the largest area, the ratio of the high pixel contrast threshold to the low pixel contrast threshold, to obtain the scaled corrected contrast of all connected quadrilaterals output in step S5. The corrected contrast is then compared with the high pixel contrast threshold, and quadrilaterals with a contrast greater than this threshold are output.
7. The calibration board testing method under complex environments according to claim 1, characterized in that, In step S7, if the number of connected quadrilaterals output by each layer reaches a preset value, all output connected quadrilaterals are sorted in descending order with scaled and corrected contrast, and only the first preset number of sorted quadrilaterals are output to meet the output number requirement.
Citation Information
Patent Citations
Camera calibration board and camera calibration data acquisition method
CN109285194A
A two-dimensional code image preprocessing method
CN109697381A
Method for detecting parking lot payment two-dimensional code based on vehicle-mounted all-round fisheye camera
CN114742558A
Four-corner two-dimensional code directional plane target device and calibration method thereof
CN115272459A
Image processing apparatus, image forming apparatus, image processing method, image processing program, and recording medium
JP2004343334A
