A machine vision-based system and method for detecting surface defects in parts

Through the machine vision-based part surface defect detection system, the defect identification accuracy and efficiency problems of traditional visual inspection technology under environmental changes and material differences are solved, and the precise classification and evaluation of defects of complex shapes and sizes is achieved, which improves the effect of product quality control.

CN118691585BActive Publication Date: 2025-02-28KUNSHAN KANGTAIDA INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202410841573.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2025-02-28
Estimated Expiration
2044-06-27

AI Technical Summary

Technical Problem

When traditional visual inspection technology responds to different environmental changes and material differences, it is difficult to accurately capture subtle surface defects, which affects the accuracy and detection efficiency of defect recognition. It lacks flexibility and adaptability, making it difficult to accurately classify and evaluate defects of complex shapes or different sizes.

Method used

The part surface defect detection system based on machine vision is adopted, and the exposure and focal length parameters of the image acquisition equipment are adjusted through the image optimization processing module, color balance and contrast adjustment are performed, and the image after optimization is obtained; then, local contrast analysis is performed through the defect type identification module to identify the defect type, and the defect area and shape impact is calculated through the defect quantization evaluation module, and finally the overall defect severity is evaluated by the overall defect evaluation module.

Benefits of technology

It improves image quality, enhances the recognizability of defects, accurately matches and identifys defect types, improves the accuracy of defect classification, and conducts quantitative evaluation of the severity of each type of defect, optimizes the quality control of parts, and ensures that product quality meets high standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The present invention relates to the field of defect detection technology, specifically to a part surface defect detection system and method based on machine vision, the system comprising an image optimization processing module, a defect type recognition module, a defect quantification evaluation module and an overall defect evaluation module. The present invention improves the image quality by optimizing the part surface image, makes the local contrast analysis more accurate, enhances the recognizability of defects in the image, and can accurately match and identify the defect type by comparing with a preset part defect feature library, effectively improves the accuracy of defect classification, and accurately quantifies the severity of the defect by evaluating the area and shape of each type of defect, providing detailed data support for the overall defect evaluation, and can effectively grade the surface integrity of the part, optimize the quality control of the part, and ensure that the final quality of the product meets high standards.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of defect detection, and in particular to a system and method for detecting surface defects of parts based on machine vision. Background Art

[0002] The field of defect detection technology mainly involves the use of automated or semi-automated systems and methods to identify and classify defects on materials or parts. Defect detection technology is often used in manufacturing, production and quality control processes to improve product quality and production efficiency and reduce the need for manual inspection. Defect detection technologies include visual inspection, ultrasonic inspection and X-ray inspection, which can identify cracks, holes, wear, corrosion or other defects, and then evaluate whether the product meets quality standards.

[0003] Among them, the part surface defect detection system is a technical solution specially designed to detect and evaluate surface defects of mechanical parts. The main purpose of the system is to automatically identify any abnormalities or damage on the surface, such as scratches, dents, unevenness or other forms of defects during the manufacturing and quality control process. By accurately identifying various defects. This helps to improve production efficiency, reduce scrap rates, and ensure that products meet high quality standards.

[0004] When traditional defect detection systems cope with different environmental changes and material differences, traditional visual inspection technology will suffer from poor image quality and find it difficult to accurately capture subtle surface defects, affecting the accuracy of defect identification and detection efficiency. Traditional systems lack sufficient flexibility and adaptability when conducting quantitative evaluations of defects, making it difficult to accurately classify and evaluate defects of complex shapes or varying sizes, leading to higher scrap rates in the production process and higher quality control costs. Summary of the invention

[0005] The purpose of the present invention is to solve the shortcomings of the prior art and to propose a system and method for detecting surface defects of parts based on machine vision.

[0006] In order to achieve the above object, the present invention adopts the following technical solution: a part surface defect detection system based on machine vision, the system comprising:

[0007] The image optimization processing module is based on the surface characteristics of the part to be inspected, which include the surface material and color of the part. Combined with the light intensity and color of the inspection environment, the exposure and focal length parameters of the image acquisition device are adjusted to capture the part surface image, and the color balance and contrast of the part surface image are adjusted to obtain the optimized image.

[0008] The defect type recognition module identifies the surface defects of the differentiated parts through local contrast analysis based on the optimized image, compares the sample data in the preset part defect feature library, calculates the matching degree between the current defect and the preset defect, identifies the type of defect, including scratches and dents, and obtains the defect category recognition result;

[0009] The defect quantification assessment module identifies the edge contour of each type of defect based on the defect category identification result, calculates the area of ​​each type of defect on the part, and evaluates the size level of each type of defect in combination with the shape of each type of defect to obtain a defect size assessment result;

[0010] The overall defect assessment module assesses the overall defect severity based on the defect category identification results and defect size assessment results, combined with the location of each type of defect, and grades the surface integrity of the parts according to the overall defect severity to obtain an overall defect assessment result.

[0011] The present invention is improved in that the method for adjusting the exposure and focal length parameters of the image acquisition device is:

[0012] Based on the part detection environment, obtain the light intensity and light color indicators through the formula:

[0013]

[0014] Calculate the ambient light adjustment factor γ;

[0015] Wherein, I is the ambient light intensity measured in real time, I0 is the standard ambient light intensity, C is the ambient light color index measured in real time, C0 is the standard ambient light color index, α is the ambient light attenuation adjustment coefficient, θ is the index of the intensity affected by the color difference, γ is the ambient light adjustment factor, and e is the base of the natural logarithm;

[0016] According to the ambient light adjustment factor γ, combined with the surface material and color characteristics of the part, the formula is:

[0017] E=E0×γ×k1

[0018]

[0019] Calculate the exposure parameter E and focal length parameter F of the acquisition device, and apply the exposure parameter E and focal length parameter F of the acquisition device to the image acquisition device to capture the surface image of the part and obtain basic image data;

[0020] Among them, E is the exposure parameter of the image acquisition device, F is the focal length parameter of the image acquisition device, E0 and F0 are the default exposure parameter and focal length parameters of the image acquisition device respectively, k1 is the material light reflection coefficient, β and δ are adjustment factors, and γ is the ambient light adjustment factor.

[0021] The present invention is improved in that the step of acquiring the image after the optimization process is:

[0022] Based on the basic image data, by the formula:

[0023]

[0024] Calculate the adjusted image color value C new ;

[0025] Among them, C old is the color value in the base image, C target is the desired color balance target, C mean is the average value of the current channel, λ is the color adjustment coefficient, ρ is the nonlinear adjustment coefficient, C new is the adjusted image color value;

[0026] Based on the basic image data, by the formula:

[0027]

[0028] Calculate the adjusted image brightness value I new ;

[0029] Among them, I old Represents the brightness value in the base image, I min and I max are the minimum and maximum values ​​of image brightness, κ is the contrast enhancement coefficient, e is the base of the natural logarithm, I new is the brightness value of the image after adjustment;

[0030] Based on the adjusted image color value C new and the adjusted image brightness value I new , integrate the adjusted color and contrast data, resynthesize the image, and obtain the optimized image.

[0031] The present invention is improved in that the step of obtaining the defect category identification result is:

[0032] Based on the optimized image, the formula is:

[0033]

[0034] Calculate the contrast value D of the feature;

[0035] Among them, I z Indicates the brightness value of the zth pixel in the area, I avg is the average brightness of pixels in the area, N D is the total number of pixels in the area, and D is the contrast value of the feature;

[0036] Based on the contrast value D of the feature, it is compared with the sample data in the preset part defect feature library, through the formula:

[0037]

[0038] Calculate the matching degree M:

[0039] Among them, D i is the contrast value of the jth feature in the image, D j,ref is the contrast value of the corresponding feature in the feature library, w j is the weight coefficient of each feature, m is the total number of features, M is the matching degree, and j is the index;

[0040] The matching degree M is compared with a preset matching degree threshold. If the matching degree M exceeds the preset matching degree threshold, it is determined to be a corresponding defect category, and a defect category identification result is obtained.

[0041] The present invention is improved in that the step of obtaining the defect size evaluation result is:

[0042] Based on the defect category recognition results, the edge contour of each type of defect is identified by the formula:

[0043]

[0044] Calculate the defect area A;

[0045] Among them, (x i ,y i ) and (x i+1 ,y i+1 ) are the coordinates of the i-th point and the i+1-th point on the defect contour, n is the total number of points on the contour, i is the index, and A is the defect area;

[0046] Based on the defect area A, by the formula:

[0047]

[0048] Calculate the shape influence S;

[0049] Among them, S is the shape effect, P is the perimeter of the defect contour, C is the sum of the curvatures of the defect shape, and A is the defect area;

[0050] Based on the defect area A and shape influence S, by the formula:

[0051]

[0052] Calculate the defect size level L and obtain the defect size assessment result;

[0053] Among them, k is the scaling factor, η is the shape complexity adjustment coefficient, L is the defect size level, S is the shape impact, and A is the defect area.

[0054] The present invention is improved in that the method for evaluating the severity of the overall defect is:

[0055] Based on the defect category identification results and defect size assessment results, combined with the location of each type of defect, the formula is:

[0056]

[0057] Calculate the overall defect severity score Z;

[0058] Where Z is the overall defect severity score, α is the adjustment factor, and L f is the size level of the fth defect, w c,f is the defect category weight, w p,f is the defect location weight, N Z is the total number of defects;

[0059] Based on the overall defect severity score Z, the defect severity of the part is evaluated according to the size of the overall defect severity score Z.

[0060] The present invention is improved in that the steps of obtaining the overall defect assessment result are:

[0061] Based on the severity score Z of the overall defect, by the formula:

[0062]

[0063] Calculate the surface integrity grade R of the parts;

[0064] Among them, Z is the severity score of the overall defect, R represents the surface integrity grade of the part, μ is the median parameter, and σ is the standard deviation parameter;

[0065] Based on the surface integrity grade R of the part, it is compared with the preset grade threshold, grade classification is performed, and the overall defect assessment result is obtained.

[0066] A part surface defect detection method based on machine vision, wherein the part surface defect detection method based on machine vision is performed based on the above-mentioned part surface defect detection system based on machine vision, and comprises the following steps:

[0067] S1: Based on the surface characteristics of the part to be inspected, combined with the light intensity and color in the inspection environment, adjust the exposure and focal length parameters of the image acquisition device, collect the part surface image, and generate the basic image data set;

[0068] S2: Based on the basic image data set, perform color balance and contrast adjustment to optimize image quality and obtain an optimized image;

[0069] S3: Based on the optimized image, identify the defect area in the image, compare it with a preset part defect feature library, calculate the matching degree, identify the defect type, and obtain a defect recognition result;

[0070] S4: Based on the defect identification result, the contour of each defect is determined by an edge detection algorithm, the area of ​​each defect is calculated, and the severity of the defect is evaluated according to the shape and size of the defect to generate defect quantitative data;

[0071] S5: Based on the defect identification results and defect quantification data, evaluate the location of each type of defect and its overall impact on the surface integrity of the part, classify the defects according to their severity, and generate an overall defect evaluation result.

[0072] Compared with the prior art, the advantages and positive effects of the present invention are:

[0073] In the present invention, by optimizing the part surface image, the image quality is improved, the local contrast analysis is made more accurate, the recognizability of defects in the image is enhanced, and by comparing with a preset part defect feature library, the defect type can be accurately matched and identified, effectively improving the accuracy of defect classification, and evaluating the area and shape of each type of defect, accurately quantifying the severity of the defect, providing detailed data support for the overall defect evaluation, and being able to effectively grade the surface integrity of the part, thereby optimizing the quality control of the part and ensuring that the final quality of the product meets high standards. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] Figure 1 is a system flow chart of the present invention;

[0075] Figure 2 A flow chart for adjusting exposure and focus parameters of an image acquisition device for the present invention;

[0076] Figure 3 A flowchart of obtaining an optimized image according to the present invention;

[0077] Figure 4 A flow chart for obtaining defect category identification results for the present invention;

[0078] Figure 5 A flow chart for obtaining defect size evaluation results for the present invention;

[0079] Figure 6 Flowchart for assessing overall defect severity for the present invention;

[0080] Figure 7Flow chart for obtaining overall defect assessment results for the present invention. DETAILED DESCRIPTION

[0081] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0082] In the description of the present invention, it should be understood that the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating positions or positional relationships, are based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, in the description of the present invention, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0083] Example

[0084] See also Figure 1 The present invention provides a technical solution: a part surface defect detection system based on machine vision, the system comprising:

[0085] The image optimization processing module is based on the surface characteristics of the part to be inspected, which include the surface material and color of the part. Combined with the light intensity and color of the inspection environment, the exposure and focal length parameters of the image acquisition device are adjusted to capture the part surface image, and the color balance and contrast of the part surface image are adjusted to obtain the optimized image.

[0086] The defect type recognition module identifies differentiated part surface defects based on the optimized image through local contrast analysis, compares them with the sample data in the preset part defect feature library, calculates the matching degree between the current defect and the preset defect, identifies the defect type, including scratches and dents, and obtains the defect category recognition result;

[0087] The defect quantitative assessment module identifies the edge contour of each type of defect based on the defect category recognition results, calculates the area of ​​each type of defect on the part, and evaluates the size level of each type of defect based on the shape of each type of defect to obtain the defect size assessment results;

[0088] The overall defect assessment module evaluates the overall defect severity based on the defect category identification results and defect size assessment results, combined with the location of each type of defect, and classifies the surface integrity of the parts according to the overall defect severity to obtain the overall defect assessment results;

