A Machine Vision-Based In-Situ Measurement Method and System for Milling Tool Wear

By constructing a high-brightness soft mask and gamma correction in the HSV color space, and combining an improved fast nonlocal mean filter and a fractional-order enhanced dung beetle optimization algorithm, the problem of stable segmentation of multi-grayscale features in milling tool wear detection is solved, and accurate measurement of milling tool wear width is achieved.

CN123118622APending Publication Date: 2026-11-17UNIV OF SHANGHAI FOR SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611604313.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-16
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing machine vision methods struggle to stably segment multi-grayscale features in milling tool wear detection, leading to blurred wear boundaries and inaccurate measurements. Furthermore, fluctuations in image preprocessing and threshold search affect the consistency of results.

Method used

A high-brightness soft mask based on the HSV color space and gamma correction are used, combined with an improved fast nonlocal mean filter and a fractional-order enhanced dung beetle optimization algorithm, to perform brightness correction and multi-threshold stabilization search. The wear width is calculated through a unified reference line.

Benefits of technology

It improves the stability and accuracy of milling tool back face wear measurement, reduces the impact of metal reflection and local grayscale fluctuations on threshold segmentation, and realizes semi-automatic quantitative measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123118622A_ABST
    Figure CN123118622A_ABST
Patent Text Reader

Abstract

This invention provides a machine vision-based in-situ measurement method and system for milling tool wear. The method involves image acquisition and measurement benchmark initialization. The tool is moved to a preset measurement position, and images of the flank face are acquired according to a fixed cutting edge sequence. The flank face images are converted to HSV space, and a high-brightness soft mask is constructed. Target brightness fusion is performed on strongly reflective pixels, and gamma correction is applied to the brightness channel. After the corrected image is grayscaled, an improved fast nonlocal mean filter is used for noise reduction. Using the total inter-class variance of the multi-threshold Otsu method as the fitness function, a fractional-order enhanced dung beetle optimization algorithm is used to search for four ordered segmentation thresholds, obtaining five grayscale segmentation images. The method receives the setting information of the measurement area, reference point, and target grayscale category, fits a reference line, calculates the current feature distance from the target grayscale category pixel set to the reference line, and calculates the flank face wear width of each cutting edge based on the initial feature distance and pixel equivalent of the intact tool.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a machine vision inspection method, and more particularly to a machine vision-based in-situ measurement method and system for milling tool wear. Background Technology

[0002] Milling cutters are subjected to cyclic loads, cutting heat, and friction during the cutting process, making their flanks prone to abrasive wear, adhesive wear, and localized spalling. As flank wear intensifies, the geometry of the cutting edge and the cutting state change, potentially leading to increased cutting forces and temperatures, and reduced dimensional accuracy and surface quality. Therefore, timely detection and quantitative measurement of the flank wear width of milling cutters are fundamental to developing tool change strategies and ensuring the stability of the machining process.

[0003] Existing tool wear detection methods include indirect detection methods based on cutting force, vibration, current, or acoustic emission signals, as well as direct visual measurement methods based on tool surface images. Machine vision methods can directly obtain tool surface morphology and wear dimensions, and are non-contact and easy to geometrically quantify. However, specular and diffuse reflection of the tool metal surface, fluctuations in ambient lighting, surface texture, wear debris adhesion, and plastic flash can change the local brightness and grayscale distribution of the back face image, easily causing blurred wear boundaries, isolated bright spots, and false features.

[0004] The flank face image of a milling tool typically contains multiple grayscale levels, including background, dark interference, normal flank face, wear transition features, and bright wear or flash. The grayscale histogram exhibits multi-peak overlapping characteristics. Fixed-threshold or single-threshold segmentation methods struggle to simultaneously separate these multi-level features. Traditional multi-threshold Otsu's method requires searching within a large threshold combination space, and the computational load increases rapidly with the number of thresholds. When using swarm intelligence algorithms to search for multi-threshold combinations, if the algorithm experiences a decrease in population diversity or local convergence in the complex multi-peak search space, it can lead to fluctuations in the segmentation threshold, further affecting the wear boundary location and the calculation of the flank face wear width.

[0005] Furthermore, visual measurement results also depend on the consistency of the reference datum, target pixel boundaries, and scale conversion. If inconsistent data objects are used in image preprocessing, thresholding, and geometric measurement, reflections, noise, and segmentation errors generated in the preceding steps will be passed on to subsequent wear width calculations. Therefore, a machine vision method is needed that can sequentially perform brightness correction, edge-preserving denoising, multi-threshold stable search, and feature distance measurement around the same tool flank image to improve the stability and accuracy of milling tool flank wear measurement under complex imaging conditions. Summary of the Invention

[0006] This invention provides a machine vision-based in-situ measurement method and system for milling tool wear. It addresses the challenge of stably obtaining multi-threshold segmentation results under conditions such as strong metallic reflection, local grayscale fluctuations, and overlapping grayscale levels in the milling tool flank image. Furthermore, it converts the segmented wear-related pixels into repeatable flank wear widths, thereby reducing the impact of image preprocessing and threshold search fluctuations on VB measurement results. The technical solution is as follows:

[0007] A machine vision-based method for in-situ measurement of milling tool wear includes the following steps:

[0008] S1: Perform image acquisition and measurement benchmark initialization, determine pixel equivalent and obtain the initial feature distance of each cutting edge in good condition, move the tool to the preset measurement position and acquire the back face image according to the fixed cutting edge sequence;

[0009] S2: Convert the back face image to the HSV color space, construct a high-brightness soft mask based on the luminance channel V and the saturation channel S, use the high-brightness soft mask to perform target brightness fusion on the highly reflective area, and perform gamma correction on the fused luminance channel to obtain a luminance-corrected image.

[0010] S3: Convert the brightness-corrected image to grayscale and use an improved fast nonlocal mean (IFNLM) filter to denoise the grayscale image to obtain a preprocessed image;

[0011] S4: Based on the grayscale histogram of the preprocessed image, the fractional-order enhanced dung beetle optimization algorithm is used to iteratively optimize the four-dimensional candidate threshold vector composed of four candidate thresholds, outputting four ordered optimal thresholds, and the preprocessed image is divided into five grayscale categories according to the four ordered optimal thresholds to obtain five grayscale segmentation images.

