The present invention belongs to the field of image processing and computer vision, and particularly relates to a method for adaptively detecting chessboard sub-pixel level corner points.
As a kind of special corner points, chessboard corner points are widely used in camera calibration and play an important role. Chessboard patterns are widely used for camera calibration because of obvious contrast, simple features, and easy detection and recognition. At the same time, the calibration accuracy of internal and external parameters of a camera is directly determined by the accuracy of chessboard corner point detection, and the accuracy of subsequent image processing tasks is directly determined by the accuracy of the calibrated parameters of the camera. Therefore, improving the accuracy of corner point detection of chessboard images is an important topic in the field of vision measurement.
According to the implementation mode, the existing corner point detection methods are generally divided into three categories: methods based on gray intensity, methods based on edge contour, and methods based on corner point models. The methods based on gray intensity are mainly to detect corner points by checking the variance in local gray value of images; the methods based on edge contour are mainly to detect corner points by analyzing the edge shape characteristics of images; and the basic framework of the methods based on corner point models is to match and filter images by building different types of corner point parameterization models.
However, none of the above-mentioned methods can completely cover the whole angle of field of the camera with a chessboard image or extract feature points of edge area by the chessboard image, so that the calibrated internal and external parameters of the camera are certainly not accurate. At the same time, for a chessboard image shot in a complex illumination condition, the situations of chessboard corner point wrong detection and missing detection may occur. For a chessboard image with low resolution or large distortion, improper size of an iteration window for calculating sub-pixel level corner points will lead to wrong or unstable position detection of the sub-pixel level corner points.
The present invention aims to overcome the defects of the existing chessboard corner point detection technology and proposes a method for adaptively detecting chessboard sub-pixel level corner points, i.e., detection of sub-pixel level corner points is completed by setting marks on a chessboard to mark position of an initial unit grid, determining pixel coordinates of four corner points of the initial unit grid, using a homography matrix H calculated by the pixel coordinates of the four corner points of the initial unit grid in a pixel coordinate system and manually set world coordinates in a world coordinate system to expand outwards, adaptively adjusting size of an iteration window in the process of expanding outwards, and finally spreading to the whole chessboard region.
The present invention has the following specific technical solution: a method for adaptively detecting chessboard sub-pixel level corner points, comprising the following steps:
Step 2) “shooting an image” comprises the following specific steps:
Conducting gray processing and binarization operation to the image after the image is shot; due to light and shadow, the effect directly using Otsu's method is not very ideal, so dividing an image I into M*N blocks by block binarization method, with each block named Ii; as and using Otsu's method for each Ii to obtain a binarization image binary_I.
Step 4) comprises the following specific steps:
Solving the formula by least square method:
GiTGiq=GiTGipi
i.e.:
q=(GiTGi)−1*(GiTGipi)
The coordinate of an initial corner point is an integer and is assumed to be q0, and a window is selected centering on q0; the radius win of the iteration window of the sub-pixel level corner point is obtained; each point of the window is pi; the quantity of pi is N, Gaussian weight is introduced, the weight at point pi is wi, and the coordinate q of the sub-pixel level corner point is:
Using sobel convolution to calculate the gray gradient Gi at point pi; for point pi:
the sub-pixel level corner point detected is the most accurate, wherein k and p are coefficients of first order terms, and c and b are constants; based on the known k, ρ, c, b,
if the above relations are not satisfied, the size of the iteration window win for calculating sub-pixel level corner points shall be dynamically adjusted until the relations are satisfied.
Step 5) comprises the following specific steps:
Based on that ZcP′=HW′, letting
then the homography matrix H is obtained:
H=A[r1r2t]
Step 6) comprises the following specific steps:
the sub-pixel level corner point detected is the most accurate, wherein k and ρ are coefficients of first order teams, and c and b are constants; based on the known k, ρ, c, b,
if the above relations are not satisfied, the size of the iteration window win for calculating sub-pixel level corner points shall be dynamically adjusted until the relations are satisfied.
The present invention has the following beneficial effects: the present invention proposes a method for adaptively detecting chessboard corner points, having the following characteristics:
The present invention proposes a method for adaptively detecting chessboard sub-pixel level corner points, which realizes adaptive detection of chessboard sub-pixel level corner points by six steps, i.e., setting marks, shooting an image, detecting the marks, using the marks, expanding outwards and adaptively adjusting. The present invention will be described in detail below in combination with drawings and embodiments by taking the example of setting five circles on a chessboard as marks.
1) First, a printed chessboard is required, and a calibration target can be a chessboard with five circles or a common chessboard calibration target pasted with five circles as markers. As shown in
2) The chessboard is shot by a camera until the black and white chessboard can completely cover the whole angle of field of the camera, and gray processing and binarization are respectively conducted to a collected image.
3) Taking an image I as an example, five circles in the image are detected by Hough circle detection algorithm, and pixel coordinates of the five circles are recorded. Middle points of four lines connecting the four peripheral circles C1, C2, C3 and C4 to the central circle C0 are calculated and numbered as P1, P2, P3 and P4, and the four points are used as four initial corner points. It is assumed that the side lengths of P1P2, P2P3, P3P4, P4P1 are respectively d1, d2, d3, d4, and the corresponding included angles of every two sides are respectively θ1, θ2, θ3, θ4. According to empirical formulas obtained from previous observation, when the average value
the sub-pixel level corner point detected is the most accurate, wherein k and ρ are coefficients of first order terms, and c and b are constants. Based on the known k, ρ, c, b,
4) After sub-pixel level corner point coordinates of the four points are calculated by iteration, the accuracy of the sub-pixel level corner point coordinates calculated need to be verified. The lengths of the four sides of the unit grid are named in the same direction (clockwise or counterclockwise) as d′1, d′2, d′3, d′4, the tangents of the four sides are named as ϕ1, ϕ2, ϕ3, ϕ4, and the corresponding included angles of every two adjacent sides are named as θ′1, θ′2, θ′3, θ′4 respectively. Parameters μ1, μ2, λ1, λ2, η1, η2, δ1 and δ2 are set, and μ1=λ1=η1=δ1=0.9 and μ2=λ2=η2=δ2=1.1; are taken. The side lengths needs to satisfy that:
If the above relations are not satisfied, the size of the iteration window win for calculating sub-pixel level corner points shall be dynamically adjusted until the relations are satisfied. Four sub-pixel level corner points P1, P2, P3 and P4 are solved by iteration according to the solving principle of sub-pixel level corner points.
4) The points on the chessboard are assigned with values one by one in a world coordinate system according to the four initial sub-pixel level corner points. A homography matrix H can be obtained by the relationship between the four points in the world coordinate system and those in a pixel coordinate system.
5) By using the homography matrix H of the initial four points and the coordinates of a pair of points P5 and P6 to be solved of an adjacent unit grid in the world coordinate system, pixel coordinates of next two points P5 and P6 can be obtained, and then new sub-pixel level corner points P5 and P6 are solved by iteration according to the solving principle of sub-pixel level corner points.
6) All sub-pixel level corner points on the chessboard are calculated by expanding and spreading outwards from the unit grid defined by the four points to the positive half axis of the X axis, the negative half axis of X axis, the positive half axis of the Y axis, and the negative half axis of Y axis.
7) In the process of expanding outwards, the other two unknown rough sub-pixel level corner points of the adjacent unit grid can be obtained according to the homography matrix H, the rough lengths of the four sides of the adjacent unit grid can be obtained according to the coordinates of the two rough corner points, the lengths of the four sides are named in the same direction (clockwise or counterclockwise) as d1, d2, d3, d4, and the corresponding included angles of every two adjacent sides are named as θ1, θ2, θ3, θ4 respectively. According to empirical formulas obtained from previous observation, when the average value
the sub-pixel level corner point detected is the most accurate, wherein k and ρ are coefficients of first order terms, and c and b are constants. Based on the known k, ρ, c, b,
8) After sub-pixel level corner point coordinates of the four points are calculated by iteration, the accuracy of the sub-pixel level corner point coordinates calculated need to be verified. The lengths of the four sides of the unit grid are named in the same direction (clockwise or counterclockwise) as d′1, d′2, d′3, d′4, the tangents of the four sides are named as ϕ1, ϕ2, ϕ3, ϕ4, and the corresponding included angles of every two adjacent sides are named as θ′1, θ′2, θ′3, θ′4 respectively. Parameters μ1, μ2, λ1, λ2, η1, η2, δ1 and δ2 are set, and μ1=λ1=η1=δ1=0.9 and μ2=λ2=η2=δ2=1.1 are taken. The side lengths needs to satisfy that:
If the above relations are not satisfied, the size of the iteration window win for calculating sub-pixel level corner points shall be dynamically adjusted until the relations are satisfied.
Number | Date | Country | Kind |
---|---|---|---|
202010027812.0 | Jan 2020 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2020/077959 | 3/5/2020 | WO |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2021/138990 | 7/15/2021 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
8681224 | Mallon | Mar 2014 | B2 |
20120057053 | Mallon | Mar 2012 | A1 |
20150077543 | Kerr | Mar 2015 | A1 |
20160371855 | Jovanovic et al. | Dec 2016 | A1 |
20220148213 | Kong | May 2022 | A1 |
Number | Date | Country |
---|---|---|
104089575 | Oct 2014 | CN |
104240229 | Dec 2014 | CN |
108734743 | Nov 2018 | CN |
Entry |
---|
L. Huang, L. He, J. Li and L. Yu, “A Checkerboard Corner Detection Method Using Circular Samplers, ” 2018 IEEE 4th International Conference on Computer and Communications (ICCC), Chengdu, China, 2018, pp. 1546-1550, doi: 10.1109/CompComm.2018.8780757. (Year: 2018). |
Y. Zhang, G. Li, X. Xie and Z. Wang, “A new algorithm for accurate and automatic chessboard corner detection,” 2017 IEEE International Symposium on Circuits and Systems (ISCAS), Baltimore, MD, USA, 2017, pp. 1-4, doi: 10.1109/ISCAS.2017.8050637. (Year: 2017). |
Number | Date | Country | |
---|---|---|---|
20220198712 A1 | Jun 2022 | US |