[0089] The optimized images include improved color saturation and contrast enhancement, the defect category recognition results include defect type and category characteristics, the defect size assessment results include the area and shape parameters of each defect, and the overall defect assessment results include the corresponding impact level of the defect and the surface integrity score.

[0090] See also Figure 2 , the method to adjust the exposure and focus parameters of the image acquisition device is:

[0091] Based on the part detection environment, obtain the light intensity and light color indicators through the formula:

[0092]

[0093] Calculate the ambient light adjustment factor γ;

[0094] Wherein, I is the ambient light intensity measured in real time, I0 is the standard ambient light intensity, C is the ambient light color index measured in real time, C0 is the standard ambient light color index, α is the ambient light attenuation adjustment coefficient, θ is the index of the intensity affected by the color difference, γ is the ambient light adjustment factor, and e is the base of the natural logarithm;

[0095] According to the ambient light adjustment factor γ, combined with the surface material and color characteristics of the part, the formula is:

[0096] E=E0×γ×k1

[0097]

[0098] Calculate the exposure parameter E and focal length parameter F of the acquisition device, and apply the exposure parameter E and focal length parameter F of the acquisition device to the image acquisition device to capture the surface image of the part and obtain basic image data;

[0099] Among them, E is the exposure parameter of the image acquisition device, F is the focal length parameter of the image acquisition device, E0 and F0 are the default exposure parameter and focal length parameters of the image acquisition device respectively, k1 is the material light reflection coefficient, β and δ are adjustment factors, and γ is the ambient light adjustment factor.

[0100] formula:

[0101]

[0102] E=E0×γ×k1

[0103]

[0104] Parameter details and how to obtain them:

[0105] Light intensity I and standard light intensity I0: I represents the ambient light intensity measured in real time, which is directly measured by the light sensor in a specific environment. I0 is the set standard light intensity, which is usually the average light intensity measured under typical indoor lighting conditions.

[0106] Light color index C and standard light color index C0: C is the ambient light color index measured in real time, and the color temperature of light can be obtained through a spectrum analyzer. C0 is the standard index of light color temperature, usually selected as neutral white light color temperature.

[0107] Light attenuation adjustment coefficient α and color difference influence intensity exponent θ: α is an empirical coefficient used to adjust the rate of light attenuation and can be set according to environmental sensitivity. θ controls the intensity of the nonlinear influence of color difference and can be set according to experimental data on the impact of light color on vision.

[0108] The device's default exposure parameter E0 and the device's default focal length parameter F0: The parameters are usually preset by the manufacturer of the image acquisition device according to standard test conditions.

[0109] Material light reflection coefficient k1, basic coefficient of color to focal length β and nonlinear adjustment factor δ: k1 represents the material's ability to reflect light, which can be obtained through material optical property testing, such as 0.5 represents half of the light is reflected. β and δ are coefficients for adjusting focal length, which are adjusted based on experimental data of equipment and usage environment and can be preset by experts.

[0110] Calculation example:

[0111] Assumptions: I = 600 lux, I0 = 500 lux, C = 5600K, C0 = 5000K, α = 0.1, θ =2.0, E0=1 / 60s, F0=50mm, k1=0.5, β=10mm / K, δ=0.05.

[0112] Calculation of ambient light adjustment factor γ:

[0113]

[0114] Calculation of exposure parameter E:

[0115]

[0116] Calculation of focal length parameter F:

[0117]

[0118] Under given ambient light conditions, the device should adjust the exposure time to approximately 0.01 seconds and the focal length to approximately 54.55 mm to adapt to the ambient light and color conditions to ensure optimal image capture.

[0119] See also Figure 3 , the steps to obtain the image after optimization processing are:

[0120] Based on the basic image data, through the formula:

[0121]

[0122] Calculate the adjusted image color value C new ;

[0123] Among them, C old is the color value in the base image, C target is the desired color balance target, C mean is the average value of the current channel, λ is the color adjustment coefficient, ρ is the nonlinear adjustment coefficient, C new is the adjusted image color value;

[0124] Based on the basic image data, through the formula:

[0125]

[0126] Calculate the adjusted image brightness value I new ;

[0127] Among them, I old Represents the brightness value in the base image, I min and I max are the minimum and maximum values ​​of image brightness, κ is the contrast enhancement coefficient, e is the base of the natural logarithm, I new is the brightness value of the image after adjustment;

[0128] Based on the adjusted image color value C new and the adjusted image brightness value I new , integrate the adjusted color and contrast data, resynthesize the image, and obtain the optimized image.

[0129] formula:

[0130]

[0131]

[0132] Parameter details and how to obtain them:

[0133] C old : The color values ​​in the original image, directly measured by the image capture device.