[0012] S5: Receive the measurement area, reference point and target gray level category set for the five types of gray level segmented images, fit a reference line according to the reference point, extract the target pixel set belonging to the target gray level category in the measurement area, and determine the minimum vertical distance from the target pixel set to the reference line as the current feature distance;

[0013] S6: Calculate the back face wear width of each cutting edge based on the pixel equivalent, the initial feature distance, and the current feature distance, and output the wear detection result of the milling tool based on the back face wear width of each cutting edge.

[0014] Furthermore, step S1 includes the following steps:

[0015] S11: Using a calibration component with known dimensions, determine the pixel equivalent at the preset measurement position and fixed imaging magnification, acquire images of the back face of each cutting edge in good condition, and obtain the initial feature distance;

[0016] The initial feature distance of each cutting edge can be obtained by using the same reference line and target pixel ranging method as S5.

[0017] S12: In the subsequent processing, that is, in the milling process, the milling tool stops rotating after each preset processing step, and the milling tool is controlled to move to the preset measurement position. The back face image of each cutting edge of the milling tool is collected according to the fixed cutting edge sequence.

[0018] Furthermore, step S2 includes the following steps:

[0019] The luminance channel V and saturation channel S are normalized to v and s, respectively, and the high-brightness soft mask is constructed according to the following formula. :

[0020] ;

[0021] in, pixel position The highlight soft mask weight at the location has a value range of [0,1]. and Pixel positions The normalized brightness and saturation values; The high brightness threshold is set at the beginning of the threshold. Low saturation threshold; This indicates that the calculation results are limited to the range [0,1]. The first term in the formula characterizes the degree to which pixel brightness exceeds the high brightness threshold, and the second term characterizes the degree to which pixel saturation is below the low saturation threshold. The product of these two terms gives a larger mask weight to near-white, highly reflective areas that are both bright and low-saturation. Target brightness fusion is then performed according to the following formula:

[0022] ;

[0023] in, For high-brightness soft masks After smoothing, at pixel position Weight at each location; This is the original normalized brightness value at that pixel location; Preset target brightness; This is the normalized brightness value after target brightness fusion. When the value is close to 0, the fusion result mainly retains the original brightness; when... As the value approaches 1, the fusion result gradually approaches the target brightness. This allows for continuous and smooth brightness constraints on highly reflective areas.

[0024] Furthermore, in step S3, the improved fast nonlocal mean filtering calculates the difference between the central neighborhood block and the candidate neighborhood block within the search window, uses the product of Gaussian weight and Tukey truncation weight as the composite weight, and calculates the neighborhood block distance through the pixel difference integral map to reduce the influence of low similarity neighborhoods on the filtering result and reduce the repeated summation of neighborhood blocks, thereby obtaining a preprocessed image that preserves boundaries and texture.

[0025] Furthermore, in step S4, the fractional-order enhanced dung beetle optimization algorithm is used to iteratively optimize the four-dimensional candidate threshold vector composed of four candidate thresholds. This means that the fractional-order enhanced dung beetle optimization algorithm divides the candidate threshold individuals into rolling individuals, breeding individuals, foraging individuals, and stealing individuals. During the iteration process, an oscillation balance factor is used to adjust the search amplitude of rolling individuals, and the fractional-order dynamic boundary containing historical iteration states is used to adjust the local search range of breeding individuals and foraging individuals. Dimensional mutation based on the t-distribution is also implemented on the current globally optimal threshold individual. After each individual update, the total inter-class variance of the candidate threshold vector before and after the update is compared, and the candidate threshold vector with higher fitness is retained.

[0026] Furthermore, in step S4, let the candidate threshold vector be... The grayscale range is divided into five intervals based on the candidate threshold vector. The pixel weight and average grayscale value of each interval are calculated, and the total inter-class variance of the five grayscale categories is used as the fitness of the candidate threshold vector. Before each fitness calculation, the candidate threshold vector undergoes grayscale boundary constraints, integerization, ascending sorting, and duplicate threshold repair to ensure it meets the following requirements. .

[0027] Furthermore, in step S5, the operator's settings for the measurement area, reference point, and target grayscale category are received. A reference line is fitted based on the reference point, and a set of pixels representing the target grayscale category is extracted within the measurement area. The reference line is in the form Ax + By + C = 0. For the target pixel set... Any target pixel in Its perpendicular distance to the reference line for The current feature distance This is the minimum vertical distance from each target pixel in the target pixel set to the reference line. Represents the target pixel set The j-th target pixel in and Representing the target pixels respectively The horizontal and vertical coordinates in the image coordinate system; A, B, and C are the line parameters of the reference line Ax+By+C=0 obtained by fitting based on the reference point; Indicates target pixel The perpendicular distance to the reference line; This represents the current feature distance corresponding to the i-th measurement.

[0028] Furthermore, in step S6, the difference between the current feature distance and the initial feature distance in the intact state is calculated, and the current back face wear width is obtained by combining the pixel equivalent.

[0029] Furthermore, step S7 is included to summarize the multi-edge wear results. The same cutting edge is repeatedly measured and the average value is taken. The maximum value among the wear widths of each cutting edge represents the current wear state of the milling tool, and the wear value and corresponding judgment result are output.

[0030] For example, the wear width of the flank face measured in the i-th measurement. according to Calculate, where k is the pixel equivalent. The initial feature distance in the intact state. The current feature distance is used; the same cutting edge is measured three times and the average value is taken as the wear width of the flank face of the cutting edge, and the maximum value of the wear width of the flank face of each cutting edge is used to characterize the current wear state of the milling tool.

[0031] A machine vision-based in-situ measurement system for milling tool wear includes an image acquisition module, an image preprocessing module, a threshold segmentation module, a wear measurement module, a result output module, and a parameter and reference storage module. Each module transmits data based on the same tool flank image, threshold segmentation results, and measurement reference.

[0032] The image preprocessing module receives the back face image, converts the back face image to the HSV color space, constructs a high-brightness soft mask based on the luminance and saturation channels, performs target luminance fusion and V channel gamma correction on the highly reflective areas, converts the luminance-corrected image to grayscale, and uses an improved fast nonlocal mean filter for noise reduction to obtain a preprocessed image, which is then sent to the threshold segmentation module.

