Part milling machine machining detection method and system

By using grayscale and brightness abnormality index to construct feature vectors and calculate scratch index in the detection of parts by milling machine machining, the problems of missed and missed detection in existing detection methods are solved, and the accuracy of detection is improved.

CN119963544AActive Publication Date: 2025-05-09SHAANXI HUACHEN AVIATION TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510428223.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-05-09
Estimated Expiration
2045-04-08

AI Technical Summary

Technical Problem

Existing methods for detecting surface scratches of milling machines are prone to missed and missed inspections during the inspection process, resulting in low detection accuracy.

Method used

The color image processing method is used to calculate the grayscale anomaly index and brightness anomaly index of pixel points, build a feature vector, and calculate the scratch index, and identify the scratch area through clustering analysis.

Benefits of technology

It improves the accuracy of the inspection of parts of the milling machine, avoids missed inspection of scratch areas, and enhances the detection ability of slight scratches.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119963544A_ABST
    Figure CN119963544A_ABST
Patent Text Reader

Abstract

The invention relates to the field of part detection, in particular to a part milling machine machining detection method and system, and the method comprises the steps: obtaining a color image of a milling machine machining part, and converting the color image to obtain a gray image; calculating gray abnormal indexes of pixel points in the gray image; calculating brightness anomaly indexes of pixel points in the color image; constructing a corresponding pixel point feature vector by using the gray anomaly index and the brightness anomaly index; the scratch index of the pixel points is calculated, the pixel points with the scratch index larger than a preset scratch threshold value serve as mark points, the mark points are clustered to obtain a plurality of clustering clusters, and when the number of the data points in the clustering clusters is larger than a preset number threshold value, a prompt that scratches exist on the surface of the part is sent out. The accuracy of milling machine part detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of parts detection, and in particular to a parts milling machine processing detection method and system. Background Art

[0002] Milling machine is a common mechanical processing equipment. It is mainly used for cutting metal materials, especially in surface processing, forming processing, bevel processing and curve processing. Common processing methods of milling machines are: plane milling, slot milling, side milling, forming milling and gear milling. Among them, plane milling is used to process the plane of the workpiece, usually using a plane milling cutter for cutting. In the plane milling process, due to improper tool selection, inappropriate cutting parameters, and loose fixation of the workpiece or fixture, the machine tool, tool or workpiece will vibrate, further causing the machined surface to be uneven and tool marks, i.e. scratches, will appear. Based on the characteristics of milling processing, scratches generally appear on the surface of parts in an approximately straight line.

[0003] A Chinese patent application document with publication number CN115760696A discloses a surface scratch detection method, which relates to the technical field of machine vision defect detection. The method comprises the following steps: using an image acquisition device to acquire a product surface image, and performing image processing on the acquired surface image to obtain an area to be detected; preprocessing the image of the area to be detected; performing edge detection on the preprocessed image of the area to be detected, and performing image fusion on different edge detection image results to obtain a fused edge detection image; processing the fused edge detection image to obtain an image of a marked edge; performing scratch screening on the image of the marked edge to obtain a surface scratch detection result.

[0004] The above scheme obtains the edge by performing edge detection on the image, and then obtains the detection result of the scratches on the product surface. However, due to the characteristics of milling machine processing, the surface of the part after milling by the milling machine usually has slight scratches, and the scratch depth is shallow and difficult to identify. The edge detection algorithm is prone to missed detection and false detection, resulting in low accuracy of part detection. Summary of the invention

[0005] In order to solve the problem that surface scratches of parts processed by existing milling machines are easily missed during the detection process, resulting in low detection accuracy, the present invention provides a part milling machine processing detection method and system.