[0134] C target: Target color balance value, set according to the image processing requirements. If you want to enhance the blue component, this value may be higher than the average value of the blue channel.

[0135] C mean : The average color value of the current channel, obtained by analyzing the color histogram of the original image.

[0136] λ: Color adjustment coefficient, set according to the sensitivity of color adjustment, usually set by image processing experts based on experience.

[0137] ρ: Non-linear adjustment coefficient, used to balance the adjustment strength of color difference, adjusted according to the specific needs of the image.

[0138] I old : The brightness value of the original image, obtained directly from the image data.

[0139] I min and I max : The minimum and maximum values ​​of the image brightness, obtained by statistically analyzing the brightness distribution of the image.

[0140] κ: Contrast enhancement coefficient, which is adjusted according to the contrast requirements of the image to ensure a natural transition of image brightness.

[0141] Calculation example:

[0142] Assume the following parameters: C old =100, C target =120, C mean =110, λ=0.2, ρ=0.05.

[0143] Calculate color balance values:

[0144]

[0145] It means that the color value is adjusted from 100 to 101.9, which slightly increases the target color component and prevents excessive color adjustment through nonlinear adjustment.

[0146] Hypothesis I old =150,I min =100,I max =200,κ=0.01.

[0147] Calculate the adjusted brightness value:

[0148]

[0149] The calculation results show that the original brightness value of 150 is reduced to 97.1 after contrast adjustment, which improves the contrast of the image and enhances the visibility of details. The nonlinear factor ensures smooth adjustment of brightness and avoids sudden brightness changes.

[0150] See also Figure 4 , the steps to obtain the defect category recognition results are:

[0151] Based on the optimized image, the formula is:

[0152]

[0153] Calculate the contrast value D of the feature;

[0154] Among them, I z Indicates the brightness value of the zth pixel in the area, I avg is the average brightness of pixels in the area, N D is the total number of pixels in the area, and D is the contrast value of the feature;

[0155] Based on the feature contrast value D, it is compared with the sample data in the preset part defect feature library, using the formula:

[0156]

[0157] Calculate the matching degree M:

[0158] Among them, D j is the contrast value of the jth feature in the image, D j,ref is the contrast value of the corresponding feature in the feature library, w j is the weight coefficient of each feature, m is the total number of features, M is the matching degree, and j is the index;

[0159] According to the matching degree M, it is compared with the preset matching degree threshold. If the matching degree M exceeds the preset matching degree threshold, it is determined to be the corresponding defect category, and the defect category identification result is obtained.

[0160] formula:

[0161]

[0162]

[0163] Parameter details and how to obtain them:

[0164] I z : The brightness value of the zth pixel in the local area, obtained directly from the image data.

[0165] I avg : The average brightness of all pixels in the local area, which is calculated by summing the values ​​of all pixels in the local area and dividing by the total number of pixels n.

[0166] N D: The total number of pixels in the local area, determined according to the partitioning strategy of image processing, such as selecting a 10x10 area, N D Then it is 100.

[0167] w j : The weight coefficient of each feature, which is set manually or automatically adjusted through machine learning methods according to the importance of the feature in defect identification.

[0168] D j,ref : The contrast value of the corresponding feature in the feature library, which is the preset value.

[0169] Calculation example:

[0170] Assume the following parameters:

[0171] There are 10 pixels in the local area

[0172] The brightness values ​​of each pixel are:

[0173] 100,105,110,95,90,85,120,115,105,100.

[0174] Calculate the average pixel brightness I avg :

[0175]

[0176] Calculate D:

[0177]

[0178] Assume that the contrast value D of the corresponding feature in the feature library ref =8, weight w=1.

[0179] Calculate the matching degree M:

[0180]

[0181] Assuming the threshold is 0.5, since the calculated matching degree M = 0.561 exceeds the threshold 0.5, according to the preset logic, it is determined that there is a defect type in the current image that matches the feature library. This indicates that the image features of the local area have a high similarity with a certain defect feature in the feature library, so that the corresponding defect type, such as scratches or dents, can be effectively identified.

[0182] See also Figure 5 , the steps to obtain the defect size assessment results are:

[0183] Based on the defect category recognition results, the edge contour of each type of defect is identified using the formula:

[0184]

[0185] Calculate the defect area A;

[0186] Among them, (xi, y i ) and (x i+1 , +1 ) are the coordinates of the i-th point and the i+1-th point on the defect contour, n is the total number of points on the contour, i is the index, and A is the defect area;

[0187] Based on the defect area A, by the formula:

[0188]

[0189] Calculate the shape influence S;

