Machine tool cutter size measurement method based on machine vision and adaptive guide filtering

By combining machine vision and adaptive guided filtering methods with equipment initialization procedures, the problem of low efficiency or high cost in traditional machine tool tool measurement has been solved, achieving high-precision and high-efficiency tool size detection.

CN118918165AActive Publication Date: 2024-11-08ZHONGYUAN ENGINEERING COLLEGE
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410936380.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-11-08
Estimated Expiration
2044-07-12

AI Technical Summary

Technical Problem

Traditional machine tool measurement methods are inefficient or costly, making it difficult to meet the high-precision measurement requirements of Industry 4.0.

Method used

A machine vision-based and adaptive guided filtering method is adopted. Through the improved adaptive guided filtering algorithm and Canny operator processing, combined with the equipment initialization process, including pixel equivalent acquisition, centerline coordinate determination, tilt correction and grating ruler zero point correction, high-precision edge extraction of tool images is achieved.

Benefits of technology

It achieves high precision and high efficiency in tool measurement, with the detection error stabilized below 0.01mm, reaching micron-level precision and meeting the requirements of high-precision detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918165A_ABST
    Figure CN118918165A_ABST
Patent Text Reader

Abstract

The invention discloses a machine tool cutter size measurement method based on machine vision and adaptive guide filtering. The method comprises the following steps: acquiring a cutter image according to cutter image acquisition equipment; preprocessing the cutter image by adopting an improved self-adaptive guide filtering algorithm to obtain a foreground region image and a background region image in the cutter image; performing guided filtering processing on the foreground region image and the background region image by adopting different regularization items to obtain images after filtering processing; and processing the filtered image by adopting a canny operator to obtain image edge information. According to the invention, the image noise can be filtered more flexibly, and the image edge information can be obtained with higher detection efficiency and higher precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of machine tool processing and image recognition, and in particular relates to a machine tool tool size measurement method based on machine vision and adaptive guided filtering. Background Art

[0002] In the context 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 mapping the machining coordinate system and the actual machine tool coordinate system in actual processing, and is one of the important factors determining the machining accuracy of machine tools. The traditional method of using a vernier caliper is inefficient, and the method based on laser measurement is high in accuracy but expensive. Under such realistic conditions, the tool size detection method based on machine vision has attracted attention because of its non-contact, sufficiently high detection accuracy, and low equipment cost. Therefore, the present invention designs a new tool size detection system, and explains the initialization process and the edge extraction algorithm based on adaptive guided filtering. Summary of the invention

[0003] In order to solve the above technical problems, the present invention proposes a machine tool tool size measurement method 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 machine tool tool size measurement method based on machine vision and adaptive guided filtering, comprising:

[0005] Acquire a tool image according to a tool image acquisition device;

[0006] Preprocessing the tool image using an improved adaptive guided filtering algorithm to obtain a foreground area image and a background area image in the tool image;

[0007] Performing guided filtering processing on the foreground area image and the background area image using different regularization items respectively to obtain filtered images;

[0008] The filtered image is processed using a Canny operator to obtain image edge information.

[0009] According to the machine tool tool size measurement method based on machine vision and adaptive guided filtering provided by the present invention, before the tool image acquisition device acquires the tool image, 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] Determine the coordinates of the center axis of the tool image acquisition device;

[0012] Performing tilt correction on the rotary or translational tool image acquisition device;

[0013] Correct the zero point of the grating ruler in the tool image acquisition device.

[0014] According to the machine tool tool size measurement method based on machine vision and adaptive guided filtering 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 with the camera, obtaining the pixel position of the center of the spot circle in the calibration plate, and obtaining the pixel equivalent of the camera in combination with the known distance between the spots on the calibration plate itself.

[0015] According to the machine tool tool size measurement method based on machine vision and adaptive guided filtering provided by the present invention, the method for determining the coordinates of the central axis of the tool image acquisition device includes:

[0016] Controlling the stepper motor of the tool image acquisition device to move upward from the bottom to a preset distance to obtain edge coordinate points of a current calibration stick;

[0017] Based on the edge coordinate points of the current calibration rod, the center point coordinates are obtained by calculation;

[0018] Based on the center point coordinates, it is determined whether the stepper motor has reached the top of the calibration rod. If yes, the average coordinates of all the detected center point coordinates are calculated as the center axis coordinates. Otherwise, the stepper motor is returned to move upward a preset distance.

[0019] According to the machine tool tool size measurement method based on machine vision and adaptive guided filtering provided by the present invention, the method for performing tilt correction on the rotating tool image acquisition device includes: obtaining the coordinates of two points in the edge points of the calibration rod image;

[0020] Calculate the difference in x and y directions between the coordinates of two points;

[0021] The inclination angle of the tool image acquisition device is calculated.

[0022] According to the machine tool tool size measurement method based on machine vision and adaptive guided filtering provided by the present invention, the method for performing tilt correction on the translational tool image acquisition device comprises: S1, rotating the calibration rod to obtain 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 ​​in the x-coordinate are changing. If they are not changing, calculate the translational offset. If they are changing, return to S1.

[0025] According to the machine tool tool size measurement method based on machine vision and adaptive guided filtering provided by the present invention, the method for correcting the zero point of the grating ruler in the tool image acquisition device includes: moving the stepper motor upward to the top of the calibration rod to obtain the coordinates of the top of the calibration rod;

[0026] Calculate the actual length of the calibration rod according to the top coordinates of the calibration rod;

[0027] Record the grating ruler reading in the current tool image acquisition device, and obtain the detection length of the calibration rod in combination with the actual length of the calibration rod;

[0028] The actual length of the calibration rod is combined with the detection length of the calibration rod to calculate the zero point compensation of the grating ruler.

[0029] According to the machine tool tool size measurement method based on machine vision and adaptive guided filtering provided by the present invention, the method for obtaining the foreground area image and the background area image in the tool image includes:

[0030] S1, using the maximum intercostal variance method to calculate the threshold of the tool image as the initial threshold;

[0031] S2, calculating the grayscale mean of the foreground area and the grayscale mean of the background area of ​​the tool image through an adaptive regional threshold, and obtaining a new threshold based on the grayscale mean of the foreground area and the grayscale mean of the background area;

[0032] S3, judging whether the absolute value of the difference between the new threshold and the initial threshold is less than the manually specified grayscale difference a, if yes, obtaining the final threshold, otherwise returning to S1.

[0033] According to the machine tool tool size measurement method based on machine vision and adaptive guided filtering provided by the present invention, the method for obtaining the filtered image is:

[0034]

[0035] Where T is the weight factor; β is the regularization parameter to prevent the weight factor from being zero and causing division by zero anomaly; t is the grayscale of the segmentation threshold obtained by the iterative method; p is the actual grayscale of the pixel in the image; q i is the filtered image; I i is the guiding image, which can be considered as the image p itself in this paper, that is, the guidance of itself; a k and b k As shown in the above formula; ω k is a window with a radius of r; i is a pixel in the image; k is the midpoint pixel position; |ω| is a window with a midpoint pixel position of k and a window radius of r. k The total number of pixels in μk For window ω k The mean of the grayscale values ​​of the inner pixels; For the input image I in window ω k The grayscale mean within ; For window ω k The variance of the grayscale value of the inner pixel; ε is the manually specified guided filter regularization term, which is set to 1 / 64 in this paper; ε' is the guided filter regularization term after adaptive regularization adjustment.

[0036] According to the machine tool tool size measurement method based on machine vision and adaptive guided filtering provided by the present invention, the method of obtaining image edge information by processing the filtered image with a canny operator includes:

[0037] Extracting the grayscale gradient amplitude and gradient direction of the filtered image by using a Sobel operator;

[0038] Perform non-maximum suppression on the calculated gradient amplitude in the gradient direction to filter out false edge points and refine the edge;

