A camera center calibration method for a cutting machine worktable
By using an automated camera center calibration method, which utilizes image processing techniques and the least squares method to calculate the camera center position, the calibration error problem caused by manual operation in existing technologies is solved, achieving higher accuracy and simpler camera center calibration.
Patent Information
- Application Number
- CN202210875750.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-25
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2042-07-25
AI Technical Summary
The existing method for calibrating the camera center of the slicing machine worktable relies on manual operation, resulting in low calibration accuracy and difficulty in achieving precise positioning.
An automated camera center calibration method is adopted. By acquiring image sequences, the camera center position is calculated using a checkerboard calibration board and image processing techniques such as Gaussian filtering, adaptive binarization, and median filtering, combined with the least squares method, thereby reducing manual errors.
It improves the accuracy of camera center calibration and ease of operation, reduces mechanical errors, and has wider applicability.
Smart Images

Figure CN115359125B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of slicing machine equipment technology, specifically a method for calibrating the camera center of a slicing machine worktable. Background Technology
[0002] In the dicing operation, the center position of the camera relative to the worktable is a parameter that needs to be calibrated. If the calibration accuracy is too low, the workpiece cannot be accurately positioned when it is moved or rotated, which will have an adverse effect on the dicing operation. Therefore, it is very important to accurately calibrate the center position of the camera.
[0003] Currently, traditional calibration methods mainly rely on the two-point or three-point method. These methods require manual movement of the camera to a marker point, obtaining the coordinates of the marker point, and then calculating the camera's center position. The size of the marker point and the precision of manually moving the camera will introduce deviations, leading to errors in the final camera calibration result that are difficult to quantify. Summary of the Invention
[0004] To address the above problems, this invention provides a simple and highly accurate method for calibrating the camera center of a slicing machine worktable.
[0005] The technical solution adopted by the present invention to solve the above-mentioned technical problems is as follows: a method for calibrating the camera center of a slicing machine worktable, comprising the following steps:
[0006] S1. Initially determine the camera center position A and acquire the image sequence Pn. The specific steps are as follows.
[0007] S11, Manually coarsely calibrate the camera center position to obtain position A;
[0008] S12, move the worktable and Y1 axis to position A;
[0009] S13, place the checkerboard calibration plate under the camera and fix it to the worktable. The checkerboard calibration plate can be placed at any angle, and the center of the camera is roughly aligned with the center of the checkerboard calibration plate. Each checkerboard grid in the checkerboard calibration plate has a size of 1mm.
[0010] S14, focus the camera on the checkerboard calibration board;
[0011] S15, first rotate the worktable to a negative angle Na, and then rotate the worktable in the direction of increasing angle with a fixed angle step S. The negative angle Na is set to -5 degrees and the step S is set to 5 degrees.
[0012] S16, starting from 0 degrees, take a chessboard image with the camera every one step of rotation to get the image sequence Pn;
[0013] S2, based on the image sequence Pn described in S1, find the rotation center coordinates B, and adjust position A to the new camera center position E. The specific steps are as follows.
[0014] S21, traverse the image sequence Pn, find the center point of the complete white square in each image Pi, obtain the point set Cn1 and filter it, delete some unqualified points, and mark whether the point is an abnormal point. The XY coordinates of the point are floating points.
[0015] S22, gather all the filtered point sets Cn1 on all images to obtain a new point set Cn2, where each filtered point set Cn1 includes outliers and non-outliers;
[0016] S23, find the center D in the point set Cn2;
[0017] S24, calculate the rotation center coordinates B based on the coordinates of the center D and position A, then adjust the original position A to obtain the new camera center position E and perform calibration. The specific calculation is as follows:
[0018] Ex = Ax – xoffset;
[0019] Ey = Ay – yoffset;
[0020] xoffset=[Dx–(ImageWidth / 2.0-0.5)]*LengthPerPx;
[0021] yoffset=[Dy–(ImageHeight / 2.0-0.5)]*LengthPerPx;
[0022] Where Ex and Ey are the X and Y physical coordinates of the new camera position, respectively; Ax and Ay are the X and Y physical coordinates of the original camera position during coarse calibration, respectively; Dx and Dy are the X and Y pixel coordinates of the center of the circle found, respectively; ImageWidth and ImageHeight are the width and height of the image captured by the camera, respectively; and LengthPerPx is the length in millimeters corresponding to each pixel of the camera. The camera used has each pixel with the same length in the X and Y directions.
[0023] Preferably, the specific steps for finding the center point set Cn1 of the complete white square in a single image Pi in step S21 are as follows:
[0024] S2101, perform Gaussian filtering on a single image Pi, set the window size to 7x7, and set the standard deviation in the X and Y directions to 3, and obtain the image Pig after filtering;
[0025] S2102, Adaptive binarization is performed on the image Pig, the neighborhood threshold is calculated using the Gaussian method, the window size is set to 25x25, and the processed image Pia is obtained.
[0026] S2103, perform median filtering on the image Pia, set the window size to 7x7, and obtain the image Pim after processing;
[0027] S2104, perform an erosion operation on the image Pim, using a rectangular 3x3 structure as the structural element, to obtain the image Pie;
[0028] S2105, Search for contours on the image Pie, set to search only for external contours, and obtain the contour set Contour1;
[0029] S2106, Based on the difference between the maximum and minimum values of the contour dimensions in the X and Y directions, delete some contours in Contour1, specifically deleting contours that meet the following conditions.
[0030] xdiff<xlimit_min||xdiff> xlimit_max||ydiff<ylimit_min||ydiff> ylimit_max, where
[0031] xdiff: The difference between the maximum and minimum values in the x-direction of contour i;
[0032] xlimit_min: The threshold value for the minimum difference in the x-axis;
[0033] xlimit_max: Sets the maximum difference threshold in the x-direction;
[0034] ydiff: The difference between the maximum and minimum y-axis values in contour i;
[0035] ylimit_min: The minimum difference threshold set in the y-direction;
[0036] ylimit_max: Sets the maximum difference threshold in the y-direction;
[0037] S2107, calculate the area of each remaining contour in Contour1, and arrange them in descending order to obtain a new set of contours, Contour2, which has been sorted according to area;
[0038] S2108, Create a new image F. The image F is an 8-bit single-channel image with a black background and the same size as the image Pi. Fill the first n contours of the contour set Contour2 on the image F with white, and set n to 20.
[0039] S2109, find the contours on the image F, set to only find the external contours, and obtain the contour set Contour3;
[0040] S2110, traverse the contour set Contour3, calculate the area of each contour in the contour set Contour3, and delete the item if the area is less than the set threshold. The threshold is set to 430 * 430;
[0041] S2111, traverse the contour set Contour3, find the minimum bounding rectangle of each contour, and delete it if the length or width of the rectangle exceeds the set threshold. The threshold is set to 433. At the same time, calculate the center coordinates G of each minimum bounding rectangle to obtain the center coordinate set Cn1;
[0042] S2112, add an attribute P to each point in the point set Cn1, and judge whether it is an abnormal point through the attribute P. By default, each point is a non-abnormal point;
[0043] S2113, traverse the points in Cn1, calculate the pixel distance Distance1 between two points, and judge and process each point in the point set Cn1 according to the following rules based on Distance1. Delete the unqualified points and mark whether the points are abnormal points:
[0044] (1) If (Distance1 – 2.0 / LengthPerPx) <= d1, then do not process these two points. d1 is the set threshold and is set to 1, which is one pixel value; where LengthPerPx is the millimeter length corresponding to each pixel of the camera;
[0045] (2) If d1 < (Distance1 – 2.0 / LengthPerPx) <= d2, then mark these two points as abnormal points. d2 is the set threshold and is set to 3, which is three pixel values;
[0046] (3) If d2 < (Distance1 – 2.0 / LengthPerPx) < d3, then delete these two points. d3 is the set threshold and is set to 170, which is 170 pixel values;
[0047] The points that are not processed are non-abnormal points.
[0048] Preferably, the specific steps of finding the center D in the point set Cn2 in step S23 are as follows:
[0049] S2301, create a new image G. The image G is 8-bit single-channel, with a black background and the same size as Pi;
[0050] S2302, traverse the point set Cn2, and draw each point on the image G with a white circle filled with the point. When drawing, the coordinates are converted to integers, the center of the circle is the integer coordinates of the point, and the radius is set to 19.
[0051] S2303, Search for contours on image G, set to search for all contours, and obtain the contour set Contour4;
[0052] S2304, Traverse the contour set Contour4 and calculate the number of non-outlier points in Cn2 contained in each contour;
[0053] S2305, find the contours in Contour4 where the number of non-outliers is within [c1, c2], and obtain a new contour set Contour5, where c1 is set to 360 / S. * (2 / 3), S is the step size of the table rotation angle, and c2 is set to 2. * 360 / S;
[0054] S2306, iterate through the contour set Contour5, count the number of different angles of non-outlier points within each contour, and filter out contours whose number of different angles is within the range [c3, c4] to obtain a new contour set Contour6, where c3 is set to 360 / S. * (2 / 3), S is the step size of the table rotation angle, and c4 is set to 360 / S;
[0055] S2307, Traverse the contour set Contour6, calculate the area of each contour, and find the contour c0 with the smallest area;
[0056] S2308, based on all points in the contour c0, the center Center1 and radius Radius1 are calculated using least squares.
[0057] S2309, traverse the points in Cn2, and find the non-outlier point closest to the center Center1 at each step angle to obtain the point set Cn3;
[0058] S2310, First compare the number of points in point set Cn3 with c3 and make a judgment. If the number of points in point set Cn3 is less than c3, then jump to step S2319. If the number of points in point set Cn3 is greater than or equal to c3, then go to step S2311.
[0059] S2311, calculate the distance Distance2 between each point in Cn3 and Center1, sort them from smallest to largest, take the first m points and calculate an average value avg1, and set m to 10;
[0060] S2312, for each point in Cn3, if Abs(Distance2-avg1)>td, then delete the point from the point set Cn3, where td is a threshold value, and the threshold value is set to 2;
[0061] S2313, compare the number of points in point set Cn3 with c3 again and make a judgment. If the number of points in point set Cn3 is less than c3, jump to step S2319. If the number of points in point set Cn3 is greater than or equal to c3, go to step S2314.
[0062] S2314, Sort the points in the point set Cn3 according to the step angle from small to large. If the angle difference between two adjacent points or between the first point and the last point exceeds ang, jump to S2319. If the angle difference between two adjacent points or between the first point and the last point is less than or equal to ang, go to step S2315, where ang is set to 120 degrees.
[0063] S2315, Based on the point set Cn3, the center Center2 and radius Radius2 are calculated using least squares.
[0064] S2316, calculate the absolute value of the difference between the distance from the midpoint of Cn3 to Center2 and Radius2, then calculate the mean of the absolute values of the differences of all points, avg2, and store Center2 and avg2 in a set Result;
[0065] S2317, Delete all points that are already in Cn3 from Cn2;
[0066] S2318, Set Center1 = Center2, return to step S2309;
[0067] S2319, find the item with the smallest avg2 in the set Result, and determine its corresponding Center2 as the center D.
[0068] Compared with the prior art, the present invention has the following beneficial effects:
[0069] This invention is an automated calibration method that is simple to operate and has higher accuracy. It greatly overcomes the errors caused by manual operation of equipment in traditional methods. At the same time, this method uses more points when calculating the center, resulting in smaller final calibration error and wider applicability. Attached Figure Description
[0070] Figure 1 This is a schematic diagram of the specific process of step S1 in this invention;
[0071] Figure 2 This is a schematic diagram of the specific process of step S2 in this invention;
[0072] Figure 3 This is a schematic diagram of the specific process of step S21 in this invention;
[0073] Figure 4 This is a schematic diagram of the specific process of step S23 in this invention;
[0074] Figure 5 This is a schematic diagram of the image sequence Pn obtained in step S16 of this invention;
[0075] Figure 6 This is a schematic diagram of the image Pia obtained in step S2102 of the present invention;
[0076] Figure 7 This is a schematic diagram of the image Pim obtained in step S2103 of the present invention;
[0077] Figure 8 This is a schematic diagram of the image Pie obtained in step S2104 of the present invention;
[0078] Figure 9 This is a schematic diagram of image F in step S2108 of the present invention;
[0079] Figure 10 This is a schematic diagram of step S2111 in this invention, which represents the central coordinate set Cn1, where the black dots in the diagram represent Cn1.
[0080] Figure 11 This is a schematic diagram of point set Cn2 in step S22 of this invention;
[0081] Figure 12 This is a schematic diagram of c0 in image G in step S23 of the present invention, where the smallest ring is c0;
[0082] Figure 13 This is a schematic diagram of the point set used by the center 1 in the calculation embodiment of finding the center D in the point set Cn2 of the present invention;
[0083] Figure 14 This is a schematic diagram of the point set used by the center 2 in the calculation embodiment of the present invention for finding the center D in the point set Cn2;
[0084] Figure 15 This is a schematic diagram of the point set used by the center 3 in the calculation embodiment of finding the center D in the point set Cn2 of the present invention;
[0085] Figure 16 This is a schematic diagram of the point set used for center 4 in the calculation embodiment of finding center D in point set Cn2 according to the present invention. Detailed Implementation
[0086] The following will combine Figure 1-16The present invention will be described in detail below. The illustrative embodiments and descriptions herein are used to explain the invention, but are not intended to limit the invention.
[0087] A method for calibrating the camera center of a slicing machine worktable includes the following steps:
[0088] S1. Initially determine the camera center position A and acquire the image sequence Pn. The specific steps are as follows.
[0089] S11, Manually coarsely calibrate the camera center position to obtain position A;
[0090] S12, move the worktable and Y1 axis to position A;
[0091] S13, place the checkerboard calibration plate under the camera and fix it to the worktable. The checkerboard calibration plate can be placed at any angle. At the same time, the center of the camera is roughly aligned with the center of the checkerboard calibration plate, and each checkerboard grid in the checkerboard calibration plate has a size of 1mm.
[0092] S14, focus the camera on the checkerboard calibration board;
[0093] S15, first rotate the worktable to -5 degrees, then rotate the worktable in the direction of increasing angle with a fixed angle step of 5 degrees. By rotating to -5 degrees, mechanical error in the opposite direction is reduced.
[0094] S16, starting from 0 degrees, capture one chessboard image with a camera for each rotation of one step, obtaining an image sequence Pn, such as... Figure 5 As shown;
[0095] S2: Based on the image sequence Pn in S1, find the rotation center coordinates B, and adjust position A to the new camera center position E. The specific steps are as follows.
[0096] S21, traverse the image sequence Pn, find the center point of the complete white square in each image Pi, obtain the point set Cn1 and filter it, where the XY coordinates of the points are floating points, as follows:
[0097] S2101, perform Gaussian filtering on a single image Pi, set the window size to 7x7, and set the standard deviation in the X and Y directions to 3, and obtain the image Pig after filtering;
[0098] S2102, adaptive binarization is performed on the image Pig, the neighborhood threshold is calculated using the Gaussian method, the window size is set to 25x25, and the processed image Pia is obtained, as shown. Figure 6 As shown;
[0099] S2103, perform median filtering on image Pia, setting the window size to 7x7, and obtain image Pim after processing, as shown. Figure 7 As shown;
[0100] S2104, perform an erosion operation on the image Pim, using a 3x3 rectangular structuring element to obtain the image Pie, as shown. Figure 8 As shown;
[0101] S2105, Search for contours on the image Pie, set to search only for external contours, and obtain the contour set Contour1;
[0102] S2106, Based on the difference between the maximum and minimum values of the contour dimensions in the X and Y directions, delete some contours in Contour1, specifically deleting contours that meet the following conditions.
[0103] xdiff<xlimit_min||xdiff> xlimit_max||ydiff<ylimit_min||ydiff> ylimit_max, where
[0104] xdiff: The difference between the maximum and minimum values in the x-direction of contour i;
[0105] xlimit_min: The minimum difference threshold in the x-direction is set, which is 420 here;
[0106] xlimit_max: The maximum difference threshold in the x-direction is set, which is 620 here;
[0107] ydiff: The difference between the maximum and minimum y-axis values in contour i;
[0108] ylimit_min: The minimum difference threshold in the y-direction, set to 420 here;
[0109] ylimit_max: The maximum difference threshold in the y-direction, set to 620 here;
[0110] S2107, calculate the area of each remaining contour in Contour1, and arrange them in descending order to obtain a new set of contours, Contour2, which has been sorted according to area;
[0111] S2108, Create a new image F, such as Figure 9 As shown, image F is an 8-bit single-channel image with a black background and the same size as image Pi. The first 20 contours of contour set Contour2 are filled with white on image F.
[0112] S2109, Search for contours on image F, set to search only for external contours, and obtain the contour set Contour3;
[0113] S2110, traverse the contour set Contour3, calculate the area of each contour in the contour set Contour3, and delete the item if the area is less than the set threshold, which is set to 430 * 430;
[0114] S2111, traverse the contour set Contour3, find the minimum bounding rectangle of each contour, and delete it if the length or width of the rectangle exceeds the set threshold, which is set to 433. At the same time, calculate the center coordinates G of each minimum bounding rectangle to obtain the center coordinate set Cn1, as Figure 10 shown, the black dots in the figure are Cn1;
[0115] S2112, add an attribute P to each point in the point set Cn1, and determine whether it is an abnormal point through the attribute P. By default, each point is a non-abnormal point;
[0116] S2113, traverse the points in Cn1, calculate the pixel distance Distance1 between two points, and judge and process each point in the point set Cn1 according to the following rules based on Distance1. Delete unqualified points and mark whether the point is an abnormal point:
[0117] (1) If (Distance1 - 2.0 / LengthPerPx) <= d1, then do not process these two points. d1 is the set threshold and is set to 1, which is one pixel value; where LengthPerPx is the millimeter length corresponding to each pixel of the camera;
[0118] (2) If d1 < (Distance1 - 2.0 / LengthPerPx) <= d2, then mark these two points as abnormal points. d2 is the set threshold and is set to 3, which is three pixel values;
[0119] (3) If d2 < (Distance1 - 2.0 / LengthPerPx) < d3, then delete these two points. d3 is the set threshold and is set to 170, which is 170 pixel values;
[0120] Among them, the points that are not processed are non-abnormal points. Abnormal points and non-abnormal points are screened out through judgment and processing as the screened point set Cn1;
[0121] S22, collect each screened point set Cn1 on all images to obtain a new point set Cn2, as Figure 11 shown. Abnormal points can be drawn in red, Figure 11 there are no abnormal points in it. Retaining abnormal points is to make the contour continuous and maximize the contour area when dilating and drawing the point set;
[0122] S23, find the center D in the point set Cn2, specifically as follows:
[0123] S2301, Create a new image G, wherein the image G is an 8-bit single-channel image with a black background and the same size as Pi;
[0124] S2302, traverse the point set Cn2, and draw each point on the image G with a white circle filled with the point. When drawing, the coordinates are converted to integers, the center of the circle is the integer coordinates of the point, and the radius is set to 19.
[0125] S2303, Search for contours on image G, set to search for all contours, and obtain the contour set Contour4;
[0126] S2304, Traverse the contour set Contour4 and calculate the number of non-outlier points in Cn2 contained in each contour;
[0127] S2305, find the contours in Contour4 where the number of non-outliers is within [c1, c2], and obtain a new contour set Contour5, where c1 is set to 360 / S. * (2 / 3), S is the step size of the table rotation angle, and c2 is set to 2. * 360 / S;
[0128] S2306, iterate through the contour set Contour5, count the number of different angles within each contour, and filter out contours whose number of different angles falls within the range [c3, c4] to obtain a new contour set Contour6, where c3 is set to 360 / S. * (2 / 3), S is the step size of the table rotation angle, and c4 is set to 360 / S;
[0129] S2307, iterate through the contour set Contour6, calculate the area of each contour, and find the contour c0 with the smallest area, such as... Figure 12 As shown in the figure, the smallest ring is c0;
[0130] S2308, based on all points in contour c0, including both outliers and non-outliers, use least squares to calculate the center point Center1 and radius Radius1;
[0131] S2309, traverse the points in Cn2, and find the non-outlier point closest to the center Center1 at each step angle to obtain the point set Cn3;
[0132] S2310, First compare the number of points in point set Cn3 with c3 and make a judgment. If the number of points in point set Cn3 is less than c3, then jump to step S2319. If the number of points in point set Cn3 is greater than or equal to c3, then go to step S2311.
[0133] S2311, calculate the distance Distance2 between each point in Cn3 and Center1, sort them from smallest to largest, take the first m points and calculate an average value avg1, and set m to 10;
[0134] S2312, for each point in Cn3, if Abs(Distance2-avg1)>td, then delete the point from the point set Cn3, where td is a threshold value, and the threshold value is set to 2;
[0135] S2313, compare the number of points in point set Cn3 with c3 again and make a judgment. If the number of points in point set Cn3 is less than c3, jump to step S2319. If the number of points in point set Cn3 is greater than or equal to c3, go to step S2314.
[0136] S2314, Sort the points in the point set Cn3 according to the step angle from small to large. If the angle difference between two adjacent points or between the first point and the last point exceeds ang, jump to S2319. If the angle difference between two adjacent points or between the first point and the last point is less than or equal to ang, go to step S2315, where ang is set to 120 degrees.
[0137] S2315, Based on the point set Cn3, the center Center2 and radius Radius2 are calculated using least squares.
[0138] S2316, calculate the absolute value of the difference between the distance from the midpoint of Cn3 to Center2 and Radius2, then calculate the mean of the absolute values of the differences of all points, avg2, and store Center2 and avg2 in a set Result;
[0139] S2317, Delete all points that are already in Cn3 from Cn2;
[0140] S2318, Set Center1 = Center2, return to step S2309;
[0141] S2319, find the item with the smallest avg2 in the set Result, and determine its corresponding Center2 as the center D;
[0142] S24, calculate the rotation center coordinates B based on the coordinates of the center D and position A, then adjust the original position A to obtain the new camera center position E and perform calibration. The specific calculation is as follows:
[0143] Ex = Ax – xoffset;
[0144] Ey = Ay – yoffset;
[0145] xoffset=[Dx–(ImageWidth / 2.0-0.5)]*LengthPerPx;
[0146] yoffset=[Dy–(ImageHeight / 2.0-0.5)]*LengthPerPx;
[0147] Where Ex and Ey are the X and Y physical coordinates of the new camera position, respectively; Ax and Ay are the X and Y physical coordinates of the original camera position during coarse calibration, respectively; Dx and Dy are the X and Y pixel coordinates of the center of the circle found, respectively; ImageWidth and ImageHeight are the width and height of the image captured by the camera, respectively; and LengthPerPx is the length in millimeters corresponding to each pixel of the camera. The camera used has each pixel with the same length in the X and Y directions.
[0148] During implementation, the physical coordinates of position A, i.e., the original coarse calibration position of the camera, are (-209.1881, -101.0223), in millimeters. ImageWidth and ImageHeight, i.e., the image width and height, are 2048 and 1536 respectively, in pixels. LengthPerPx, i.e., the physical length corresponding to each pixel of the camera, is 0.0023mm. An example of the calculation for "finding the center D of the circle in the point set Cn2" is shown below. Figure 13-16 As shown, Figure 13-16 Hollow circles are used to represent the point set used when calculating the center of the circle. The calculation results are as follows (unit: pixels). Finally, the center of the circle with the smallest average error is taken as the new camera center.
[0149] like Figure 13 The center of the circle shown is 1
[0150] Center: (1170.475, 772.7444), Radius: 307.0515, Number of points used: 72, Average error: -0.0002399021, Lower limit of error: -0.7539063, Upper limit of error: 0.8572998;
[0151] like Figure 14 The center of the circle shown is 2
[0152] Center: (1170.59, 772.7662), Radius: 366.5982, Number of points used: 72, Average error: -3.433228E-05, Lower limit of error: -0.3591614, Upper limit of error: 0.6569214;
[0153] like Figure 15 The center of the circle shown is 3
[0154] Center: (1170.746, 772.8392), Radius: 551.406, Number of points used: 55, Average error: -6.103516E-05, Lower limit of error: -0.69104, Upper limit of error: 0.4732056;
[0155] like Figure 16 The center of the circle shown is 4
[0156] Center: (1170.685, 772.5806), Radius: 586.6187, Number of points used: 44, Average error: -0.0001248446, Lower limit of error: -0.578064, Upper limit of error: 0.7015991;
[0157] Observing the centers of the four circles, the maximum difference in center X was 0.2714844, and the maximum difference in center Y was 0.258606. This proves that the camera center calibration error using this method is very small and the accuracy is high. Among them, the average error avg2 of center 2 is the smallest. Therefore, center 2 is taken as the final center D found in this embodiment. Then, according to step S24 of the embodiment, the camera center is adjusted to the new position. After calculation:
[0158] xoffset=[Dx–(ImageWidth / 2.0-0.5)]*LengthPerPx
[0159] = [1170.59 – (2048 / 2.0 – 0.5)] * 0.0023
[0160] =0.3383
[0161] yoffset=[Dy–(ImageHeight / 2.0-0.5)]*LengthPerPx
[0162] = [772.7662 – (1536 / 2.0 – 0.5)] * 0.0023
[0163] =0.0121
[0164] Ex=Ax–xoffset=-209.1881-0.3383=-209.5264
[0165] Ey=Ay–yoffset=-101.0223-0.0121=-101.0344
[0166] Based on the above calculations, the new position E of the camera center is obtained as (-209.5264, -101.0344), in millimeters.
[0167] The technical solutions provided by the embodiments of the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the embodiments of the present invention. The descriptions of the embodiments above are only for helping to understand the principles of the embodiments of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the embodiments of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A camera center calibration method of a dicing machine worktable, characterized in that, The method comprises the following steps: S1, preliminarily calibrating the camera center position A and acquiring an image sequence Pn, and the specific steps are as follows, S11, manually coarsely calibrating the camera center position to obtain the position A; S12, moving the workbench and the Y1 axis to the position A; S13, placing a chessboard calibration plate under the camera and fixing the chessboard calibration plate on the workbench, the chessboard calibration plate is placed at an arbitrary angle, and the camera center is roughly aligned with the center of the chessboard calibration plate, and the size of each chessboard in the chessboard calibration plate is 1 mm; S14, focusing the camera on the chessboard calibration plate; S15, rotating the workbench to a certain negative angle Na first, and then rotating the workbench in the direction of increasing angle at a fixed angle step S, the negative angle Na is set to -5 degrees, and the step S is set to 5 degrees; S16, starting from 0 degrees, acquiring one chessboard image through the camera every step, and obtaining an image sequence Pn; S2, finding the rotation center coordinate B according to the image sequence Pn in S1, adjusting the position A to a new camera center position E, and the specific steps are as follows, S21, traversing the image sequence Pn, finding the center point of each complete white square in each image Pi, obtaining a point set Cn1 and performing screening, deleting part of the unqualified points, and marking whether the point is an abnormal point, wherein the XY coordinates of the points are all floating points; S22, collecting each screened point set Cn1 on all images to obtain a new point set Cn2, wherein each screened point set Cn1 includes abnormal points and non-abnormal points; S23, finding the center D of the circle in the point set Cn2; S24, calculating the rotation center coordinate B according to the coordinates of the center D and the position A, thereby adjusting the original position A to obtain the new camera center position E and performing calibration, and the specific calculation is Ex=Ax–xoffset; Ey=Ay–yoffset; xoffset=[Dx–(ImageWidth / 2.0-0.5)]*LengthPerPx; yoffset=[Dy–(ImageHeight / 2.0-0.5)]*LengthPerPx; Wherein, Ex, Ey are the new position X, Y physical coordinates of the camera, Ax, Ay are the original position X, Y physical coordinates of the camera after coarse calibration, Dx, Dy are the found center X, Y pixel coordinates of the circle, ImageWidth, ImageHeight are the width and height of the image collected by the camera, LengthPerPx is the millimeter length corresponding to each pixel of the camera, and the camera used has the same length in X and Y directions for each pixel.
2. The camera center calibration method of the cutting machine worktable according to claim 1, wherein, The specific steps of finding the complete white square center point set Cn1 in the step S21 of each image Pi are as follows: S2101, performing Gaussian filtering on the single image Pi, setting the window size to 7x7, and setting the X and Y standard deviations to 3, and obtaining an image Pig after filtering; S2102, performing adaptive binarization on the image Pig, and calculating the neighborhood threshold value by using the Gaussian method, and setting the window size to 25x25, and obtaining an image Pia after processing; S2103, performing median filtering on the image Pia, with a window size of 7x7, to obtain an image Pim; S2104, performing an erosion operation on the image Pim, with a rectangular 3x3 structure as a structure element, to obtain an image Pie; S2105, searching for contours on the image Pie, with a setting of searching for only external contours, to obtain a contour set Contour1; S2106, deleting some contours in Contour1 according to the maximum and minimum difference values of the contour size in the X and Y directions, specifically deleting contours satisfying the following conditions xdiff < xlimit_min || xdiff > xlimit_max || ydiff < ylimit_min || ydiff > ylimit_max, wherein xdiff: the maximum and minimum difference value of contour i in the X direction; xlimit_min: a set minimum difference threshold value in the X direction; xlimit_max: a set maximum difference threshold value in the X direction; ydiff: the maximum and minimum difference value of contour i in the Y direction; ylimit_min: a set minimum difference threshold value in the Y direction; ylimit_max: a set maximum difference threshold value in the Y direction; S2107, calculating the areas of the remaining contours in Contour1, and arranging them in descending order to obtain a new contour set Contour2 sorted according to the areas; S2108, creating a new image F, which is an 8-bit single channel with a black background and the same size as the image Pi, and performing white filling on the first n contours in the contour set Contour2 on the image F, with n set as 20; S2109, searching for contours on the image F, with a setting of searching for only external contours, to obtain a contour set Contour3; S2110, traversing the contour set Contour3, calculating the area of each contour in the contour set Contour3, and deleting the contour if the area is less than a set threshold value, with the threshold value set as 430*430; S2111, traversing the contour set Contour3, searching for the minimum bounding rectangle of each contour, and deleting the contour if the length or width of the rectangle exceeds a set threshold value, with the threshold value set as 433, and calculating the center coordinates G of each minimum bounding rectangle to obtain a center coordinate set Cn1; S2112, adding an attribute P to each point in the point set Cn1, and determining whether the point is an abnormal point through the attribute P, with each point being a non-abnormal point by default; S2113, traversing the points in Cn1, calculating the pixel distance Distance1 between two points, and judging and processing each point in the point set Cn1 according to Distance1 according to the following rules, deleting the points that do not meet the requirements, and marking whether the points are abnormal points: (1) (Distance1 – 2.0 / LengthPerPx) <= d1, then the distance between the two points is not processed, d1 is a set threshold value and is set as 1, i.e., a pixel value; wherein LengthPerPx is the millimeter length corresponding to each pixel of the camera; (2) d1 < (Distance1-2.0 / LengthPerPx) <= d2, then the distance between two points is marked as an abnormal point, d2 is a set threshold value, and is set to 3, i.e. 3 pixel values; (3) d2 < (Distance1-2.0 / LengthPerPx) < d3, then the distance between two points is deleted, d3 is a set threshold value, and is set to 170, i.e. 170 pixel values; The points that are not processed are non-abnormal points.
3. The method of claim 1, wherein, The specific steps of the step S23 for searching the center D in the point set Cn2 are as follows: S2301, a new image G is created, the image G is an 8-bit single channel, the background is black, and the size is the same as Pi; S2302, the point set Cn2 is traversed, and each point is drawn on the image G in a circular white filling, the coordinates are converted to integers during drawing, the center of the circle is the integer coordinates of the point, and the radius is set to 19; S2303, the contour is searched on the image G, and all contours are set to be searched to obtain a contour set Contour4; S2304, the contour set Contour4 is traversed, and the number of non-abnormal points in Cn2 contained in each contour is calculated; S2305, find the contours in Contour4 whose number of non-outlier points is within [c1, c2] to get a new contour set Contour5, where c1 is set to 360 / S * (2 / 3), S is the rotation angle step size of the workbench, and c2 is set to 2 * 360 / S; S2306, traverse the contour set Contour5, count the number of different angles of non-anomalous points in each contour, filter out the contours with the number of different angles in the range [c3, c4], and obtain a new contour set Contour6, wherein c3 is set to 360 / S * (2 / 3), S is the rotation angle step of the workbench, and c4 is set to 360 / S; S2307, the contour set Contour6 is traversed, and the area of each contour is calculated to find a contour c0 with the smallest area; S2308, the center Center1 and the radius Radius1 are calculated by using least squares according to all points in the contour c0; S2309, the points in Cn2 are traversed, and a non-abnormal point closest to the center Center1 is found at each step angle to obtain a point set Cn3; S2310, the number of points in the point set Cn3 is compared with c3 for the first time, and if the number of points in the point set Cn3 is less than c3, the step S2319 is jumped to, and if the number of points in the point set Cn3 is greater than or equal to c3, the step S2311 is turned to; S2311, the distance Distance2 between each point in Cn3 and the center Center1 is calculated, and the distances are sorted from small to large, and the first m values are taken to calculate an average value avg1, and m is set to 10; S2312, for each point in Cn3, if Abs(Distance2-avg1) > td, the point is deleted from the point set Cn3, wherein td is a threshold value, and the threshold value is set to 2; S2313, the number of points in the point set Cn3 is compared with c3 again, and if the number of points in the point set Cn3 is less than c3, the step S2319 is jumped to, and if the number of points in the point set Cn3 is greater than or equal to c3, the step S2314 is turned to; S2314, the points in the point set Cn3 are sorted from small to large according to the step angle, and if the angle difference between adjacent two points or the first point and the last point exceeds ang, the step S2319 is jumped to, and if the angle difference between adjacent two points or the first point and the last point is less than or equal to ang, the step S2315 is turned to, wherein ang is set to 120 degrees; S2315, the center Center2 and the radius Radius2 are calculated by using least squares according to the point set Cn3; S2316, calculate the absolute value of the difference between the distance from the center of Cn3 to Center2 and Radius2, and then calculate the average value avg2 of the absolute values of the differences of all points, and save Center2 and avg2 in a set Result; S2317, delete all points in Cn3 from Cn2; S2318, set Center1 = Center2, and return to step S2309; S2319, find the item with the minimum avg2 in the set Result, and determine the corresponding Center2 as the center D of the circle.
Citation Information
Patent Citations
Fully automatic detection method for checkerboard corners
WO2021138995A1
Calibration method, calibration apparatus, and non-volatile computer-readable storage medium
WO2021212978A1