[0190] Among them, S is the shape effect, P is the perimeter of the defect contour, C is the sum of the curvatures of the defect shape, and A is the defect area;

[0191] Based on the defect area A and shape influence S, the formula is:

[0192]

[0193] Calculate the defect size level L and obtain the defect size assessment result;

[0194] Among them, k is the scaling factor, η is the shape complexity adjustment coefficient, L is the defect size level, S is the shape impact, and A is the defect area.

[0195] formula:

[0196]

[0197]

[0198]

[0199] Parameter details and how to obtain them:

[0200] Point coordinates (xi, y i ): are the pixel coordinates of the defect edge in the image, obtained from the defect detection step through image processing software or algorithms.

[0201] Total number of points n: The total number of points on the contour, obtained directly from the output of the image processing software, represents the number of points involved in the area calculation.

[0202] Perimeter P: obtained by summing the straight-line distances between all adjacent points. The distance between each pair of adjacent points is calculated using the Euclidean distance formula.

[0203] Curvature Sum C: Calculate the curvature of each point and then sum it up. The curvature can be approximated by comparing the angle change of every three consecutive points.

[0204] Scaling factor k and shape complexity adjustment factor η: artificially set parameters according to the specific requirements of defect classification, which adjust the output range of size levels and the impact of shape complexity on the final size assessment.

[0205] Calculation example:

[0206] Assume the following parameters:

[0207] Defect contour coordinate point: (xi, y i )=[(1,1),(4,1),(4,5),(1,5)], forming a rectangle.

[0208] The total number of points n = 4. Assume k = 0.5, η = 0.1.

[0209] Calculation of area A:

[0210]

[0211] Calculation of perimeter P:

[0212]

[0213]

[0214] Calculation of the sum of curvature C:

[0215] Because it is a rectangle, assuming that the simplified curvature changes by 90 degrees at each point, the total curvature C = 360 degrees.

[0216] Calculation of size class L:

[0217]

[0218] The calculated example shows a defect size rating of 0.86, providing a quantitative assessment that reflects the combined impact of the defect's area and shape complexity.

[0219] See also Figure 6 , the method for evaluating the overall defect severity is:

[0220] Based on the defect category identification results and defect size assessment results, combined with the location of each type of defect, the formula is:

[0221]

[0222] Calculate the overall defect severity score Z;

[0223] Where Z is the overall defect severity score, α is the adjustment factor, and L f is the size level of the fth defect, w c,f is the defect category weight, w p,f is the defect location weight, N Z is the total number of defects;

[0224] Based on the overall defect severity score Z, the defect severity of the part is evaluated according to the size of the overall defect severity score Z.

[0225] formula:

[0226]

[0227] Parameter details and how to obtain them:

[0228] Lf: size class of the f-th defect, obtained by the previous step.

[0229] w c,f : Defect category weights are set based on the severity of the defect type and the potential risk of impact on structural integrity. For example, a structural crack may have a higher weight than a surface scratch.

[0230] w p,f : Location weight, based on the specific location of the defect in the structure. The weight is determined by the relative distance between the defect location and the critical part of the structure.

[0231] N Z : The total number of defects calculated comes directly from the number of defects detected.

[0232] α: Size class adjustment factor, used to balance the effect of size class in the calculation, usually set based on experience or experimental data.

[0233] Calculation example:

[0234] Assume there are three defects, whose size levels L are 1.5, 2.0, and 2.5 respectively. Assume the corresponding class weights w c is 1.0, 1.2, and 1.5, and the position weight w p They are 0.8, 0.6, and 0.4 respectively. Set α=0.1.

[0235] Calculate the severity score for each defect:

[0236] For the first defect:

[0237]

[0238] For the second defect:

[0239]

[0240] For the third defect:

[0241]

[0242] These three scores are added together to get the overall severity score:

[0243] Z = 0.85 + 0.85 + 0.76 = 2.46

[0244] The calculated result Z = 2.46 reflects the combined effect of all identified defects in the structure.

[0245] See also Figure 7 , the steps to obtain the overall defect assessment results are:

[0246] Based on the overall defect severity score Z, by the formula:

[0247]

[0248] Calculate the surface integrity grade R of the parts;

[0249] Among them, Z is the severity score of the overall defect, R represents the surface integrity grade of the part, μ is the median parameter, and σ is the standard deviation parameter;

[0250] Based on the surface integrity grade R of the part, it is compared with the preset grade threshold, graded and graded to obtain the overall defect assessment result.

[0251] formula:

[0252]

[0253] Parameter details and how to obtain them:

[0254] Z: The overall defect severity score, obtained by the previous step.

