Three-dimensional reconstruction method of numerical control milling cutter, electronic equipment and three-dimensional reconstruction device

By acquiring images at different camera magnifications on a CNC milling cutter, and utilizing index tables and image registration techniques, combined with zoom lenses and Gaussian fitting, the insufficient accuracy of existing CNC milling cutter 3D wear detection technology has been solved, achieving efficient and high-precision 3D reconstruction.

CN121788720APending Publication Date: 2026-04-03HUAZHONG UNIV OF SCI & TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing three-dimensional wear detection methods for CNC milling cutters have insufficient accuracy, especially when observing details at the fillet of the cutter, they cannot take into account both the large field of view and the details, and changes in lighting affect the measurement accuracy, making them unsuitable for measurements when the cutter position is fixed.

Method used

By acquiring images at different camera magnifications, using an index table to record the focusing distance and distance-to-pixel ratio, image registration and focusing evaluation index calculation are performed. Combined with a zoom lens, three-dimensional reconstruction with the tool position unchanged is achieved. Image pyramid and Gaussian fitting processing are used to improve measurement accuracy.

Benefits of technology

It achieves efficient and high-precision 3D reconstruction without changing the tool position, avoids scratching the lens due to improper operation during the measurement process, can accurately identify details such as tool fillet, and improves the comprehensiveness and accuracy of the measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121788720A_ABST
    Figure CN121788720A_ABST
Patent Text Reader

Abstract

The invention belongs to the related technical field of image processing, and discloses a three-dimensional reconstruction method of a numerical control milling cutter, electronic equipment and a three-dimensional reconstruction device.The three-dimensional reconstruction method comprises the steps that an index table is obtained, focusing distances and distance pixel ratios corresponding to different camera magnifications are recorded in the index table, and images shot at different magnifications are obtained; the method comprises the following steps: firstly, taking an image under an initial magnification as a reference image, and performing integral scaling on other images according to a magnification relationship to realize image registration; calculating a focusing evaluation index at each pixel point; and comparing all pixel points corresponding to the same part of the numerical control milling cutter in the image pyramid, taking the pixel point with the maximum focusing evaluation index as the optimal pixel point of the part, searching the focusing distance and the distance pixel ratio based on the index table to obtain (X, Y, Z) coordinates of the part in the three-dimensional coordinate system, and realizing three-dimensional reconstruction of the numerical control milling cutter. The method can keep the position of the cutter unchanged and can realize three-dimensional reconstruction of the cutter efficiently and precisely.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing technology, and more specifically, relates to a three-dimensional reconstruction method, electronic device and three-dimensional reconstruction apparatus for CNC milling cutters. Background Technology

[0002] In the field of CNC machining, the accuracy of the machined workpiece has always been an important indicator for evaluating the quality of a CNC milling machine. Among the several factors that affect the accuracy of the machined workpiece, the accuracy of the milling cutter is undoubtedly an important indicator, because the wear detection of CNC milling cutters has always been a hot topic in the field of measurement.

[0003] Previously, most CNC milling cutter wear detection was done using two-dimensional, non-contact methods. However, since the wear on CNC milling cutters is primarily three-dimensional, such as the wear on the flank face, using non-contact two-dimensional measurement may lead to some deviations in the measured wear area. Therefore, more intuitive three-dimensional tool measurement may be more suitable for milling cutter wear detection.

[0004] Chinese invention patent application CN2014107916790 discloses an offline detection method for three-dimensional cutting tools. This method uses a microscope platform to obtain a set of multi-focus images by adjusting the distance of the cutting tool along the camera axis. The image is then processed by the brightness variance multi-focus image sequence to obtain the actual distance of each pixel, thereby restoring the three-dimensional shape of the cutting tool.

[0005] In the aforementioned 3D reconstruction method, since only the distance of the tool along the camera's optical axis is changed, the camera magnification is fixed during the measurement process. Therefore, at low magnification, some minute wear on the tool surface cannot be observed, and at high magnification, the full morphology of tool wear may not be fully displayed. For example, regarding wear at the tool's fillet, if a fixed magnification lens is used and only the distance of the tool along the camera axis is changed, the details of the tool's fillet will be unrecognizable at low magnification, while using a high magnification lens will result in an excessively small field of view of the tool obtained by the camera. Second, the luminance variance operator needs to consider the calculation of the three RGB components during the calculation process, which slows down the processing speed. Third, the luminance variance operator is greatly affected by external light, such as indoor lighting, and changes in lighting during the measurement process will affect the processing accuracy. Fourth, in certain measurement fields, such as when the tool is difficult to adjust its position or cannot move along the camera axis, this measurement method may fail.

[0006] Therefore, it is necessary to propose a technical solution that keeps the tool position unchanged and can achieve efficient and high-precision three-dimensional reconstruction of the tool. Summary of the Invention

[0007] In view of the above-mentioned defects or improvement needs of the existing technology, the present invention provides a three-dimensional reconstruction method, electronic device and three-dimensional reconstruction device for CNC milling cutters, the purpose of which is to keep the tool position unchanged and realize the three-dimensional reconstruction of the tool with high efficiency and high precision.

[0008] To achieve the above objectives, the following technical solution is proposed.

[0009] According to a first aspect of the present invention, a method for three-dimensional reconstruction of a CNC milling cutter is provided, comprising: Obtain an index table, which records the focusing distance and distance-to-pixel ratio corresponding to different camera magnifications. The distance-to-pixel ratio is the ratio between the focusing distance at the corresponding camera magnification and the imaging pixels at the focusing plane. Using one of the magnifications in the index table as the initial magnification, obtain the image of the CNC milling cutter located at the focusing plane taken by the camera at the initial magnification, and the images taken by the camera at other magnifications in the index table while keeping the positions of the CNC milling cutter and the camera unchanged. First, the image at the initial magnification is used as the reference image. Other images are scaled as a whole according to the magnification relationship, so that the ratio between the size of the adjusted image and the size of the reference image is equal to the ratio between the magnification of the reference image and the magnification of the adjusted image. Then, all images are stacked into an image pyramid according to the scaled size to achieve image registration. After image registration, the overlapping pixels projected along the height direction of the pyramid correspond to the same position of the CNC milling cutter. For each image in the image pyramid, calculate the focus evaluation index at each pixel. The focus evaluation index at each pixel is the sum of the second partial derivatives of the gray values ​​of each pixel in a preset-size region centered on that pixel. By comparing all pixels corresponding to the same part of the CNC milling cutter in the image pyramid, the pixel with the highest focus evaluation index is taken as the optimal pixel of that part. Based on the index table, the focusing distance and distance-to-pixel ratio corresponding to the camera magnification used for the optimal pixel are found. The focusing distance is used as the Z coordinate of the part in the three-dimensional coordinate system. The image coordinates (x, y) of the optimal pixel in the image are multiplied by the distance-to-pixel ratio to obtain the (X, Y) coordinates of the part in the three-dimensional coordinate system. The three-dimensional point cloud is obtained by combining the (X, Y, Z) coordinates of different parts of the CNC milling cutter in the three-dimensional coordinate system, thus realizing the three-dimensional reconstruction of the CNC milling cutter.

[0010] According to a second aspect of the present invention, a three-dimensional reconstruction electronic device for CNC milling cutters is provided, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that the processor executes the computer program to implement the steps of the method described in any of the preceding claims.

[0011] According to a third aspect of the invention, a computer-readable storage medium is provided having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the steps of the method described in any of the preceding claims.

[0012] According to a fourth aspect of the present invention, a three-dimensional reconstruction device for a CNC milling cutter is provided, comprising a CNC milling machine, a camera mounted on the CNC milling machine, and a fixture for holding the CNC milling cutter, and further comprising a three-dimensional reconstruction electronic device for the CNC milling cutter as described above. The camera has a zoom lens, and the clamp is used to hold the CNC milling cutter in front of the zoom lens and within its shooting range. The camera is used to capture images of the CNC milling cutter at different magnifications and transmit them to the electronic device. The electronic device is used to perform three-dimensional reconstruction based on the CNC milling cutter images.

