A method for locating the central image point of circular array target based on vanishing points
By calculating the blanking point and the common tangent point of the elliptical equation based on the perspective-invariant homography matrix, the problem of low accuracy and high computational complexity in positioning the central image point of the circular array target is solved, and more efficient image point positioning is achieved. .
Patent Information
- Application Number
- CN202110907195.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-09
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-08-09
AI Technical Summary
The existing circular array target center image point positioning method has low accuracy and high computational complexity, and cannot effectively solve the problem of mapping the spatial circle to the center of the image plane ellipse under perspective projection.
Based on the property of perspective invariance, the homography matrix is used to calculate the coordinates of the blanking point, and the blanking point and the ellipse equation are jointly solved to obtain the common tangent point, and then the true projection point of the target circle center is calculated.
The accuracy of the central image point is improved, the program running time is significantly shortened, the efficiency is improved, and it has high usage value.
Smart Images

Figure CN113610917B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image point positioning in photogrammetry, and in particular to a method for positioning the central image point of a circular array target based on a vanishing point. Background Art
[0002] In the field of computer vision, circular targets are common camera calibration templates with advantages such as obvious shape features and good stability. During the calibration process, it is usually necessary to shoot the calibration plate from multiple angles, and the target plane is not completely parallel to the camera plane. During imaging, the circular target usually becomes an ellipse, and the geometric center of the ellipse is not the true projection of the center of the circle. Therefore, the accurate positioning of the true projection center of the circle is crucial.
[0003] Circular array targets are usually used in camera calibration, three-dimensional measurement, and multi-sensor calibration. The positioning of the central image point of the circular array target affects the accuracy of the final result. In response to this problem, many scholars have proposed different methods. Chen Tianfei proposed a method for calculating the central image point of the circular array target based on projective transformation. First, the edge is sub-pixel positioned, and then the degenerate ellipse is mapped into a more regular circle by iterative calculation of the projective transformation matrix, and then the central image point is calculated by RANSAN circle fitting iteration calculation, which has strong practicality. Xu Peng used the principle of perspective invariance to find the common tangent of three ellipses with non-collinear centers through a search algorithm. The intersection of the tangent point connection line can get the coordinates of the central image point. The calculation process is simple and efficient, but the amount of calculation is large. Xing Dekui set concentric circle targets and extracted their sub-pixel edge points, and then used the cross ratio invariance to obtain the distortion coefficient, and then compensated for the deviation of the center of the circle in the perspective projection transformation process, and finally obtained the accurate projection point of the center of the circle. This method is relatively clever, but it is only suitable for extracting the projection of the center of the concentric circle. Lu Xiaodong used the ellipse fitting center as the initial value for calibration, established a virtual target based on the calibration results, and solved the deviation problem of the ellipse center by iteratively calculating the center of the virtual target and its projection center, thus improving the calibration accuracy. However, multiple iterations undoubtedly increased the complexity of the algorithm. Li Zhanli et al. constructed an ellipse cone with the optical center as the vertex and the ideal projection contour as the dummy line, and constructed and determined a circular plane parallel to the space circle in the ellipse cone. The real image point coordinates of the space circle were determined by calculating the center of the parallel circle. However, this method requires the camera's internal parameters and distortion coefficients to be calibrated in advance.
[0004] In summary, although the existing image point positioning method can determine the coordinates of the real image point of the circle, it has low accuracy and high computational complexity. It cannot solve the problem that the perspective projection maps the spatial circle to an ellipse on the image plane, and the central image point of the spatial circle is often not the geometric center of the projected ellipse. Summary of the invention
[0005] In view of the technical problems of low precision and high computational complexity of existing image point positioning methods, the present invention proposes a method for locating the central image point of a circular array target based on vanishing points. Based on the property of perspective invariance, the coordinates of the vanishing points are calculated using the homography matrix, and the vanishing points are solved with the ellipse on the image plane to obtain the common tangent points, and the real projection point of the target circle center is calculated through the common tangent points. Simulation and actual experiments show that while improving the precision of the central image point, the running time of the program can also be greatly shortened, thereby improving efficiency.
[0006] In order to achieve the above object, the technical solution of the present invention is implemented as follows: a method for locating the central image point of a circular array target based on a vanishing point, the steps of which are as follows:
[0007] Step 1: Collect the image of the circular array target, preprocess the image, remove the messy edges on the preprocessed image, and obtain an image with the contour of interest;
[0008] Step 2: Use the Canny edge detection algorithm to perform edge detection on the image of the contour of interest to achieve rough positioning of the contour edge; use the sub-pixel edge detection algorithm to obtain the sub-pixel edge points of the contour edge; use the least squares method to perform ellipse fitting on the sub-pixel edge points to obtain the equation of the ellipse contour and the coordinates of the central image point of the ellipse;
[0009] Step 3: Calculate the homography matrix using the correspondence between the coordinates of the central image point of the ellipse and the circle on the circular array target;
[0010] Step 4: Use the homography matrix obtained in step 3 to calculate the vanishing point coordinates, and solve the vanishing point coordinates and the equation of the ellipse contour obtained in step 2 to obtain two sets of common tangent point coordinates of each ellipse contour;
[0011] Step 5: Establish the equation of the straight line between the two sets of common tangent points, and combine the two equations to find the coordinates of the central image point of each circle.
[0012] Preferably, the circular array target is a rectangular calibration plate, and a plurality of circles on the calibration plate form a rectangular array, the rectangular array includes at least 3 marking circles, and the diameter of the marking circle is larger than the diameter of other circles, and any three marking circles cannot be on the same straight line at the same time.
[0013] Preferably, the rectangular array is an 11×9 rectangular array, and 5 marking circles are arranged in the rectangular array, and the 5 marking circles are not on a straight line.
[0014] Preferably, the preprocessing method is: firstly performing binarization and median filtering operations on the image, and then using the Canny edge detection algorithm to obtain edge information of the contours of all objects in the target on the image;
[0015] Preferably, the method for removing the cluttered edges on the preprocessed image is: using the perimeter rule, area rule, and roundness information of the ellipse itself in sequence to remove the cluttered edges on the preprocessed image, that is,
[0016] Use the perimeter rule and area rule to remove the contours that do not meet the conditions:
[0017]
[0018] Among them, C min represents the minimum perimeter of the contour of interest, C max represents the maximum perimeter of the contour of interest, S min is the minimum value of the contour area of interest, S max is the maximum value of the contour area of interest;
[0019] Use the roundness information to remove the contours that do not meet the conditions:
[0020] A=4π(S / C 2 );
[0021] Among them, S is the area information of the detected contour, and C is the perimeter information of the detected contour. A threshold is set. When the value of the roundness A is greater than the threshold, it is considered that the detected contour meets the requirements; otherwise, the detected contour is cleared.
[0022] Preferably, the method of obtaining the sub-pixel edge point of the contour edge by using the sub-pixel edge detection algorithm is as follows: calculating the values of the first-order derivative and the second-order derivative of the grayscale of all pixels in the region of interest on the image after rough positioning; if the value of the first-order derivative of a certain pixel is less than the average value of the first-order derivatives of all pixels in the region, the pixel is excluded from the range of candidate points; then, points with opposite signs on both sides of the second-order derivative are found along the x-axis and y-axis directions, which are the candidate points; and the linear fitting function of the second-order derivative is set equal to zero to achieve accurate edge positioning of the candidate points;
[0023] The extracted sub-pixel edge points of the contour are fitted to an ellipse using the least squares method to obtain the relevant parameters of the ellipse; the coordinates of the central image point of the fitted ellipse are stored in the container imageCenter, and the value of the contour area of the ellipse is calculated and stored in the array contoursArea.
[0024] Preferably, the implementation method of step three is: using the marker circle on the circular array target to correspond the coordinates of the central image points of the ellipse fitting according to the arrangement order of the circles in the world coordinate system, and using the three-dimensional coordinate points of the marker circle in the world coordinate system and the two-dimensional coordinate points in the image coordinate system to calculate the homography matrix; sorting the coordinates of the central image points of the ellipse fitting, and recalculating the homography matrix using the correspondence between the three-dimensional coordinate points of all the circles on the circular array target and the two-dimensional coordinate points in the image coordinate system.
[0025] Preferably, the method of using the marking circle on the circular array target to correspond the coordinates of the central image point of the ellipse fitting according to the arrangement order of the circles in the world coordinate system is: taking the center of the marking circle on the calibration plate as the feature point, finding the position in the image coordinate system corresponding to the feature point, that is, the coordinates of the central image point of the ellipse in the container imageCenter, and the implementation method is:
[0026] Set the origin w(0,0,0) of the world coordinate system to the upper left corner of the circular array target plane, and the distance between the centers of any two circles in the x-axis and y-axis directions to 1. Sort the contour areas in the array contoursArea obtained in step 2 in descending order, and adjust the order in the container imageCenter accordingly to ensure that the values of the contour areas and the coordinates of the center image points of the contours have a one-to-one logical correspondence in their respective storage spaces.
[0027] Take out the first N elements in the container imageCenter and put them into the container dstPoint; N is the number of marker circles;
[0028] According to the position relationship of the marking circles on the circular array target, the distance between any two marking circles is calculated, that is, the distance between any two center image points in the container dstPoint is calculated. There are 2N groups in total, which are stored in the structure array structNum. Each element in the structure array structNum contains the coordinates of two center image points and the distance between them.
[0029] Sort the structure array structNum according to the size of the distance value in each element, and assign the result back to the structure array structNum;
[0030] According to the distance relationship between the marking circles on the circular array target, it can be known that the distance between feature point I and feature point II is the longest, and the distance between feature point III and feature point IV is the shortest; according to the position relationship that has been arranged in the structure array structNum, the four central image points contained in the two elements structNum[0] and structNum[2N-1] are taken out, the container dstPoint is traversed, and the four taken out central image points are used as judgment conditions to determine the coordinates of the central image point in the pixel coordinate system corresponding to the feature point V in the world coordinate system;
[0031] According to the different distances from feature point III and feature point IV on the circular array target to feature point V, the two feature points with the smallest distances are determined as the judgment conditions; the pixel coordinates corresponding to feature point III are used as the judgment points to determine the positions of the two feature points with the largest distances in structNum[0]; the corresponding relationship between the coordinates of all the central image points in the container dstPoint and the feature points marking the circle in the world coordinate system is obtained by cyclic calculation;
[0032] The method for determining the two feature points with the shortest distance length is: obtain the distances between the two central image points in structNum[2N-1] and the pixel coordinates corresponding to the feature point V, and determine that the longer distance point is the pixel coordinate point corresponding to the feature point III, and the shorter distance point is the pixel coordinate point corresponding to the feature point IV;
[0033] The method for determining the positions of the two feature points with the largest distance length in structNum[0] is as follows: the pixel coordinates corresponding to the feature point III are used as the judgment point, and the distances from the two central image points in structNum[0] to the judgment point are calculated respectively. The longer point is the pixel coordinate point corresponding to the feature point II, and the shorter point is the pixel coordinate point corresponding to the feature point I.
[0034] Preferably, the corresponding relationship between the three-dimensional coordinate points of all circles on the circular array target and the two-dimensional coordinate points on the image coordinate system is realized as follows: in the world coordinate system, the origin (0,0,0) is located at the upper left corner of the circular array target, the x-axis direction ranges from 0 to 10, and the y-axis direction ranges from 0 to 8. The positions of all central image points in the container imageCenter are determined: given two layers of for loops, the first layer is the value of i changing from 0 to 10, and the second layer is the value of j changing from 0 to 8; each loop of the innermost layer forms a feature point (i,j,0), and the homography matrix obtained by marking the circle is multiplied by the feature point (i,j,0) to obtain the mapping position of the feature point in the image coordinate system , and temporarily store it in the variable tempCenter; calculate the distances from the 99 central image points in the container imageCenter to tempCenter respectively, and store the results in the array disCenter. Perform a traversal of the array disCenter to determine the subscript of the minimum value in the array disCenter. The point corresponding to the subscript in the container imageCenter is the coordinate of the central image point corresponding to the feature point (i, j, 0). The coordinate of the central image point is stored in the container orderedImageCenter, and the first traversal is completed; continue the next traversal until the coordinates of all central image points are determined.
[0035] Preferably, the two sets of common tangent point coordinates are calculated by using the properties of the homography matrix. In the world coordinate system, the infinite points in the x-axis and y-axis directions are V1 and V2, and their coordinates are
[100] T and
[010] T , the projection points of the infinite points V1 and V2 on the image plane are the vanishing points P1 and P2 respectively, then:
[0036]
[0037] To obtain the coordinates of the common tangent point, you only need to establish equations by combining the vanishing point with the equation of the ellipse contour. The main coefficients of the equations are:
[0038]
[0039] Among them, A, B, C, D, E, and F are the equations of the ellipse contour obtained by the least squares method in step 2. 2 +Bxy+Cy 2 +Dx+Ey+F=0; G, H1, I, J, K, L are the coefficients constrained by the expression established by the coordinates of the vanishing point and the ellipse equation; (x v ,y v ) are the coordinates of the vanishing point;
[0040] By establishing a mathematical model for the equation coefficients, a set of common tangent point coordinates corresponding to a single vanishing point can be solved. The specific method is:
[0041]
[0042] Among them, (x1, y1) and (x2, y2) are the two coordinates of a set of common tangent points corresponding to a single vanishing point.
[0043] Preferably, the method for calculating the coordinates of the central image point in step 5 is:
[0044] Let A′(x1,y1) and B′(x2,y2) be the coordinates of the common tangent points obtained by combining the vanishing point P1 with the elliptic equation. Let C′(x3,y3) and D′(x4,y4) be the coordinates of the common tangent points obtained by combining the vanishing point P2 with the elliptic equation. Establish the general equation of the straight line A′B′ (y2-y1)x+(x1-x2)y+(x2y1-x1y2)=0;
[0045] The general equation for the straight line C′D′ is: (y4-y3)x+(x3-x4)y+(x4y3-x3y4)=0;
[0046] By combining the two general equations, the intersection of the two straight lines is the real coordinates of the central image point after the projection of the space circle, that is, the coordinates of the central image point (x0, y0) are obtained as:
[0047]
[0048] Compared with the prior art, the present invention has the following beneficial effects: the traditional method uses the projection properties of the common tangents between circles, and finds the common tangents of the edge of the projected ellipse through a search algorithm. The intersection of the tangent point connection line is the center image point of the circle; however, it takes a long time to search and is not very practical. The present invention uses the perspective invariance principle to combine the vanishing point with the ellipse equation to directly obtain two sets of common tangent point coordinates, and solves the center image point through the common tangent point coordinates. Simulation and actual experiments show that: while improving the accuracy of the center image point, it can also greatly reduce the running time of the program, improve efficiency, and has a high use value in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 It is a schematic diagram of the process of the present invention.
[0051] Figure 2 This is an image of the target of the actual experiment of the present invention.
[0052] Figure 3 for Figure 2 The effect diagram of the image after preprocessing.
[0053] Figure 4 It is a schematic diagram of the u-axis direction error of the simulation experiment results of the present invention.
[0054] Figure 5 It is a schematic diagram of the v-axis direction error of the simulation experiment result of the present invention.
[0055] Figure 6 It is a schematic diagram of the cross ratio value of the actual experimental results of the present invention. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0057] like Figure 1As shown, a method for accurately locating the central image point of a circular array target based on vanishing points is conceived as follows: first, pre-process the input target image, screen out the contours that meet the requirements, and extract the sub-pixel edges of the contours that meet the requirements; second, use the least squares method to perform ellipse fitting on the edge pixel points obtained to obtain the coordinates of the center of the ellipse and the equation expression, and sort the obtained ellipse centers according to the arrangement order of the circles on the target in the world coordinate system, recalculate the homography matrix, and use the homography matrix to calculate the vanishing points; finally, the vanishing points are solved in turn with each ellipse equation to obtain two sets of common tangent point coordinates of the ellipse contour, so that the two sets of tangent points can obtain the true central image point coordinates after the spatial circle is projected. The experimental results show that: while improving the accuracy of the central image point, the present invention can also greatly shorten the running time of the program, improve efficiency, and has a strong use value. The specific steps of the present invention are:
[0058] Step 1: Collect an image of the circular array target, preprocess the image, remove the cluttered edges on the preprocessed image, and obtain an image with a contour of interest.
[0059] like Figure 2 As shown, the circular array target used in the present invention is a rectangular calibration plate, and the multiple dots on the calibration plate form a rectangular array, the dots include at least 3 marking circles, and the diameter of the marking circle is larger than the diameter of other dots, and the 3 marking circles are not in a straight line. In a specific experiment, 99 dots are provided on the calibration plate, forming an 11×9 rectangular array, and there are 5 marking circles, and the 5 marking circles are not in a straight line. The calibration plate is placed in the field of view of the CCD camera to ensure that the entire calibration plate image can be completely captured, and the digital image obtained is the digital image to be processed by the present invention.
[0060] Before solving the central image point, the input image, i.e. the acquired image, needs to be preprocessed. The preprocessing first performs binarization, i.e. grayscale, median filtering and other operations on the image to reduce the impact of noise on image clarity, and uses the Canny edge detection algorithm to obtain the edge information of the contours of all objects in the target on the image. Figure 3 This shows the effect after removing the messy edges.
[0061] The method of removing the cluttered edges on the preprocessed image and obtaining an image with an interesting contour is to use the perimeter rule, area rule, and roundness information of the ellipse itself to remove the cluttered edges on the preprocessed image, that is,
[0062] Use the perimeter rule and area rule to remove the contours that do not meet the conditions:
[0063]
[0064] When removing cluttered edges, make a logical or judgment. When the circumference and area of a certain contour meet the range of the circumference and area of the small circle or the large circle, it will be retained. In the target plane, the shape and size of the circles are consistent, and their edge circumference and area should satisfy the above inequality, where C min represents the minimum perimeter of the contour of interest, C max represents the maximum perimeter of the contour of interest, S min is the minimum value of the contour area of interest, S max is the maximum value of the contour area of interest.
[0065] Use the roundness information to remove the contours that do not meet the conditions:
[0066] A=4π(S / C 2 );
[0067] Wherein, S is the area information of the detected contour, C is the circumference information of the detected contour, when the roundness A is equal to 1, the contour represents a perfect circle, and when the roundness A is equal to 0, the contour represents a polygon. Therefore, the present invention sets a threshold value, and when the value of the roundness A is greater than the threshold value, it can be considered that the detected contour meets the requirements. According to the circumference and area of the circular contour, a suitable threshold value is given to achieve the removal of cluttered edges.
[0068] Step 2: Use the Canny edge detection algorithm to achieve rough positioning of the contour edge, and use the sub-pixel edge detection algorithm to obtain the sub-pixel edge point information of the contour edge; then use the least squares method to fit the contour to an ellipse to obtain the equation of the ellipse contour and the coordinates of the central image point of the ellipse.
[0069] After image preprocessing and cluttered contour removal in step 1, only the contour of interest is retained on the image, and the Canny edge detection algorithm is used to achieve rough positioning of the contour edge. The Canny edge detection algorithm can quickly and accurately achieve the positioning of the contour edge.
[0070] Based on the rough positioning of the contour by the Canny algorithm, the method of extracting the sub-pixel edge points of the contour using the sub-pixel edge detection algorithm is as follows:
[0071] Calculate the first-order derivative and second-order derivative of the grayscale of all pixels in the region of interest on the image. If the value of the first-order derivative of a pixel is less than the average value of the first-order derivative of all pixels in the region, the pixel is excluded from the range of candidate points. Then find the points with opposite signs on both sides of the second-order derivative along the x-axis and y-axis as candidate points. Set the linear fitting function of the second-order derivative equal to zero to achieve accurate edge positioning of the candidate point. Similarly, use this method to extract sub-pixel edge points of other contours of interest.
[0072] The sub-pixel edge points of the extracted contour are fitted to an ellipse using the least squares method to obtain the relevant parameters of the ellipse; the coordinates of the center image point of the fitted ellipse are stored in the imageCenter
[99] container, and the value of the contour area of the contour is calculated and stored in the contoursArea
[99] array.
[0073] Step 3: Calculate the homography matrix using the correspondence between the coordinates of the central image point of the ellipse and the points on the circular array target.
[0074] The coordinates of the central image points of the ellipse fitting are matched according to the arrangement order of the circles in the world coordinate system using the marker circles on the circular array target, and the homography matrix is calculated using the three-dimensional coordinate points of the marker circles in the world coordinate system and the two-dimensional coordinate points in the image coordinate system; the coordinates of the central image points of the ellipse fitting are sorted, and the homography matrix is recalculated using the correspondence between the three-dimensional coordinate points and the two-dimensional coordinate points of all the circle points.
[0075] like Figure 2 As shown in the figure, the 11×9 dot calibration plate is used in the actual experiment. The five large circles on the calibration plate are marker circles, and the centers of the circles are feature points. The positions of these five feature points in the pixel coordinate system are found, so that the mapping relationship between the two planes can be calculated to be relatively accurate. The calibration plate is a two-dimensional plane, that is, the z-axis is defined as 0, and the origin of the world coordinate system w(0,0,0) is set at the upper left corner of the target plane. The distance between any two centers of the circles in the x-axis and y-axis directions is set to 1. Assuming that the positions of the five marker circles relative to the origin in the world coordinate system are w(2,4,0), w(5,2,0), w(8,4,0), w(5,6,0), and w(6,6,0), the contour areas obtained in step 2 are sorted in descending order. While sorting, the order in imageCenter
[99] is adjusted at the same time to ensure that the logical relationship between the contour area value and the contour center image point in their respective storage spaces corresponds one to one.
[0076] At this point, the first five elements in the contoursArea array and the imageCenter container are the contour area values of the large circle and the corresponding center image point coordinates. However, the correspondence between the positions of the five center image points in the pixel coordinate system and the five marker circles in the world coordinate system is not certain. Here, the first five elements in the imageCenter container are taken out and placed in the dstPoint[5] container for easy processing.
[0077] According to the positional relationship of the marker circles on the target, first, calculate the distance between any two marker circles, that is, calculate the distance between any two points in the dstPoint container. There are ten sets of data in total, which are stored in a structure array structNum
[10] . Each element in the structure array contains the coordinates of two center image points and the distance between them.
[0078] Sort the structure array structNum according to the size of the distance value in each element, and assign the result back to the structure array structNum. According to the distance relationship between the marking circles on the circular array target, it can be seen that the distance between the feature point w(2,4,0) and the feature point w(8,4,0) should be the longest, and the distance between the feature point w(5,6,0) and the feature point w(6,6,0) should be the shortest. Therefore, according to the position relationship that has been arranged in the structure array structNum, take out the four coordinate points contained in the two elements structNum[0] and structNum[9]. Each structure variable in the structure array contains three variables, two Point2f type coordinates and the distance value between the two coordinate points. Traverse the container dstPoint and use the four center image points taken out as the judgment condition. At this time, the coordinates of the center image point in the pixel coordinate system corresponding to the feature point w(5,2,0) in the world coordinate system can be determined. structNum[0] contains the two points with the longest distance between the center image points of the five marking circles. structNum[9] contains the two points with the shortest distance between the center image points of the five marking circles. Therefore, by traversing the dstPoint[5] array, the coordinates of the center image point corresponding to the feature point w(5,2,0) can be obtained.
[0079] Continue to determine the positions of the remaining four feature points. Since the distances from the feature points w(5,6,0) and w(6,6,0) on the circular target to w(5,2,0) are different, the two feature points with the smallest distances can be used as a judgment condition to determine the two feature points. Calculate the distances between the two central image points in structNum[9] and the pixel coordinates corresponding to the feature point w(5,2,0). The longer distance is the pixel coordinate point corresponding to the feature point w(5,6,0), and the shorter distance is the pixel coordinate point corresponding to the feature point w(6,6,0).
[0080] Finally, we only need to determine the positions of the two feature points with the largest distance in structNum[0]. Here, we need to use the pixel coordinates corresponding to the feature point w(5,6,0) as the judgment point. We calculate the distances from the two marker points in structNum[0] to the judgment point. The longer point is the pixel coordinate point corresponding to the feature point w(8,4,0), and the shorter point is the pixel coordinate point corresponding to the feature point w(2,4,0).
[0081] At this point, the correspondence between the five pixel points in the container dstPoint and the five marker circles in the world coordinate system has been clarified. The correspondence between these five sets of three-dimensional coordinate points and two-dimensional coordinate points is used to calculate the homography matrix. The calculation of the homography matrix uses the function findHomography() in opencv. The homography matrix obtained by these five sets of correspondence can only represent a relatively accurate mapping relationship between two planes, so it is necessary to sort the coordinates of the center image points of the remaining ellipse contours and recalculate the homography matrix using the correspondence between all three-dimensional coordinate points and two-dimensional coordinate points.
[0082] According to the target specification settings, the origin is at the upper left corner (0,0,0), the x-axis ranges from 0 to 10, and the y-axis ranges from 0 to 8. Determine the positions of all central image points in the imageCenter container. Given two layers of for loops, the first layer is the value of i changing from 0 to 10, and the second layer is the value of j changing from 0 to 8. Each loop in the innermost layer forms a feature point (i,j,0), and multiplies the homography matrix obtained by the marker circle with the feature point to obtain the relatively accurate mapping position of the feature point in the pixel coordinate system, which can be temporarily stored in the tempCenter variable. At this time, the distances of the 99 points in the imageCenter container to the tempCenter are calculated respectively, and the results are stored in the disCenter array. A trip through the disCenter array can determine the subscript of the minimum value in disCenter. The point corresponding to the subscript in the imageCenter container is the coordinate of the central image point corresponding to the feature point (i,j,0) on the target. The coordinates of the center image point are stored in the orderedImageCenter container. At this point, the first traversal is completed. Continue the next traversal until the positions of all center image points are determined. At this point, the ordered center image point coordinates are stored in the orderedImageCenter container. The homography matrix is recalculated using the correspondence between these 99 sets of three-dimensional coordinate points and two-dimensional coordinate points. tempCenter is the relatively accurate center image point coordinate of the feature point (i, j, 0), and imageCenter
[99] contains the accurate center image point coordinate of the feature point. Find the nearest point between tempCenter and imageCenter
[99] array, which is the final center image point coordinate corresponding to the feature point. This traversal method can quickly determine the position of the feature point in the world coordinate system corresponding to a certain center image point, and the idea is clear and easy to implement.
[0083] Step 4: Use the homography matrix obtained in step 3 to calculate the coordinates of the vanishing points, and solve the coordinates of the vanishing points and the equation of the ellipse contour obtained in step 2 to obtain two sets of common tangent point coordinates for each contour.
[0084] The position of the infinite point in the x-axis and y-axis directions in the world coordinate system in the pixel coordinate system is the position of the vanishing point.
[0085] Using the properties of the homography matrix, the infinite points in the x-axis and y-axis directions in the three-dimensional world coordinate system are V1 and V2, and their coordinates are [0 1 0] respectively. T and [0 1 0] T, the projection of the infinite point on the image plane is the vanishing point, and the infinite origin and the vanishing point are associated through the homography matrix H. Assuming that the projection points of the infinite points V1 and V2 on the image plane are the vanishing points P1 and P2 respectively, then there is a relationship:
[0086]
[0087] Finally, to obtain the coordinates of the common tangent point, we only need to establish an equation by combining the vanishing point with the ellipse equation. The main coefficients of the equation are:
[0088]
[0089] Among them, in step 2, the equation of the ellipse contour is obtained by the least squares method, and A, B, C, D, E, and F are Ax 2 +Bxy+Cy 2 +Dx+Ey+F=0 coefficient. (x v ,y v ) are the coordinates of the vanishing point. G, H1, I, J, K, L are the coefficients of the expression constraints established between the coordinates of the vanishing point and the ellipse equation.
[0090] By establishing a mathematical model for the equation coefficients, a set of common tangent point coordinates corresponding to a single vanishing point can be solved. The specific method is:
[0091]
[0092] Among them, (x1, y1) and (x2, y2) are the two coordinates of a set of common tangent points corresponding to a single vanishing point.
[0093] Compared with the traditional search method for obtaining the coordinates of the common tangent points, obtaining the coordinates of the two common tangent points based on the coordinates of the vanishing points can quickly calculate the two sets of common tangent point coordinates of each elliptical contour while ensuring accuracy.
[0094] Step 5: Establish the equation of the straight line between the two sets of common tangent points, and combine the two equations to find the coordinates of the central image point of each circle.
[0095] Assume A'(x1, y1) and B'(x2, y2) are a set of common tangent point coordinates obtained by the vanishing point P1, and C'(x3, y3) and D'(x4, y4) are a set of common tangent point coordinates obtained by the vanishing point P2. Then establish the general equation of the straight line A'B':
[0096] (y2-y1)x+(x1-x2)y+(x2y1-x1y2)=0;
[0097] Similarly, the general equation of the line C′D′ is:
[0098] (y4-y3)x+(x3-x4)y+(x4y3-x3y4)=0;
[0099] By combining the two general equations, the intersection of the two straight lines is the real coordinates of the central image point after the projection of the space circle, and the coordinates of the central image point (x0, y0) can be calculated. The specific solution is:
[0100]
[0101] The coordinates of the center image point of each circle obtained in this way are simple and accurate.
[0102] According to the method of the present invention, simulation and actual experiments were carried out to verify. In the simulation experiment, the corresponding camera internal and external parameter matrix was set, and Gaussian white noise with a standard deviation of 0.1 was added to the edge points of the circle in the projected image. Then, the central image point of each circle in the target was calculated using the method proposed in this article. Figure 2 is the target of actual experiment. Figure 3 To preprocess the target image and filter out the contour of interest, the following methods are used to calculate the coordinates of the center image point. Method 1 is to calculate the center of the circle by least squares ellipse fitting, method 2 is the method of calculating the center of the circle by using the outer common tangent of the ellipse in reference [1] [Document: Xu Peng, Wang Jianye, Wang Yanru. Accurate calculation of the coordinates of the center image point of the target circle in camera calibration [J]. Infrared and Laser Engineering, 2011, 40(07): 1342-1346.], and method 3 uses the method proposed by the present invention. Figure 4 is the u-axis direction error between the center image point coordinates obtained by the three methods in the simulation experiment and the ideal center image point, and the corresponding Figure 5 is the error in the v-axis direction. It can be seen that the error between the central image point obtained by the present invention and the ideal central image point is relatively smaller. At the same time, the QtCreator compiler is used to implement the program code writing. Table 1 shows the program running time of the three methods.
[0103] Table 1 Running time (unit: seconds)
[0104] Method 1 Method 2 The present invention time 79.624 648.147 1.133
[0105] In actual experiments, the coordinate position of the ideal circle center is unknown, so it is necessary to use the intersection ratio of collinear points in the projective space to verify the effectiveness of the method of the present invention. Figure 6The coordinates of the center image point obtained by three methods are displayed, and the cross ratio value is calculated; and compared with the ideal cross ratio value on the target, the results show that the cross ratio value of the center image point obtained by the present invention is closer to the ideal cross ratio value, thereby verifying the effectiveness of the present invention. The simulation and actual experimental results show that: while improving the accuracy of the center image point obtained, the present invention can also greatly shorten the running time of the program, and has stronger practical use value.
[0106] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for locating the central image point of a circular array target based on vanishing points. It is characterized in that The steps are as follows: Step 1: Collect the image of the circular array target, preprocess the image, remove the messy edges on the preprocessed image, and obtain an image with the contour of interest; Step 2: Use the Canny edge detection algorithm to perform edge detection on the image of the contour of interest to achieve rough positioning of the contour edge; use the sub-pixel edge detection algorithm to obtain the sub-pixel edge points of the contour edge; use the least squares method to perform ellipse fitting on the sub-pixel edge points to obtain the equation of the ellipse contour and the coordinates of the central image point of the ellipse; Step 3: Calculate the homography matrix using the correspondence between the coordinates of the central image point of the ellipse and the circle on the circular array target; Step 4: Use the homography matrix obtained in step 3 to calculate the vanishing point coordinates, and solve the vanishing point coordinates and the equation of the ellipse contour obtained in step 2 to obtain two sets of common tangent point coordinates of each ellipse contour; Step 5: Establish the equation of the straight line between the two sets of common tangent points, and combine the two equations to find the coordinates of the central image point of each circle.
2. The method for locating the central image point of a circular array target based on vanishing points according to claim 1, It is characterized in that The circular array target is a rectangular calibration plate, and multiple circles on the calibration plate form a rectangular array. The rectangular array includes at least 3 marked circles, and the diameter of the marked circle is larger than the diameter of other circles. Any three marked circles cannot be on the same straight line at the same time.
3. The method for locating the central image point of a circular array target based on vanishing points according to claim 2, It is characterized in that The rectangular array is an 11×9 rectangular array, in which 5 marking circles are arranged, and the 5 marking circles are not on a straight line.
4. The method for locating the central image point of a circular array target based on vanishing points according to claim 1 or 3, It is characterized in that The preprocessing method is: firstly, the image is binarized and median filtered, and then the edge information of the contours of all objects in the target on the image is obtained by using the Canny edge detection algorithm; The method for removing the cluttered edges on the preprocessed image is: using the perimeter rule, area rule, and roundness information of the ellipse itself in sequence to remove the cluttered edges on the preprocessed image, that is, Use the perimeter rule and area rule to remove the contours that do not meet the conditions: Among them, C min represents the minimum perimeter of the contour of interest, C max represents the maximum perimeter of the contour of interest, S min is the minimum value of the contour area of interest, S max is the maximum value of the contour area of interest; Use the roundness information to remove the contours that do not meet the conditions: A=4π(S / C 2 ); Among them, S is the area information of the detected contour, and C is the perimeter information of the detected contour. A threshold is set. When the value of the roundness A is greater than the threshold, it is considered that the detected contour meets the requirements; otherwise, the detected contour is cleared.
5. The method for locating the central image point of a circular array target based on vanishing points according to claim 1, 2 or 3, It is characterized in that The method for obtaining sub-pixel edge points of contour edges by using a sub-pixel edge detection algorithm is as follows: first-order derivatives and second-order derivatives of the grayscale of all pixels in the region of interest on the image after rough positioning are calculated; if the value of the first-order derivative of a certain pixel is less than the average value of the first-order derivatives of all pixels in the region, the pixel is excluded from the range of candidate points; then points with opposite signs on both sides of the second-order derivative are found along the x-axis and y-axis directions, which are candidate points; and the linear fitting function of the second-order derivative is set equal to zero to achieve accurate edge positioning of the candidate points; The extracted sub-pixel edge points of the contour are fitted to an ellipse using the least squares method to obtain the relevant parameters of the ellipse; the coordinates of the central image point of the fitted ellipse are stored in the container imageCenter, and the value of the contour area of the ellipse is calculated and stored in the array contoursArea.
6. The method for locating the central image point of a circular array target based on vanishing points according to claim 5, It is characterized in that The implementation method of step three is: use the marker circle on the circular array target to correspond the coordinates of the central image points of the ellipse fitting according to the arrangement order of the circles in the world coordinate system, and use the three-dimensional coordinate points of the marker circle in the world coordinate system and the two-dimensional coordinate points in the image coordinate system to calculate the homography matrix; sort the coordinates of the central image points of the ellipse fitting, and recalculate the homography matrix using the correspondence between the three-dimensional coordinate points of all the circles on the circular array target and the two-dimensional coordinate points in the image coordinate system.
7. The method for locating the central image point of a circular array target based on vanishing points according to claim 6, It is characterized in that The method of using the marking circle on the circular array target to correspond the coordinates of the central image point of the ellipse fitting according to the arrangement order of the circles in the world coordinate system is: taking the center of the marking circle on the calibration plate as the feature point, finding the position in the image coordinate system corresponding to the feature point, that is, the coordinates of the central image point of the ellipse in the container imageCenter, and the implementation method is: Set the origin w(0,0,0) of the world coordinate system to the upper left corner of the circular array target plane, and the distance between the centers of any two circles in the x-axis and y-axis directions to 1. Sort the contour areas in the array contoursArea obtained in step 2 in descending order, and adjust the order in the container imageCenter accordingly to ensure that the values of the contour areas and the coordinates of the center image points of the contours have a one-to-one logical correspondence in their respective storage spaces. Take out the first N elements in the container imageCenter and put them into the container dstPoint; N is the number of marker circles; According to the position relationship of the marking circles on the circular array target, the distance between any two marking circles is calculated, that is, the distance between any two center image points in the container dstPoint is calculated. There are 2N groups in total, which are stored in the structure array structNum. Each element in the structure array structNum contains the coordinates of two center image points and the distance between them. Sort the structure array structNum according to the distance value of each element, and assign the result back to the structure array structNum; According to the distance relationship between the marked circles on the circular array target, it can be seen that the distance between feature point I and feature point II is the longest, and the distance between feature point III and feature point IV is the shortest; According to the positional relationship that has been arranged in the structure array structNum, the four central image points contained in the two elements structNum[0] and structNum[2N-1] are taken out, the container dstPoint is traversed, and the four taken out central image points are used as judgment conditions to determine the coordinates of the central image point in the pixel coordinate system corresponding to the feature point V in the world coordinate system; According to the different distances from feature point III and feature point IV on the circular array target to feature point V, the two feature points with the smallest distances are determined as the judgment conditions; the pixel coordinates corresponding to feature point III are used as the judgment points to determine the positions of the two feature points with the largest distances in structNum[0]; the corresponding relationship between the coordinates of all the central image points in the container dstPoint and the feature points marking the circle in the world coordinate system is obtained by cyclic calculation; The method for determining the two feature points with the shortest distance length is: obtain the distances between the two central image points in structNum[2N-1] and the pixel coordinates corresponding to the feature point V, and determine that the longer distance point is the pixel coordinate point corresponding to the feature point III, and the shorter distance point is the pixel coordinate point corresponding to the feature point IV; The method for determining the positions of the two feature points with the largest distance length in structNum[0] is as follows: the pixel coordinates corresponding to the feature point III are used as the judgment point, and the distances from the two central image points in structNum[0] to the judgment point are calculated respectively. The longer point is the pixel coordinate point corresponding to the feature point II, and the shorter point is the pixel coordinate point corresponding to the feature point I.
8. The method for locating the central image point of a circular array target based on vanishing points according to claim 7, It is characterized in that The corresponding relationship between the three-dimensional coordinate points of all circles on the circular array target and the two-dimensional coordinate points on the image coordinate system is realized as follows: in the world coordinate system, the origin (0,0,0) is located at the upper left corner of the circular array target, the x-axis direction ranges from 0 to 10, and the y-axis direction ranges from 0 to 8. The positions of all central image points in the container imageCenter are determined: given two layers of for loops, the first layer is the value of i changing from 0 to 10, and the second layer is the value of j changing from 0 to 8; each loop of the innermost layer forms a feature point (i,j,0), and the homography matrix obtained by marking the circle is multiplied by the feature point (i,j,0) to obtain the mapping position of the feature point in the image coordinate system, and is temporarily stored in the variable tempCenter; Calculate the distances from the 99 central image points in the container imageCenter to tempCenter respectively, and store the results in the array disCenter. Perform a traversal of the array disCenter to determine the subscript of the minimum value in the array disCenter. The point corresponding to the subscript in the container imageCenter is the coordinate of the central image point corresponding to the feature point (i, j, 0). Store the coordinates of the central image point in the container orderedImageCenter, and the first traversal is completed; continue the next traversal until the coordinates of all central image points are determined.
9. The method for locating the central image point of a circular array target based on vanishing points according to claim 1 or 8, It is characterized in that The calculation method of the two sets of common tangent point coordinates is: using the properties of the homography matrix H, the infinite point in the x-axis and y-axis directions in the world coordinate system is V 1 、V 2 , whose coordinates are [100] T and [010] T , point V at infinity 1 、V 2 The projection points on the image plane are the vanishing points P 1 , P 2 , then: To obtain the coordinates of the common tangent point, you only need to establish equations by combining the vanishing point with the equation of the ellipse contour. The main coefficients of the equations are: Among them, A, B, C, D, E, and F are the equations of the ellipse contour obtained by the least squares method in step 2. 2 +Bxy+Cy 2 +Dx+Ey+F=0; G, H1, I, J, K, L are the coefficients constrained by the expression established by the coordinates of the vanishing point and the ellipse equation; (x v ,y v ) are the coordinates of the vanishing point; By establishing a mathematical model for the equation coefficients, a set of common tangent point coordinates corresponding to a single vanishing point can be solved. The specific method is: Among them, (x 1 ,y 1 ) and (x 2 ,y 2 ) are the two coordinates of a set of common tangent points corresponding to a single vanishing point.
10. The method for locating the central image point of a circular array target based on vanishing points according to claim 9, It is characterized in that The method for calculating the coordinates of the central image point in step 5 is: Let A′(x 1 ,y 1 )、B′(x 2 ,y 2 ) is the vanishing point P 1 The coordinates of a set of common tangent points obtained by combining the elliptic equation; C′(x 3 ,y 3 )、D′(x 4 ,y 4 ) is the vanishing point P 2 The coordinates of the common tangent points obtained by combining the ellipse equation are used to establish the general equation of the straight line A′B′ (y 2 -y 1 )x+(x 1 -x 2 )y+(x 2 y 1 -x 1 y 2 )=0; The general equation of the straight line C′D′ is: 4 -y 3 )x+(x 3 -x 4 )y+(x 4 y 3 -x 3 y 4 )=0; The intersection of the two general equations is the real coordinates of the central image point after the projection of the space circle, that is, the coordinates of the central image point (x 0 ,y 0 )for:
