Machining positioning distance measuring method
By using CNC machine tools and cameras for positioning in laser precision machining, high-precision machining positioning is achieved through clarity evaluation and curve fitting, the problems of low positioning accuracy and high cost in the prior art are solved, and processing efficiency and quality are improved.
Patent Information
- Application Number
- CN202411801870.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-11
AI Technical Summary
In laser precision machining, it is difficult for the prior art to achieve high-precision machining positioning, especially when thin workpiece processing, contact rangefinders are prone to deformation of workpieces, and non-contact rangefinders have problems of low accuracy and high cost.
CNC machine tools and cameras are used for processing and positioning. By setting the target evaluation area and processing control theoretical parameters, pictures are collected and clarity evaluation is performed, the clarity change curve function is fitted, the theoretical maximum value is found, and the distance from the camera to the processing position is obtained through iteratively precise positioning.
It realizes high-precision machining positioning, reduces the use of measuring instruments, reduces the manufacturing cost of processing equipment, improves the distance measurement efficiency, and avoids errors caused by processing deformation of thin workpieces.
Smart Images

Figure CN119600014A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of laser processing, and relates to a processing positioning and ranging method, and in particular to a ranging method for processing positioning using numerical control and a camera. Background Art
[0002] At present, in the field of laser precision processing, there are very high requirements for accuracy and efficiency when processing workpieces. Before processing, the workpiece needs to be positioned and the processing position needs to be positioned. Whether the positioning is accurate is directly related to the quality of processing. However, due to various considerations, making full use of the CNC and camera of the processing machine tool for pre-processing positioning has become an economical and stable positioning method. Making full use of the fixed parts of the processing equipment for positioning not only avoids the errors caused by secondary clamping, but also ensures that the positioning, processing, and detection benchmarks are consistent. The key factor in pre-processing positioning is whether the distance from the laser light outlet to the processing position can be accurately measured, that is, to ensure that the laser focus can accurately fall on the processing position, thereby ensuring high-quality processing.
[0003] At present, most of the positioning before processing is done by contact or non-contact distance meter. There are also technical solutions using industrial cameras for positioning in actual processing business, but there are also many technical solutions using cameras for positioning, each with its own advantages and disadvantages. If the workpiece to be processed is very thin, the force generated by the contact distance meter during contact and collision can easily cause the workpiece to deform and increase the error. The basic principle of non-contact distance meter is to use the reflection of light for distance measurement. Non-contact distance meter cannot be installed coaxially with laser and has low precision. High-precision non-contact distance meter will inevitably bring high cost. Summary of the invention
[0004] In order to solve the above technical problems existing in the background technology, the present invention provides a processing positioning and ranging method with high positioning accuracy, which can reduce the use of measuring instruments, reduce the manufacturing cost of processing equipment and improve the ranging efficiency.
[0005] In order to achieve the above object, the present invention adopts the following technical solution:
[0006] A processing positioning and ranging method, characterized in that: the processing positioning and ranging method comprises the following steps:
[0007] 1) Set the target evaluation area and processing control theory parameters;
[0008] 2) collecting images based on the processing control theoretical parameters preset in step 1);
[0009] 3) performing clarity evaluation on the image acquired in step 2) to obtain a clarity evaluation result;
[0010] 4) fitting a clarity change curve function based on the clarity evaluation result obtained in step 3);
[0011] 5) searching for coordinates corresponding to the theoretical maximum value in the clarity variation curve function obtained in step 4);
[0012] 6) Iterating the coordinates corresponding to the theoretical maximum value obtained in step 5) to obtain the actual maximum value;
[0013] 7) According to the actual maximum value obtained in step 6), the axis coordinate corresponding to the image with the highest definition is found, and the axis coordinate corresponding to the image with the highest definition is the distance from the camera to the processing position.
[0014] In the above step 1), the target evaluation area is the workpiece processing position, and the size of the target evaluation area is similar to the actual processing range; the processing control theoretical parameters include the maximum motion range of the motion axis installed by the camera, the minimum motion range of the motion axis, the motion speed of the motion axis and the single motion step length of the motion axis.
[0015] The specific implementation method of the above step 2) is: according to the preset processing control theoretical parameters in step 1), the axis of the CNC machine tool is controlled by the processing control software to move at a constant speed within an allowable range at a set moving speed. While the axis of the CNC machine tool is moving, the camera is turned on to continuously capture pictures of the object to be processed or positioned, and the machine tool coordinates corresponding to each picture are recorded.
[0016] The specific implementation of the above step 3) is:
[0017] 3.1) Crop the image acquired in step 2) according to the target area preset in step 1);
[0018] 3.2) Converting the image processed in step 3.1) into grayscale image;
[0019] 3.3) performing clarity evaluation on the image after grayscale image processing to obtain a clarity evaluation result, wherein the clarity evaluation result includes whether the image is clear or blurred;
[0020] 3.4) Record the clarity and coordinates of the image.
[0021] In the above step 3.3), the methods for evaluating clarity are the Tenengrad gradient method, the Laplacian gradient method and the variance method; the judgment standard for image clarity is: obtaining multiple consecutive image clarity values, judging the relationship between the current image clarity value and the clarity values of the next 2-3 consecutive images, if the clarity values of the next 2-3 consecutive images are all lower than the clarity value of the current image and gradually decrease, then the current image is clear; if the clarity values of the next 2-3 consecutive images are all higher than the clarity value of the current image and gradually increase, then the current image is blurred.
[0022] The specific implementation of the above step 4) is:
[0023] 4.1) constructing a data set based on the results obtained in step 3.4);
[0024] 4.2) Fitting the data set constructed in step 4.1) to obtain a clarity change curve function; the expression of the clarity change curve function is:
[0025] y=p0+p1×x+p2×x 2 +...+pk×x k
[0026] in:
[0027] x represents the input parameter variable indicating the position of the machine tool;
[0028] The y value represents the image clarity value of the camera axis at the x position;
[0029] k represents the polynomial coefficient of the fitting curve.
[0030] In the above step 4.2), the data set constructed in step 4.1) is fitted based on the least square method; in the step 4.2), k=7 or k=8.
[0031] The specific implementation method of the above step 5) is: using the conventional numerical differential central difference method to obtain the theoretical maximum coordinates of the fitting curve, the theoretical maximum coordinates are the theoretical clearest positions.
[0032] The specific implementation method of the above step 6) is: take a coordinate on the left and right sides of the position corresponding to the theoretical maximum value, narrow the detection range, repeat steps 2) to 5) until the difference between the iterative theoretical maximum value and the adjacent point is much larger than the difference between other adjacent points; determine the iterative theoretical maximum value as the actual maximum value.
[0033] The advantages of the present invention are:
[0034] The present invention provides a processing positioning and ranging method, comprising: 1) setting a target evaluation area and a processing control theoretical parameter; 2) collecting pictures based on the processing control theoretical parameters preset in step 1); 3) performing clarity evaluation on the pictures collected in step 2) to obtain a clarity evaluation result; 4) fitting a clarity change curve function based on the clarity evaluation result obtained in step 3); 5) searching for coordinates corresponding to a theoretical maximum value in the clarity change curve function obtained in step 4); 6) iterating the coordinates corresponding to the theoretical maximum value obtained in step 5) to obtain an actual maximum value; 7) finding the axis coordinates corresponding to the image with the highest clarity according to the actual maximum value obtained in step 6), and the axis coordinates corresponding to the image with the highest clarity are the distance from the camera to the processing position. The present invention uses the existing components of the processing equipment itself for positioning and ranging, and the core solves the following problems: no additional distance measuring instrument is installed to solve the problem of positioning before processing, and reduce the manufacturing cost of the processing equipment. The invention can also be used for distance measurement while processing, to solve the problem that the thin film workpiece is easily affected by processing deformation and the processing quality. The problem of low efficiency of similar camera ranging and positioning solutions is solved. The present invention adopts camera positioning, which reduces the secondary error caused by contact collision compared with contact ranging. The present invention adopts the fitting search theory first and then the second step-by-step iteration for precise positioning, which is more efficient than the single step-by-step distance measurement. The present invention uses a machine tool and a camera fixed to the processing equipment for distance measurement, which reduces the use of measuring instruments and reduces the manufacturing cost of the processing equipment. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a flow chart of the processing positioning and ranging method provided by the present invention. DETAILED DESCRIPTION
[0036] The core idea of the present invention is to use the CNC machine tool movement of the processing equipment, the camera and the control software containing some visual algorithms to accurately locate the processing position of the workpiece, so as to ensure the quality of laser processing. The core technical method is to efficiently measure the clearest position of the workpiece under the camera.
[0037] See also Figure 1 , the core technical steps of the present invention are as follows:
[0038] 1. Set the target evaluation area and processing control theory parameters
[0039] In the processing control software, select the target area to be evaluated on the image captured by the camera. The target area is generally the processing position of the workpiece, and the size of the target area is similar to the actual processing range. Set other theoretical parameters of related controls according to actual processing needs. Other theoretical parameters of related controls include: the maximum and minimum motion ranges of the motion axis installed on the camera, the axis motion speed, and the axis single motion step size. The specific values of these parameters are set according to the actual business scenario. The main function of these parameters is to control the motion control of the axis where the camera is located. The actual business scenario can refer to the expansion.
[0040] 2. Collect pictures within the theoretical range
[0041] According to the theoretical parameters of other related controls (such as the maximum and minimum motion ranges of the motion axis where the camera is installed, the axis motion speed, and the axis motion step length), the axis of the CNC machine tool (the linear axis where the camera is located) is controlled by the processing control software to move at a constant speed within the allowable range at the set moving speed. While the axis of the CNC machine tool is moving, the processing control software turns on the camera and continuously collects pictures of the object to be processed or positioned, and records the machine tool coordinates corresponding to each picture. When collecting pictures of the object to be processed or positioned, the effect is usually better for flat parts. For curved parts, pay attention to the small target evaluation area mentioned above to ensure that it is approximately flat. In addition, pay attention to the fact that the image quality cannot be guaranteed for objects with severe light transmission or reflection, so it is not suitable for the application scenario of this patent.
[0042] In this step, the clarity evaluation can also be performed while collecting. If the clarity values gradually decrease for multiple times, the collection can be stopped before reaching the end position of the theoretical parameter. The clarity value usually obtained is not a completely smooth change trend, but a wave-like rising or falling trend. Therefore, when judging according to the clarity, it can be judged that a certain clarity value is lower than this time for 2-3 consecutive times, and it is considered that the image begins to become blurred. The clarity analysis of this step and the clarity analysis described later are specifically for the clarity evaluation of the region or the entire image of the image. Commonly used image clarity evaluation methods include Tenengrad gradient method, Laplacian gradient method and variance method, etc. The variance method is used in the verification of the present invention. Compared with the blurred image, the grayscale difference between the image data of the clear image is larger, that is, its variance is larger, so the image clarity can be evaluated by the variance of the image grayscale data. The larger the variance, the clearer the image. The specific algorithm implementation can refer to the operator of the open source visual Opencv algorithm library, and can also be implemented according to actual needs. The MeanStdDev algorithm of Opencv is used in the test process of the present invention. The clarity evaluation process usually has the following steps:
[0043] Image cropping, i.e. the target area mentioned above, is the area cropping of the image captured by the camera according to the target area.
[0044] Convert the image to grayscale, that is, convert the image cropped in the previous step to grayscale.
[0045] Algorithm evaluation refers to the use of variance method to evaluate clarity as mentioned above.
[0046] 3. Evaluate the clarity of the image and fit the clarity change curve function
[0047] After the machine tool has finished moving within the set theoretical parameter range, each image is cropped according to the target evaluation area, and the image quality evaluation algorithm is called to evaluate the clarity, and the image clarity value and corresponding coordinates are recorded in turn. The main process of clarity evaluation has been described above, and this step will not be repeated. This step is only to evaluate after the acquisition is completed.
[0048] The data result set after the analysis is a set of points in the quadrant, with the X-axis representing the machine tool position and the Y-axis representing the clarity value.
[0049] The result data set is fitted by a general least squares fitting algorithm to calculate the polynomial (y = p0 + p1 × x + p2 × x 2 +...+pk×x k ), where x represents the input variable indicating the machine tool position, the obtained y value represents the image clarity value of the camera axis at the x position, and k represents the coefficient of the fitting curve. According to the test experience of this patent, k = 7 or 8 is usually the best.
[0050] 4. Find the coordinates corresponding to the theoretical maximum value in the clarity change curve function
[0051] The conventional numerical differential central difference method is used to find the maximum coordinates of the fitting curve, that is, the theoretical position has the clearest value. At this time, it is only the theoretical clearest position, not the actual clearest position.
[0052] 5. Iterate the result obtained in step 4) to confirm the clearest position, that is, the actual maximum value;
[0053] Through the above steps, the maximum coordinates of the curve that have been found are the theoretical positions of the actual clear positions. At this time, a coordinate is taken on the left and right of the theoretical position (taken according to actual needs, according to the curve, if the maximum value of the fitting curve is obvious, the range of the left and right points can be reduced, otherwise it needs to be enlarged. Usually the range is based on the pixel reference of the selected camera, [-20, 20] is OK, and it is set according to the actual business scenario experience value), that is, the detection range is reduced. It should be noted that when the range is reduced, the fixed motion step length can be appropriately reduced. For example, the fixed step length is 0.05mm for the first time, and the fixed motion step length can be changed to 0.025mm for the second repetition. The shorter the step length, the higher the accuracy, and the more accurate the positioning of the machine tool coordinate position.
[0054] Specifically, in the fitting curve, the maximum value obviously means that the difference between the maximum value and the adjacent point is much larger than the difference between other adjacent points. That is to say, in the fitting curve, the difference between the maximum value and the adjacent point is much larger than the difference between other adjacent points, and vice versa.
[0055] After obtaining the new iterative test range, the machine tool is controlled to start at the starting point of the range, and moves and records images and coordinates in sequence according to the set parameter axis single motion step. The logical flow is as follows:
[0056] The recorded images are quality inspected to find the axis coordinates corresponding to the image with the highest definition, that is, the distance from the camera to the processing position.
[0057] Note: In the above steps, if the clarity value of the image analyzed by the second iteration deviates greatly from the maximum clarity value of the fitting curve in the previous step, you can repeat this step or reduce the machine tool movement step size to increase the sample size of the collected image.
[0058] 6. According to the actual maximum value obtained before, find the axis coordinate corresponding to the image with the highest clarity. The axis coordinate corresponding to the image with the highest clarity is the distance from the camera to the processing position.
Claims
1. A processing positioning and ranging method, characterized in that: The processing positioning and ranging method comprises the following steps: 1) Set the target evaluation area and processing control theory parameters; 2) collecting images based on the processing control theoretical parameters preset in step 1); 3) Performing clarity evaluation on the image acquired in step 2) to obtain a clarity evaluation result; 4) fitting a clarity change curve function based on the clarity evaluation result obtained in step 3); 5) searching for coordinates corresponding to the theoretical maximum value in the clarity variation curve function obtained in step 4); 6) Iterating the coordinates corresponding to the theoretical maximum value obtained in step 5) to obtain the actual maximum value; 7) According to the actual maximum value obtained in step 6), the axis coordinate corresponding to the image with the highest definition is found, and the axis coordinate corresponding to the image with the highest definition is the distance from the camera to the processing position.
2. The processing positioning and ranging method according to claim 1, characterized in that: The target evaluation area in step 1) is the workpiece processing position, and the size of the target evaluation area is similar to the actual processing range; the processing control theoretical parameters include the maximum motion range of the motion axis installed by the camera, the minimum motion range of the motion axis, the motion speed of the motion axis and the single motion step length of the motion axis.
3. The processing positioning and ranging method according to claim 2, characterized in that: The specific implementation method of step 2) is: according to the preset processing control theoretical parameters in step 1), the axis of the CNC machine tool is controlled by the processing control software to move at a uniform speed within an allowable range at a set moving speed. While the axis of the CNC machine tool is moving, the camera is turned on to continuously capture pictures of the object to be processed or positioned, and the machine tool coordinates corresponding to each picture are recorded.
4. The processing positioning and ranging method according to claim 3, characterized in that: The specific implementation method of step 3) is: 3.1) Crop the image acquired in step 2) according to the target area preset in step 1); 3.2) Converting the image processed in step 3.1) into grayscale image; 3.3) performing clarity evaluation on the image after grayscale image processing to obtain a clarity evaluation result, wherein the clarity evaluation result includes whether the image is clear or blurred; 3.4) Record the clarity and coordinates of the image.
5. The processing positioning and ranging method according to claim 4, characterized in that: The clarity evaluation method in step 3.3) is the Tenengrad gradient method, the Laplacian gradient method and the variance method; the judgment standard of the image clarity is: obtaining a plurality of consecutive image clarity values, judging the relationship between the current image clarity value and the subsequent 2-3 consecutive image clarity values, if the subsequent 2-3 consecutive image clarity values are all lower than the current image clarity value and gradually decrease, then the current image is clear; If the image clarity values are higher than the current image clarity value for 2-3 consecutive times and gradually increase, the current image is blurred.
6. The processing positioning and ranging method according to claim 5, characterized in that: The specific implementation method of step 4) is: 4.1) constructing a data set based on the results obtained in step 3.4); 4.2) Fitting the data set constructed in step 4.1) to obtain a clarity change curve function; the expression of the clarity change curve function is: y=p0+p1×x+p2×x 2 +...+pk×x k in: x represents the input parameter variable indicating the position of the machine tool; The y value represents the image clarity value of the camera axis at the x position; k represents the polynomial coefficient of the fitting curve.
7. The processing positioning and ranging method according to claim 6, characterized in that: In the step 4.2), the data set constructed in the step 4.1) is fitted based on the least square method; in the step 4.2), k=7 or k=8.
8. The processing positioning and ranging method according to claim 7, characterized in that: The specific implementation method of step 5) is: using the conventional numerical differential central difference method to obtain the theoretical maximum coordinates of the fitting curve, and the theoretical maximum coordinates are the theoretical clearest positions.
9. The processing positioning and ranging method according to claim 8, characterized in that: The specific implementation method of step 6) is: take a coordinate on the left and right sides of the position corresponding to the theoretical maximum value, narrow the detection range, repeat steps 2) to 5) until the difference between the iterative theoretical maximum value and the adjacent point is much larger than the difference between other adjacent points; determine the iterative theoretical maximum value as the actual maximum value.