Machine tool tool size measurement method based on machine vision and adaptive guided filtering
Through machine vision and adaptive guided filtering methods, the problem of low or high cost of tool measurement in traditional machine tools is solved, and high-precision and high-efficiency tool size measurement is achieved, and the detection accuracy reaches the micron level.
Patent Information
- Application Number
- CN202410936380.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2044-07-12
AI Technical Summary
Traditional machine tool tool measurement methods are inefficient or costly, making it difficult to meet the needs of Industry 4.0 for high-precision measurements.
Using machine vision and adaptive boot filtering methods, through device initialization, adaptive boot filtering algorithm and canny operator processing, the foreground and background areas of the tool image are obtained, and accurate image edge information is extracted.
It realizes high-precision and high-efficiency tool size measurement, and the detection error is stable below 0.01mm, achieving micron-level detection accuracy.
Smart Images

Figure CN118918165B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical fields of machine tool machining and image recognition, and particularly relates to a method for measuring the size of a machine tool tool based on machine vision and adaptive guided filtering. Background Art
[0002] Under the background of Industry 4.0, with the continuous development of intelligent manufacturing technology, the measurement accuracy of machine tool tools is getting higher and higher. This is because the accuracy of tool setting determines the accuracy of the mapping between the machining coordinate system and the actual machine tool coordinate system in actual machining, and is one of the important factors determining the machining accuracy of machine tools. The traditional method of using a vernier caliper is inefficient, while the method based on laser measurement is expensive although it has high accuracy. Under such practical conditions, the tool size detection method based on machine vision has attracted attention because of its non-contact, high enough detection accuracy, and low equipment cost. Therefore, the present invention designs a new tool size detection system and describes the initialization process and the edge extraction algorithm based on adaptive guided filtering. Summary of the Invention
[0003] To solve the above technical problems, the present invention proposes a method for measuring the size of a machine tool tool based on machine vision and adaptive guided filtering, which improves the accuracy and efficiency of tool measurement.
[0004] To achieve the above object, the present invention provides a method for measuring the size of a machine tool tool based on machine vision and adaptive guided filtering, including:
[0005] Obtaining a tool image according to a tool image acquisition device;
[0006] Preprocessing the tool image by using an improved adaptive guided filtering algorithm to obtain a foreground region image and a background region image in the tool image;
[0007] Performing guided filtering processing on the foreground region image and the background region image respectively by using different regularization terms to obtain a filtered image;
[0008] Processing the filtered image by using a canny operator to obtain image edge information.
[0009] According to the method for measuring the size of a machine tool tool based on machine vision and adaptive guided filtering provided by the present invention, before obtaining a tool image according to a tool image acquisition device, the tool image acquisition device needs to be initialized, and the method for initializing the tool image acquisition device includes:
[0010] Obtaining the pixel equivalent of the camera in the tool image acquisition device;
[0011] Determining the central axis coordinates of the tool image acquisition device;
[0012] Perform tilt correction on the rotary or translational tool image acquisition device;
[0013] Perform zero correction on the grating ruler in the tool image acquisition device.
[0014] According to the machine vision and adaptive guided filtering based machine tool tool size measurement method provided by the present invention, the method for obtaining the pixel equivalent of the camera in the tool image acquisition device includes: photographing a calibration plate through the camera, obtaining the pixel positions of the centers of the spots in the calibration plate, and combining with the known distances between the spots on the calibration plate itself to obtain the pixel equivalent of the camera.
[0015] According to the machine vision and adaptive guided filtering based machine tool tool size measurement method provided by the present invention, the method for determining the central axis coordinates of the tool image acquisition device includes:
[0016] Control the stepper motor of the tool image acquisition device to move upward a preset distance from the bottom, and obtain the edge coordinate points of a current calibration rod;
[0017] Based on the edge coordinate points of the current calibration rod, calculate the center point coordinates through calculation;
[0018] Based on the center point coordinates, determine whether the stepper motor has reached the top of the calibration rod. If so, calculate the average coordinates of all detected center point coordinates as the central axis coordinates, otherwise, return to move the stepper motor upward a preset distance again.
[0019] According to the machine vision and adaptive guided filtering based machine tool tool size measurement method provided by the present invention, the method for performing tilt correction on the rotary tool image acquisition device includes: obtaining the coordinates of two points among the edge points of the calibration rod image;
[0020] Calculate the differences in the x and y directions between the two point coordinates;
[0021] Calculate the inclination angle of the tool image acquisition device.
[0022] According to the machine vision and adaptive guided filtering based machine tool tool size measurement method provided by the present invention, the method for performing tilt correction on the translational tool image acquisition device includes: S1. Rotate the calibration rod to obtain the edge coordinate points at the same y coordinate on multiple calibration rods;
[0023] S2. Record the maximum and minimum values of the obtained x coordinates;
[0024] S3. Determine whether the maximum and minimum values of the x coordinates are changing. If not, calculate the translational offset. If they are changing, return to S1 again.
[0025] According to the method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering provided by the present invention, the method for calibrating the zero point of the grating scale in the cutter image acquisition device includes: moving the stepping motor upward to the top of the calibration rod, and obtaining the coordinate of the top of the calibration rod;
[0026] Calculating the actual length of the calibration rod according to the coordinate of the top of the calibration rod;
[0027] Recording the reading of the grating scale in the cutter image acquisition device at present, and combining with the actual length of the calibration rod to obtain the detected length of the calibration rod;
[0028] Combining the actual length of the calibration rod with the detected length of the calibration rod to calculate the zero point compensation of the grating scale.
[0029] According to the method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering provided by the present invention, the method for obtaining the foreground region image and the background region image in the cutter image includes:
[0030] S1. Calculating the threshold as the initial threshold for the cutter image by using the maximum inter-class variance method;
[0031] S2. Obtaining the gray mean value of the foreground region and the gray mean value of the background region for the cutter image through adaptive region threshold calculation, and obtaining a new threshold based on the gray mean value of the foreground region and the gray mean value of the background region;
[0032] S3. Judging whether the absolute value of the difference between the new threshold and the initial threshold is less than the manually specified gray difference a. If so, obtaining the finally determined threshold; otherwise, returning to S1 again.
[0033] According to the method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering provided by the present invention, the method for obtaining the image after filtering is:
[0034]
[0035] Wherein, T is the weight factor; β is the regularization parameter to prevent the division by zero anomaly caused by the weight factor being zero; t is the segmentation threshold gray value obtained by the iterative method; p is the actual gray value of the pixel in the image; q i is the image after filtering; I i is the guidance image; ω k is the window with a window radius of r; i is a pixel in the image; k is the position of the midpoint pixel; |ω| is the total number of pixels in a window ω with a midpoint pixel position of k and a window radius of r k ; μ k is the mean value of the pixel gray values in the window ω k ; is the input image I in the window ωk the average gray value within is the window ω k the variance of the pixel gray values within; ε is the regularization term of the guided filter specified manually; ε' is the regularization term of the guided filter after adaptive regularization adjustment.
[0036] According to the method for measuring the size of a machine tool tool based on machine vision and adaptive guided filtering provided by the present invention, the method for obtaining the edge information of the image by processing the filtered image with the canny operator includes:
[0037] With the help of the Sobel operator, extract the gray gradient amplitude and gradient direction of the filtered image for the filtered image;
[0038] Perform non-maximum suppression on the calculated gradient amplitude in the gradient direction to screen out false edge points and thus refine the edge;
[0039] Determine the two highest and lowest gray thresholds in the filtered image, screen the pixel points in the image, further screen out false edge points, and finally obtain the edge image.
[0040] Technical effects of the present invention: In terms of device initialization, the present invention proposes a series of device initialization processes that can be based on the information collected by the device itself and standard-sized objects, and can initialize the tool presetting instrument system itself accurately enough. In terms of the detection algorithm, compared with the traditional guided filter, with the help of this method, the image noise can be filtered more flexibly, and the edge information of the image can be obtained with higher detection efficiency and higher accuracy. It can be seen from the experiment that the tool size error detected by the present invention can be stably below 0.01 mm, reaching the micron-level detection accuracy, meeting the requirements of high-precision tool detection. Description of the Drawings
[0041] The drawings constituting a part of this application are used to provide a further understanding of this application. The schematic embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation to this application. In the drawings:
[0042] Figure 1 is the flowchart of the method for measuring the size of a machine tool tool based on machine vision and adaptive guided filtering according to the embodiment of the present invention;
[0043] Figure 2 is the schematic diagram of the tool image acquisition device according to the embodiment of the present invention;
[0044] Figure 3 is the flowchart of the device initialization according to the embodiment of the present invention;
[0045] Figure 4 is the physical diagram of the calibration plate according to the embodiment of the present invention;
[0046] Figure 5 The calibration plate image in the camera view of the embodiment of the present invention;
[0047] Figure 6 Schematic diagrams of two tilting situations in the embodiment of the present invention, where (a) is rotational tilting; (b) is translational tilting;
[0048] Figure 7 Flowchart of tilt correction in the embodiment of the present invention, where (a) is rotational tilt correction; (b) is translational tilt correction;
[0049] Figure 8 Flowchart of grating scale zero point compensation calculation in the embodiment of the present invention;
[0050] Figure 9 Flowchart of adaptive region threshold calculation in the embodiment of the present invention;
[0051] Figure 10 Flowchart of adaptive guided filtering in the embodiment of the present invention. Detailed implementation manners
[0052] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the drawings and in combination with the embodiments.
[0053] It should be noted that the steps shown in the flowchart of the drawings may be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than here.
[0054] As Figure 1 shown, in this embodiment, a machine tool tool size measurement method based on machine vision and adaptive guided filtering is provided, including: obtaining a tool image according to a tool image acquisition device;
[0055] Preprocessing the tool image by using an improved adaptive guided filtering algorithm to obtain a foreground region image and a background region image in the tool image;
[0056] Performing guided filtering processing on the foreground region image and the background region image respectively by using different regularization terms to obtain a filtered image;
[0057] Processing the filtered image by using a canny operator to obtain image edge information.
[0058] As Figure 2As shown in the figure, the structure mainly consists of a frame for installing equipment, a high-definition industrial camera, a high-precision grating scale, a stepping motor, and other auxiliary parts. The frame, as a precision platform, mainly undertakes the installation and positioning tasks of the imaging equipment and the tool-carrying device. It is composed of a base, a camera mounting panel, and a light source mounting panel. To facilitate the adjustment of the equipment position, long holes are designed on both the camera and light source mounting panels. In addition, positioning references are set on the camera mounting panel and the base to ensure the precise installation of the camera and the precision platform. The motor driver is connected via USB, and communication with the motor controller is achieved through serial commands, so as to control the stepping motor to perform two-dimensional up-and-down movement on a high-precision flat track at different speeds. Since the top of the equipment is measured by the industrial camera, it only requires the motor to be able to control the camera module to move around the top of the tool. There are no requirements for the stopping accuracy and movement accuracy of the motor, thus reducing the cost of the equipment. First, place the tool already clamped on the tool holder on the tool base of this system. The motor will drive the camera to slowly descend to the tip of the tool. When the camera system senses the tip of the tool, it will stop. The image processing module will detect the highest point and the horizontal edge points of the tool in the image. The movement distance of the motor will be converted into a pulse signal by the grating with an accuracy of 0.5 microns on the track, so as to obtain the movement distance of the motor. At this time, assuming the length from the zero point of the grating scale to the tip of the tool, and converting the coordinates of the highest point in the image into the actual length, the length that the tool needs to be measured can be calculated.
[0059] As Figure 3 shown, when using the tool image acquisition device to measure the tool size, it is necessary to initialize the device first, and the steps are as follows:
[0060] Step 1: Obtain the pixel equivalent of the camera.
[0061] Pixel equivalent conversion is a key step in the machine vision system. It establishes the correspondence between image pixels and actual physical dimensions. Generally speaking, pixel equivalent conversion is usually achieved through the calibration process.
[0062] In practical applications, pixel equivalent conversion is usually completed by photographing a calibration board with known dimensions. The correspondence between the pixel coordinates and the actual physical coordinates of the feature points (such as the corner points of the checkerboard or the centers of the circular grids) on the calibration board in the image can be calculated through the calibration algorithm. This correspondence is the key parameter for pixel equivalent conversion. The present invention will use the calibration board as shown in Figure 4 the figure for distortion calibration and pixel equivalent detection.
[0063] The calibration board has a total of 7 rows and 7 columns of spots, and the distance between the centers of each spot is 2.5 mm. However, the camera used in this system has a small field of view, making it difficult to capture all the spots. However, during the calibration process, it is best to have the same number of spots in each image. Therefore, during the actual calibration process, the number of spots in the image is controlled to achieve the same number of spots in each image. The present invention selects to use only 4 rows and 5 columns of spots. As Figure 5 is the image of the calibration board captured by the camera.
[0064] Let the pixel coordinate distance between the centers of two circles be d, and the actual measured distance between the centers of the calibration board be L. Then the pixel equivalent k can be obtained by the formula:
[0065]
[0066] To ensure the influence of the center detection algorithm on the pixel equivalent calculation, by Figure 5 It can be seen that there are a total of 16 pairs of circle centers in one image. The present invention will calculate all pairs of circle centers in one image and take the average value as the final pixel equivalent value.
[0067] Step 2: Determine the coordinate of the central axis of the device. In order to make greater use of the camera's field of view, this system measures the diameter of the tool by measuring the radius of the tool. Therefore, it is necessary to determine the position of the central axis of the device in the image coordinate system. It is necessary to detect with a calibration rod device with a known accurate diameter, and the formula used is shown in formula (2).
[0068]
[0069] In the formula, R is the known radius of the calibration rod, with the unit of mm; k is the pixel equivalent; (xr, yr) is the edge coordinate of the calibration rod in the image; (xm, ym) is the coordinate of the determined central axis point of the device in the image. That is to say, when determining the central axis, it is necessary to first obtain the edge coordinate points of the calibration rod, and use formula (2) to obtain the center point coordinates. Then, move the camera at a specific distance interval to obtain the next edge point and calculate the center point until reaching the top of the calibration rod. The connection line of all the center points at all positions is the central axis, and the specific detection process is as Figure 5 shown.
[0070] Step 3: Device tilt correction
[0071] The device detects the highest point and edge information of the tool through machine vision. These information are only meaningful under the assumption that the object to be measured is completely vertical. However, there are a large number of mechanical support structures in the device, and these mechanical mechanisms often have certain errors and it is difficult to achieve overall absolute verticality. Therefore, it is necessary to obtain these tilt data through some means and correct them. The schematic diagram of the correction principle is asFigure 6 As shown, there are mainly two forms of the tilt mode of the device: rotational type and translational type. As Figure 6 (a) shows, in the rotational type, the tool to be detected will rotate around the installation position of the device; as Figure 6 (b) shows, in the translational type, due to problems with the device base, the tool will rotate translationally around an axis.
[0072] The process of correcting the rotational tilt is as Figure 7 (a) shows,
[0073] This type of tilt will cause the device to have a tilt angle. The tilt angle will cause the highest point of the object to be measured not to reflect its length, but a trigonometric relationship of its length. Also, since the rightmost point may also change, the measured diameter will also be affected. Then the tilt angle that can be calculated is as shown in formula (3).
[0074]
[0075] In the formula, θ is the angle to be found. Measure the radii of two points p1 and p2 on the tool to obtain the larger radius l1 and the smaller radius l2. The length obtained by subtracting the two is l’, and the length between the two points is h. The tilt angle can be calculated through the formula. It should be noted that when p1 is above p2, θ is positive, and vice versa. After calculating θ, the detected image can be rotated. The rotation formula of the image is as shown in formula (4).
[0076]
[0077] In the formula, θ is the angle to be found in formula (4), x and y are the original positions of each pixel in the image, and x’ and y’ are the pixel positions after rotation. It should be noted that after rotating the image, the position of the original central axis may change, and a central axis determination operation needs to be performed again.
[0078] The process of correcting the translational tilt is as Figure 7 (b) described,
[0079] This type of offset mainly affects the finally measured diameter, but has little impact on the length of the object to be measured. Its calibration method is relatively simple. During detection, the maximum and minimum lengths from the edge points of the tool at the same height to the previously detected central axis are l1 and l2 respectively. Their difference l’ is the maximum offset amount. In order to compensate for the error, when measuring the diameter of the corresponding tool, the object to be measured needs to be rotated one circle to obtain its maximum and minimum diameters, and then subtracting the compensation amount l' / 2 is the true diameter of the tool.
[0080] Step 5: Zero calibration of the grating scale. Due to motor processes such as motor drive, motor torque, and load conditions, etc., when the device returns to its home position, the motor often cannot accurately return to the same grating scale position each time. Therefore, the zero point of the grating scale considered by the program each time has a certain error and is always at a certain distance from the actual zero point. The calculation of the zero compensation value is as follows Figure 8 as shown, and the specific method includes:
[0081] Before the device starts normal measurement, calibration compensation is carried out with the help of a calibration rod of known length. The calibration formula is as shown in formula (5).
[0082] z = R - R' (5)
[0083] where R is the actual length of the calibration rod, and R' is the length of the calibration rod measured by the device through the assumed grating scale and image. z is the zero calibration value of the grating scale. The system first assumes the zero point of the grating scale of the device (usually the position of the grating scale when the device is powered on) to measure the length of the calibration rod to obtain R', and then compares it with the standard known length of the calibration rod to obtain the zero compensation of the grating scale.
[0084] Furthermore, the initialized device can acquire the tool image and perform preprocessing of the image with the help of an improved adaptive guided filtering algorithm. The specific steps are as follows:
[0085] Step 1: Iterative foreground and background region division algorithm for images. It is mainly used to simply distinguish the foreground and background regions in the image, so as to adopt different guided filtering regularization terms for different regions in the subsequent process, as Figure 9 shown, and specifically includes:
[0086] 1. Initialize the foreground and background threshold T of the image by the Otsu method.
[0087] 2. According to the set background threshold T, the pixel points in the image with pixel gray values greater than or equal to T are used as the foreground region, and the average value v1 of its gray values is calculated; the pixel points with pixel gray values less than T are used as the background region, and the average value v2 of its gray values is calculated.
[0088] 3. Take the average value of the calculated foreground and background gray means as the new threshold T n .
[0089] 4. Judge whether the absolute value of T n and T is less than the self-defined number a.
[0090] 5. If it is less than, the purpose of foreground and background separation is achieved, and T is the final threshold; if it is not less than, then use T n as the new T and further calculate until the condition of step 4 is met.
[0091] Step 2: For the above region, use different regularization terms to perform guided filtering. Calculate the guided filtering regularization terms for the foreground and background parts in the image respectively through Equation (6):
[0092]
[0093] where T is the weight factor to be obtained; β is the regularization parameter to prevent division by zero caused by T being zero; t is the segmentation threshold gray level obtained by the iterative method.
[0094] The calculated value of T is the regularization term of the corresponding pixel. Substituting it into the following guided filtering algorithm formula can obtain the adaptive guided filtering result image:
[0095]
[0096] where q is the base layer of the input image, that is, the image after removing the detail layer e representing noise, and can also be understood as the output image after filtering; I is the guidance image, which is the image to be processed itself here, that is, the input image p; |ω| is the total number of pixels in a window ω with the midpoint pixel position k and window radius r k inside; is the gray level mean of the input image I in the window ω k inside; and μ k and σ k 2 are the mean and variance of the pixel gray level values in ω k window ω k inside. The adaptive guided filtering is as shown in Figure 10 and specifically includes the following steps:
[0097] 1. Take the image to be filtered as the guidance image and perform preliminary filtering using traditional Gaussian filtering;
[0098] 2. After filtering, extract the gradient of the image through a 2x2 first-order difference template to obtain the corresponding gradient map of the image;
[0099] 3. Apply the adaptive foreground and background thresholds obtained in the previous step to the image gradient map to distinguish the gradient regions of the foreground and background of the image, and perform guided filtering on the image to be filtered based on different regularization terms during subsequent guided filtering.
[0100] Step 3: Use the image after the filtering process to implement tool edge extraction with the help of the canny operator, including the following steps:
[0101] (1) Gradient extraction. Use the templates of the canny operator to calculate the partial derivatives Gx and Gy of the image in the horizontal and vertical directions respectively, so as to obtain the gray level gradient amplitude P and gradient direction of the image.
[0102]
[0103] In the formula, Px(x, y) and Py(x, y) respectively represent the gradient information in two directions of the image extracted by the canny operator template, and P(x, y) is the final gradient information of the pixel point.
[0104] (2) Non-maximum suppression. Perform non-maximum suppression on the calculated gradient amplitude in the gradient direction: If the gradient of the central pixel is the maximum value of the gradient values in the corresponding gradient direction, then retain this gradient; otherwise, this pixel is a non-maximum point and needs to be suppressed, that is, its gradient value is set to 0. After this step of non-maximum suppression, it is possible to effectively exclude some pixel points of "suspected" edge points, thereby effectively refining the edge and screening out false edge points.
[0105] (3) Double-threshold screening. By artificially determining two gray-scale thresholds T1 and T2, screen the pixel points in the image: When the gradient of this pixel point is higher than T1, it can be directly marked as an edge point; when the gradient of this pixel point is between T1 and T2, it is necessary to judge the maximum value among the neighboring pixels of this pixel. If this value can be higher than T1, then this point is still marked as an edge point, otherwise this point is discarded; and if the gradient value of this pixel point is lower than T2, it is directly discarded. The double-threshold screening method essentially divides the image into two edge maps according to the high and low thresholds. Based on the edge map with the low threshold and referring to the high-threshold edge map, screen the pixel points in the low-threshold edge map, thereby further reducing the false edge points detected by mistake.
[0106] The present invention proposes a series of device initialization processes that can be based on the information collected by the device itself and standard-sized objects. In terms of device initialization, it can initialize the tool presetting instrument system itself with sufficient accuracy. In terms of the detection algorithm, compared with the traditional guided filter, by means of this method, it is possible to filter image noise more flexibly and obtain image edge information with higher detection efficiency and higher accuracy. It can be seen from the experiment that the tool size error detected by the present invention can be stabilized below 0.01 mm, reaching the micron-level detection accuracy, meeting the requirements of high-precision tool detection.
[0107] The above is only a preferred specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed in the present application should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering, characterized in that, Including: Obtaining a tool image according to a tool image acquisition device; Preprocessing the tool image by using an improved adaptive guided filtering algorithm to obtain a foreground region image and a background region image in the tool image; Performing guided filtering processing on the foreground region image and the background region image respectively by using different regularization terms to obtain a filtered image; The method for obtaining the filtered image is: Among them, T is the weight factor; β is the regularization parameter to prevent division-by-zero exceptions caused by the weight factor being zero; t is the segmentation threshold gray value obtained by the iterative method; p is the actual gray value of the pixel in the image; q i is the filtered image; I i is the guidance image; ω k is a window with a window radius of r; i is a pixel in the image; k is the position of the midpoint pixel; |ω| is the total number of pixels in a window ω with a midpoint pixel position of k and a window radius of r k ; μ k is the mean value of the gray values of the pixels in the window ω k ; is the mean gray value of the input image I in the window ω k ; is the variance of the gray values of the pixels in the window ω k ; ε is the guidance filtering regularization term specified manually; ε' is the guidance filtering regularization term after adaptive regularization adjustment; Processing the filtered image by using a canny operator to obtain image edge information.
2. The method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering according to claim 1, characterized in that Before obtaining a tool image according to a tool image acquisition device, the tool image acquisition device needs to be initialized. The method for initializing the tool image acquisition device includes: Obtaining the pixel equivalent of the camera in the tool image acquisition device; Determining the central axis coordinates of the tool image acquisition device; Performing tilt correction on the rotational or translational tool image acquisition device; Performing zero correction on the grating ruler in the tool image acquisition device.
3. The method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering according to claim 2, wherein, The method for obtaining the pixel equivalent of the camera in the tool image acquisition device includes: photographing a calibration plate through the camera, obtaining the pixel positions of the centers of the spots in the calibration plate, and matching the known distances between the spots on the calibration plate itself to obtain the pixel equivalent of the camera.
4. The method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering according to claim 2, wherein The method for determining the central axis coordinates of the tool image acquisition device includes: Controlling the stepping motor of the tool image acquisition device to move upward from the bottom by a preset distance, and obtaining the edge coordinate points of a current calibration rod; Based on the edge coordinate points of the current calibration rod, calculating the center point coordinates through calculation; Based on the center point coordinates, determining whether the stepping motor reaches the top of the calibration rod. If so, calculating the average coordinates of all detected center point coordinates as the central axis coordinates, otherwise returning to move the stepping motor upward by the preset distance again.
5. The method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering according to claim 4, characterized in that, The method for performing tilt correction on the rotational tool image acquisition device includes: obtaining the coordinates of two points among the edge points of the calibration rod image; Calculating the differences in the x and y directions between the two point coordinates; Calculating the inclination angle of the tool image acquisition device.
6. The method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering according to claim 4, wherein The method for performing tilt correction on the translational tool image acquisition device includes: S1. Rotating the calibration rod to obtain the edge coordinate points at the same y coordinate on multiple calibration rods; S2. Recording the maximum and minimum values of the obtained x coordinates; S3. Judging whether the maximum and minimum values of the x coordinates are changing. If not, calculating the translational offset, and if so, returning to S1 again.
7. The method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering according to claim 4, wherein The method for performing zero correction on the grating ruler in the tool image acquisition device includes: moving the stepping motor upward to the top of the calibration rod, and obtaining the top coordinate of the calibration rod; Calculating the actual length of the calibration rod according to the top coordinate of the calibration rod; Recording the grating ruler reading in the current tool image acquisition device, and combining it with the actual length of the calibration rod to obtain the detected length of the calibration rod; Combining the actual length of the calibration rod with the detected length of the calibration rod, and calculating the grating ruler zero compensation.
8. The method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering according to claim 1, wherein The method for obtaining the foreground region image and the background region image in the tool image includes: S1. Calculating the threshold as the initial threshold for the tool image by using the maximum inter-class variance method; S2. Obtain the gray mean value of the foreground region and the gray mean value of the background region by calculating the adaptive region threshold for the tool image, and obtain a new threshold based on the gray mean value of the foreground region and the gray mean value of the background region; S3. Judge whether the absolute value of the difference between the new threshold and the initial threshold is less than the manually specified gray difference a. If so, obtain the finally determined threshold; otherwise, return to S1 again.
9. The method for measuring the size of a machine tool cutter based on machine vision and adaptive guided filtering according to claim 1, characterized in that, The method for obtaining the image edge information by processing the filtered image with the canny operator includes: With the help of the Sobel operator for the filtered image, extract the gray gradient amplitude and gradient direction of the filtered image; Perform non-maximum suppression on the calculated gradient amplitude in the gradient direction to screen out false edge points and thus refine the edge; Determine the two highest and lowest gray thresholds in the filtered image, screen the pixel points in the image, further screen out false edge points, and finally obtain the edge image.
Citation Information
Patent Citations
Target size measurement method based on multi-view binocular visual perception
CN114255286A
Weak and small target detection method based on background perception
CN117078663A