[0013] In summary, compared with the prior art, the technical solutions conceived in this invention have the following main advantages: 1. The three-dimensional reconstruction method for CNC milling cutters proposed in this invention can achieve three-dimensional reconstruction by simply acquiring images at different magnifications of a zoom lens without changing the tool position. Since the tool position does not need to be adjusted, it can effectively avoid the tool scratching the lens due to improper operation during the measurement process. Furthermore, since images at different magnifications are acquired, a tool image with a large field of view can be obtained at low magnification, while detailed images of the tool's rounded corners and other parts can be obtained at high magnification, thus overcoming the problem that a large field of view and detailed images cannot be obtained simultaneously in traditional methods. 2. The 3D reconstruction method for CNC milling cutters proposed in this invention, after obtaining images at different magnifications, performs scaling and registration processing on the images according to the varying magnification areas, since the focal areas of each image are different. After obtaining the registered image sequence, the focus evaluation index of each pixel in the image is calculated. The focus evaluation index proposed in this invention can accurately reflect the sharpness of the pixel. By comparing the focus evaluation indices of pixels in different images corresponding to the same part of the tool in the image pyramid, the pixel with the highest focus can be quickly and accurately identified. This pixel is taken as the sharpest point, and the focal plane of the image corresponding to this point is the plane of the actual position of this point. In this way, the optimal focused pixel at each position in the image pyramid can be obtained, a full-focus image can be reconstructed, and the actual distance of each pixel on the full-focus image along the camera axis can be obtained. Based on the full-focus image and the actual distance, the 3D point cloud of the tool can be quickly and accurately reconstructed. Attached Figure Description

[0014] Figure 1 This is a flowchart of the steps of a three-dimensional reconstruction method for a CNC milling cutter according to an embodiment of the present invention; Figure 2 This is a schematic diagram showing the change of the focal plane of a zoom lens at different magnifications in one embodiment; Figure 3 This is a structural diagram of the measuring device in one embodiment of the present invention; Figure 4 This is a comparative schematic diagram of image registration before and after one embodiment of the present invention; Figure 5 This is a schematic diagram of image processing in one embodiment of the present invention; Figure 6 This is a Gaussian fitting curve diagram according to an embodiment of the present invention. Detailed Implementation

[0015] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0016] In a first aspect, the present invention claims a method for three-dimensional reconstruction of a CNC milling cutter.

[0017] like Figure 1 The diagram shows a flowchart of a three-dimensional reconstruction method for a CNC milling cutter according to an embodiment of the present invention. The order of steps in the diagram is only one possible approach and is not intended to limit the scope of the invention. The following is a combination of... Figure 1 This method will be described in detail.

[0018] S1. Obtain the index table, which records the focusing distance and distance-to-pixel ratio corresponding to different camera magnifications. The distance-to-pixel ratio is the ratio between the focusing distance at the corresponding camera magnification and the imaging pixels at the focusing plane. Using one of the magnifications in the index table as the initial magnification, obtain the image of the CNC milling cutter located at the focusing plane taken by the camera at the initial magnification, and the images taken by the camera at other magnifications in the index table while keeping the positions of the CNC milling cutter and the camera unchanged.

[0019] Specifically, the index table can be determined based on the calibration of the calibrator.

[0020] With the camera position fixed, place the calibration object on the stage. By moving the stage, the position of the calibration object can be finely adjusted along the direction of the camera's optical axis. Figure 2The diagram illustrates the change of the focal plane of a zoom lens at different magnifications in one embodiment. As the magnification is changed, the focal plane also changes. First, the zoom lens magnification is set to its lowest setting. Then, the stage is adjusted so that the calibration block produces the clearest image in the camera. The imaging distance at this point is recorded as the focal distance. Based on the image of the calibration block in the camera, the ratio between the imaging distance and the number of pixels in the camera photo at this magnification is calculated, yielding the distance-to-pixel ratio at this magnification. Then, the zoom lens magnification is adjusted according to a set graduation value, and the stage distance is adjusted. The above steps are repeated, recording the clearest imaging distance and the distance-to-pixel ratio at each magnification, creating a magnification-focal distance-distance-to-pixel ratio index table.

