Diamond cutter automatic positioning method for laser galvanometer machining
By using CCD cameras in the laser galvanometer system for high-resolution image acquisition and image processing of diamond tool tips, the problem of high positioning accuracy and cost of diamond tool in the prior art is solved, and low-cost and high-precision automatic positioning is achieved, which is suitable for efficient and automated production.
Patent Information
- Application Number
- CN202510719674.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2045-05-30
AI Technical Summary
The existing cutting-point positioning methods of diamond tools have problems such as high cost, high accuracy requirements, easy damage and low efficiency, especially in efficient automated production, which is difficult to achieve high-precision positioning.
A CCD camera that is coaxially set with the laser galvanometer is used to obtain high-resolution images of the diamond tool tip, and accurately calculate the processing position through specific geometric feature extraction and image processing algorithms to achieve high-precision automatic positioning.
It realizes low-cost and high-precision automatic positioning of diamond tools, avoids physical contact damage to the tool, improves processing efficiency and adaptability, and is suitable for efficient and automated production.
Smart Images

Figure CN120228418A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of laser precision machining, and particularly relates to an automatic positioning method for diamond tools used in laser galvanometer machining. Background Art
[0002] For most CVD diamond-coated tools (such as milling cutters, turning tools, drills), diamond coatings are deposited on the entire tool surface (including the tool tip, cutting edge, and tool body). During the deposition process, microscopic protrusions, grain boundaries, or granular structures may be formed, resulting in a relatively high surface roughness of the tool and uneven coating thickness. Diamond tools are commonly used in high-precision machining, such as ultra-precision machining of machinery, manufacturing of optical components, etc. Therefore, the coating quality of the tool tip directly affects the tool performance. The CVD diamond coating itself is very hard, but due to possible surface unevenness, particle protrusion, etc. during the deposition process, the friction increases or the coating adhesion is insufficient. In order to improve the cutting performance of the tool, a three-dimensional laser galvanometer is used to polish the tool tip of the diamond tool to remove loose particles on the surface layer, reduce the surface roughness, make the coating combine more tightly with the substrate, reduce the risk of peeling, extend the tool life, and improve the machining accuracy of the tool. Therefore, positioning before polishing has become the core problem to be solved. The tip coating polishing of diamond tools requires very precise positioning, otherwise the tool may be damaged or the polishing effect may be affected.
[0003] The existing methods for positioning the tool tip of diamond tools are as follows: Optical microscopic positioning: High-resolution imaging of the tool tip morphology of diamond tools is carried out using an optical microscope (such as a confocal microscope, differential interference microscope), and positioning is carried out in combination with computer vision technology. This scheme has a relatively high resolution, but the cost of optical devices is expensive, and it is difficult to achieve linkage with the laser galvanometer. Usually, an independent measurement system is adopted, which affects the overall machining efficiency.
[0004] Laser interference positioning: A laser interferometer is used to measure the position of the tool tip of the diamond tool, and extremely high measurement accuracy can be achieved. However, this scheme has a complex system, high requirements for environmental vibration, and high equipment cost, which limits its large-scale application in actual production.
[0005] Mechanical contact positioning: The tool tip of the diamond tool is contacted by a high-precision probe or touch probe to determine its spatial position. This scheme needs to be combined with a precision motion control platform to improve the measurement accuracy. Contact measurement may cause microscopic damage to the tool, reduce the tool life, and at the same time, the measurement efficiency is low, which is not suitable for high-efficiency automated production. Summary of the Invention
[0006] Aiming at the deficiencies in the existing technology, the present invention provides an automatic positioning method for diamond tools used in laser galvanometer processing. It uses a CCD camera coaxially arranged with the laser galvanometer to obtain high-resolution images of the tips of diamond tools, and through specific geometric feature extraction and image processing algorithms, accurately calculates the processing positions, without being interfered by the tool direction, with fast calculation speed and high positioning accuracy.
[0007] To achieve the above object, the present invention adopts the following technical solutions: The present invention provides an automatic positioning method for diamond tools used in laser galvanometer processing. The laser galvanometer is installed on a gantry (the gantry can move in the Z-axis and X-axis directions), and a coaxial CCD camera and a laser rangefinder are installed on the laser galvanometer.
[0008] First, calibrate the camera, adjust the galvanometer to its zero initial state, that is, the optical path is vertically downward. Use the Zhang Zhengyou calibration method to perform internal parameter calibration on the CCD camera, remove distortion, establish the mapping relationship between the image coordinate system and the world coordinate system, and calculate the pixel equivalent.
[0009] After the camera calibration is completed, calibrate the laser rangefinder and the camera. Assume that the laser beam of the laser rangefinder is absolutely parallel to the optical axis of the camera. The calibration steps are as follows: 1. Place the checkerboard calibration plate on the processing platform, drive the gantry to move in the Z-axis, so that the camera takes multiple calibration plate images at different heights, and at the same time the laser rangefinder measures multiple groups of heights; 2. Detect the corner points of the calibration plate image; 3. Multiple groups of rotation and translation matrices, that is, the camera pose matrices, can be obtained through multiple groups of corner points; 4. Through multiple groups of camera pose matrices and the results of the laser rangefinder, use the least squares algorithm to solve the Z-axis compensation coefficient between the camera and the laser rangefinder α , α indicating the Z-axis position difference between the camera coordinate system and the laser rangefinder coordinate system. Due to the different installation positions of the camera and the laser rangefinder, there is a fixed deviation between them in the Z-axis direction. Through this compensation coefficient, the distance value measured by the laser rangefinder can be converted to the Z-axis value in the camera coordinate system, thus realizing the unification of the two coordinate systems.
[0010] Perform preliminary correction on the laser galvanometer. Control the laser galvanometer to punch a matrix dot pattern on the calibration plate according to the theoretical dot matrix coordinates. Use a magnifying device such as a microscope to determine the coordinates of each point on the calibration plate, compare the deviation between the actual coordinates and the theoretical coordinates of the dot pattern marking points punched by the laser galvanometer on the calibration plate, and compensate the Z-axis of the laser galvanometer to correct the Z-axis error of the two-dimensional galvanometer at each point.
[0011] After the laser galvanometer is calibrated, drive the Z-axis of the gantry to move the galvanometer to focus, and re-strike the dot matrix on the board. Record the height of the laser rangefinder at this time. Then, drive the Z-axis of the gantry to move so that the CCD camera can clearly focus on the small-area dot matrix struck by the laser galvanometer, and the laser rangefinder measures the Z-direction height of the dot matrix plane at this time. Determine the transformation relationship matrix between the camera coordinate system and the laser galvanometer processing coordinate system according to the dot matrix image.
[0012] Let be the galvanometer processing coordinate system, be the world coordinate system. The detailed steps are as follows: 1. After the galvanometer is calibrated, drive the Z-axis of the gantry to make the laser galvanometer focus on the board, re-strike the dot matrix on the board, and record the height of the laser rangefinder at this time. Let the galvanometer re-strike the dot matrix on the board.
[0013] 2. Drive the Z-axis of the gantry to make the CCD camera clearly focus on the small-area dot matrix struck by the laser galvanometer, and record the height of the laser rangefinder at this time. Then the Z-axis height in the camera coordinate system is Take a picture of the dot matrix image, and the dot matrix set in the image coordinate system is where n represents n groups of point coordinates.
[0014] 3. Convert the dot matrix set in the image coordinate system to the dot matrix set in the camera coordinate system: ; where K is the internal parameter matrix of the CCD camera, represents the th group of point coordinates; ; where is the optical center, that is, the projection of the optical axis of the CCD camera on the image, , are the pixel focal lengths.
[0015] 4. The transformation relationship between the camera coordinate system and the galvanometer processing coordinate system at this time is as follows: ; where P is the dot matrix coordinate in the galvanometer processing coordinate system, C is the dot matrix coordinate in the camera coordinate system, R is the rotation matrix, and T is the translation matrix, which can be written as: ; Furthermore, it can be abbreviated as: ; Let , then H is the relationship transformation matrix from the camera coordinate system to the galvanometer processing coordinate system.
[0016] 5. Since n may be large, the least squares algorithm is used to solve H corresponding to multiple sets of point sets to obtain the optimal solution relationship transformation matrix.
[0017] After calibration, fix the diamond tool on the processing platform (the processing platform moves along the Y-axis direction), drive the diamond tool and the gantry on the processing platform to move until the diamond tool tip is imaged in the CCD camera, drive the gantry to move along the Z-axis until the CCD camera can be clearly focused, and collect the tip image of the diamond tool; Perform image processing on the collected tip image. First, perform binarization and morphological processing on the tip image, and then perform edge detection to extract the tip edge point set , by identifying two edge lines in the tip edge points, calculate the intersection point of the two edge lines P i and set the search radius, and find the point closest to the intersection point P i from the tip edge point set to determine the tip vertex position in the image coordinate system P v ; Combined with the Z-axis data of the laser rangefinder and the conversion relationship matrix between the CCD camera coordinate system, the laser rangefinder and the galvanometer processing coordinate system, convert the vertex coordinates P v in the image coordinate system and the tip direction vector to the coordinates in the galvanometer processing coordinate system respectively to generate the processing path of the laser galvanometer system.
[0018] Furthermore, the binarization and morphological processing of the tip image include using the Otsu method to adaptively threshold-segment the tip area and the background in the image, and then using morphological opening operation to remove the white spots in the tip area.
[0019] The principle of the Otsu method is to determine an optimal threshold to maximize the gray-scale discrimination between the foreground and background of the image. The specific steps are as follows: 1. Calculate the image gray-scale histogram, count the number of pixels at each gray level (0-255) in the image, and calculate the probability of each gray level.
[0020] 2. Use the gray levels of each probability as the threshold to divide the image into foreground and background. When the gray value is greater than the threshold, this pixel point is used as the foreground, otherwise as the background. Calculate the foreground pixel ratio And the background pixel ratio , calculate the average foreground gray value And the average background gray value , calculate the panoramic average gray value and the between-class variance. The calculation formula is as follows: ; ; Among them, Represents the panoramic average gray value, Represents the between-class variance.
[0021] The specific steps to remove the white spots in the tip area using morphological opening operation are as follows: Use morphological opening operation, and its mathematical definition is: ; Among them, A is the input image, B is the structuring element, C is the output image, ⊖ represents the erosion operation, and ⊕ represents the dilation operation.
[0022] In order to obtain a morphological processing effect independent of direction, the structuring element selected for the morphological opening operation here is circular. The circular structuring element is suitable for processing targets with circular or arc features, and can effectively remove noise and small interferences in the image. Since there are many large particle noises in the image, the size of the structuring element is selected as 15×15. The size selection needs to be debugged according to the actual scenario.
[0023] Furthermore, use the Canny edge detection algorithm to extract a continuous set of tip edge points .
[0024] Canny edge detection is a commonly used and effective edge detection method in image processing. It determines the edge position by detecting the gradient change of pixel values in the image. The detailed steps are as follows: 1. First, use Gaussian filtering to smooth the image and filter out noise. The Gaussian filtering formula is as follows: ; Among them, Represents the Gaussian kernel function, Is the standard deviation.
[0025] 2. Use the Sobel operator to calculate the gradients in the horizontal and vertical directions of the image. The calculation formula is: ; ; Among them, And Are the gradients in the horizontal and vertical directions, Is the pixel value in the image.
[0026] 3. Non-maximum suppression to eliminate pixels that do not belong to the edge and retain the pixels with the maximum gradient magnitude.
[0027] 4. Double-threshold segmentation to divide the gradient magnitude in the image into strong edges, weak edges, and non-edges. Set the pixels with a gradient magnitude greater than the high threshold as strong edges; set the pixels with a gradient magnitude less than the high threshold and greater than the low threshold as weak edges; set the pixels with a gradient magnitude less than the low threshold as non-edges.
[0028] 5. The strong edges after segmentation can be directly marked as edge points; for weak edges, if there are strong edges among the eight adjacent pixels of the weak edge, mark this weak edge as an edge point, otherwise it is noise and is directly excluded; for non-edges, it is directly regarded as noise. Through the above, the final edge point set can be obtained.
[0029] Furthermore, use the Hough line detection, set appropriate threshold parameters, and detect two edge lines among the tool tip edge points, namely the left line L 1 and the right line L 2 , extend the two edge lines and calculate the intersection coordinates of the two edge lines P i .
[0030] Furthermore, the calculation formula for the intersection coordinates P i is: ; is a point on the left line L 1 , is the direction vector on the left line L 1 , the point is a point on the right line L 2 , is the direction vector on the right line L 2 .
[0031] Furthermore, find the point closest to the intersection from the tool tip edge point set P i to determine the tool tip vertex position P v Specifically: (1) With the intersection P i Centered around, define a circular neighborhood as the candidate search area according to the preset search radius parameter; (2) Traverse the set of tool tip edge points , and filter the edge points located within the candidate search area as the candidate point set ; (3) Calculate the Euclidean distance between each candidate point in the candidate point set and the intersection point P i , record the minimum distance value and the corresponding edge point coordinates; (4) If there are valid candidate points, mark the point with the minimum distance as the nearest edge point, and this point is the position of the tool tip vertex P v .
[0032] Further, record the tool tip direction vector in the image coordinate system . After image processing is completed, drive the gantry to move along the X-axis so that the laser rangefinder moves directly above the tool tip, read the data on the laser rangefinder, and convert it to the Z-axis coordinate in the camera coordinate system Z 1 .
[0033] Further, there is the following conversion relationship between the tool tip vertex in the image coordinate system and the point in the camera coordinate system: ; where K is the internal parameter matrix of the CCD camera; ; where is the optical center, that is, the projection of the optical axis of the CCD camera on the image, , are the pixel focal lengths; According to the projection relationship, it can be obtained that: .
[0034] Further, convert the tool tip direction vector in the image coordinate system to the tool tip direction vector in the camera coordinate system.
[0035] The specific process is as follows: 1. As above, the tool tip vertex in the image coordinate system has been converted to the point in the camera coordinate system, and the intersection point of the two straight lines in the image coordinate system is converted to the point in the camera coordinate system.
[0036] 2. Direction vector It is the subtraction of two points in space in the camera coordinate system, that is: .
[0037] Furthermore, the diamond tool plane is parallel to the CCD camera target plane, and the plane distance of the diamond tool is Z 1 , and the plane equation of the diamond tool is Z = Z 1 . According to the tool tip coordinates P c in the camera coordinate system, the tool tip direction vector , and the plane equation Z = Z 1 , through the conversion relationship matrix of the calibrated CCD camera coordinate system, laser rangefinder and laser galvanometer processing coordinate system, it is converted into the coordinates in the galvanometer processing coordinate system, and the processing path is generated.
[0038] The specific steps for generating the processing path are as follows: 1. In the previous steps, the relationship conversion matrix H from the camera coordinate system to the galvanometer processing coordinate system is obtained. Then, the tool tip coordinates in the camera coordinate system are converted into the tool tip coordinates in the galvanometer processing coordinate system, that is: .
[0039] 2. Through the above steps, the tool tip direction vector of the diamond tool in the camera coordinate system has been obtained. Convert it into the direction vector in the galvanometer processing coordinate system, that is: .
[0040] 3. Similarly, the point sets of two straight lines L 1 and L 2 in the galvanometer processing coordinate system can be obtained. At the tool tip along the direction vector in the reverse direction at a distance d, make a straight line perpendicular to , which is the first processing path.
[0041] 4. At the intersection of the straight line and , along the direction vector in the reverse direction at a distance d, make a straight line perpendicular to , which is the second processing path. Repeat the above steps until the processing path covers the entire range of the diamond tool tip.
[0042] Compared with the prior art, the present invention has the following beneficial effects: 1. Low cost and high system integration: The present invention uses a combination of a CCD camera and a laser rangefinder to achieve non-contact measurement, avoiding the use of expensive optical microscopy systems and laser interferometers, reducing the overall system cost, and integrating and linking with a galvanometer scanning system to achieve integrated processing and detection, improving processing efficiency.
[0043] 2. High positioning accuracy and strong environmental adaptability: By extracting the three-dimensional coordinates and direction vectors of the apex of a diamond tool tip through image processing, combining the internal parameters of the camera and the laser ranging data, high-precision identification of the three-dimensional spatial position and direction vector of the tool tip is achieved. The system is insensitive to external vibration interference and is suitable for industrial field environments.
[0044] 3. Non-contact detection to protect tool life: Different from mechanical contact solutions, the present invention uses a full-process non-contact measurement method, avoiding micro-damage to diamond tools and significantly increasing tool service life.
[0045] 4. Strong attitude robustness and wide adaptability: The image processing algorithm in the present invention is based on the geometric features of the tool tip. By locating the tool tip apex through the intersection of two edge lines and the search radius, it has good direction robustness and can accurately identify the position and direction of the tool tip in any placement attitude, improving the system adaptability and automation level.
[0046] 5. Suitable for automated production processes: The system can be directly integrated into laser processing equipment to achieve rapid positioning and path generation, effectively improving the overall processing efficiency and being suitable for high-efficiency automated manufacturing scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The present invention will be further described in detail below with reference to the drawings and specific embodiments.
[0048] Figure 1 It is a structural diagram of the galvanometer scanning system processing device in the present invention; Figure 2 It is a partial enlarged view of the tool tip of the diamond tool in the present invention; Figure 3 It is a schematic diagram of the corresponding coordinate systems of the camera coordinate system, the galvanometer processing coordinate system, and the world coordinate system in the present invention; Figure 4 It is an image of the tool tip of the diamond tool collected by the CCD camera in the present invention; Figure 5 It is a binary image in the present invention; Figure 6 It is an image after morphological opening operation processing in the present invention; Figure 7 It is a Canny edge detection map in the present invention; Figure 8 Schematic diagram of the straight-edge detection of the tool tip in the present invention Figure 9 Schematic diagram of finding the tool tip vertex in the present invention Figure 10 Schematic diagram of the tool tip of the diamond tool in the present invention Figure 11 Schematic diagram of generating a machining path for the tool tip part of the diamond tool in the present invention Detailed implementation manners
[0049] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0050] An embodiment of the present invention discloses an automatic positioning method for a diamond tool used in laser galvanometer processing The structure of the overall laser galvanometer system processing device is as Figure 1 shown. The laser galvanometer is installed on the gantry (the gantry can move along the Z-axis and X-axis directions). A coaxial CCD camera and a laser rangefinder are installed on the laser galvanometer. The laser galvanometer can be driven by the gantry to move along the Z-axis and X-axis directions; the diamond tool is fixed on the tabletop of the processing platform located below the laser galvanometer, and the moving platform drives the processing platform to move along the X-axis and Y-axis directions. In a specific embodiment, a CCD camera with 5 million pixels is selected and equipped with a long-focus telecentric lens, which can capture a field of view of 2mm * 1.6mm.
[0051] Since only the tool tip layer needs to be polished in the laser polishing of this solution, it is necessary to locate the position and direction of the tool tip. Since the tool tip of the diamond tool is arc-shaped and the arcs of most tool tips are not perfect circles, if the Hough circle detection algorithm is used, it is usually impossible to accurately locate the tool tip. The local magnification of the tool tip of the diamond tool is as Figure 2 shown.
[0052] Therefore, based on the geometric characteristics of the tool tip of the diamond tool itself, the following positioning algorithm is proposed S1. First, calibrate the camera, adjust the galvanometer to its zero initial state, that is, the optical path is vertically downward. Use the Zhang Zhengyou calibration method to calibrate the internal parameters of the CCD camera, remove the distortion, establish the mapping relationship between the image coordinate system and the world coordinate system, and calculate the pixel equivalent.
[0053] After the camera calibration is completed, calibrate the laser rangefinder and the camera. Assume that the laser beam of the laser rangefinder is absolutely parallel to the optical axis of the camera. The calibration steps are as follows 1. Place the checkerboard calibration plate on the processing platform, drive the Z-axis of the gantry to move, so that the camera takes multiple calibration plate images at different heights, and at the same time the laser rangefinder tests to obtain multiple groups of heights; 2. Detect the corner points of the calibration plate image; 3. Multiple groups of rotation and translation matrices, that is, camera pose matrices, can be obtained through multiple groups of corner points; 4. Through multiple groups of camera pose matrices and the results of the laser rangefinder, the Z-axis compensation coefficient between the camera and the laser rangefinder is solved by the least squares algorithm α , α represents the Z-axis position difference between the camera coordinate system and the laser rangefinder coordinate system. Due to the different installation positions of the camera and the laser rangefinder, there is a fixed deviation between the two in the Z-axis direction. Through this compensation coefficient, the distance value measured by the laser rangefinder can be converted to the Z-axis value in the camera coordinate system, so as to realize the unification of the two coordinate systems.
[0054] S2. Conduct preliminary calibration on the laser galvanometer, control the laser galvanometer to hit a matrix dot pattern on the calibration plate according to the theoretical dot matrix coordinates, use magnifying devices such as microscopes to determine the coordinates of each point on the calibration plate, compare the deviation between the actual coordinates and the theoretical coordinates of the dot matrix marking points hit by the laser galvanometer on the calibration plate, and compensate the Z-axis of the laser galvanometer to correct the Z-axis error of the two-dimensional galvanometer at each point.
[0055] S3. After the laser galvanometer is calibrated, drive the Z-axis of the gantry to make the galvanometer focus, re-hit the dot pattern on the board, and record the height of the laser rangefinder at this time , then drive the Z-axis of the gantry to make the CCD camera clearly focus on the small area dot pattern hit by the laser galvanometer, and the laser rangefinder measures the Z-direction height of the dot matrix plane at this time , and determine the transformation relationship matrix between the camera coordinate system and the laser galvanometer processing coordinate system according to the dot matrix image.
[0056] As Figure 3 shown, is the camera coordinate system, is the galvanometer processing coordinate system, is the world coordinate system, and the detailed steps are as follows: 1. After the galvanometer is calibrated, drive the Z-axis of the gantry to make the laser galvanometer focus on the board, re-hit the dot pattern on the board, and record the height of the laser rangefinder at this time , and make the galvanometer re-hit the dot pattern on the board.
[0057] 2. Drive the Z-axis of the gantry to make the CCD camera clearly focus on the small area dot pattern hit by the laser galvanometer, and record the height of the laser rangefinder at this time , then the Z-axis height in the camera coordinate system is , take a dot matrix image, and the dot matrix set in the image coordinate system is ,in n represent n Group point coordinates.
[0058] 3. Set the dot matrix in the image coordinate system Convert to a point set in the camera coordinate system : ; Among them, K is the internal parameter matrix of the CCD camera, Representative Group point coordinates; ; in, is the optical center, that is, the projection of the CCD camera optical axis on the image, , is the pixel focal length.
[0059] 4. At this time, the transformation relationship between the camera coordinate system and the galvanometer processing coordinate system is as follows: ; Where P is the dot coordinate in the galvanometer processing coordinate system, C is the dot coordinate in the camera coordinate system, R is the rotation matrix, and T is the translation matrix, which can be written as: ; Further, it can be shortened to: ; make , then H is the relationship transformation matrix from the camera coordinate system to the galvanometer processing coordinate system.
[0060] 5. Due to n It may be large. The least squares algorithm is used to solve H corresponding to multiple groups of point sets to obtain the optimal solution relationship transformation matrix.
[0061] S4. After the calibration is completed, the diamond tool is fixedly installed on the processing platform (the processing platform moves along the Y-axis direction), and the diamond tool and the gantry on the processing platform are driven to move until the diamond tool tip is imaged in the CCD camera. The gantry is driven to move along the Z-axis until the CCD camera can focus clearly and collect the image of the diamond tool tip. Figure 4 As shown. Due to the high magnification of the CCD camera lens, the optical path design cannot be perfect, so the "vignetting effect" is inevitable in the imaging, that is, the brightness in the image is Gaussian, bright in the middle and dark around. However, the effective information of the knife tip still exists, so it can be extracted through subsequent image processing.
[0062] S5. Perform image processing on the collected tip images, fit the side lines of the tip, and obtain the coordinates of the tip vertex in the image coordinate system.
[0063] The specific steps are as follows: 1. First, use the Otsu method for adaptive thresholding to perform image binarization, segment the tip area and the background in the image, and obtain as Figure 5 shown.
[0064] The principle of the Otsu method is to determine an optimal threshold to maximize the gray-scale discrimination between the foreground and background of the image. The specific steps are as follows: (1) Calculate the image gray-scale histogram, count the number of pixels at each gray level (0 - 255) in the image, and calculate the probability of each gray level.
[0065] (2) Use each probability gray level as the threshold to divide the image into foreground and background. When the gray value is greater than the threshold, this pixel point is regarded as the foreground, and vice versa as the background. Calculate the foreground pixel ratio and the background pixel ratio , calculate the foreground average gray and the background average gray , calculate the panoramic average gray and the between-class variance. The calculation formulas are: ; ; where, represents the panoramic average gray, represents the between-class variance.
[0066] 2. Use morphological opening operation to remove the white spots in the tip area and obtain Figure 6 .
[0067] The specific steps are as follows: Use morphological opening operation, whose mathematical definition is: ; where A is the input image, B is the structuring element, C is the output image, ⊖ represents erosion operation, and ⊕ represents dilation operation.
[0068] To obtain a morphological processing effect independent of direction, the structuring element selected for morphological opening operation here is circular. The circular structuring element is suitable for processing targets with circular or arc features, and can effectively remove noise and small interferences in the image. Since there are many large particle noises in the image, the size of the structuring element is selected as 15×15. The size selection needs to be debugged according to the actual scenario.
[0069] 3. Use the Canny edge detection algorithm to extract a continuous set of tip edge points , obtain the edge points as shown in Figure 7 shown.
[0070] Canny edge detection is a commonly used and effective edge detection method in image processing. It determines the edge position by detecting the gradient change of pixel values in the image. The detailed steps are as follows: (1) First, use Gaussian filtering to smooth the image and filter out noise. The Gaussian filtering formula is as follows: ; Among them, represents the Gaussian kernel function, is the standard deviation.
[0071] (2) Use the Sobel operator to calculate the gradients in the horizontal and vertical directions of the image. The calculation formulas are: ; ; Among them, and are the gradients in the horizontal and vertical directions, is the pixel value in the image.
[0072] (3) Non-maximum suppression to eliminate the pixels that do not belong to the edge and retain the pixel points with the largest gradient magnitude.
[0073] (4) Double-threshold segmentation to divide the gradient magnitude in the image into strong edges, weak edges, and non-edges. Set the pixel points with gradient magnitude greater than the high threshold as strong edges; set the pixel points with gradient magnitude less than the high threshold and greater than the low threshold as weak edges; set the pixel points with gradient magnitude less than the low threshold as non-edges.
[0074] (5) The strong edges after segmentation can be directly marked as edge points; for weak edges, if there are strong edges among the eight adjacent pixels of the weak edge, then mark this weak edge as an edge point, otherwise it is noise and is directly excluded; for non-edges, it is directly regarded as noise. Through the above, the final edge point set can be obtained.
[0075] 4. Use the Hough line detection, set appropriate threshold parameters, and detect two edge lines in the tool tip edge points, namely the left line L 1 and the right line L 2 , as shown in Figure 8 shown. The specific lines are represented by the point-direction form: Left line: ; Right line: ; Among them, is the left lineL 1 a point on is the direction vector of the left straight line L 1 on, point is the right straight line L 2 a point on is the right straight line L 2 the direction vector on.
[0076] 5. Extend the two edge straight lines and calculate the intersection coordinates of the two edge straight lines P i . The specific steps are as follows: (1) Determine whether the two straight lines are parallel, that is, calculate the determinant: ; If , then the straight lines are parallel and there is no intersection. Otherwise, there is.
[0077] (2) Calculate the parameter t: ; (3) The intersection coordinates P i are: .
[0078] 6. Find the tool tip edge point set the point in that is the closest to the intersection point P i This point is the tool tip vertex P v , as Figure 9 shown, the search logic is as follows: (1) Take the intersection point P i as the center, and define a circular neighborhood as the candidate search area according to the preset search radius parameter (for example, 300 pixels); (2) Traverse the tool tip edge point set , and filter out the edge points located in the candidate search area as the candidate point set ; (3) Calculate the Euclidean distance between each candidate point in the candidate point set and the intersection point P i , and record the minimum distance value and its corresponding edge point coordinates; (4) If there are valid candidate points, mark the point with the minimum distance as the nearest edge point, and this point is the position of the tool tip vertex of the tool P v . Otherwise, return no matching result.
[0079] 7. Finally, find the tool tip, as Figure 10 shown.
[0080] S6. Record the tool tip direction vector in the image coordinate system . After the image processing is completed, drive the gantry to move along the X-axis so that the laser rangefinder moves directly above the tool tip, read the data on the laser rangefinder, and convert it to the Z-axis coordinate in the camera coordinate system Z 1 . S7. Convert the tool tip coordinates in the image coordinate system P v to the tool tip coordinates in the camera coordinate system P c , the steps are as follows: (1) It is known that the tool tip vertex in the image coordinate system and the point in the camera coordinate system have the following conversion relationship: ; where K is the internal parameter matrix of the CCD camera; ; where is the optical center, that is, the projection of the optical axis of the CCD camera on the image, , are the pixel focal lengths; According to the projection relationship, it can be obtained that: .
[0081] S8. Similarly, convert the tool tip direction vector in the image coordinate system to the tool tip direction vector in the camera coordinate system .
[0082] The specific process is as follows: (1) As above, the tool tip vertex in the image coordinate system P v has been converted to the point in the camera coordinate system, and the intersection point of the two straight lines in the image coordinate system P i is converted to the point in the camera coordinate system.
[0083] (2) The direction vector is the subtraction of two spatial points in the camera coordinate system, that is: .
[0084] The diamond tool plane is parallel to the CCD camera target plane. It is known from step S6 that the plane distance of the diamond tool isZ 1 , the plane equation of the diamond tool is Z = Z 1 , according to the tool tip coordinates in the camera coordinate system P c , the tool tip direction vector and the plane equation Z = Z 1 , through the conversion relationship matrix of the calibrated CCD camera coordinate system, laser rangefinder and laser galvanometer processing coordinate system, it is converted into the coordinates in the galvanometer processing coordinate system, and the processing path is generated.
[0085] As Figure 11 shown, the specific steps for generating the processing path are as follows: 1. In the previous steps, the relationship conversion matrix H from the camera coordinate system to the galvanometer processing coordinate system is obtained. Then, the tool tip coordinates in the camera coordinate system are converted into the tool tip coordinates in the galvanometer processing coordinate system, that is: .
[0086] 2. Through the above steps, the tool tip direction vector of the diamond tool in the camera coordinate system has been obtained. Convert it into the direction vector in the galvanometer processing coordinate system, that is: .
[0087] 3. Similarly, the point sets of the two straight lines and in the galvanometer processing coordinate system can be obtained. At a distance d in the opposite direction of the tool tip along the direction vector , draw a straight line perpendicular to , which is the first processing path.
[0088] 4. At the intersection of the straight line and , at a distance d in the opposite direction of the direction vector , draw a straight line perpendicular to , which is the second processing path. Repeat the above steps until the processing path covers the entire range of the diamond tool tip.
[0089] Through experiments, image processing and positioning are performed on the actual photographed image, and the tool tip positioning accuracy reaches 0.5μm.
[0090] Although embodiments of the present invention have been shown and described, those of ordinary skill in the art will understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An automatic positioning method for diamond tools in laser galvanometer processing, characterized in that the laser galvanometer is installed on the gantry, and a coaxial CCD camera and a laser rangefinder are installed on the laser galvanometer; perform internal parameter calibration on the CCD camera to eliminate distortion, establish the mapping relationship between the pixel coordinate system and the world coordinate system, and calculate the pixel equivalent; determine the transformation relationship matrix between the CCD camera coordinate system, the laser rangefinder and the laser galvanometer processing coordinate system; fix the diamond tool to the processing platform, drive the diamond tool on the processing platform and the gantry to move until the diamond tool tip is imaged in the CCD camera, and drive the gantry to move along the Z-axis until the CCD camera can be clearly focused, and collect the tip image of the diamond tool; Perform image processing on the collected tool tip images. First, perform binaryzation and morphological processing on the tool tip images, and then perform edge detection to extract the tool tip edge point set , calculate the intersection point of the two edge lines by identifying the two edge lines in the tool tip edge points P i And set the search radius to find the point closest to the intersection point from the tool tip edge point set P i , and determine the tool tip vertex position in the image coordinate system P v ; Combined with the Z-axis data of the laser rangefinder, the conversion relationship matrix between the CCD camera coordinate system and the laser rangefinder and the laser galvanometer processing coordinate system, the vertex coordinates in the image coordinate system P v , the tool tip direction vector are respectively converted to the coordinates in the galvanometer processing coordinate system to generate the processing path of the laser galvanometer system.
2. The automatic positioning method of the diamond tool for laser galvanometer processing according to claim 1, wherein perform binaryzation and morphological processing on the tip image, including using the Otsu method to adaptively threshold and segment the tip area and the background in the image, and using morphological opening operation to remove the white spots in the tip area.
3. The automatic positioning method of the diamond tool for laser galvanometer processing according to claim 2, characterized in that Use the Canny edge detection algorithm to extract a continuous set of tool tip edge points .
4. The automatic positioning method of the diamond cutting tool for laser galvanometer processing according to claim 3, wherein Using Hough line detection and setting appropriate threshold parameters, two edge lines in the tool tip edge points are detected, namely the left line L 1 and the right line L 2 . Extend the two edge lines and calculate the intersection coordinates of the two edge lines P i .
5. The automatic positioning method of the diamond tool for laser galvanometer processing according to claim 4, characterized in that, The intersection coordinates of two edge lines P i The calculation formula is as follows: ; Among them, is a point on the left straight line L 1 ; is the direction vector on the left straight line L 1 . The point is a point on the right straight line L 2 ; is the direction vector on the right straight line L 2 .
6. The automatic positioning method of the diamond tool for laser galvanometer processing according to any one of claims 1 to 5, characterized in that Find the point closest to the intersection point from the set of edge points of the tool tip P i to determine the position of the tool tip vertex in the image coordinate system P v Specifically: (1)With the intersection point P i as the center, define a circular neighborhood as the candidate search area according to the preset search radius parameter; (2) Traverse the set of tool tip edge points , and filter the edge points located within the candidate search area as the candidate point set ; (3) Calculate the candidate point set For each candidate point within P i calculate the Euclidean distance to the intersection point, and record the minimum distance value and the coordinates of the corresponding edge point; If there are valid candidate points, mark the point with the smallest distance as the nearest edge point, which is the position of the tool tip vertex P v 。 7. The automatic positioning method of the diamond tool for laser galvanometer processing according to claim 6, characterized in that, Tool tip direction vector in the recorded image coordinate system After the image processing is completed, drive the gantry to move along the X-axis so that the laser rangefinder moves directly above the tool tip, read the data on the laser rangefinder, and convert it to the Z-axis coordinate in the camera coordinate system Z 1 。 8. The automatic positioning method of the diamond tool for laser galvanometer processing according to claim 7, wherein The tip vertex in the image coordinate system and the point in the camera coordinate system have the following conversion relationship: ; where K is the internal parameter matrix of the CCD camera; ; Among them, is the optical center, that is, the projection of the optical axis of the CCD camera on the image, and are the pixel focal lengths; According to the projection relationship, it can be obtained that: 。 9. The automatic positioning method of the diamond cutting tool for laser galvanometer processing according to claim 8, characterized in that Convert the tool tip direction vector in the image coordinate system to the tool tip direction vector in the camera coordinate system .
10. The automatic positioning method of the diamond tool for laser galvanometer processing according to claim 9, wherein The plane of the diamond tool is parallel to the target plane of the CCD camera, and the plane distance of the diamond tool is Z 1 . The plane equation of the diamond tool is Z = Z 1 . According to the tip coordinates P c in the camera coordinate system, the tip direction vector and the plane equation Z = Z 1 , through the conversion relationship matrix of the calibrated CCD camera coordinate system, laser rangefinder and galvanometer processing coordinate system, it is converted into the coordinates in the galvanometer processing coordinate system, and the processing path is generated.
Citation Information
Patent Citations
Method of accurate location of diamond turning tool in micro-turning process
CN103170877A
Diamond tool in-situ detection and positioning method
CN104669065A
A method for calculating the tool tip position of a machine tool based on machine vision
CN109345500A
Machining method for simultaneously passivating and strengthening cutting edge of cutter through femtosecond laser
CN116275531A
Complex structure surface laser polishing method based on 3D laser super-focal-depth treatment
CN118752077A