[0006] In the first aspect, the present invention provides a method for detecting parts processing by a milling machine, which adopts the following technical solution: Obtain a color image of a part processed by a milling machine, and convert the color image into a grayscale image; Calculate the grayscale anomaly index of the pixel in the grayscale image, the grayscale anomaly index is positively correlated with the absolute value of the difference between the grayscale value of the corresponding pixel and the grayscale value of other pixels; calculate the brightness anomaly index of the pixel in the color image, the brightness anomaly index is positively correlated with the absolute value of the difference between the brightness value of the corresponding pixel and the brightness value of other pixels; construct the feature vector of the corresponding pixel using the grayscale anomaly index and the brightness anomaly index; calculate the scratch index of the pixel, take the pixel whose scratch index is greater than the preset scratch threshold as the mark point, cluster the mark points to obtain multiple clusters, and issue a prompt that there are scratches on the surface of the part in response to the number of data points in the cluster being greater than the preset number threshold; The expression of scratch index is:

[0007] In the formula, Represents the scratch index of the mth pixel in the grayscale image, Represents the modulus of the feature vector of the mth pixel, represents the modulus of the feature vector of the nth neighboring pixel of the mth pixel, and k represents the total number of neighboring pixels of the mth pixel.

[0008] The feature vector is constructed using the brightness anomaly index and the grayscale anomaly index to further calculate the scratch index of the pixel point. The scratch index can be used to determine whether the corresponding pixel point area is a scratch area, thereby facilitating the detection of slight scratches on the surface of the part, improving the accuracy of milling machine part detection, and avoiding the phenomenon of missed detection of scratch areas.

[0009] Preferably, the grayscale anomaly index is calculated by performing edge detection on the grayscale image to obtain edge pixels. The grayscale anomaly index is expressed as:

[0010] In the formula, Represents the grayscale anomaly index of the mth pixel in the grayscale image, Represents the gray value of the mth pixel in the gray image. It represents the average grayscale value of the remaining pixels after removing the edge pixels in the grayscale image. represents the maximum grayscale value of the neighborhood pixels of the m-th pixel in the grayscale image, a represents the number of grayscale values ​​greater than the grayscale value of the m-th pixel in the neighborhood pixels of the m-th pixel, and norm represents the normalization function.

[0011] The grayscale anomaly index is obtained by comparing the grayscale value of the pixel with the grayscale values ​​of other pixels. The grayscale index can be used to preliminarily understand the possibility that the corresponding pixel area is a scratch area pixel.

[0012] Preferably, the method further comprises: A first window and a second window are constructed respectively with the corresponding pixel point as the center, and the area of ​​the second window is larger than the area of ​​the first window; A first grayscale co-occurrence matrix of the first window is constructed, and a first contrast of the first grayscale co-occurrence matrix is ​​calculated using a contrast calculation formula; a second grayscale co-occurrence matrix of the second window is constructed, and a second contrast of the second grayscale co-occurrence matrix is ​​calculated using a contrast calculation formula; and a ratio of the first contrast to the sum of the first contrast and the second contrast is used as a weight factor of the grayscale anomaly index of the corresponding pixel.

[0013] The influence of the grayscale anomaly index is adjusted by using the weight factor to improve the accuracy of the feature vector.

[0014] Preferably, the expression of the feature vector is:

[0015] In the formula, Represents the feature vector of the mth pixel, Represents the grayscale anomaly index of the mth pixel in the grayscale image, represents the brightness abnormality index of the m-th pixel in the grayscale image, and β represents the preset weight factor of the grayscale abnormality index of the m-th pixel.

[0016] The grayscale anomaly index and the brightness anomaly index are used to construct a feature vector, so that the feature vector can further reflect the possibility that the corresponding pixel point is a pixel point in the scratch area.

[0017] Preferably, the scratch threshold is calculated as follows: the scratch threshold is set to H, a plurality of marking points are obtained, any one of the marking points is selected as the center point, and the center point and the marking point are connected to obtain a plurality of connecting lines; Construct the objective function, the expression is:

[0018] In the formula, represents the objective function about the scratch threshold H, Represents the variance of the cosine of the angles between multiple connecting lines and the preset reference line. represents the information entropy of the grayscale value of the pixel corresponding to the marked point, and b represents the number of connecting lines; the minimum value of the objective function is solved to obtain the value of H; multiple marked points are repeatedly selected as the center points to further obtain multiple values ​​of H, and the average value of H is taken as the scratch threshold.