[0033] The threshold segmentation module receives the preprocessed image, uses the multi-threshold Otsu total inter-class variance as the fitness, employs a fractional-order enhanced dung beetle optimization algorithm to search for four ordered optimal thresholds, and divides the preprocessed image into five gray-level categories according to the four ordered optimal thresholds to obtain five gray-level segmented images, and sends the five gray-level segmented images to the wear measurement module.

[0034] The wear measurement module is used to receive the five types of grayscale segmented images, as well as the setting information of the measurement area, reference point, and target grayscale category. It fits a reference straight line according to the reference point, extracts the target pixel set corresponding to the target grayscale category in the measurement area, calculates the current feature distance from the target pixel set to the reference straight line, and calculates the back face wear width of each cutting edge according to the pixel equivalent, the initial feature distance in the intact state, and the current feature distance.

[0035] The result output module is used to receive the back face wear width of each cutting edge, average the repeated measurement results of the same cutting edge, and use the maximum value of the average wear width of each cutting edge to characterize the current wear state of the milling tool. It generates wear judgment results according to the preset wear judgment threshold, and displays and stores the wear value and wear judgment results.

[0036] The parameter and baseline storage module is used to store pixel equivalents, initial feature distances of each cutting edge in good condition, high-brightness soft mask parameters, gamma correction parameters, improved fast nonlocal mean filter parameters, fractional-order enhanced dung beetle optimization parameters, and wear judgment threshold.

[0037] A computing device includes one or more processors and a storage device, wherein the storage device stores one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors perform the above-described visual measurement method for milling tool wear.

[0038] A computer-readable storage medium storing a program that, when executed by a processor, implements the above-described machine vision-based in-situ measurement method for milling tool wear.

[0039] The machine vision-based in-situ measurement method and system for milling tool wear can reduce the impact of metal reflection and local grayscale fluctuations on threshold segmentation, improve the stability of threshold search under complex grayscale distributions, and achieve semi-automatic quantitative measurement of the wear width of the milling tool's flank face. It has the following advantages:

[0040] (1) Based on the V and S channels, a continuous high-brightness soft mask is constructed, and the original brightness and the target brightness are smoothly fused. This allows the processing to mainly act on the strong reflective area that is close to white, reducing the gray-scale abrupt change introduced by the binary truncation at the mask boundary. Combined with V channel gamma correction, it can weaken the continuous reflection and background halo.

[0041] (2) IFNLM uses Gaussian–Tukey composite weights to suppress the influence of low similarity neighborhoods on the filtering results, and uses integral maps to reduce the repeated calculation of neighborhood block distances, thus weakening isolated pixels and local grayscale fluctuations while preserving the cutting edge, wear boundary and processing texture.

[0042] (3) FDBO is used for four-dimensional threshold search of multi-threshold Otsu. Global exploration and local development are coordinated by oscillation balance factor, fractional dynamic boundary and optimal individual variation based on t distribution. Threshold repair ensures that the output threshold is orderly and effective, which is conducive to improving the stability of threshold search under complex multi-peak gray distribution.

[0043] (4) Define the current feature distance by using a unified reference line, target grayscale category pixel set and minimum vertical distance, and then subtract it from the initial feature distance of the intact tool so that the segmentation result can be directly mapped to the wear width of the back face, forming a closed chain from image segmentation to physical size calculation.

[0044] (5) By fixing the measurement position, fixing the cutting sequence, calibrating the pixel equivalent, taking the average value of repeated single-cutting measurements and summarizing the maximum value of multiple cuttings, the comparability of measurements between different processing stages can be improved, and the tool wear status for tool change judgment can be output. Attached Figure Description

[0045] Figure 1 This is a flowchart illustrating the machine vision-based in-situ measurement method for milling tool wear.

[0046] Figure 2 This is a schematic diagram of the architecture of the machine vision-based in-situ measurement system for milling tool wear.

[0047] Figure 3a This is a schematic diagram of in-situ acquisition of tool flank face images and hardware layout for an in-situ detection scheme.

[0048] Figure 3b This is a schematic diagram of the image acquisition, data transmission, and host computer processing flow of the in-situ detection scheme.

[0049] Figure 4 This is a flowchart of the highlight constraint, V-channel gamma correction, and IFNLM preprocessing.

[0050] Figure 5 This is a flowchart of the threshold search process for the FDBO-optimized multi-threshold Otsu.

[0051] Figure 6 This is a schematic diagram of VB calculation based on a reference line and feature distance. Detailed Implementation

[0052] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments. The embodiments are used to explain the present invention and are not intended to limit the scope of protection of the present invention. Equivalent substitutions made by those skilled in the art to the image acquisition components, parameter ranges, threshold numbers, and software deployment methods without departing from the technical concept of the present invention can all be considered implementations of the present invention.

[0053] like Figure 1 As shown, a machine vision-based method for in-situ measurement of milling tool wear includes the following steps:

[0054] S1: Perform image acquisition and measurement benchmark initialization, determine pixel equivalent and obtain the initial feature distance of each cutting edge in good condition; in subsequent machining, control the tool to move to the preset measurement position and acquire the back face image of each cutting edge according to a fixed cutting edge sequence;

[0055] Step S1 includes the following steps:

[0056] S11: Using a calibration component with known dimensions, determine the pixel equivalent at the preset measurement position and fixed imaging magnification, acquire images of the back face of each cutting edge in good condition, and obtain the initial feature distance;

[0057] The initial feature distance of each cutting edge can be obtained by using the same reference line and target pixel ranging method as S5.

[0058] S12: In the subsequent processing, that is, in the milling process, the milling tool stops rotating after each preset processing step, and the milling tool is controlled to move to the preset measurement position. The back face image of each cutting edge of the milling tool is collected according to the fixed cutting edge sequence.

[0059] S2: Convert the back face image to the HSV color space, construct a high-brightness soft mask based on the luminance channel V and the saturation channel S, use the high-brightness soft mask to perform target brightness fusion on the highly reflective area, and perform gamma correction on the fused luminance channel to obtain a luminance-corrected image.

[0060] Combination Figure 4 As shown, it includes the following steps:

[0061] The luminance channel V and saturation channel S are normalized to v and s, respectively, and the high-brightness soft mask is constructed according to the following formula. :