[0021] When measuring a CNC milling cutter, the camera and the CNC milling cutter to be measured are mounted on the CNC milling machine, such as... Figure 3 The diagram shows the structure of the measuring device in one embodiment of the present invention. Camera 1 and zoom lens 2 are combined to form a confocal measuring unit, supported on a first support frame 3 and a second support frame 5. The first support frame 3 and the second support frame 5 are fixed to a base 4. A CNC milling cutter 6 is clamped in front of the lens and within its shooting range. The zoom lens 2 can automatically adjust its magnification. First, the camera zoom lens is adjusted to its initial magnification. In actual operation, the initial magnification can be selected as the camera's minimum magnification. The CNC machine tool is controlled to move the CNC milling cutter until the image with the clearest focus is presented in the camera, and a photo is taken at this point. Then, the CNC milling cutter is fixed, and the zoom lens is adjusted according to the magnification recorded in the table. Each adjustment is made to a magnification of one index table, and photos are taken until images at all magnifications in the index table are obtained. Based on the above operations, multiple images at different magnifications can be obtained.

[0022] S2. First, use the image at the initial magnification as the reference image. Then, scale the other images as a whole according to the magnification relationship so that the ratio between the size of the adjusted image and the size of the reference image is equal to the ratio between the magnification of the reference image and the magnification of the adjusted image. Then, stack all the images into an image pyramid according to the scaled size to achieve image registration. After image registration, the overlapping pixels projected along the height direction of the pyramid correspond to the same position of the CNC milling cutter.

[0023] Because of the different camera magnifications, the field of view of the tool displayed in the resulting images varies. The image with the lowest magnification has the widest field of view and the longest focusing distance, while the image with the highest magnification has the smallest field of view and the shortest focusing distance. Therefore, image registration is necessary.

[0024] In this invention, based on the inverse relationship between the field of view size and the magnification, image registration can be achieved by scaling the image using the magnification, such as... Figure 4The image shown is a schematic diagram comparing the image registration before and after in one embodiment of the present invention.

[0025] Specifically, the reference image is defined as the first image, and the registration formula can be expressed as: ; In the formula, The size of the first image. The size of the nth image after scaling. The magnification corresponding to the first image. This represents the magnification of the nth image.

[0026] Using the above calculation formula, all images except the first one are scaled, and then all images are stacked according to their scaled size to form a result like this. Figure 4 The image pyramid shown is used to perform image registration. After image registration, the overlapping pixels projected along the height direction of the pyramid correspond to the same position of the CNC milling cutter.

[0027] S3. For each image in the image pyramid, calculate the focus evaluation index at each pixel. The focus evaluation index at each pixel is the sum of the second-order partial derivatives of the gray values ​​of each pixel in a preset-size region centered on that pixel.

[0028] After image registration, the overlapping pixels projected along the pyramid height correspond to the same position of the CNC milling cutter. In other words, the same position of the CNC milling cutter has corresponding pixels in multiple images. Therefore, it is necessary to select the pixel with the highest resolution from all images in the image pyramid. Figure 5 The diagram shown is a schematic diagram of image processing in one embodiment of the present invention. For example, there are a total of n images, and a certain part of the CNC milling cutter has corresponding pixels in each of the n images. The pixels of these n different planes are projected and overlapped along the height direction of the pyramid. It is necessary to select the clearest pixel from the n pixels.

[0029] Within a given image region, the clearer the image, the more information it contains, and the greater the change in its pixel gradient. Therefore, gradient changes can be used to determine the clarity of that region. When calculating the gradient, the second-order partial derivative can obtain high-frequency components, thus yielding sharper edges; therefore, the second-order partial derivative can be used to calculate the gradient.

[0030] Based on the above principles, for each image, the focus evaluation index at each pixel is calculated. The focus evaluation index at each pixel is the sum of the second-order partial derivatives of all pixels within a preset-size region centered on that pixel.

[0031] The calculation formula for the focus evaluation indicators is as follows: ; In the formula, For pixels in the image Focused evaluation indicators For pixels The second partial derivative of the gray value at that point, , To set the pixel distance, 2 The length of the preset-sized region, 2 This defines the width of the preset-sized region. For example, the length of the preset-sized region is... ,but , .

[0032] In one embodiment, the Laplace operator is selected to calculate the second-order partial derivative of the gray value at each pixel, and the Laplace operator is used to calculate the gray value of any pixel. The formula for calculating the second partial derivative of the gray value at a given point is: ; In the formula, Represents pixels The second-order partial derivative of the grayscale value along the horizontal axis of the pixel coordinate system. Represents pixels The second-order partial derivative of the gray value along the vertical axis of the pixel coordinate system.

[0033] In one embodiment, the numerical differential can be solved using the finite difference method, for example, by selecting an accuracy of [insert accuracy here]. The central difference formula is used to replace the second-order partial derivative of a certain pixel, and its calculation formula is as follows: ; ; In the formula, Represents pixels The grayscale value at that location.

[0034] S4. Compare all pixels in the image pyramid corresponding to the same part of the CNC milling cutter, and take the pixel with the largest focus evaluation index as the optimal pixel of that part. Based on the index table, find the focus distance and distance-to-pixel ratio corresponding to the camera magnification used for the optimal pixel. Use the focus distance as the Z coordinate of the part in the three-dimensional coordinate system. Multiply the image coordinates (x, y) of the optimal pixel in the image by the distance-to-pixel ratio to obtain the (X, Y) coordinates of the part in the three-dimensional coordinate system. Combine the (X, Y, Z) coordinates of different parts of the CNC milling cutter in the three-dimensional coordinate system to obtain the three-dimensional point cloud, and realize the three-dimensional reconstruction of the CNC milling cutter.

[0035] Specifically, in the image pyramid, pixels projected and overlapping along the pyramid's height correspond to the same position on the CNC milling cutter. This step involves selecting the clearest pixel from multiple pixels corresponding to the same location for 3D reconstruction based on a focus evaluation index. By comparing the focus evaluation index among multiple pixels corresponding to the same location, the pixel with the highest focus evaluation index is selected for 3D reconstruction and defined as the optimal pixel for the corresponding location. Subsequently, based on the camera magnification used when the image of the optimal pixel was captured, the corresponding focus distance and distance-pixel ratio are found using a magnification-focus distance-distance-pixel ratio index table. The focus distance is used as the Z-coordinate for 3D reconstruction. The image coordinates (x, y) of the optimal pixel in the image are multiplied by the distance-pixel ratio to obtain the (X, Y) coordinates of the location in the 3D coordinate system, thus obtaining the (X, Y, Z) coordinates of the location during 3D reconstruction. By combining the (X, Y, Z) coordinates of different locations on the CNC milling cutter in the 3D coordinate system, the 3D reconstruction of the CNC milling cutter is achieved, thereby restoring the 3D morphology of the CNC milling cutter's surface.

[0036] In one embodiment, considering that the focusing distance of the image obtained by zoom-focusing is discrete, the Z-coordinate of the point cloud of the 3D milling cutter surface obtained by the above method is also discrete, and the resulting 3D point cloud will exhibit a layered structure in the Z-axis direction. By studying the scatter plot of the focus evaluation function value and focus distance at each pixel location, it was found that the focus evaluation index value and focus distance satisfy a Gaussian function distribution. Therefore, in order to make the 3D point cloud smoother, Gaussian interpolation processing can be performed on the 3D point cloud.

[0037] The interpolation process specifically includes: selecting the interpolation position (X, Y) of the CNC milling cutter in the three-dimensional coordinate system; finding all pixels corresponding to this interpolation position from the image pyramid as interpolation auxiliary pixels; obtaining the focus evaluation index of each interpolation auxiliary pixel; and looking up the focus distance corresponding to the camera magnification used by the interpolation auxiliary pixel based on the index table. Each interpolation auxiliary pixel corresponds to a set of (focus distance, focus evaluation index), resulting in multiple sets of (focus distance, focus evaluation index) discrete points. The discrete points are then fitted with a Gaussian curve to obtain the fitting curve of the focus evaluation index with respect to the focus distance, such as... Figure 6 The figure shown is a Gaussian fitting curve in one embodiment of the present invention. The mean of the fitting curve is used as the Z coordinate of the interpolation position (X, Y) to obtain the (X, Y, Z) coordinates of the interpolation point in the three-dimensional coordinate system, thereby realizing the interpolation processing of the three-dimensional point cloud. Based on the interpolation processing, the three-dimensional point cloud can be made smoother.