[0255] μ: median parameter that affects the conversion point from the S value to the grade R. The parameter is usually set based on historical data and professional experience to ensure that the sensitivity of the grade conversion matches the actual situation.

[0256] σ: Standard deviation parameter, which affects the sensitivity and response speed of the mapping to the level. The setting of the parameter is based on historical data analysis and actual application requirements.

[0257] Calculation example:

[0258] Assume the parameters are set as follows:

[0259] Z = 1.8: Composite severity score assumed to be derived from analysis of multiple defects.

[0260] μ=1.5: The median value of the classification based on past analysis data.

[0261] σ=0.5:Determines the speed of function transition. Smaller value means that the function changes faster around μ. Using these parameters,

[0262] Calculate the value of R:

[0263]

[0264] The obtained R value is about 6.47, indicating that the surface integrity grade of the part is at an upper-middle level in the set scoring system.

[0265] A method for detecting surface defects of parts based on machine vision comprises the following steps:

[0266] S1: Based on the surface characteristics of the part to be inspected, combined with the light intensity and color in the inspection environment, adjust the exposure and focal length parameters of the image acquisition device, collect the part surface image, and generate the basic image data set;

[0267] S2: Based on the basic image data set, color balance and contrast adjustment are performed to optimize image quality and obtain the optimized image;

[0268] S3: Based on the optimized image, identify the defect area in the image, compare it with the preset part defect feature library, calculate the matching degree, identify the defect type, and obtain the defect recognition result;

[0269] S4: Based on the defect identification results, the edge detection algorithm is used to determine the contour of each defect, calculate the area of ​​each defect, and evaluate the severity of the defect according to the shape and size of the defect to generate defect quantitative data;

[0270] S5: Based on the defect identification results and defect quantification data, evaluate the location of each type of defect and its overall impact on the surface integrity of the part, classify the defects according to their severity, and generate an overall defect assessment result.

[0271] The above are only preferred embodiments of the present invention and are not intended to limit the present invention in other forms. Any technician familiar with the profession may use the technical contents disclosed above to change or modify them into equivalent embodiments with equivalent changes and apply them to other fields. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the technical solution of the present invention still falls within the protection scope of the technical solution of the present invention.

Claims

1. A part surface defect detection system based on machine vision, characterized in that: The system comprises: The image optimization processing module is based on the surface characteristics of the part to be inspected, which include the surface material and color of the part. Combined with the light intensity and color of the inspection environment, the exposure and focal length parameters of the image acquisition device are adjusted to capture the part surface image, and the color balance and contrast of the part surface image are adjusted to obtain the optimized image. The defect type recognition module identifies the surface defects of the differentiated parts through local contrast analysis based on the optimized image, compares the sample data in the preset part defect feature library, calculates the matching degree between the current defect and the preset defect, identifies the type of defect, including scratches and dents, and obtains the defect category recognition result; The defect quantification assessment module identifies the edge contour of each type of defect based on the defect category identification result, calculates the area of ​​each type of defect on the part, and evaluates the size level of each type of defect in combination with the shape of each type of defect to obtain a defect size assessment result; The steps for obtaining the defect size assessment result are: Based on the defect category recognition results, the edge contour of each type of defect is identified by the formula: Calculate the defect area A; Among them, (x i ,y i ) and (x i+1 ,y i+1 ) are the coordinates of the i-th point and the i+1-th point on the defect contour, n is the total number of points on the contour, i is the index, and A is the defect area; Based on the defect area A, by the formula: Calculate the shape influence S; Among them, S is the shape effect, P is the perimeter of the defect contour, C is the sum of the curvatures of the defect shape, and A is the defect area; Based on the defect area A and shape influence S, by the formula: Calculate the defect size level L and obtain the defect size assessment result; Where k is the scaling factor, η is the shape complexity adjustment factor, L is the defect size level, S is the shape impact, and A is the defect area; The overall defect assessment module assesses the overall defect severity based on the defect category identification result and the defect size assessment result, combined with the location of each type of defect, and classifies the surface integrity of the part according to the overall defect severity to obtain an overall defect assessment result; The method for evaluating the overall defect severity is: Based on the defect category identification results and defect size assessment results, combined with the location of each type of defect, the formula is: Calculate the overall defect severity score Z; Where Z is the overall defect severity score, α is the adjustment factor, and L f is the size level of the fth defect, w c,f is the defect category weight, w p,f is the defect location weight, N Z is the total number of defects; Based on the overall defect severity score Z, assess the defect severity of the part according to the magnitude of the overall defect severity score Z; The steps for obtaining the overall defect assessment result are: Based on the severity score Z of the overall defect, by the formula: Calculate the surface integrity grade R of the parts; Among them, Z is the severity score of the overall defect, R represents the surface integrity level of the part, μ is the median parameter, and σ is the standard deviation parameter; Based on the surface integrity grade R of the part, it is compared with the preset grade threshold, grade classification is performed, and the overall defect assessment result is obtained.