[0062] ;

[0063] in, pixel position The highlight soft mask weight at the location has a value range of [0,1]. and Pixel positions The normalized brightness and saturation values; The high brightness threshold is set at the beginning of the threshold. Low saturation threshold; This indicates that the calculation results are limited to the range [0,1]. The first term in the formula characterizes the degree to which pixel brightness exceeds the high brightness threshold, and the second term characterizes the degree to which pixel saturation is below the low saturation threshold. The product of these two terms gives a larger mask weight to near-white, highly reflective areas that are both bright and low-saturation. Target brightness fusion is then performed according to the following formula:

[0064] ;

[0065] in, For high-brightness soft masks After smoothing, at pixel position Weight at each location; This is the original normalized brightness value at that pixel location; Preset target brightness; This is the normalized brightness value after target brightness fusion. When the value is close to 0, the fusion result mainly retains the original brightness; when... As the value approaches 1, the fusion result gradually approaches the target brightness. This allows for continuous and smooth brightness constraints on highly reflective areas.

[0066] S3: Convert the brightness-corrected image to grayscale and use an improved fast nonlocal mean (IFNLM) filter to denoise the grayscale image to obtain a preprocessed image;

[0067] The improved fast nonlocal mean filtering calculates the difference between the central neighborhood block and candidate neighborhood blocks within the search window, uses the product of Gaussian weights and Tukey truncation weights as composite weights, and calculates the neighborhood block distance through the pixel difference integral map to reduce the influence of low similarity neighborhoods on the filtering results and reduce repeated summation of neighborhood blocks, thereby obtaining a preprocessed image that preserves boundaries and texture, and establishing a grayscale histogram of the preprocessed image.

[0068] S4: Based on the grayscale histogram of the preprocessed image, the fractional-order enhanced dung beetle optimization algorithm is used to iteratively optimize the candidate threshold vector composed of four candidate thresholds, output four ordered optimal thresholds, and divide the preprocessed image into five grayscale categories based on the four ordered optimal thresholds to obtain five grayscale segmentation images.

[0069] Using FDBO-Otsu, we describe a grayscale segmentation method that iteratively optimizes the threshold combinations of multi-threshold Otsu using the fractional-order enhanced dung beetle optimization algorithm (FDBO) described in this paper. The total inter-class variance of the multi-threshold Otsu is used as the fitness function of FDBO. Each FDBO individual represents a set of candidate segmentation thresholds. FDBO searches for combinations of candidate thresholds, and the threshold combination corresponding to the final globally optimal individual is taken as the optimal segmentation threshold for multi-threshold Otsu. This embodiment uses four optimal thresholds to divide the preprocessed image into five grayscale categories.

[0070] like Figure 5 As shown, this step represents each individual as a four-dimensional candidate threshold vector. Threshold optimization is achieved through FDBO oscillation balancing, fractional-order dynamic boundary, and t-distribution mutation mechanisms. Boundary constraints, rounding, sorting, and duplicate value repair are applied to the candidate thresholds, outputting four ordered optimal thresholds and forming five-class grayscale segmentation images. The total inter-class variance of the candidate threshold vectors before and after the update is compared, and candidate threshold vectors with higher fitness are retained.

[0071] Specifically: Each FDBO individual represents a four-dimensional candidate threshold vector:

[0072] ;

[0073] in, , , and These represent the four candidate segmentation thresholds corresponding to the i-th individual, i.e., the four threshold components of the four-dimensional candidate threshold vector. The FDBO population consists of multiple individuals with the above-mentioned candidate solutions, and is divided into rolling individuals, breeding individuals, foraging individuals, and stealing individuals according to different search behaviors.

[0074] During the iteration process, the rolling ball individual, the breeding individual, the foraging individual, and the stealing individual update their four-dimensional candidate threshold vectors according to their respective position update strategies. Among them, the rolling ball individual updates its position by combining the current individual, historical position, and worst individual, and uses an oscillation balance factor to adjust the search amplitude; the breeding individual establishes a search boundary around the local optimal individual and adjusts the local search range using a fractional-order dynamic boundary that includes the historical iteration state; the foraging individual establishes a search boundary around the global optimal individual and adjusts its local search range using a fractional-order dynamic boundary; the stealing individual updates its position based on the positions of the local optimal individual and the global optimal individual, and performs a t-distribution-based dimension-wise mutation on the current global optimal individual.

[0075] After each individual position update, the updated four-dimensional candidate threshold vector is subjected to gray-level boundary constraints, integerization, ascending sorting, and duplicate threshold repair, and the corresponding multi-threshold Otsu total inter-class variance is calculated. Based on the fitness comparison results, candidate threshold vectors with higher fitness are retained. After reaching the maximum number of iterations or meeting a preset termination condition, the current globally optimal threshold combination is output, and five gray-level segmentation images are generated in order from low gray-level to high gray-level. The five gray-level categories are used for feature separation and boundary localization, and are not limited to fixed physical regions.

[0076] Furthermore, in step S4, let the candidate threshold vector be... The grayscale range is divided into five intervals based on the candidate threshold vector. The pixel weight and average grayscale value of each interval are calculated, and the total inter-class variance of the five grayscale categories is used as the fitness of the candidate threshold vector. Before each fitness calculation, the candidate threshold vector undergoes grayscale boundary constraints, integerization, ascending sorting, and duplicate threshold repair to ensure it meets the following requirements. .

[0077] S5: Receive the measurement area, reference point and target gray level category set for the five types of gray level segmented images, fit a reference line according to the reference point, extract the target pixel set belonging to the target gray level category in the measurement area, and determine the minimum vertical distance from the target pixel set to the reference line as the current feature distance;

[0078] like Figure 6 As shown, the system receives the operator's settings for the measurement area, reference point, and target grayscale category. Based on the reference point, it fits a reference straight line and extracts the pixel set of the target grayscale category within the measurement area. The reference straight line has the form Ax + By + C = 0. For the target pixel set... Any target pixel in Its perpendicular distance to the reference line for The current feature distance This is the minimum vertical distance from each target pixel in the target pixel set to the reference line. Represents the target pixel set The j-th target pixel in and Representing the target pixels respectively The horizontal and vertical coordinates in the image coordinate system; A, B, and C are the line parameters of the reference line Ax+By+C=0 obtained by fitting based on the reference point; Indicates target pixel The perpendicular distance to the reference line; This represents the current feature distance corresponding to the i-th measurement.