[0039] The highest and lowest grayscale thresholds in the filtered image are determined, the pixels in the image are screened, and false edge points are further screened to finally obtain an edge image.

[0040] Technical effect of the present invention: In terms of equipment initialization, the present invention proposes a series of equipment initialization processes that can be based on the information collected by the equipment itself and objects of standard size, and can initialize the tool presetter system itself accurately enough. In terms of detection algorithm, compared with traditional guided filtering, with the help of this method, image noise can be filtered more flexibly, and image edge information can be obtained with higher detection efficiency and higher accuracy. It can be seen from experiments that the tool size error detected by the present invention can be stabilized below 0.01mm, achieving micron-level detection accuracy, which meets the needs of high-precision tool detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0042] Figure 1 It is a flow chart of a method for measuring the size of a machine tool tool based on machine vision and adaptive guided filtering according to an embodiment of the present invention;

[0043] Figure 2 This is a schematic diagram of a tool image acquisition device according to an embodiment of the present invention;

[0044] Figure 3This is a flow chart of device initialization according to an embodiment of the present invention;

[0045] Figure 4 This is a physical picture of the calibration plate of an embodiment of the present invention;

[0046] Figure 5 is an image of a calibration plate in the camera viewing angle of an embodiment of the present invention;

[0047] Figure 6 Schematic diagrams of two tilting conditions of an embodiment of the present invention, wherein (a) is a rotational tilting condition; (b) is a translational tilting condition;

[0048] Figure 7 Flow chart of tilt correction according to an embodiment of the present invention, wherein (a) is rotational tilt correction; (b) is translational tilt correction;

[0049] Figure 8 This is a flow chart of the calculation of zero point compensation of the grating ruler according to an embodiment of the present invention;

[0050] Fig. 9 This is a flow chart of adaptive regional threshold calculation according to an embodiment of the present invention;

[0051] Fig.10 This is a flow chart of adaptive guided filtering according to an embodiment of the present invention. DETAILED DESCRIPTION

[0052] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0053] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0054] like Figure 1 As shown, in this embodiment, a machine tool tool size measurement method based on machine vision and adaptive guided filtering is provided, including: acquiring a tool image according to a tool image acquisition device;

[0055] Preprocessing the tool image using an improved adaptive guided filtering algorithm to obtain a foreground area image and a background area image in the tool image;

[0056] Performing guided filtering processing on the foreground area image and the background area image using different regularization items respectively to obtain filtered images;

[0057] The filtered image is processed using a Canny operator to obtain image edge information.

[0058] like Figure 2 As shown in the figure, the structure is mainly composed of a rack for installing equipment, a high-definition industrial camera, a high-precision grating ruler, a stepper motor and other auxiliary parts. The rack, as a precision platform, is mainly responsible for the installation and positioning of imaging equipment and carrying tools. It consists of three parts: 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 the mounting panels of the camera and the light source. In addition, positioning references are also set on the mounting panel and base of the camera to ensure the precise installation of the camera and the precision platform. The motor driver is connected via USB, and the serial port command is used to communicate with the motor controller to achieve the purpose of controlling the stepper motor to move up and down two-dimensionally on a high-precision flat track at different speeds. Since the top of the equipment is measured by an industrial camera, it is only necessary for the motor to control the camera module to move around the top of the tool. There is no requirement for the stopping accuracy and movement accuracy of the motor, which also reduces the cost of the equipment. First, place the tool that has been clamped on the tool handle 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, and the image processing module will detect the highest point of the tool in the image and the lateral edge point. The motor's movement distance is converted into a pulse signal through the grating on the track with an accuracy of 0.5 microns, thereby obtaining the motor's movement distance. At this time, assuming that the tool is the length from the grating ruler zero point to the tool tip, the coordinates of the highest point in the image are converted to the actual length, and the length that the tool needs to measure can be calculated.

