A diamond tool automatic positioning method for laser galvanometer processing
By combining a CCD camera and a laser rangefinder with image processing algorithms, the problems of high cost and low accuracy in diamond tool positioning in existing technologies have been solved. This achieves low-cost, high-precision tool positioning, which is suitable for laser galvanometer machining and improves machining efficiency and tool life.
Patent Information
- Application Number
- CN202510719674.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-05-30
AI Technical Summary
Existing positioning methods for diamond tools are costly, have low accuracy, and are not suitable for efficient automated production, especially in laser galvanometer machining where it is difficult to achieve efficient and accurate tool tip positioning.
By employing a coaxially mounted CCD camera and laser rangefinder, combined with image processing algorithms, and through specific geometric feature extraction and image processing algorithms, high-resolution positioning of the diamond tool tip is achieved, avoiding contact measurement, reducing costs and improving accuracy.
It achieves low-cost, high-precision diamond tool positioning, is suitable for laser galvanometer machining, improves machining efficiency and tool life, and is highly adaptable to industrial environments.
Smart Images

Figure CN120228418B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of laser precision machining, and particularly relates to a diamond tool automatic positioning method for laser galvanometer machining. BACKGROUND
[0002] Most CVD diamond-coated tools (such as milling cutters, turning tools, drill bits) have diamond coatings deposited on the entire tool surface (including the cutting edge, the cutting edge, and the tool body). During the deposition process, micro protrusions, grain boundaries or granular structures may be formed, resulting in high tool surface roughness and uneven coating thickness. Diamond tools are often used for high-precision machining, such as ultra-precision machining and optical element manufacturing, so the coating quality of the cutting edge directly affects the performance of the tool. CVD diamond coating is very hard, but due to surface unevenness, particle protrusions and other problems that may exist during the deposition process, friction is increased 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 cutting edge of the diamond tool to remove loose particles on the surface, reduce surface roughness, make the coating and the substrate more closely bonded, reduce the risk of peeling, prolong the tool life, and improve the machining precision of the tool. Therefore, positioning before polishing becomes a core problem to be solved. The cutting edge coating of the diamond tool requires very precise positioning, otherwise it may damage the tool or affect the polishing effect.
[0003] There are several existing methods for positioning the cutting edge of a diamond tool:
[0004] Optical microscopic positioning: high-resolution imaging of the cutting edge morphology of the diamond tool is performed using an optical microscope (such as a confocal microscope, a differential interference microscope), and positioning is performed in combination with computer vision technology. This scheme has high resolution, but the cost of optical devices is high, and it is difficult to achieve linkage with the laser galvanometer. An independent measurement system is usually used, which affects the overall machining efficiency.
[0005] Laser interferometric positioning: a laser interferometer is used to measure the position of the cutting edge of the diamond tool, which can achieve very high measurement accuracy. However, this scheme is complex, requires high environmental vibration, and the cost of the equipment is high, limiting its large-scale application in actual production.
[0006] Mechanical contact positioning: the cutting edge of the diamond tool is contacted by a high-precision probe or measuring head to determine its spatial position. This scheme requires a precision motion control platform to improve measurement accuracy. Contact measurement may cause micro-damage to the tool, reducing tool life, and the measurement efficiency is low, which is not suitable for high-efficiency automated production. SUMMARY
[0007] In view of the deficiencies in the prior art, the present application provides a diamond tool automatic positioning method for laser galvanometer machining, which uses a CCD camera coaxial with the laser galvanometer to obtain a high-resolution image of the diamond tool tip, and uses a specific geometric feature extraction and image processing algorithm to accurately calculate the machining position, which is not disturbed by the tool direction, has fast calculation speed and high positioning accuracy.
[0008] In order to achieve the above-mentioned purpose, the present application adopts the following technical solutions:
[0009] The present application provides a diamond tool automatic positioning method for laser galvanometer machining, and the laser galvanometer is installed on a gantry (the gantry can move along the Z-axis and X-axis directions), and a coaxial CCD camera and a laser range finder are installed on the laser galvanometer.
[0010] Firstly, the camera is calibrated, and the galvanometer is adjusted to the zero initial state, that is, the optical path is vertically downward. Zhang Zhengyou calibration method is used to calibrate the internal parameters of the CCD camera, remove distortion, establish the mapping relationship between the image coordinate system and the world coordinate system, and calculate the pixel equivalent.
[0011] After the camera calibration is completed, the laser range finder and the camera are calibrated, and it is assumed that the laser beam of the laser range finder is absolutely parallel to the camera optical axis, and the calibration steps are as follows:
[0012] 1. A checkerboard calibration board is placed on the machining platform, the gantry Z-axis is driven to move, and the camera shoots multiple images of the calibration board at different heights, and the laser range finder tests multiple groups of heights at the same time;
[0013] 2. The corner points of the calibration board image are detected;
[0014] 3. A plurality of rotation and translation matrices, that is, camera pose matrices, can be obtained through a plurality of corner points;
[0015] 4. Through a plurality of camera pose matrices and laser range finder results, the least square method algorithm is used to solve the Z-axis compensation coefficient α of the camera and the laser range finder, and α represents the Z-axis position difference between the camera coordinate system and the laser range finder coordinate system. Because the installation positions of the camera and the laser range finder are different, there is a fixed deviation in the Z-axis direction, and through the compensation coefficient, the distance value measured by the laser range finder can be converted to the Z-axis value in the camera coordinate system, so as to realize the unification of the two coordinate systems.
[0016] The laser galvanometer is preliminarily corrected, the laser galvanometer is controlled to punch a matrix point array on the calibration board according to the theoretical point array coordinates, a microscope or other magnifying device is used to determine the coordinates of each point on the calibration board, the deviation between the actual coordinates and the theoretical coordinates of the point array mark points punched by the laser galvanometer on the calibration board is compared, and the Z-axis of the laser galvanometer is compensated to correct the Z-axis error of the two-dimensional galvanometer at each point.
[0017] After the laser galvanometer is corrected, the gantry Z-axis is driven to focus the galvanometer, and a dot matrix is printed on the plate again, and the height Z of the laser range finder at this time is recorded pg The gantry Z-axis is driven to focus the small area dot matrix printed by the laser galvanometer, and the height Z of the dot matrix plane in the Z direction is measured by the laser range finder pc The conversion relationship matrix of the camera coordinate system and the laser galvanometer processing coordinate system is determined according to the dot matrix image.
[0018] X c Y c Z c is the camera coordinate system, X P Y P is the galvanometer processing coordinate system, X w Y w Z w is the world coordinate system, and the detailed steps are as follows:
[0019] 1. After the galvanometer is corrected, the gantry Z-axis is driven to focus the laser galvanometer on the plate, and a dot matrix is printed on the plate again, and the height Z of the laser range finder at this time is recorded pg The galvanometer is driven to print a dot matrix on the plate again.
[0020] 2. Drive the gantry Z-axis to focus the small area dot matrix printed by the laser galvanometer, and record the height Z of the laser range finder at this time pc Then the Z-axis height in the camera coordinate system is (α+Z pc ), the dot matrix image is shot, and the dot matrix set in the image coordinate system is Where n represents n groups of point coordinates.
[0021] 3. Convert the dot matrix set in the image coordinate system to the dot matrix set in the camera coordinate system
[0022] Where K is the intrinsic matrix of the CCD camera, and i represents the i-th group of point coordinates.
[0023]
[0024] Where (c x ,c y ) is the optical center, that is, the projection of the CCD camera optical axis on the image, f x , f y is the pixel focal length.
[0025] 4. The transformation relationship between the camera coordinate system and the galvanometer processing coordinate system is as follows:
[0026] P=R·C+T;
[0027] where P is the point set in galvanometer machining coordinate system, C is the point set in camera coordinate system, R is rotation matrix, T is translation matrix, which can be written as:
[0028]
[0029] Further, it can be written as:
[0030]
[0031] Let H is the relationship conversion matrix from camera coordinate system to galvanometer machining coordinate system.
[0032] 5. Since n can be large, the optimal solution relationship conversion matrix is obtained by solving H corresponding to multiple sets of point sets by least square method.
[0033] After calibration, the diamond tool is fixed and installed on the machining platform (the machining platform moves along the Y axis direction), the diamond tool and gantry on the machining 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 be clearly focused, and the tool tip image of the diamond tool is collected;
[0034] The collected tool tip image is processed, first the tool tip image is binarized and morphologically processed, and then the edge detection is performed to extract the tool tip edge point set ∑P C By identifying two edge straight lines in the tool tip edge point set, the intersection point P i of the two edge straight lines is calculated, and a search radius is set to find the nearest point from the intersection point P C in the tool tip edge point set ∑P i , to determine the tool tip vertex position P v in the image coordinate system;
[0035] The vertex coordinate P v in the image coordinate system and the tool tip direction vector are respectively converted to coordinates in the galvanometer machining coordinate system in combination with the Z axis data of the laser range finder and the conversion relationship matrix of the CCD camera coordinate system, the laser range finder and the laser galvanometer machining coordinate system, to generate the machining path of the laser galvanometer system.
[0036] Further, the binarization and morphological processing of the tool tip image includes using Otsu method to adaptively threshold segment the tool tip area and background in the image, and then using morphological opening operation to remove white spots in the tool tip area.
[0037] The principle of Otsu method is to determine a best threshold to maximize the gray scale separation degree of the foreground and background of the image, and the specific steps are as follows:
[0038] 1. Calculate the image grayscale histogram, count the number of pixels at each grayscale level (0 to 255) in the image, and calculate the probability of each grayscale level.
[0039] 2. Use the grayscale of each probability as the threshold to divide the image into foreground and background. When the grayscale value is greater than the threshold, the pixel is considered as the foreground, otherwise it is considered as the background. Calculate the foreground pixel ratio ω1 and the background pixel ratio ω2, calculate the foreground average grayscale μ1 and the background average grayscale μ2, calculate the panoramic average grayscale and the inter-class variance, and the calculation formula is:
[0040] μ=ω1·μ1+ω2·μ2;
[0041] σ 2 =ω1·(μ1-μ) 2 +ω2·(μ2-μ) 2 ;
[0042] Among them, μ represents the average grayscale of the whole scene, σ 2 represents the between-class variance.
[0043] The specific steps of using morphological opening operation to remove white spots in the tip area are as follows:
[0044] Use the morphological opening operation, which is mathematically defined as:
[0045]
[0046] Where A is the input image, B is the structural element, and C is the output image. represents the erosion operation, Represents the dilation operation.
[0047] To achieve a direction-independent morphological processing effect, the structuring element selected for the morphological opening operation is a circle. Circular structuring elements are suitable for processing objects with circular or arc-shaped features and can effectively remove noise and small interference in the image. Due to the high concentration of large-particle noise in the image, the structuring element size is selected to be 15×15. The size selection needs to be adjusted according to the actual scenario.
[0048] Furthermore, the Canny edge detection algorithm is used to extract the continuous tool tip edge point set ∑P C .
[0049] 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:
[0050] 1. First, use Gaussian filtering to smooth the image and filter out noise. The Gaussian filtering formula is as follows:
[0051]
[0052] where G(x, y) represents a Gaussian kernel function, and σ is a standard deviation.
[0053] 2. Sobel operator is used to calculate the horizontal and vertical gradients of the image, and the calculation formula is:
[0054]
[0055] where G x and G y are the horizontal and vertical gradients, and I(x, y) is the pixel value in the image.
[0056] 3. Non-maximum suppression is used to eliminate pixels that do not belong to the edge and keep the pixel points with the largest gradient amplitude.
[0057] 4. Double threshold segmentation is used to divide the gradient amplitude in the image into strong edges, weak edges, and non-edges. The pixel points with a gradient amplitude greater than the high threshold value are set as strong edges; the pixel points with a gradient amplitude less than the high threshold value and greater than the low threshold value are set as weak edges; and the pixel points with a gradient amplitude less than the low threshold value are set as non-edges.
[0058] 5. The strong edges after segmentation can be directly marked as edge points; for weak edges, if there are strong edges in the adjacent eight pixel points, the weak edge is marked as an edge point, otherwise it is noise and is directly excluded; for non-edges, they are directly considered as noise. Through the above, the final edge point set can be obtained.
[0059] Further, Hough line detection is used to set appropriate threshold parameters to detect two edge straight lines in the knife tip edge point set, which are left straight line L1 and right straight line L2. The intersection coordinates P i of the two edge straight lines are calculated.
[0060] Further, the calculation formula of the intersection coordinates P i of the two edge straight lines is:
[0061]
[0062] P(x1, y1) is a point on the left straight line L1, v1 = (v x1 , v y1 ) is the direction vector of the left straight line L1, P(x2, y2) is a point on the right straight line L2, and v2 = (v x2 , v y2 ) is the direction vector of the right straight line L2.
[0063] Further, the intersection point P C is found from the knife tip edge point set ∑Pi The nearest point is to determine the tool tip vertex position P in the image coordinate system. v Specifically:
[0064] (1) Take the intersection point P i As the center, a circular neighborhood is defined as the candidate search area according to the preset search radius parameter;
[0065] (2) Traverse the tool tip edge point set ∑P C , filter the edge points in the candidate search area as the candidate point set ∑P Filter ;
[0066] (3) Calculate the candidate point set ∑P Filter Each candidate point in the intersection point P i Euclidean distance, record the minimum distance value and its corresponding edge point coordinates;
[0067] (4) If there is a valid candidate point, mark the point with the smallest distance as the nearest edge point. This point is the tool tip vertex position P v .
[0068] Furthermore, the tool tip direction vector in the image coordinate system is recorded After the image processing is completed, the gantry is driven to move along the X-axis so that the laser rangefinder is moved to the top of the tool tip. The data on the laser rangefinder is read and converted into the Z-axis coordinate Z1 in the camera coordinate system.
[0069] Furthermore, the tool tip vertex P in the image coordinate system v (x v ,y v ) and point P in the camera coordinate system c (X, Y, Z) has the following conversion relationship:
[0070]
[0071] Where K is the internal parameter matrix of the CCD camera;
[0072]
[0073] Among them, (c x ,c y ) is the optical center, that is, the projection of the CCD camera optical axis on the image, f x 、f y is the pixel focal length;
[0074] According to the projection relationship, we can get:
[0075]
[0076] Furthermore, the tool tip direction vector in the image coordinate system is Convert the tool tip direction vector to the camera coordinate system
[0077] The specific process is:
[0078] 1. As above, the tool tip vertex P in the image coordinate system v Point P has been converted into the camera coordinate system vc (X vc ,Y vc ,Z1), the intersection point P of the two straight lines in the image coordinate system i Transformed into point P in the camera coordinate system ic (X ic ,Y ic ,Z1).
[0079] 2. Direction vector It is the subtraction of two points in the camera coordinate system, that is:
[0080]
[0081] Furthermore, the diamond tool plane is parallel to the CCD camera target surface, the plane distance of the diamond tool is Z1, and the plane equation of the diamond tool is Z=Z1. According to the tool tip coordinate P in the camera coordinate system c , tool tip direction vector The plane equation Z=Z1 is converted into coordinates in the galvanometer processing coordinate system through the calibrated conversion relationship matrix of the CCD camera coordinate system, the laser rangefinder and the laser galvanometer processing coordinate system, and the processing path is generated.
[0082] The specific steps for generating the machining path are as follows:
[0083] 1. The previous step obtained the relationship transformation matrix H from the camera coordinate system to the galvanometer processing coordinate system, then the tool tip coordinate P in the camera coordinate system vc Convert to tool tip coordinate P in galvanometer machining coordinate system vp ,Right now:
[0084] P vp =H·P vc .
[0085] 2. Through the above steps, the direction vector of the diamond tool tip in the camera coordinate system has been obtained Convert it into the direction vector in the galvanometer processing coordinate system Right now:
[0086]
[0087] 3. Similarly, we can obtain the point set of the two straight lines L1 and L2 in the galvanometer processing coordinate system, at the tool tip P vp Along direction vector a straight line S1 perpendicular to the direction vector of the straight line S1 at a distance d in the opposite direction, is a first machining path.
[0088] 4. At the intersection of the straight line S1 and the straight line S2, a straight line S3 perpendicular to the direction vector of the straight line S3 at a distance d in the opposite direction, is a second machining path.
[0089] Compared with the prior art, the present application has the following beneficial effects:
[0090] 1. Low cost and high system integration: The present application uses a CCD camera combined with a laser range finder to realize non-contact measurement, avoiding the use of expensive optical microscopic systems and laser interferometers, reducing the overall system cost, and integrating with a laser galvanometer system to realize integrated machining and detection, improving machining efficiency.
[0091] 2. High positioning accuracy and strong environmental adaptability: The method of extracting the three-dimensional coordinates of the diamond tool tip vertex and the direction vector through image processing, combined with the camera internal participation and laser ranging data, realizes high-precision identification of the three-dimensional space position and direction vector of the tool tip, and the system is not sensitive to external vibration interference, suitable for industrial field environment.
[0092] 3. Non-contact detection, protecting tool life: Unlike mechanical contact solutions, the present application uses a full-range non-contact measurement method, avoiding micro-damage to the diamond tool, significantly improving tool life.
[0093] 4. Strong attitude robustness and wide adaptability: The image processing algorithm in the present application is based on the geometric features of the tool tip, positioning the tool tip vertex through the intersection of the two edge lines and the search radius, with good direction robustness, capable of accurately identifying the tool tip position and direction in any attitude, improving system adaptability and automation level.
[0094] 5. Suitable for automatic production process: The system can be directly integrated into a laser machining device to realize rapid positioning and path generation, effectively improving overall machining efficiency, suitable for efficient automatic manufacturing scenarios. BRIEF DESCRIPTION OF DRAWINGS
[0095] The present application will be further described in detail below in conjunction with the drawings and specific embodiments.
[0096] Figure 1 is a structural diagram of the laser galvanometer system machining device in the present application;
[0097] Figure 2 is a local enlarged view of the tool tip of the diamond tool in the present application;
[0098] Figure 3 Corresponding coordinate system diagram of camera coordinate system, galvanometer machining coordinate system and world coordinate system in the application;
[0099] Figure 4 Image of a diamond tool tip collected by a CCD camera in the application;
[0100] Figure 5 Binary image in the application;
[0101] Figure 6 Image after morphological opening operation in the application;
[0102] Figure 7 Canny edge detection diagram in the application;
[0103] Figure 8 Diagram of diamond tool tip edge line detection in the application;
[0104] Figure 9 Diagram of finding a diamond tool tip vertex in the application;
[0105] Figure 10 Diagram of a diamond tool tip in the application;
[0106] Figure 11 Diagram of generating a machining path for a diamond tool tip in the application. DETAILED DESCRIPTION
[0107] The technical solutions in the embodiments of the application will be clearly and completely described below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments of the application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the application.
[0108] Embodiments of the application disclose a diamond tool automatic positioning method for laser galvanometer machining,
[0109] The structure of the overall laser galvanometer system machining device is shown in Figure 1 The laser galvanometer is installed on a gantry (the gantry can move along the Z-axis and X-axis directions), a coaxial CCD camera and a laser range finder are installed on the laser galvanometer, the laser galvanometer can be driven to move along the Z-axis and X-axis directions by the gantry, the diamond tool is fixed on the tabletop of the machining platform below the laser galvanometer, and the machining platform is driven to move along the X-axis and Y-axis directions by the moving platform. In specific embodiments, a 5 million pixel CCD camera is selected, and a long-focus telecentric lens is matched, so that a 2mm*1.6mm field of view can be shot.
[0110] Since laser polishing in this scheme only needs to polish the tool tip layer, the position and direction of the tool tip need to be positioned. Since the tool tip of the diamond tool is in the form of a circular arc, and most of the tool tips are not true circles, if the Hough circle detection algorithm is used, the tool tip cannot be accurately positioned. The local enlargement of the tool tip of the diamond tool is shown in Figure 2 .
[0111] Therefore, based on the geometric characteristics of the tool tip of the diamond tool itself, the following positioning algorithm is proposed:
[0112] S1, first calibrate the camera, adjust the galvanometer to the zero initial state, that is, the optical path is perpendicular downward. Use Zhang Zhengyou calibration method to calibrate the internal parameters of the CCD camera, remove distortion, establish the mapping relationship between the image coordinate system and the world coordinate system, and calculate the pixel equivalent.
[0113] After the camera calibration, the laser range finder and the camera are calibrated. It is assumed that the laser beam of the laser range finder and the camera optical axis are absolutely parallel, and the calibration steps are as follows:
[0114] 1. Place the checkerboard calibration board on the machining platform, drive the gantry Z-axis to move, and make the camera shoot multiple images of the calibration board at different heights, while the laser range finder tests multiple sets of heights;
[0115] 2. Corner detection is performed on the calibration board image;
[0116] 3. Through multiple sets of corner points, multiple sets of rotation and translation matrices, that is, camera pose matrices, can be obtained;
[0117] 4. Through multiple sets of camera pose matrices and laser range finder results, the least squares method is used to solve the Z-axis compensation coefficient a of the camera and the laser range finder. a represents the Z-axis position difference between the camera coordinate system and the laser range finder coordinate system. Since the installation positions of the camera and the laser range finder are different, there is a fixed deviation in the Z-axis direction. Through the compensation coefficient, the distance value measured by the laser range finder can be converted to the Z-axis value in the camera coordinate system, thereby realizing the unification of the two coordinate systems.
[0118] S2, preliminary correction is performed on the laser galvanometer, the laser galvanometer is controlled to punch a matrix point array on the calibration board according to the theoretical point array coordinates, a microscope or other magnification device is used to determine the coordinates of each point on the calibration board, and the deviation between the actual coordinates and the theoretical coordinates of the point array mark points punched by the laser galvanometer on the calibration board is compared. The Z-axis of the laser galvanometer is compensated, and the Z-axis error of the two-dimensional galvanometer at each point is corrected.
[0119] S3, after the laser galvanometer is corrected, the gantry Z-axis is driven to move to focus the galvanometer, and the point array is punched on the board again, and the laser range finder height Z pg, drive gantry Z axis movement to enable the CCD camera clear focus laser galvanometer small area dot matrix, laser range finder to measure the dot matrix plane Z direction height Z pc , according to the dot matrix image to determine the camera coordinate system and laser galvanometer processing coordinate system conversion relationship matrix.
[0120] As Figure 3 shown, X c Y c Z c for the camera coordinate system, X P Y P for the galvanometer coordinate system, X w Y w Z w for the world coordinate system, the detailed steps are as follows:
[0121] 1, after the galvanometer correction, drive gantry Z axis to focus the laser galvanometer on the plate, re on the plate to drop dot matrix, record the height of laser range finder Z pg , let the galvanometer re on the plate to drop dot matrix.
[0122] 2, drive gantry Z axis to enable the CCD camera clear focus laser galvanometer small area dot matrix, record the height of laser range finder Z pc , then the Z axis height under the camera coordinate system is (α+Z pc ), shoot dot matrix image, dot matrix set under the image coordinate system is Where n represents n group point coordinates.
[0123] 3, the dot matrix set under the image coordinate system is converted to the dot matrix set under the camera coordinate system
[0124]
[0125] Where, K is the internal parameter matrix of CCD camera, i represents the i group point coordinates;
[0126]
[0127] Where, (c x ,c y ) is the optical center, that is, the projection of the CCD camera optical axis on the image, f x , f y is the pixel focal length.
[0128] 4, the transformation relationship between the camera coordinate system and the galvanometer processing coordinate system is as follows:
[0129] P=R·C+T;
[0130] Where P is the dot array coordinate in the galvanometer machining coordinate system, C is the dot array coordinate in the camera coordinate system, R is the rotation matrix, and T is the translation matrix, which can be written as:
[0131]
[0132] Further, it can be written as:
[0133]
[0134] Let H is the relationship conversion matrix from the camera coordinate system to the galvanometer machining coordinate system.
[0135] 5. Since n can be large, the optimal solution relationship conversion matrix is obtained by solving the corresponding H of multiple sets of point sets through the least squares algorithm.
[0136] S4. After calibration, the diamond tool is fixed and installed on the machining platform (the machining platform moves along the Y-axis direction), the diamond tool and gantry on the machining 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 be clearly focused, and the tool tip image of the diamond tool is collected, as shown in Figure 4 Due to the high magnification of the lens of the CCD camera, the optical path design cannot be perfect, so the unavoidable "vignetting effect" appears in the imaging, that is, the brightness in the image is Gaussian distribution, bright in the middle and dark around. However, the effective information of the tool tip still exists, so the effective information can be extracted through subsequent image processing.
[0137] S5. The tool tip image collected is processed, the side straight line of the tool tip is fitted, and the tool tip vertex coordinate in the image coordinate system is obtained.
[0138] The specific steps are as follows:
[0139] 1. First, the Otsu method is used to adaptively threshold the image binarization, and the tool tip region and background in the image are segmented, as shown in Figure 5
[0140] The principle of the Otsu method is to determine a best threshold to maximize the gray scale difference between the foreground and background of the image, and the specific steps are as follows:
[0141] (1) Calculate the image gray scale histogram, count the number of pixels in each gray scale level (0-255) in the image, and calculate the probability of each gray scale level.
[0142] (2) Take the gray level of each probability as a threshold, divide the image into foreground and background, when the gray value is greater than the threshold, the pixel point is foreground, otherwise it is background. Calculate the foreground pixel proportion ω1 and the background pixel proportion ω2, calculate the foreground average gray μ1 and the background average gray μ2, calculate the overall average gray and the inter-class variance, the calculation formula is:
[0143] μ = ω1 μ1 + ω2 μ2
[0144] σ 2 = ω1 (μ1 - μ) 2 + ω2 (μ2 - μ) 2 ;
[0145] Wherein, μ represents the overall average gray, σ 2 represents the inter-class variance.
[0146] 2, using morphological open operation to remove the white spots of the knife tip area, get Figure 6 .
[0147] The specific steps are as follows:
[0148] Using morphological open operation, its mathematical definition is:
[0149]
[0150] Where A is the input image, B is the structure element, C is the output image, represents the erosion operation, represents the dilation operation.
[0151] In order to obtain the direction independence of morphological processing effect, the structure element of morphological open operation here is selected as a circle, the circular structure element is suitable for processing the target with circular or arc characteristics, and can effectively remove the noise and small interference in the image. Because there are many large particle noises in the image, the size of the structure element is selected as 15*15. The size selection needs to be debugged according to the actual scene.
[0152] 3, using Canny edge detection algorithm, extracting continuous knife tip edge point set ∑P C , get the edge point as shown in Figure 7 .
[0153] Canny edge detection is a commonly used and effective edge detection method in image processing, which determines the edge position by detecting the gradient change of pixel value in the image, the detailed steps are as follows:
[0154] (1) First, use Gaussian filter to smooth the image and filter out noise, the Gaussian filter formula is as follows:
[0155]
[0156] where G(x, y) represents a Gaussian kernel function, and σ is a standard deviation.
[0157] (2) The Sobel operator is used to calculate the horizontal and vertical gradients of the image, and the calculation formula is:
[0158]
[0159] where G x and G y are the horizontal and vertical gradients, and I(x, y) is the pixel value in the image.
[0160] (3) Non-maximum suppression, eliminate pixels that do not belong to the edge, and keep the pixel point with the largest gradient amplitude.
[0161] (4) Double threshold segmentation, the gradient amplitude in the image is divided into strong edge, weak edge and non-edge, the pixel point with gradient amplitude greater than the high threshold is set as strong edge; the pixel point with gradient amplitude less than the high threshold and greater than the low threshold is set as weak edge; the pixel point with gradient amplitude less than the low threshold is set as non-edge.
[0162] (5) The strong edge after segmentation can be directly marked as edge point; for weak edge, when there is strong edge in the adjacent eight pixel points of weak edge, the weak edge is marked as edge point, otherwise it is noise and is directly excluded; for non-edge, it is directly regarded as noise. Through the above, the final edge point set can be obtained.
[0163] 4. Hough line detection is used to set appropriate threshold parameters to detect two edge lines in the knife tip edge point, which are left line L1 and right line L2, as shown in Figure 8 , and the specific line is represented by point to form:
[0164] Left line:
[0165] Right line:
[0166] where P(x1, y1) is a point on the left line L1, v1 = (v x1 ,v y1 ) is the direction vector of the left line L1, and P(x2, y2) is a point on the right line L2, v2 = (v x2 ,v y2 ) is the direction vector of the right line L2.
[0167] 5. Extend the two edge lines to calculate the intersection coordinates P i of the two edge lines. The specific steps are as follows:
[0168] (1) Determine whether two straight lines are parallel, that is, calculate the determinant:
[0169] D=v x1 ·v y2 -v y1 ·v x2 ;
[0170] If |D| = 0, the lines are parallel and have no intersection. Otherwise, they do.
[0171] (2) Calculation parameter t:
[0172]
[0173] (3) Intersection coordinates P i for:
[0174]
[0175] 6. Find the tool tip edge point set ∑P C Mid-distance intersection point P i The nearest point is the tip of the tool, P. v ,like Figure 9 As shown, the search logic is as follows:
[0176] (1) Take the intersection point P i As the center, a circular neighborhood is defined as the candidate search area according to the preset search radius parameter (e.g. 300 pixels);
[0177] (2) Traverse the tool tip edge point set ∑P C , filter the edge points in the candidate search area as the candidate point set ∑P Filter ;
[0178] (3) Calculate the candidate point set ∑P Filter Each candidate point in the intersection point P i Euclidean distance, record the minimum distance value and its corresponding edge point coordinates;
[0179] (4) If there is a valid candidate point, mark the point with the smallest distance as the nearest edge point. This point is the tool tip vertex position P v Otherwise, no matching results are returned.
[0180] 7. Finally find the tip of the knife, such as Figure 10 shown.
[0181] S6. Record the tool tip direction vector in the image coordinate system After the image processing is completed, the gantry is driven to move along the X-axis so that the laser rangefinder is moved to the top of the tool tip. The data on the laser rangefinder is read and converted into the Z-axis coordinate Z1 in the camera coordinate system.
[0182] S7, convert the tool tip point P v in the image coordinate system into the tool tip point P c (X, Y, Z) in the camera coordinate system c , the steps are as follows:
[0183] (1) the tool tip point P x in the image coordinate system is known y , and the point P x (X, Y, Z) in the camera coordinate system has the following conversion relationship:
[0184]
[0185] wherein K is the intrinsic matrix of the CCD camera;
[0186]
[0187] wherein (c y , c v ) is the optical center, i.e. the projection of the optical axis of the CCD camera on the image, f vc , f vc is the pixel focal length;
[0188] According to the projection relationship, the following can be obtained:
[0189]
[0190] S8, similarly, the tool tip direction vector in the image coordinate system is converted into the tool tip direction vector in the camera coordinate system
[0191] The specific process is as follows:
[0192] (1) as above, the tool tip point P vc in the image coordinate system has been converted into the point P i (X ic , Y ic , Z1) in the camera coordinate system, and the intersection point P ic of the two straight lines in the image coordinate system is converted into the point P c (X vc , Y vp , Z1) in the camera coordinate system.
[0193] (2) the direction vector is the subtraction of two points in the camera coordinate system, i.e.:
[0194]
[0195] The plane of the diamond cutter is parallel to the target plane of the CCD camera. The plane distance of the diamond cutter is Z1, which is known from step S6. The plane equation of the diamond cutter is Z=Z1. According to the conversion relationship matrix of the CCD camera coordinate system, the laser range finder and the laser galvanometer machining coordinate system, the coordinate in the galvanometer machining coordinate system is converted according to the tip coordinate P c , the tip direction vector and the plane equation Z=Z1, and the machining path is generated.
[0196] As shown in Figure 11 , the machining path generation step specifically includes:
[0197] 1. The relationship conversion matrix H of the camera coordinate system to the galvanometer machining coordinate system is obtained in the previous step. Then, the tip coordinate P vc in the camera coordinate system is converted into the tip coordinate P vp in the galvanometer machining coordinate system, i.e.
[0198] P vp =H·P vc .
[0199] 2. The tip direction vector in the camera coordinate system is converted into the direction vector in the galvanometer machining coordinate system, i.e.
[0200]
[0201] 3. Similarly, the point set of the two straight lines L1 and L2 in the galvanometer machining coordinate system can be obtained. At the tip P vp , a straight line S1 perpendicular to is drawn at a distance d in the opposite direction of the direction vector , which is the first machining path.
[0202] 4. At the intersection of the straight line S1 and , a straight line S2 perpendicular to is drawn at a distance d in the opposite direction of the direction vector , which is the second machining path. The above steps are repeated until the machining path covers the entire range of the diamond cutter tip.
[0203] Through experiments, the real shot image is processed and positioned, and the tip positioning accuracy reaches 0.5 μm.
[0204] Although the embodiments of the present application have been shown and described, it can be understood by those skilled in the art that various changes, modifications, replacements and variations can be made to the embodiments without departing from the principles and spirits of the present application, and the scope of the present application is defined by the appended claims and their equivalents.
Claims
1. A method for automatically positioning a diamond tool for 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 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 conversion relationship matrix between the CCD camera coordinate system, laser rangefinder and laser galvanometer processing coordinate system; The diamond tool is fixedly mounted on the processing platform, 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, and 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; The collected tool tip image is processed by first binarizing and morphologically processing the tool tip image, and then edge detection is performed to extract the tool tip edge point set ∑P C , by identifying the two edge lines in the tool tip edge point, calculate the intersection point P of the two edge lines i And set the search radius, from the tool tip edge point set ∑P C Find the distance intersection point P i The nearest point is to determine the tool tip vertex position P in the image coordinate system. v ; Combined with the Z-axis data of the laser rangefinder and the conversion relationship matrix of the CCD camera coordinate system, the laser rangefinder and the laser galvanometer processing coordinate system, the vertex coordinate P in the image coordinate system is converted to v , tool tip direction vector The coordinates are converted into the galvanometer processing coordinate system respectively to generate the processing path of the laser galvanometer system.
2. The automatic positioning method for diamond tools used in laser galvanometer processing according to claim 1, characterized in that: The tool tip image is binarized and morphologically processed, including using the Otsu method to adaptively threshold the tool tip area and the background in the image, and using the morphological opening operation to remove the white spots in the tool tip area.
3. The automatic positioning method for diamond tools used in laser galvanometer processing according to claim 2, characterized in that: Use the Canny edge detection algorithm to extract the continuous tool tip edge point set ∑P C .
4. The automatic positioning method for diamond tools used in laser galvanometer processing according to claim 3, characterized in that: Use Hough line detection, set appropriate threshold parameters, detect the two edge lines in the tool tip edge point, namely the left line L1 and the right line L2, extend the two edge lines, and calculate the intersection coordinates P of the two edge lines i .
5. The automatic positioning method for diamond tools used in laser galvanometer processing according to claim 4, characterized in that: The intersection coordinates P of the two edge lines i The calculation formula is: Left straight line: Right straight line: D=v x1 ·v y2 -v y1 ·v x2 ; Among them, P(x1,y1) is a point on the left straight line L1, v1=(v x1 ,v y1 ) is the direction vector on the left straight line L1, point P(x2,y2) is a point on the right straight line L2, v2=(v x2 ,v y2 ) is the direction vector on the right straight line L2.
6. The automatic positioning method for a diamond tool for laser galvanometer processing according to any one of claims 1 to 5, characterized in that: From the tool tip edge point set ∑P C Find the distance intersection point P i The nearest point is to determine the tool tip vertex position P in the image coordinate system. v Specifically: (1) Take the intersection point P i As the center, a circular neighborhood is defined as the candidate search area according to the preset search radius parameter; (2) Traverse the tool tip edge point set ∑P C , filter the edge points in the candidate search area as the candidate point set ∑P Filter ; (3) Calculate the candidate point set ∑P Filter Each candidate point in the intersection point P i Euclidean distance, record the minimum distance value and its corresponding edge point coordinates; (4) If there is a valid candidate point, mark the point with the smallest distance as the nearest edge point. This point is the tool tip vertex position P v .
7. The automatic positioning method for diamond tools used in laser galvanometer processing according to claim 6, characterized in that: Record the tool tip direction vector in the image coordinate system After the image processing is completed, the gantry is driven to move along the X-axis so that the laser rangefinder is moved to the top of the tool tip. The data on the laser rangefinder is read and converted into the Z-axis coordinate Z1 in the camera coordinate system.
8. The automatic positioning method for diamond tools used in laser galvanometer processing according to claim 7, characterized in that: Tool tip vertex P in the image coordinate system v (x v ,y v ) and point P in the camera coordinate system c (X, Y, Z) has the following conversion relationship: Where K is the internal parameter matrix of the CCD camera; Among them, (c x ,c y ) is the optical center, that is, the projection of the CCD camera optical axis on the image, f x 、f y is the pixel focal length; According to the projection relationship, we can get:
9. The automatic positioning method for diamond tools used in laser galvanometer processing according to claim 8, characterized in that: The direction vector of the tool tip in the image coordinate system Convert the tool tip direction vector to the camera coordinate system 10. The automatic positioning method for diamond tools used in laser galvanometer processing according to claim 9, characterized in that: The plane of the diamond tool is parallel to the target surface of the CCD camera. The plane distance of the diamond tool is Z1. The plane equation of the diamond tool is Z=Z1. According to the tool tip coordinate P in the camera coordinate system c , tool tip direction vector The plane equation Z=Z1 is converted into coordinates in the galvanometer processing coordinate system through the calibrated conversion relationship matrix of the CCD camera coordinate system, the laser rangefinder and the laser 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