[0079] S6: Calculate the back face wear width of each cutting edge based on the pixel equivalent, the initial feature distance, and the current feature distance, and output the wear detection result of the milling tool based on the back face wear width of each cutting edge.

[0080] The current back face wear width is obtained by subtracting the current feature distance from the initial feature distance in the intact state and combining it with the pixel equivalent.

[0081] Step S7: Summarize the multi-edge wear results. Repeatedly measure the same cutting edge and take the average value. Use the maximum value among the wear widths of each cutting edge to represent the current wear state of the milling tool, and output the wear value and corresponding judgment result.

[0082] For example, the wear width of the flank face measured in the i-th measurement. according to Calculate, where k is the pixel equivalent. The initial feature distance in the intact state. The current feature distance is used; the same cutting edge is measured three times and the average value is taken as the wear width of the flank face of the cutting edge, and the maximum value of the wear width of the flank face of each cutting edge is used to characterize the current wear state of the milling tool.

[0083] like Figure 2 As shown, a machine vision-based in-situ milling tool wear measurement system includes an image acquisition module, an image preprocessing module, a threshold segmentation module, a wear measurement module, a result output module, and a parameter and reference storage module. Each module transmits data based on the same tool flank image, threshold segmentation results, and measurement reference.

[0084] The image acquisition module includes an industrial camera, a lens, an LED lighting assembly, and an acquisition control unit that communicates with the machine tool controller. The light emission center line of the LED lighting assembly, the optical axis of the lens, and the imaging optical axis of the industrial camera are arranged along the same center line. The image acquisition module is used to receive measurement trigger signals, communicate with the machine tool controller through the acquisition control unit, coordinate the milling cutter to stop rotating, move to a preset measurement position and perform fixed cutting edge sequence positioning, acquire the back face image of each cutting edge, and send the acquired back face image to the image preprocessing module.

[0085] The image preprocessing module receives the back face image, converts the back face image to the HSV color space, constructs a high-brightness soft mask based on the luminance and saturation channels, performs target luminance fusion and V channel gamma correction on the highly reflective areas, converts the luminance-corrected image to grayscale, and uses an improved fast nonlocal mean filter for noise reduction to obtain a preprocessed image, which is then sent to the threshold segmentation module.

[0086] The threshold segmentation module receives the preprocessed image, uses the multi-threshold Otsu total inter-class variance as the fitness, employs a fractional-order enhanced dung beetle optimization algorithm to search for four ordered optimal thresholds, and divides the preprocessed image into five gray-level categories according to the four ordered optimal thresholds to obtain five gray-level segmented images, and sends the five gray-level segmented images to the wear measurement module.

[0087] The wear measurement module is used to receive the five types of grayscale segmented images, as well as the setting information of the measurement area, reference point, and target grayscale category. It fits a reference straight line according to the reference point, extracts the target pixel set corresponding to the target grayscale category in the measurement area, calculates the current feature distance from the target pixel set to the reference straight line, and calculates the back face wear width of each cutting edge according to the pixel equivalent, the initial feature distance in the intact state, and the current feature distance.

[0088] The result output module is used to receive the back face wear width of each cutting edge, average the repeated measurement results of the same cutting edge, and use the maximum value of the average wear width of each cutting edge to characterize the current wear state of the milling tool. It generates wear judgment results according to the preset wear judgment threshold, and displays and stores the wear value and wear judgment results.

[0089] The parameter and baseline storage module is used to store pixel equivalents, initial feature distances of each cutting edge in good condition, high-brightness soft mask parameters, gamma correction parameters, improved fast nonlocal mean filter parameters, fractional-order enhanced dung beetle optimization parameters, and wear judgment threshold.

[0090] Step S1 of the machine vision-based in-situ measurement of milling tool wear is completed collaboratively by the image acquisition module, the wear measurement module, and the parameter and reference storage module; the processing of steps S2 to S3 corresponds to the image preprocessing module; the processing of step S4 corresponds to the threshold segmentation module; the processing of steps S5 to S6 corresponds to the wear measurement module; the processing of step S7 corresponds to the result output module; and the parameter and reference storage module is used throughout the entire process.

[0091] Example 1: System Configuration and Image Acquisition;

[0092] The milling tool wear visual measurement system in this embodiment includes an image acquisition module, an image preprocessing module, a threshold segmentation module, a wear measurement module, a result output module, and a parameter and benchmark storage module.

[0093] like Figure 3aThe diagram shows the in-situ acquisition and hardware layout of the tool flank image, including a milling platform, the tool under test, an LED lighting assembly, a lens, an industrial camera, an image acquisition unit, and a host computer. The light output center line of the LED lighting assembly, the optical axis of the lens, and the imaging optical axis of the industrial camera are arranged along the same center line. The industrial camera and LED lighting assembly are fixedly installed relative to a preset measurement position to acquire flank images of each cutting edge of the tool under test and transmit the acquired flank images to the host computer. The fixed installation of the industrial camera and LED lighting assembly relative to the preset measurement position ensures that the imaging magnification, camera orientation, and lighting conditions remain consistent for tools of the same specification in each measurement.

[0094] Figure 3b This diagram illustrates the image acquisition, data transmission, and host computer processing flow. The industrial camera imaging module and the LED lighting module work together to acquire images of the tool's back face. The images are then sent to the host computer via an acquisition card or data transmission unit. The host computer then sequentially performs image preprocessing, highlight suppression, noise reduction and enhancement, wear area segmentation, wear width measurement, and display and storage of the detection results.

[0095] During the system initialization phase, a mapping relationship between image pixels and actual length is established using a calibration component with known dimensions, thus obtaining the pixel equivalent. The unit can be μm / pixel. Under the same imaging magnification and tool measurement position, images of the flank face of each cutting edge of a four-flute end mill are acquired in good condition. The initial feature distance of each cutting edge is obtained using the reference line and target pixel ranging method described later. The pixel equivalent and initial feature distance are stored in the parameter and benchmark storage module.