[0059] like Figure 3 As shown, when using the tool image acquisition device to measure the tool size, the device needs to be initialized first. The steps are as follows:

[0060] Step 1: Obtain the camera's pixel equivalent.

[0061] Pixel equivalent conversion is a key step in machine vision systems. It establishes the correspondence between image pixels and actual physical sizes. Generally speaking, pixel equivalent conversion is usually achieved through a calibration process.

[0062] In practical applications, pixel equivalent conversion is usually completed by photographing a calibration plate of known size. The correspondence between the pixel coordinates of the feature points on the calibration plate (such as the corner points of a chessboard or the center of a circular grid) in the image and the actual physical coordinates can be calculated by a calibration algorithm. This correspondence is the key parameter of pixel equivalent conversion. Figure 4 The calibration plate shown is subjected to distortion calibration and pixel equivalent detection.

[0063] The calibration plate has 7 rows and 7 columns of spots, and the center distance of each spot is 2.5mm. However, the camera used in this system has a small field of view, and it is difficult to capture all the spots. However, during the calibration process, it is best to have the same number of spots on each image. Therefore, in the actual calibration process, the number of spots in the image is controlled to achieve the purpose of having the same number of spots on each image. The present invention only uses 4 rows and 5 columns of spots. Figure 5 The calibration plate image taken by the camera.

[0064] Assume that the pixel coordinate distance between the centers of the two circles is d, and the actual measured center distance of the calibration plate is L. Then the pixel equivalent k can be obtained by the formula:

[0065]

[0066] In order to ensure the influence of the circle center detection algorithm on the pixel equivalent calculation, Figure 5 It can be seen that there are 16 circle center pairs in a picture. The present invention calculates all the circle center pairs in a picture and takes the average value as the final pixel equivalent value.

[0067] Step 2: Determine the coordinates of the center axis of the device. In order to make full use of the camera field of view, this system measures the tool radius to measure the tool diameter. Therefore, it is necessary to determine the position of the center axis of the device in the image coordinate system. It is necessary to use a calibration rod device with a known accurate diameter for detection. The formula used is shown in formula (2).

[0068]

[0069] Where R is the known radius of the calibration rod, in 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 device center axis point in the image. That is to say, when determining the center axis, it is necessary to first obtain the edge coordinate points of the calibration rod, and use formula (2) to calculate the center point coordinates, and then move the camera at a specific distance to obtain the next edge point and calculate the center point until it reaches the top of the calibration rod. The line connecting the center points of all positions is the center axis. The specific detection process is as follows: Figure 5 shown.

[0070] Step 3: Device tilt correction

[0071] The equipment detects the highest point and edge information of the tool through machine vision. This information is only meaningful when the object to be measured is assumed to be completely vertical. However, there are a large number of mechanical support structures in the equipment. These mechanical mechanisms often have certain errors and it is difficult to achieve absolute verticality as a whole. Therefore, it is necessary to obtain these tilt data through some means and correct them. The schematic diagram of the correction principle is shown in the figure. Figure 6 As shown, there are two main types of tilt modes for equipment: rotational and translational. Figure 6 The rotating type shown in (a) means that the tool to be tested will rotate around the installation position of the equipment; Figure 6 The translational type shown in (b) is caused by a problem with the equipment base itself, which causes the tool to translate and rotate around an axis.

[0072] The process of rotational tilt correction is as follows Figure 7 As shown in (a),