[0019] The objective function is constructed from parameters of multiple dimensions, and the corresponding scratch area can be accurately obtained using the objective function, providing a theoretical basis for screening pixel points in the scratch area.

[0020] Preferably, the method for selecting the reference line is: selecting a line in any direction of 0°, 45°, or 90° as the reference line.

[0021] Preferably, a swarm intelligence optimization algorithm is used to solve the minimum value of the objective function.

[0022] Preferably, the method further comprises: fitting the data points in the largest cluster using the least square method to obtain a fitting line, and further obtaining the scratch area.

[0023] Preferably, the method further comprises: performing edge detection on the grayscale image using a Canny algorithm to obtain edge pixels.

[0024] In a second aspect, the present invention provides a parts milling machine processing detection system, which adopts the following technical solution: A part milling machine processing detection system comprises: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned part milling machine processing detection method is implemented.

[0025] The above-mentioned part milling machine processing detection method is generated into a computer program and stored in a memory so as to be loaded and executed by a processor. Thus, a system is made based on the memory and the processor for easy use.

[0026] The present invention has the following technical effects: 1. The feature vector is constructed using the brightness anomaly index and grayscale anomaly index to further calculate the scratch index of the pixel point. The scratch index can be used to determine whether the corresponding pixel point area is a scratch area, which facilitates the detection of slight scratches on the surface of the part, improves the accuracy of milling machine processing parts detection, and avoids the phenomenon of missed detection of scratch areas.

[0027] 2. The weight factor of the grayscale anomaly index is adaptively calculated for each pixel point, and the influence of the grayscale anomaly index is adjusted using the weight factor, which improves the accuracy of the feature vector expression result and facilitates further search for scratch areas. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 The present invention is a flow chart of a part milling machine processing detection method. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0030] The embodiment of the present invention discloses a part milling machine processing detection method, referring to Figure 1 , including the following steps: S1: Obtain a color image of a part processed by a milling machine, and convert the color image into a grayscale image.

[0031] An industrial camera is used to collect color images of parts processed by a milling machine. The lighting condition is bright field lighting, and the image format is the HSV color space model. The brightness value of each pixel in the color image is obtained, and the color image is converted into a grayscale image to obtain the grayscale value of each pixel in the grayscale image. It should be noted that when there are slight scratches on the surface of the part processed by the milling machine, the grayscale value of the pixel in the scratch area is lower than the grayscale value of the pixel in the normal area, and in the color image, the brightness value of the pixel in the scratch area is lower than the brightness value of the pixel in the normal area.

[0032] S2: Calculate the grayscale anomaly index of the pixel points in the grayscale image and the brightness anomaly index of the pixel points in the color image.

[0033] The grayscale anomaly index indicates the difference between the grayscale value of the corresponding pixel and the grayscale values ​​of other pixels, and the brightness anomaly index indicates the difference between the brightness value of the corresponding pixel and the brightness values ​​of other pixels.

[0034] The canny algorithm is used to detect the edge of the grayscale image to obtain edge pixels, and then the edge pixels are removed to calculate the grayscale abnormality index of the remaining area pixels. The edge pixels obtained by edge detection are pixels with significant edge features, that is, the grayscale value of the edge pixels is significantly lower than the grayscale value of the normal area pixels, and the grayscale value of the pixels in the slight scratch area is between the two. Therefore, it is necessary to remove the edge pixels to reduce the interference of the edge pixels.

[0035] In one embodiment, the expression of the grayscale anomaly index is:

[0036] In the formula, Represents the grayscale anomaly index of the mth pixel in the grayscale image, Represents the gray value of the mth pixel in the gray image. It represents the average grayscale value of the remaining pixels after removing the edge pixels in the grayscale image. Indicates the maximum grayscale value of the neighborhood pixel of the mth pixel in the grayscale image. The neighborhood pixel adopts eight neighborhood pixel points. a indicates the number of grayscale values ​​greater than the grayscale value of the mth pixel in the neighborhood pixel of the mth pixel. norm indicates the normalization function. This expression is applicable to parts with complex surface contours, such as parts with holes on the surface. For example, the grayscale value of the mth pixel is 100, and the grayscale values ​​of the eight neighborhood pixel points of the mth pixel are 80, 86, 90, 95, 98, 105, 102, and 106 respectively. Among them, the grayscale values ​​105, 102, and 106 are greater than 100, and the value of a is 3.