2. The machine vision-based part surface defect detection system according to claim 1, characterized in that: The method for adjusting the exposure and focal length parameters of the image acquisition device is: Based on the part detection environment, obtain the light intensity and light color indicators through the formula: Calculate the ambient light adjustment factor γ; Wherein, I is the ambient light intensity measured in real time, I0 is the standard ambient light intensity, C is the ambient light color index measured in real time, C0 is the standard ambient light color index, α is the ambient light attenuation adjustment coefficient, θ is the index of the intensity affected by the color difference, γ is the ambient light adjustment factor, and e is the base of the natural logarithm; According to the ambient light adjustment factor γ, combined with the surface material and color characteristics of the part, the formula is: E=E0×γ×k1 Calculate the exposure parameter E and focal length parameter F of the acquisition device, and apply the exposure parameter E and focal length parameter F of the acquisition device to the image acquisition device to capture the surface image of the part and obtain basic image data; Among them, E is the exposure parameter of the image acquisition device, F is the focal length parameter of the image acquisition device, E0 and F0 are the default exposure parameter and focal length parameters of the image acquisition device respectively, k1 is the material light reflection coefficient, β and δ are adjustment factors, and γ is the ambient light adjustment factor.

3. The machine vision-based part surface defect detection system according to claim 2, characterized in that: The steps of obtaining the optimized image are as follows: Based on the basic image data, by the formula: Calculate the adjusted image color value C new ; Among them, C old is the color value in the base image, C target is the desired color balance target, C mean is the average value of the current channel, λ is the color adjustment coefficient, ρ is the nonlinear adjustment coefficient, C new is the adjusted image color value; Based on the basic image data, by the formula: Calculate the adjusted image brightness value I new ; Among them, I old Represents the brightness value in the base image, I min and I max are the minimum and maximum values ​​of image brightness, κ is the contrast enhancement coefficient, e is the base of the natural logarithm, I new is the brightness value of the image after adjustment; Based on the adjusted image color value C new and the adjusted image brightness value I new , integrate the adjusted color and contrast data, resynthesize the image, and obtain the optimized image.

4. The part surface defect detection system based on machine vision according to claim 1 is characterized in that: The steps for obtaining the defect category identification result are as follows: Based on the optimized image, the formula is: Calculate the contrast value D of the feature; Among them, I z Indicates the brightness value of the zth pixel in the area, I avg is the average brightness of pixels in the area, N D is the total number of pixels in the area, and D is the contrast value of the feature; Based on the contrast value D of the feature, it is compared with the sample data in the preset part defect feature library, through the formula: Calculate the matching degree M: Among them, D j is the contrast value of the jth feature in the image, D j,ref is the contrast value of the corresponding feature in the feature library, w j is the weight coefficient of each feature, m is the total number of features, M is the matching degree, and j is the index; The matching degree M is compared with a preset matching degree threshold. If the matching degree M exceeds the preset matching degree threshold, it is determined to be a corresponding defect category, and a defect category identification result is obtained.

5. A method for detecting surface defects of parts based on machine vision, characterized in that: The part surface defect detection system based on machine vision according to any one of claims 1 to 4 comprises the following steps: Based on the surface characteristics of the parts to be inspected, combined with the light intensity and color in the inspection environment, adjust the exposure and focal length parameters of the image acquisition device, collect part surface images, and generate a basic image data set; Based on the basic image data set, color balance and contrast adjustment are performed to optimize image quality and obtain an optimized image; Based on the optimized image, the defect area in the image is identified, compared with a preset part defect feature library, the matching degree is calculated, the defect type is identified, and a defect identification result is obtained; Based on the defect identification results, the contour of each defect is determined by an edge detection algorithm, the area of ​​each defect is calculated, and the severity of the defect is evaluated according to the shape and size of the defect to generate defect quantification data; Based on the defect identification results and defect quantification data, the location of each type of defect and its overall impact on the surface integrity of the part are evaluated, and the defects are graded according to their severity to generate an overall defect evaluation result.

Citation Information

Patent Citations

  • Part surface defect detection method, system and equipment and storage medium

    CN115797314A

  • Pickling quality online quantitative evaluation method and system based on machine vision

    CN116952951A

  • Casting quality tracking system of numerical control machine tool

    CN118134062A

Cited By

  • Industrial part classification method and system based on multi-modal vision

    CN121259543A