[0038] The fitting formula for the Gaussian curve is: ; In the formula, F is the focus evaluation index. For the magnitude of the Gaussian function, For the mean, For standard deviation, This is a constant term. Determining the fitted curve essentially means determining the constant term in the fitted formula. , , and ,by Used as the Z coordinate at the interpolation position (X, Y).

[0039] In one embodiment, the method further includes using the 3D model reconstructed from the unworn CNC milling cutter as a reference model, comparing the 3D model reconstructed from the current CNC milling cutter under test with the reference model to identify the wear condition of the current CNC milling cutter under test. Specifically, first, a point cloud model of the unworn milling cutter surface is reconstructed using the above method. Then, after the milling operation on the milling machine, the flank face of the milling cutter shows a certain degree of wear. Then, the above method is used to perform a second measurement at the same position to obtain the 3D point cloud of the worn surface of the milling cutter. Then, after registering the two point clouds, the Z coordinates of the point clouds at the same position are compared. If they are the same, it can be determined that the position is not worn; if they are different, it is defined that the position has been worn, and the magnitude of the wear is the difference in its Z coordinates. Considering that there is Gaussian fitting error in point cloud reconstruction, a threshold needs to be set during wear detection. If the difference in Z coordinates is less than the preset threshold, the point is not worn; if it is greater than the threshold, the point is set as an unworn point. The worn points are marked in red on the tool's 3D point cloud, and the wear amount at each wear point is recorded. This allows you to visually see which part of the end mill has worn down and the extent of wear at that location.

[0040] Secondly, the present invention also relates to a three-dimensional reconstruction electronic device for CNC milling cutters.

[0041] The electronic device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the method described above.

[0042] The electronic device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The memory can be used to store computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory.

[0043] Thirdly, the present invention also relates to a computer-readable storage medium.

[0044] The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described above.

[0045] Specifically, the memory may include high-speed random access memory, as well as non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart media cards (SMC), secure digital (SD) cards, flash cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.

[0046] Fourthly, the present invention also relates to a three-dimensional reconstruction device for CNC milling cutters.

[0047] The 3D reconstruction device for the CNC milling cutter includes a CNC milling machine, a camera mounted on the CNC milling machine, and a fixture for holding the CNC milling cutter. It also includes the 3D reconstruction electronic equipment for the CNC milling cutter as described above. The camera has a zoom lens, and the fixture is used to hold the CNC milling cutter in front of the zoom lens and within its shooting range. The camera is used to capture images of the CNC milling cutter at different magnifications and transmit them to the electronic equipment. The electronic equipment is used to perform 3D reconstruction based on the CNC milling cutter images.

[0048] The method of the present invention can be completed without relative movement between the cutting tool and the measuring module. At the same time, the use of a zoom microscope can better display the three-dimensional morphology of certain details of the cutting tool, thus enriching the three-dimensional morphology details of the cutting tool and facilitating the detection of tool wear.

[0049] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. It should be noted that the terms "in one embodiment," "for example," and "again" are intended to illustrate the present invention and are not intended to limit the present invention.

[0050] The above embodiments merely illustrate several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention.

Claims

1. A method for three-dimensional reconstruction of CNC milling cutters, characterized in that, include: Obtain an index table, which records the focusing distance and distance-to-pixel ratio corresponding to different camera magnifications. The distance-to-pixel ratio is the ratio between the focusing distance at the corresponding camera magnification and the imaging pixels at the focusing plane. Using one of the magnifications in the index table as the initial magnification, obtain the image of the CNC milling cutter located at the focusing plane taken by the camera at the initial magnification, and the images taken by the camera at other magnifications in the index table while keeping the positions of the CNC milling cutter and the camera unchanged. First, the image at the initial magnification is used as the reference image. Other images are scaled as a whole according to the magnification relationship so that the ratio between the size of the adjusted image and the size of the reference image is equal to the ratio between the magnification of the reference image and the magnification of the adjusted image. Then, all images are stacked into an image pyramid according to the scaled size to achieve image registration. After image registration, the overlapping pixels projected along the height direction of the pyramid correspond to the same position of the CNC milling cutter. For each image in the image pyramid, calculate the focus evaluation index at each pixel. The focus evaluation index at each pixel is the sum of the second partial derivatives of the gray values ​​of each pixel in a preset-size region centered on that pixel. By comparing all pixels corresponding to the same part of the CNC milling cutter in the image pyramid, the pixel with the highest focus evaluation index is taken as the optimal pixel of that part. Based on the index table, the focusing distance and distance-to-pixel ratio corresponding to the camera magnification used for the optimal pixel are found. The focusing distance is used as the Z coordinate of the part in the three-dimensional coordinate system. The image coordinates (x, y) of the optimal pixel in the image are multiplied by the distance-to-pixel ratio to obtain the (X, Y) coordinates of the part in the three-dimensional coordinate system. The three-dimensional point cloud is obtained by combining the (X, Y, Z) coordinates of different parts of the CNC milling cutter in the three-dimensional coordinate system, thus realizing the three-dimensional reconstruction of the CNC milling cutter.