[0096] In one experimental implementation, a four-flute carbide end mill was used to perform layer milling on a TC4 titanium alloy workpiece. The spindle speed was 3185 r / min, the cutting width was 3 mm, the depth of cut was 1.5 mm, and the feed rate was 764 mm / min. After each layer of milling was completed, the spindle stopped rotating, and the CNC program moved the tool to a preset measurement position, acquiring images of the flank faces of the four cutting edges according to a fixed cutting sequence. After image acquisition, the tool returned to the cutting area to continue machining.

[0097] Example 2: High-brightness soft mask and V-channel gamma correction;

[0098] The acquired RGB image of the back face was converted to the HSV color space, where Indicates hue, Indicates saturation. Indicates brightness. , Channels are normalized to the range [0,1], and denoted as follows: and To ensure that the correction primarily affects highly reflective areas close to white, while minimizing the impact on normal tool surfaces and wear textures, a high-brightness soft mask combining brightness and saturation is constructed:

[0099]

[0100] In the formula, The high brightness threshold is set at the beginning of the threshold. `clip` represents a low saturation threshold, limiting the value to the range [0,1]. As pixel brightness increases and saturation decreases, the mask weights gradually increase. Gaussian smoothing is applied to M(x,y) to obtain M̃(x,y), which is used to reduce weight abrupt changes at mask boundaries.

[0101] Let the target brightness be The brightness channel after highlight constraint for:

[0102]

[0103] This formula uses continuous weights to fuse the original brightness and the target brightness, so that highly reflective pixels are smoothly adjusted to the target brightness. Then, for... Gamma correction:

[0104]

[0105] When γ is greater than 1, the mid-to-high grayscale region undergoes nonlinear compression, which can weaken the background halo and the continuous strong reflection on the tool surface. In one implementation parameter, Vs=230, Ss=30, Vt=235, and the gamma coefficient is... Take 1.8; the corresponding parameters in the calculation formula can be converted according to the normalized scale. After completing the brightness correction, the corrected V channel is reconstructed with the original H and S channels to obtain the corrected color image, which is then converted into a grayscale image.

[0106] Example 3: IFNLM noise reduction;

[0107] After grayscale conversion, an improved fast nonlocal mean filter is performed on the region of interest containing the cutting edge and the flank face. Let the pixel to be processed be... If the candidate pixels in the search window are q, then the filtered output can be expressed as:

[0108]

[0109] in, This represents the grayscale value of the input grayscale image at candidate pixel q. This represents the output grayscale value of the pixel pp after processing using the improved fast nonlocal mean filter. for The search window is defined as w(p,q), where w(p,q) is a composite weight obtained by combining Gaussian weights and Tukey truncation weights. The smaller the difference between neighboring blocks, the larger the Gaussian weight; when the difference between normalized neighboring blocks exceeds the Tukey truncation threshold, the participation of the corresponding candidate neighborhood is significantly reduced or set to zero. To reduce the repeated summation of pixel-by-pixel in the sliding neighborhood, a pixel difference integral map is first constructed, and then the summation is performed... Figure 4 Calculate the sum of differences in the neighborhood of any rectangle using the corner points.

[0110] In one implementation, the neighborhood window is set to 5×5, the search window to 7×7, and the Gaussian weight parameters... Set the threshold to 0.10, the Tukey cutoff threshold. Set the value to 0.25. The above parameters are used to strike a balance between processing time, noise suppression, and preservation of wear boundaries; other window sizes and parameters can also be adjusted according to image resolution and imaging noise level.

[0111] Example 4: FDBO Optimization of Multi-Threshold Otsu;

[0112] After preprocessing, a grayscale histogram is constructed. Let M threshold values ​​be used. Divide the grayscale range into The first category, the The proportion of pixel-like structures is , No. The average gray level of the class is The global average gray level of the image is Then the total inter-class variance of Otsu's multi-threshold method is:

[0113]

[0114] The optimal threshold combination T* is the threshold combination that maximizes the total inter-class variance:

[0115]

[0116] In this embodiment, four thresholds are used to divide the preprocessed image into five grayscale categories. Therefore, each FDBO individual represents a four-dimensional candidate threshold vector. Before each fitness calculation, the candidate threshold is limited to the range of 1 to 254, and rounding, ascending sorting, and duplicate value repair are performed to ensure that the candidate threshold meets the requirements. .

[0117] The FDBO population comprises rolling individuals, breeding individuals, foraging individuals, and stealing individuals. During the rolling phase, candidate thresholds are updated using the current individual, historical positions, and the worst-performing individual, with the search amplitude adjusted by an oscillation balance factor throughout the iteration phases. During the breeding and foraging phases, search boundaries are established around locally optimal and globally optimal threshold individuals, respectively. These search boundaries are updated fractionally using historical boundary information from the current and previous iterations to reduce abrupt changes in the local search range. During the stealing phase, candidate thresholds are updated based on locally and globally optimal positions, and t-distribution-based dimension-wise mutation is performed on the globally optimal threshold individuals.

[0118] After each individual update, threshold repair is performed again, and the total inter-class variance is calculated. If the updated total inter-class variance is higher than before the update, the updated candidate threshold vector is retained. After reaching the maximum number of iterations or meeting the preset termination condition, the current globally optimal threshold combination is output, and five gray-level segmentation images are generated in order from low gray-level to high gray-level. The five gray-level categories are used for feature separation and boundary localization and are not limited to fixed physical regions.

[0119] In one implementation, the population size is set to 30 and the maximum number of iterations is set to 50. Other population sizes and iteration counts can also be set according to image resolution and processing time requirements.

[0120] Example 5: Reference line, feature distance, and VB calculation;

[0121] The system receives operator-defined settings for the measurement area, reference point, and target grayscale category on five types of grayscale segmented images. The measurement area covers a local region of the flank face of the cutting edge under test; the reference point is located on a stably identifiable reference structure or machining texture on the tool surface; and the target grayscale category is selected from the five-class segmentation results to characterize the set of pixels associated with the wear boundary.

[0122] Fitting a reference line based on two or more reference points has the following general form:

[0123] Ax + By + C = 0 (7)

[0124] Let the set of pixels corresponding to the target grayscale category within the measurement region be at the i-th measurement. The vertical distance from any target pixel Pj to the reference line. for:

[0125] (8)

[0126] Find the minimum perpendicular distance from each target pixel in the target pixel set to the reference line. Defined as the current feature distance li:

[0127] (9)

[0128] The initial feature distance corresponding to the intact tool was obtained in the same manner. Let the pixel equivalent be k, then the wear width of the back face in the i-th measurement is... for:

[0129] (10)

[0130] In the formula, , , respectively, are the converted initial feature distance and the current feature distance. To reduce random errors caused by manually selecting the measurement area, reference point, and target grayscale category, each cutting edge is measured three times, and the average value is taken as the final wear width of that cutting edge.

[0131] (11)

[0132] In the formula, Let be the wear width obtained from the r-th measurement of the m-th cutting edge, where r is the sequence number of the repeated measurement. The average value of the back face wear width obtained from three measurements of the m-th cutting edge.

[0133] Example 6: Experimental Results;

[0134] To verify the described visual measurement process, tool back face images were acquired during the initial wear, stable wear, and rapid wear stages. The high-brightness soft mask primarily responded to the near-white, highly reflective areas near the cutting edge, tool surface, and local flash. After target brightness fusion and V-channel gamma correction with γ=1.8, continuous reflections and background halos were reduced, while the tool's main outline and back face machining texture remained discernible. The average relative change in grayscale before and after IFNLM processing was approximately 0.45%, and the local grayscale standard deviation decreased by approximately 13.45%, indicating that the filtering effectively reduced isolated pixels and local grayscale fluctuations while essentially maintaining the image's grayscale levels.

[0135] In the threshold search comparison of nine tool images at different wear stages, the final average relative fitness of FDBO-Otsu was 0.99999041, and the average threshold standard deviation was 0.855 gray levels, which is about 70.5% lower than that of DBO-Otsu. The success rate of achieving a relative fitness of 0.99999 was 99.6%. The above results demonstrate that the fractional-order enhanced dung beetle optimization for four-threshold search under the parameters of this embodiment has good repeatability stability.

[0136] Using the measurement results from a calibrated industrial microscope as an independent reference, ten sets of tool images were compared. The average absolute error of the visual measurement results was 1.8 μm, and the average relative error was 1.3%. Except for one set, the relative errors of the remaining measurement results did not exceed 2.0%. The above results indicate that the technical chain described in this invention can convert five types of grayscale segmentation results into the wear width of the milling cutter's flank face, and maintain good consistency with the independent reference measurement results.

[0137] Example 7: System Operation Mode;

[0138] During system operation, the machine tool controller sends a measurement trigger signal to the image acquisition module after the preset machining process is completed. The image acquisition module controls tool docking, cutting sequence positioning, illumination, and camera exposure to acquire images; the image preprocessing module sequentially performs high-brightness soft mask constraint, V-channel gamma correction, grayscale conversion, and IFNLM; the threshold segmentation module reads the preprocessed image and outputs four optimal thresholds and five grayscale segmentation images; the wear measurement module displays the segmented images and receives the measurement area, reference point, and target grayscale category settings, automatically completing line fitting, target pixel search, current feature distance, and VB calculation; the result output module displays and stores the single-edge average VB, the four-edge maximum VB, and the wear judgment result.

[0139] The above method can be implemented by a program installed in an industrial control computer, edge computing device, or general-purpose computer. The program can be written in Python, C++, or other languages ​​capable of image processing and numerical calculation. The image acquisition module, machine tool controller, and computing device can be connected via digital triggering, industrial Ethernet, or other communication methods.

Claims

1. A machine vision-based method for in-situ measurement of milling tool wear, characterized in that, Includes the following steps: S1: Perform image acquisition and measurement benchmark initialization, determine pixel equivalent and obtain the initial feature distance of each cutting edge in good condition, move the tool to the preset measurement position and acquire the back face image according to the fixed cutting edge sequence; S2: Convert the back face image to the HSV color space, construct a high-brightness soft mask based on the luminance channel V and the saturation channel S, use the high-brightness soft mask to perform target brightness fusion on the highly reflective area, and perform gamma correction on the fused luminance channel to obtain a luminance-corrected image. S3: Convert the brightness-corrected image to grayscale and use an improved fast nonlocal mean filter to denoise the grayscale image to obtain a preprocessed image; S4: Based on the grayscale histogram of the preprocessed image, the fractional-order enhanced dung beetle optimization algorithm is used to iteratively optimize the four-dimensional candidate threshold vector composed of four candidate thresholds, outputting four ordered optimal thresholds, and the preprocessed image is divided into five grayscale categories according to the four ordered optimal thresholds to obtain five grayscale segmentation images. S5: Receive the measurement area, reference point and target gray level category set for the five types of gray level segmented images, fit a reference line according to the reference point, extract the target pixel set belonging to the target gray level category in the measurement area, and determine the minimum vertical distance from the target pixel set to the reference line as the current feature distance; S6: Calculate the back face wear width of each cutting edge based on the pixel equivalent, the initial feature distance, and the current feature distance, and output the wear detection result of the milling tool based on the back face wear width of each cutting edge.

2. The machine vision-based in-situ measurement method for milling tool wear according to claim 1, characterized in that: Step S1 includes the following steps: S11: Using a calibration component with known dimensions, determine the pixel equivalent at the preset measurement position and fixed imaging magnification, acquire images of the back face of each cutting edge in good condition, and obtain the initial feature distance; S12: In subsequent processing, the milling cutter stops rotating after completing each preset processing step, and the milling cutter is controlled to move to a preset measurement position. The back face image of each cutting edge of the milling cutter is acquired according to a fixed cutting sequence.

3. The machine vision-based in-situ measurement method for milling tool wear according to claim 1, characterized in that: Step S2 includes the following steps: The luminance channel V and saturation channel S are normalized to v and s, respectively, and the high-brightness soft mask is constructed according to the following formula. : ; in, pixel position The highlight soft mask weight at the location has a value range of [0,1]. and Pixel positions The normalized brightness and saturation values; The high brightness threshold is set at the beginning of the threshold. Low saturation threshold; This indicates that the calculation result is limited to the range [0,1]; the first term in the formula is used to characterize the degree to which the pixel brightness exceeds the high brightness threshold, and the second term is used to characterize the degree to which the pixel saturation is lower than the low saturation threshold. The product of the two terms gives a larger mask weight to the bright and low-saturation near-white strong reflective area; and target brightness fusion is performed according to the following formula: ; in, For high-brightness soft masks After smoothing, at pixel position Weight at each location; This is the original normalized brightness value at that pixel location; Preset target brightness; The normalized luminance value after target luminance fusion; when When the value is close to 0, the fusion result mainly retains the original brightness; when... As the value approaches 1, the fusion result gradually approaches the target brightness. This allows for continuous and smooth brightness constraints on highly reflective areas.