[0037] Indicates the difference between the gray value of the corresponding pixel and the gray value average of the entire gray image. The larger the value, the greater the possibility that the corresponding pixel is abnormal. It represents the difference between the gray value of the corresponding pixel and the maximum gray value of the neighboring pixels. The larger the value, the greater the difference between the corresponding pixel and the domain pixels, and the greater the possibility that the corresponding pixel is abnormal. The scratches on the surface of the part processed by the milling machine usually exist in the form of an approximate straight line, and the width of the scratches is small. Therefore, by comparing the gray value of the corresponding pixel with the gray value of the neighboring pixels, we can preliminarily understand whether the corresponding pixel is a pixel in the scratch area.

[0038] In one embodiment, the grayscale anomaly index of the mth pixel is calculated as follows: the absolute value of the difference between the grayscale value of the mth pixel and the grayscale average value in the grayscale image is calculated, the absolute value of the difference is normalized, and the normalized result is used as the grayscale anomaly index of the mth pixel. This method is suitable for scenes with simple surface structures of parts, for example, the entire processing surface is a plane.

[0039] In summary, the grayscale anomaly index indicates the degree of abnormality of the corresponding pixel point. The larger the value, the greater the possibility that the corresponding pixel point is abnormal, that is, the greater the possibility that the corresponding pixel point area is a scratch area.

[0040] Similarly, the brightness anomaly index of each pixel in the color image is obtained. The calculation method of the brightness anomaly index is the same as the calculation method of the grayscale anomaly index, and the specific steps are not repeated here.

[0041] S3: Use the grayscale anomaly index and brightness anomaly index to construct the corresponding pixel feature vector.

[0042] S31: Calculate the weight factor of the grayscale anomaly index of the pixel point.

[0043] The calculation method is as follows: construct the first window and the second window respectively with the corresponding pixel point as the center, and the area of ​​the second window is larger than that of the first window; construct the first grayscale co-occurrence matrix of the first window, and calculate the first contrast of the first grayscale co-occurrence matrix by using the contrast calculation formula; construct the second grayscale co-occurrence matrix of the second window, and calculate the second contrast of the second grayscale co-occurrence matrix by using the contrast calculation formula; take the ratio of the first contrast to the sum of the first contrast and the second contrast as the weight factor of the grayscale anomaly index of the corresponding pixel point.

[0044] Exemplarily, a 5×5 first window and a 9×9 second window are constructed with the mth pixel as the center, the first contrast CON1 of the first gray level co-occurrence matrix is ​​calculated, and the second contrast CON2 of the second gray level co-occurrence matrix is ​​calculated. The expression of the weight factor β of the gray level anomaly index of the corresponding pixel point is: .

[0045] The contrast of the gray-level co-occurrence matrix reflects the clarity of the image and the depth of the texture grooves. The deeper the texture grooves, the greater the contrast and the clearer the visual effect; conversely, the smaller the contrast, the shallower the grooves and the blurred the effect. The contrast calculation method is an existing technology, and the specific steps and expressions are not repeated here.

[0046] S32: Construct corresponding pixel feature vectors.

[0047] The expression of the eigenvector is:

[0048] In the formula, Represents the feature vector of the mth pixel, Represents the grayscale anomaly index of the mth pixel in the grayscale image, represents the brightness anomaly index of the mth pixel in the grayscale image, and β represents the preset weight factor of the grayscale anomaly index of the mth pixel. The grayscale anomaly index and the brightness anomaly index are adjusted by the weight factor to improve the accuracy of the feature vector.

[0049] S4: Calculate the scratch index of the pixel.

[0050] The expression of scratch index is:

[0051] In the formula, Represents the scratch index of the mth pixel in the grayscale image, Represents the modulus of the feature vector of the mth pixel, represents the modulus of the feature vector of the nth neighboring pixel of the mth pixel, and k represents the total number of neighboring pixels of the mth pixel.

[0052] It reflects the abnormal possibility of the corresponding pixel point. It reflects the overall difference between the abnormal possibility of the corresponding pixel and the abnormal possibility of the other pixels. The scratch index comprehensively reflects the possibility that the corresponding pixel is a pixel in the scratch area. The higher the value, the greater the possibility that the corresponding pixel is a pixel in the scratch area. Conversely, the lower the value, the corresponding pixel is in the normal area.

[0053] S5: Calculate a scratch threshold, and use the pixel points whose scratch index is greater than a preset scratch threshold as marking points.

[0054] Set the scratch threshold to H, obtain multiple marking points, select any one of the marking points as the center point, connect the center point and the marking point to obtain multiple connecting lines; select the line in any direction of 0°, 45°, and 90° as the reference line. In practical applications, select the corresponding reference line according to the actual situation. For example, when the scratches are distributed in the horizontal direction, select the line in the 0° direction as the reference line; when the scratches are distributed in the vertical direction, select the line in the 90° direction as the reference line; when the scratches are distributed in an inclined direction, select the line in the 45° direction as the reference line.

[0055] Construct the objective function, the expression is: ; In the formula, represents the objective function about the scratch threshold H, Represents the variance of the cosine of the angles between multiple connecting lines and the preset reference line. It represents the information entropy of the gray value of the pixel corresponding to the marked point, and b represents the number of connecting lines.

[0056] On the surface of parts processed by milling machines, scratches usually exist in the form of approximate straight lines or straight lines. Indicates the overall disorder of the connection lines. The smaller the value, the more regular the connection lines are. It indicates the contribution of each connecting line to the chaos. The smaller the value, the more regular the distribution of all connecting lines is, and the more consistent it is with the rule that the connecting lines are approximately straight line structures.

[0057] The minimum value of the objective function is solved using a swarm intelligence optimization algorithm to obtain the value of H. Multiple marked points are repeatedly selected as center points to further obtain multiple values ​​of H, and the average value of the obtained H is used as the scratch threshold.

[0058] S6: Clustering the marking points to obtain a plurality of clusters, and in response to the number of data points in the cluster being greater than a preset number threshold, issuing a prompt indicating that scratches exist on the surface of the part.

[0059] Among the multiple marking points obtained, most are pixels in the scratch area, and some are noise points. Therefore, the DBSCAN clustering algorithm is used to cluster the marking points to obtain multiple clusters, where the area corresponding to the cluster with a number of data points exceeding the number threshold is the scratch area, and conversely, the data points in the cluster with a small number of data points are noise data points. The number threshold is set artificially according to the actual situation, and for example, the number threshold is 8. The data points in the largest cluster are fitted using the least squares method to obtain a fitting line, and the scratch area is further obtained to facilitate the subsequent process of processing the surface of the part.

[0060] The embodiment of the present invention further discloses a part milling machine processing detection system, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a part milling machine processing detection method according to the present invention is implemented.

[0061] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, and their configuration and functions are known in the art, so they will not be described in detail here.

[0062] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A part milling machine processing detection method, characterized in that: Includes steps: Obtain a color image of a part processed by a milling machine, and convert the color image into a grayscale image; Calculate the grayscale anomaly index of the pixel in the grayscale image, the grayscale anomaly index is positively correlated with the absolute value of the difference between the grayscale value of the corresponding pixel and the grayscale value of other pixels; calculate the brightness anomaly index of the pixel in the color image, the brightness anomaly index is positively correlated with the absolute value of the difference between the brightness value of the corresponding pixel and the brightness value of other pixels; construct the feature vector of the corresponding pixel using the grayscale anomaly index and the brightness anomaly index; calculate the scratch index of the pixel, take the pixel whose scratch index is greater than the preset scratch threshold as the mark point, cluster the mark points to obtain multiple clusters, and issue a prompt that there are scratches on the surface of the part in response to the number of data points in the cluster being greater than the preset number threshold; The expression of scratch index is: In the formula, Represents the scratch index of the mth pixel in the grayscale image, Represents the modulus of the feature vector of the mth pixel, represents the modulus of the feature vector of the nth neighboring pixel of the mth pixel, and k represents the total number of neighboring pixels of the mth pixel.