2. The three-dimensional reconstruction method for CNC milling cutters as described in claim 1, characterized in that, The initial multiplier is the minimum multiplier in the index table.

3. The three-dimensional reconstruction method for CNC milling cutters as described in claim 1, characterized in that, pixel Focused evaluation indicators The calculation formula is: ; In the formula, For pixels The second partial derivative of the gray value at that point, , To set the pixel distance, 2 The length of the preset-sized region, 2 The width of the preset-sized area block.

4. The three-dimensional reconstruction method for CNC milling cutters as described in claim 1, characterized in that, The default size of the area block is a square area block.

5. The three-dimensional reconstruction method for CNC milling cutters as described in claim 3 or 4, characterized in that, Calculate arbitrary pixel points based on Laplacian operator Second partial derivative of the gray value at point The calculation formula is: ; In the formula, Represents pixels The second-order partial derivative of the grayscale value along the horizontal axis of the pixel coordinate system. Represents pixels The second-order partial derivative of the gray value along the vertical axis of the pixel coordinate system.

6. The three-dimensional reconstruction method for CNC milling cutters as described in claim 1, characterized in that, The method further includes: interpolating the three-dimensional point cloud. The interpolation process specifically includes: selecting the interpolation position (X, Y) of the CNC milling cutter in the three-dimensional coordinate system, finding all pixels corresponding to the interpolation position from the image pyramid as interpolation auxiliary pixels, obtaining the focus evaluation index of each interpolation auxiliary pixel, and finding the focus distance corresponding to the camera magnification used by the interpolation auxiliary pixel based on the index table. Each interpolation auxiliary pixel corresponds to a set of (focus distance, focus evaluation index), resulting in multiple sets of (focus distance, focus evaluation index) discrete points. The discrete points are fitted with a Gaussian curve to obtain the fitting curve of the focus evaluation index with respect to the focus distance. Figure 6 shows a Gaussian fitting curve diagram in one embodiment of the present invention. The mean of the fitting curve is used as the Z coordinate at the interpolation position (X, Y) to obtain the (X, Y, Z) coordinates of the interpolation point in the three-dimensional coordinate system, thereby realizing the interpolation processing of the three-dimensional point cloud.

7. The three-dimensional reconstruction method for CNC milling cutters as described in claim 1, characterized in that, The method further includes using the three-dimensional model obtained from the three-dimensional reconstruction of the unworn CNC milling cutter as a reference model, comparing the three-dimensional model obtained from the three-dimensional reconstruction of the current CNC milling cutter under test with the reference model, and identifying the wear condition of the current CNC milling cutter under test.

8. A three-dimensional reconstruction electronic device for CNC milling cutters, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.

10. A three-dimensional reconstruction device for CNC milling cutters, comprising a CNC milling machine, a camera mounted on the CNC milling machine, and a fixture for holding the CNC milling cutter, and further comprising a three-dimensional reconstruction electronic device for CNC milling cutters as described in claim 8; The camera has a zoom lens, and the clamp is used to hold the CNC milling cutter in front of the zoom lens and within its shooting range. The camera is used to capture images of the CNC milling cutter at different magnifications and transmit them to the electronic device. The electronic device is used to perform three-dimensional reconstruction based on the CNC milling cutter images.