[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 to no longer reflect its length, but a triangular relationship of its length. In addition, since the rightmost point may also change, the measured diameter will also be affected. The tilt angle that can be calculated is shown in formula (3).

[0074]

[0075] In the formula, θ is the required angle. The radius of the two points p1 and p2 on the tool is measured to obtain the larger radius l1 and the smaller radius l2. The length of the difference between the two is l', and the length between the two points is h. The inclination angle can be calculated by the formula. It should be noted that when p1 is above p2, θ is a positive number, otherwise it is a negative number. After calculating θ, the detected image can be rotated. The image rotation formula is shown in formula (4).

[0076]

[0077] In the formula, θ is the angle calculated by 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 original central axis position may change, and the central axis determination operation needs to be performed again.

[0078] The process of translational tilt correction is as follows: Figure 7 (b)

[0079] This type of offset mainly affects the final measured diameter, but has little effect on the length of the object to be measured. Its calibration method is also relatively simple. During the detection, the maximum and minimum lengths from the edge point of the tool at the same height to the previously detected center axis are l1 and l2 respectively, and the difference l' is its maximum offset. In order to compensate for its error, it is necessary to rotate the object to be measured one circle when measuring the corresponding tool diameter, obtain its maximum and minimum diameters, and then subtract the compensation amount l' / 2 to get the actual tool diameter.

[0080] Step 5: Correction of the grating ruler zero point. Due to the motor process, such as motor drive, motor torque and load conditions, the motor often cannot accurately return to the same grating ruler scale every time when the device is reset. Therefore, the grating ruler zero point considered by the program each time has a certain error, and each time there is a certain distance from the actual zero point. The zero point compensation value is calculated as follows: Figure 8 As shown, the specific methods include:

[0081] Before the device starts normal measurement, calibration compensation is performed with the help of a calibration rod of known length. The calibration formula is shown in formula (5).

[0082] z=RR' (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 ruler and image. z is the zero point correction value of the grating ruler. The system first assumes the grating ruler zero point of the device (usually the position of the grating ruler when the machine is turned 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 point compensation of the grating ruler.

[0084] Furthermore, the initialized device can obtain the tool image and preprocess the image with the help of the improved adaptive guided filtering algorithm. The specific steps are as follows:

[0085] Step 1: Iterative image foreground and background region segmentation algorithm. It is mainly used to simply distinguish the foreground and background regions in the image, so that different guided filter regularization terms can be used for different regions in the future, such as Fig. 9 As shown, specifically including:

[0086] 1. Initialize the image background threshold T by the maximum between-class variance method (OTSU).

[0087] 2. According to the set background threshold T, the pixels in the image with grayscale greater than or equal to T are regarded as the foreground area, and their grayscale value mean v1 is calculated; the pixels with grayscale less than T are regarded as the background area, and their grayscale value mean v2 is calculated.

[0088] 3. Take the average of the calculated front and back grayscale means as the new threshold T n .

[0089] 4. Judge T n Whether the absolute value of the sum T is less than the self-determined number a.

[0090] 5. If it is less than, the purpose of separating the foreground and background is achieved, and T is the final threshold; if it is not less than, T n As the new T, further calculation is performed until the conditions of step 4 are met.

[0091] Step 2: For the above regions, different regularization terms are used for guided filtering. The guided filtering regularization terms are calculated for the foreground and background parts of the image respectively through formula (6):

[0092]

[0093] Where T is the required weight factor; β is the regularization parameter to prevent T from being zero and causing division by zero anomalies; t is the grayscale of the segmentation threshold obtained by the iterative method.

[0094] The calculated T value 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, which can also be understood as the filtered output image; I is the guide image, which is the image to be processed, that is, the input image p; |ω| is a window ω with a midpoint pixel position k and a window radius r. k The total number of pixels within; For the input image I in window ω k The grayscale mean within k and σ k 2 is ω k Windowω k The mean and variance of the grayscale values ​​of the pixels within. Adaptive guided filtering is as follows Fig.10 As shown, the specific steps include:

[0097] 1. Use the image to be filtered as a guide image and use traditional Gaussian filtering for preliminary filtering;

[0098] 2. After filtering, the image is gradient extracted through a 2x2 first-order difference template to obtain the gradient map corresponding to 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 areas of the foreground and background of the image. Subsequently, when performing guided filtering, the image to be filtered is subjected to guided filtering based on different regularization terms.

[0100] Step 3: Using the filtered image, the tool edge is extracted with the help of the Canny operator, which includes the following steps:

[0101] (1) Gradient extraction: Use the template of the canny operator as shown in the formula to calculate the partial derivatives Gx and Gy in the horizontal and vertical directions of the image, thereby obtaining the grayscale gradient amplitude P and gradient direction of the image.

[0102]

[0103] Where Px(x,y) and Py(x,y) 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.

[0104] (2) Non-maximum suppression. The calculated gradient amplitude is subjected to non-maximum suppression in the gradient direction: if the gradient of the central pixel is the maximum value of the gradient value in the corresponding gradient direction, the gradient is retained; otherwise, the pixel is a non-maximum point and needs to be suppressed, that is, its gradient value is set to 0. After the non-maximum suppression step, some pixels that are "suspected" edge points can be effectively excluded, thereby effectively refining the edge and filtering out false edge points.

[0105] (3) Double threshold screening. By artificially determining the high and low grayscale thresholds T1 and T2, the pixels in the image are screened: when the pixel gradient is higher than T1, it can be directly marked as an edge point; when the pixel gradient is between T1 and T2, it is necessary to determine the maximum value of the pixel's neighborhood pixels. If the value is higher than T1, the point is still marked as an edge point, otherwise the point is discarded; and if the pixel gradient value of the point is lower than T2, it is directly discarded. The double threshold screening method essentially divides the image into two edge maps according to high and low thresholds. Based on the low threshold edge map and with reference to the high threshold edge map, the pixels in the low threshold edge map are screened, thereby further reducing false edge points that are mistakenly detected.

[0106] The present invention proposes a series of equipment initialization processes that can be based on the information collected by the equipment itself and objects of standard size. In terms of equipment initialization, the tool presetter system itself can be initialized accurately enough. In terms of detection algorithm, compared with traditional guided filtering, with the help of this method, image noise can be filtered more flexibly, and image edge information 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 stabilized below 0.01mm, achieving micron-level detection accuracy, which meets the needs of high-precision tool detection.

[0107] The above are only preferred specific implementations 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 a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. Machine tool tool size measurement method based on machine vision and adaptive guided filtering, It is characterized in that include: Acquire a tool image according to a tool image acquisition device; Preprocessing the tool image using an improved adaptive guided filtering algorithm to obtain a foreground area image and a background area image in the tool image; Performing guided filtering processing on the foreground area image and the background area image using different regularization items respectively to obtain filtered images; The filtered image is processed using a Canny operator to obtain image edge information.

2. The machine tool tool size measurement method based on machine vision and adaptive guided filtering as claimed in claim 1, It is characterized in that Before the tool image acquisition device acquires the tool image, 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; Determine the coordinates of the center axis of the tool image acquisition device; Performing tilt correction on the rotary or translational tool image acquisition device; Correct the zero point of the grating ruler in the tool image acquisition device.

3. The machine tool tool size measurement method based on machine vision and adaptive guided filtering as claimed in claim 2, It is characterized in that The method for obtaining the pixel equivalent of the camera in the tool image acquisition device includes: photographing a calibration plate with the camera, obtaining the pixel position of the center of the spot circle in the calibration plate, and obtaining the pixel equivalent of the camera by combining the known distance between the spots on the calibration plate itself.

4. The machine tool tool size measurement method based on machine vision and adaptive guided filtering as claimed in claim 2, It is characterized in that The method for determining the coordinates of the central axis of the tool image acquisition device includes: Controlling the stepper motor of the tool image acquisition device to move upward from the bottom to a preset distance to obtain edge coordinate points of a current calibration stick; Based on the edge coordinate points of the current calibration rod, the center point coordinates are obtained by calculation; Based on the center point coordinates, it is determined whether the stepper motor has reached the top of the calibration rod. If yes, the average coordinates of all the detected center point coordinates are calculated as the center axis coordinates. Otherwise, the stepper motor is returned to move upward a preset distance.

5. The machine tool tool size measurement method based on machine vision and adaptive guided filtering as claimed in claim 4, It is characterized in that The method for performing tilt correction on the rotating tool image acquisition device comprises: obtaining the coordinates of two points in the edge points of the calibration rod image; Calculate the difference in x and y directions between the coordinates of two points; The inclination angle of the tool image acquisition device is calculated.

6. The machine tool tool size measurement method based on machine vision and adaptive guided filtering as claimed in claim 4, It is characterized in that The method for performing tilt correction on the translational tool image acquisition device comprises: S1, rotating a calibration rod to obtain edge coordinate points at the same y coordinate on a plurality of calibration rods; S2, record the maximum and minimum values ​​of the obtained x coordinates; S3. Determine whether the maximum and minimum values ​​in the x-coordinate are changing. If they are not changing, calculate the translational offset. If they are changing, return to S1.

7. The machine tool tool size measurement method based on machine vision and adaptive guided filtering as claimed in claim 4, It is characterized in that The method for correcting the zero point of the grating ruler in the tool image acquisition device comprises: moving the stepper motor upward to the top of the calibration rod to obtain the coordinates of the top of the calibration rod; Calculate the actual length of the calibration rod according to the top coordinates of the calibration rod; Record the grating ruler reading in the current tool image acquisition device, and obtain the detection length of the calibration rod in combination with the actual length of the calibration rod; The actual length of the calibration rod is combined with the detection length of the calibration rod to calculate the zero point compensation of the grating ruler.

8. The machine tool tool size measurement method based on machine vision and adaptive guided filtering as claimed in claim 1, It is characterized in that The method for obtaining the foreground area image and the background area image in the tool image includes: S1, using the maximum intercostal variance method to calculate the threshold of the tool image as the initial threshold; S2, calculating the grayscale mean of the foreground area and the grayscale mean of the background area of ​​the tool image through an adaptive regional threshold, and obtaining a new threshold based on the grayscale mean of the foreground area and the grayscale mean of the background area; S3, judging whether the absolute value of the difference between the new threshold and the initial threshold is less than the manually specified grayscale difference a, if yes, obtaining the final threshold, otherwise returning to S1.

9. The machine tool tool size measurement method based on machine vision and adaptive guided filtering as claimed in claim 1, It is characterized in that The method to obtain the filtered image is: Where T is the weight factor; β is the regularization parameter to prevent the weight factor from being zero and causing division by zero anomaly; t is the grayscale of the segmentation threshold obtained by the iterative method; p is the actual grayscale of the pixel in the image; q i is the filtered image; I i is the guiding image; k is a window with a radius of r; i is a pixel in the image; k is the midpoint pixel position; |ω| is a window with a midpoint pixel position of k and a window radius of r. k The total number of pixels in μ k For window ω k The mean of the grayscale values ​​of the inner pixels; For the input image I in window ω k The grayscale mean within ; For window ω k The variance of the grayscale value of the inner pixel; ε is the manually specified guided filter regularization term; ε' is the guided filter regularization term after adaptive regularization adjustment.

10. The machine tool tool size measurement method based on machine vision and adaptive guided filtering as claimed in claim 1, It is characterized in that The method of using a canny operator to process the filtered image to obtain edge information of the image includes: Extracting the grayscale gradient amplitude and gradient direction of the filtered image by using a Sobel operator; Perform non-maximum suppression on the calculated gradient amplitude in the gradient direction to filter out false edge points and refine the edge; The highest and lowest grayscale thresholds in the filtered image are determined, the pixels in the image are screened, and false edge points are further screened to finally obtain an edge image.

Citation Information

Patent Citations

  • Local motion deblurring method and device based on visual saliency and storage medium

    CN112215773A

  • Target size measurement method based on multi-view binocular visual perception

    CN114255286A

  • Weak and small target detection method based on background perception

    CN117078663A

  • Image denoising method based on regional adaptive guide filtering

    CN117455777A

  • Image processing method and an image processing apparatus

    US20150302596A1