9-point calibration method

16627940:

1.9 point calibration

The fixture clamps the product or calibration block, selects a feature, starts calibrating the
X-axis and Y-axis and moves one position, recording the physical coordinates of the axis: (Qx1, Qy1)
Extract the corresponding feature points in the image, the image pixel coordinates: (Px1, Py1 )
Move the Nth position, record the point axis coordinates (QxN, QyN), and extract the pixel coordinates: (PxN, PyN)
generally 9 points, 16 points, the features are evenly distributed in each position of the image, which can be
calculated by the halcon operator :
If the points recorded above are converted into the usage of halcon, it is as follows:
Px: = [1, 2, 3]
Py: = [1, 2, 3]
Qx: ​​= [3, 9, 12]
Qy: = [3, 9, 12]
Nine-point calibration is used (affine transformation, at least three points), which cannot eliminate lens and camera distortion
vector_to_hom_mat2d (Px, Py, Qx, Qy, HomMat2D)
HomMat2D is the matrix obtained.
This case does not require calibration rotation Center, use Affine_Trans_Point_2d (HomMat2D, ProductCol, ProductRow, Qx, Qy); Qx, Qy are the transformed mechanical coordinates, which can be directly sent to the robot for movement processing.

2. Rotation calibration

![* Known nine-point calibration matrix
HomMat2D: = [0.0202215, 3.43298e-005, -27.1543, 3.20314e-005, -0.0202298, 75.8988]
* Pixel coordinates of the rotation point set, such as the following
Prx: = [0, 1, 2, 3, 4, 5, 6]
Pry: = [0, 1, 2, 3, 4, 5, 6]
for Index: = 0 to |Prx|-1 by 1
* Convert a point to The operator
affine_trans_point_2d of another point (HomMat2D, Prx[Index], Pry[Index], Qx, Qy)
Qrx[Index]:=Qx
Qry[Index]:=Qy The core operator of
Endfor : affine_trans_point_2d, which is a matrix
conversion point.
It is to convert a series of pixel points into physical coordinate points through a for loop, which is used to fit the circle.
Even if our physical fitting point Qrx has been obtained above, Qry.
The second step is to fit the circle:
*Fitting circle
* is generated first Contour
gen_contour_polygon_xld (Contour, Qry, Qrx)
*Contour fitting circle, select 'geotukey' for the algorithm, read the documentation yourself
fit_circle_contour_xld (Contour, 'geotukey', -1, 0, 0, 3, 2, Row_C, Column_C, Radius_C, StartPhi, EndPhi, PointOrder)
Fitting the circle will not go into details, it is available on the Internet, and we can get our circle center (Column_C, Row_C ) (note the difference between X, Y coordinates and row and column coordinates here), radius: Radius_C
]
(https://img-blog.csdnimg.cn/7a84eb02828d4f7fa2336593f16db24c.png)
Insert image description hereRotation calibration diagram
calculates a fixed angle of rotation of a point around another point The coordinates after, as shown in the figure: The position after A (x, y) is rotated a degree around B (rx0, ry0) is C (x0, y0), then there is the following relationship: x0= cos (a) * (x
- rx0) – sin (a) *(y-ry0) +rx0
y0= cos (a) * (y- ry0) + sin (a) *(x-rx0) +ry0

Calculate the actual offset:
△x=x1-x0
△y=y1-y0
△x, △y are added to the X and Y axis offsets as compensation amounts

3. Formula derivation process

Insert image description here
Insert image description here
The 9-point + rotation calibration of the plane is completed in this way. Isn’t it very pleasant!

Guess you like

Origin blog.csdn.net/slts12345/article/details/129725747