4. The machine vision-based in-situ measurement method for milling tool wear according to claim 1, characterized in that: In step S3, the improved fast nonlocal mean filtering calculates the difference between the central neighborhood block and the candidate neighborhood block within the search window, uses the product of Gaussian weight and Tukey truncation weight as the composite weight, and calculates the neighborhood block distance through the pixel difference integral map to reduce the influence of low similarity neighborhoods on the filtering result and reduce the repeated summation of neighborhood blocks, thereby obtaining a preprocessed image that preserves boundaries and texture.

5. The machine vision-based in-situ measurement method for milling tool wear according to claim 1, characterized in that: In step S4, the fractional-order enhanced dung beetle optimization algorithm is used to iteratively optimize the candidate threshold vector consisting of four candidate thresholds. This means that the fractional-order enhanced dung beetle optimization algorithm divides the candidate threshold individuals into rolling individuals, breeding individuals, foraging individuals, and stealing individuals. During the iteration process, an oscillation balance factor is used to adjust the search amplitude of rolling individuals, and the fractional-order dynamic boundary containing the historical iteration state is used to adjust the local search range of breeding individuals and foraging individuals. Finally, a t-distribution-based dimension-wise mutation is performed on the current globally optimal threshold individual. After each individual update, the total inter-class variance of the candidate threshold vectors before and after the update is compared, and the candidate threshold vectors with higher fitness are retained.

6. The machine vision-based in-situ measurement method for milling tool wear according to claim 1, characterized in that: In step S4, let the candidate threshold vector be set. The grayscale range is divided into five intervals according to the candidate threshold vector, the pixel weight and average grayscale value of each interval are calculated, and the total inter-class variance of the five grayscale categories is used as the fitness of the candidate threshold vector. The candidate threshold vector undergoes grayscale boundary constraints, integerization, ascending sorting, and duplicate threshold repair before each fitness calculation to ensure that it meets the following requirements. .

7. The machine vision-based in-situ measurement method for milling tool wear according to claim 1, characterized in that: In step S5, the operator's settings for the measurement area, reference point, and target grayscale category are received. A reference line is fitted based on the reference point, and a pixel set of the target grayscale category is extracted within the measurement area. The reference line has the form Ax + By + C = 0. For the target pixel set... Any target pixel in Its perpendicular distance to the reference line for The current feature distance The minimum vertical distance from each target pixel in the target pixel set to the reference line; where, Represents the target pixel set The j-th target pixel in and Representing the target pixels respectively The horizontal and vertical coordinates in the image coordinate system; A, B, and C are the line parameters of the reference line Ax+By+C=0 obtained by fitting based on the reference point; Represents target pixel The perpendicular distance to the reference line; This represents the current feature distance corresponding to the i-th measurement.

8. The machine vision-based in-situ measurement method for milling tool wear according to claim 1, characterized in that: It also includes step S7, which summarizes the multi-edge wear results, repeatedly measures the same cutting edge and takes the average value, uses the maximum value among the wear widths of each cutting edge to characterize the current wear state of the milling tool, and outputs the wear value and the corresponding judgment result.

9. A machine vision-based in-situ measurement system for milling tool wear, characterized in that: It includes an image acquisition module, an image preprocessing module, a threshold segmentation module, a wear measurement module, a result output module, and a parameter and benchmark storage module; among which: The image acquisition module includes an industrial camera, a lens, an LED lighting assembly, and an acquisition control unit that communicates with the machine tool controller. The light emission center line of the LED lighting assembly, the optical axis of the lens, and the imaging optical axis of the industrial camera are arranged along the same center line. The image acquisition module is used to receive measurement trigger signals, communicate with the machine tool controller through the acquisition control unit, coordinate the milling cutter to stop rotating, move to a preset measurement position and perform fixed cutting edge sequence positioning, acquire the back face image of each cutting edge, and send the acquired back face image to the image preprocessing module. The image preprocessing module is used to receive the back face image, convert the back face image to the HSV color space, construct a high-brightness soft mask based on the luminance channel and saturation channel, perform target luminance fusion and V channel gamma correction on the strong reflective area, convert the luminance correction image to grayscale, and use an improved fast nonlocal mean filter for noise reduction to obtain a preprocessed image, and send the preprocessed image to the threshold segmentation module. The threshold segmentation module is used to receive the preprocessed image, use the multi-threshold Otsu total inter-class variance as the fitness, use the fractional-order enhanced dung beetle optimization algorithm to search for four ordered optimal thresholds, and divide the preprocessed image into five gray-level categories according to the four ordered optimal thresholds to obtain five gray-level segmented images, and send the five gray-level segmented images to the wear measurement module. The wear measurement module is used to receive the five types of grayscale segmented images and the setting information of measurement area, reference point and target grayscale category. It fits a reference straight line according to the reference point, extracts the target pixel set corresponding to the target grayscale category in the measurement area, calculates the current feature distance from the target pixel set to the reference straight line, and calculates the back face wear width of each cutting edge according to the pixel equivalent, the initial feature distance in the intact state and the current feature distance. The result output module is used to receive the back face wear width of each cutting edge, average the repeated measurement results of the same cutting edge, and use the maximum value of the average wear width of each cutting edge to represent the wear state of the current milling tool. It generates wear judgment results according to the preset wear judgment threshold, and displays and stores the wear value and wear judgment results. Parameter and benchmark storage module: used to store pixel equivalents, initial feature distances of each cutting edge in good condition, high-brightness soft mask parameters, gamma correction parameters, improved fast nonlocal mean filter parameters, fractional-order enhanced dung beetle optimization parameters, and wear judgment threshold.

10. A computing device, characterized in that, The method includes one or more processors and a storage device, wherein the storage device stores one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors perform the machine vision-based in-situ measurement method for milling tool wear as described in any one of claims 1 to 8.