2. A part milling machine processing detection method according to claim 1, characterized in that: The calculation method of grayscale anomaly index is: edge detection is performed on the grayscale image to obtain edge pixels. The expression of grayscale anomaly index is: In the formula, Represents the grayscale anomaly index of the mth pixel in the grayscale image, Represents the gray value of the mth pixel in the gray image. It represents the average grayscale value of the remaining pixels after removing the edge pixels in the grayscale image. represents the maximum grayscale value of the neighborhood pixels of the m-th pixel in the grayscale image, a represents the number of grayscale values ​​greater than the grayscale value of the m-th pixel in the neighborhood pixels of the m-th pixel, and norm represents the normalization function.

3. A part milling machine processing detection method according to claim 2, characterized in that: The method also includes: A first window and a second window are constructed respectively with the corresponding pixel point as the center, and the area of ​​the second window is larger than the area of ​​the first window; A first grayscale co-occurrence matrix of the first window is constructed, and a first contrast of the first grayscale co-occurrence matrix is ​​calculated using a contrast calculation formula; a second grayscale co-occurrence matrix of the second window is constructed, and a second contrast of the second grayscale co-occurrence matrix is ​​calculated using a contrast calculation formula; and a ratio of the first contrast to the sum of the first contrast and the second contrast is used as a weight factor of the grayscale anomaly index of the corresponding pixel.

4. A part milling machine processing detection method according to claim 3, characterized in that: The expression of the eigenvector is: In the formula, Represents the feature vector of the mth pixel, Represents the grayscale anomaly index of the mth pixel in the grayscale image, represents the brightness abnormality index of the m-th pixel in the grayscale image, and β represents the preset weight factor of the grayscale abnormality index of the m-th pixel.

5. A part milling machine processing detection method according to claim 1, characterized in that: The calculation method of the scratch threshold is as follows: set the scratch threshold to H, obtain multiple marking points, select any marking point as the center point, connect the center point and the marking point to obtain multiple connecting lines; Construct the objective function, the expression is: ; In the formula, represents the objective function about the scratch threshold H, Represents the variance of the cosine of the angles between multiple connecting lines and the preset reference line. represents the information entropy of the grayscale value of the pixel corresponding to the marked point, and b represents the number of connecting lines; the minimum value of the objective function is solved to obtain the value of H; multiple marked points are repeatedly selected as the center points to further obtain multiple values ​​of H, and the average value of H is taken as the scratch threshold.

6. A part milling machine processing detection method according to claim 5, characterized in that: The method for selecting the reference line is: select a line in any direction of 0°, 45°, or 90° as the reference line.

7. A part milling machine processing detection method according to claim 1, characterized in that: The swarm intelligence optimization algorithm is used to solve the minimum value of the objective function.

8. A part milling machine processing detection method according to claim 1, characterized in that: The method also includes: fitting the data points in the largest cluster using the least square method to obtain a fitting line, and further obtaining a scratch area.

9. A part milling machine processing detection method according to claim 1, characterized in that: The method also includes: using the Canny algorithm to perform edge detection on the grayscale image to obtain edge pixel points.

10. A parts milling machine processing detection system, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a part milling machine processing detection method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Surface scratch detection method

    CN115760696A

  • Concave-convex mark visual detection method based on neighborhood decision and gray level co-occurrence matrix description

    CN112233116A

  • Spraying quality detection method for insulating layer of power distribution cabinet

    CN115937199A

  • Wallboard production quality detection method based on image processing

    CN117853493A

  • Intelligent detection method for surface defects of power adapter

    CN118014989A