Method and system for detecting defects of parts based on machine vision

By preprocessing grayscale images of automotive parts coating surfaces and performing block analysis using the fuzzy entropy method, combined with the judgment of significant fuzzy entropy values, the accuracy problem of small bubble defect detection was solved, and efficient bubble defect identification was achieved.

CN120707541BActive Publication Date: 2026-01-02MAIWEI TECH (GUANGZHOU) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510861179.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-25
Publication Date
2026-01-02
Estimated Expiration
2045-06-25

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately identify small bubble defects on the surface of automotive parts coatings, especially since these defects have low shape contrast and are similar to the surface texture of the parts, making detection difficult.

Method used

A machine vision-based component defect detection method is adopted. The grayscale image is preprocessed, and the surface texture image is divided into blocks using the fuzzy entropy method. The grayscale difference and texture change are calculated, and the bubble defect area is determined by combining the significant fuzzy entropy value. The number of sub-block iterations is dynamically adjusted to optimize the detection algorithm.

Benefits of technology

It improves the accuracy and sensitivity of small bubble defect detection, reduces false positives and false negatives, enhances the algorithm's adaptability to image regions of varying complexity, and ensures the reliability and robustness of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120707541B_ABST
    Figure CN120707541B_ABST
Patent Text Reader

Abstract

The present application relates to the field of image data processing, more particularly, the present application relates to a machine vision-based part defect detection method and system, the method comprising: obtaining a gray image of the surface of an automobile part for preprocessing, and extracting a surface texture image of the part region; using a fuzzy entropy method to block the surface texture image, and according to the gray value change and texture performance in each block, obtaining the gray difference degree and abnormality degree in the block; dynamically adjusting the iteration number of sub-blocks based on the abnormality degree of the block; optimizing the existing fuzzy entropy method according to the iteration number, obtaining the significant fuzzy entropy value of each block, and judging whether the automobile part has a bubble defect region based on the significant fuzzy entropy value. The present application can more accurately identify the potential bubble defect region by analyzing the gray difference degree and texture change in each block combined with the fuzzy entropy method.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of image data processing. More particularly, the present application relates to a machine vision-based part defect detection method and system. BACKGROUND

[0002] With the rapid development of the automobile industry, especially in the field of automated production and quality control, enterprises have increasingly high requirements for the quality of parts. The production process of automobile parts is complex, and the surface coating is one of the keys to ensuring the quality and durability of the parts. The bubble defects that may occur during the coating process not only affect the appearance of the parts, but also may affect their long-term performance and reliability. Machine vision defect detection systems can efficiently identify potential bubble defects on the surface of the coating, reducing the subjectivity and error rate of manual detection, ensuring the surface quality of the parts, and improving the safety and reliability of the vehicle.

[0003] The existing Chinese patent application file with publication number CN117197141A discloses a method for detecting surface defects of automobile parts. A gray-scale image of the surface of the automobile part is obtained, and an initial threshold value is determined based on the gray-scale value of the pixel points, and then the threshold value to be measured and the preliminary defect area and normal area are obtained. Due to the influence of light, the highlight area may be misjudged, so the trend and positional relationship between the final defect areas are used to screen the defect discontinuous area. The illumination influence value is obtained based on the gray-scale value of the pixel points, and then the gray-scale value of the pixel points is adjusted and combined with the gray-scale value of the pixel points in the normal area to obtain the gray-scale adjustment value. The contrast threshold value is obtained based on the adjusted gray-scale value of the pixel points and compared with the threshold value to be measured to obtain the optimal threshold value for defect detection of the gray-scale image.

[0004] The application file analyzes the influence of light and then obtains the optimal threshold value, effectively improving the precision of defect detection. Currently, fuzzy entropy method is used for part defect detection. The part may have small bubble defects. Due to the irregular shape of the small bubble defects, the boundary with the surrounding normal area is not clear, and the gray-scale difference is small, resulting in a low contrast in the image. The surface of the part itself has texture features, which are similar to the texture of the small bubble defects, which easily interfere with the defect detection, making it difficult to accurately identify the defects in the texture background. SUMMARY

[0005] To solve the problem that the small bubble defects have low contrast in shape, are similar to the texture features of the surface of the part itself, easily interfere with the defect detection, and are difficult to be accurately identified in the texture background, the present application provides solutions in the following aspects.

[0006] In a first aspect, a machine vision-based part defect detection method, comprising: obtaining a gray image of a surface of an automobile part for preprocessing to obtain a surface texture image of a part region; using a fuzzy entropy method to block the surface texture image, calculating the gray difference degree in each block, calculating the texture change in each block based on the texture performance in each block, and obtaining the abnormal degree of the block; based on the product of the abnormal degree of the block and the iteration number of the sub-block in the existing fuzzy entropy method, the iteration number of the sub-block is obtained by rounding up; according to the iteration number, the existing fuzzy entropy method is optimized to obtain the significant fuzzy entropy value of each block, and based on the significant fuzzy entropy value, it is judged whether the automobile part has a bubble defect region; wherein the significant fuzzy entropy value satisfies the following relationship: ; In the formula, represents the fuzzy entropy value in the th block, represents the iteration number of the sub-block size in the th block, represents the average fuzzy membership degree between the sub-blocks in the th block after the th iteration of the sub-block size, represents the average fuzzy membership degree between the sub-blocks in the corresponding block after the th iteration, represents a normalization function.

[0007] The effect is that by calculating the gray difference degree and texture change in each block, the gray and texture information is comprehensively considered, which can more comprehensively reflect the feature change in the block. It is beneficial to detect small bubble defects, which are similar to the texture features of the part surface and have low contrast, and traditional methods are prone to miss detection or false detection. The significant fuzzy entropy value is calculated by multiple iterations, which can more accurately reflect the abnormal degree in the block. Normalization processing ensures the comparability of the results between different blocks, improves the accuracy and reliability of the detection, and dynamically adjusts the iteration number of the sub-block according to the abnormal degree of the block, so that the algorithm can better adapt to image regions of different complexity. For potential bubble defect regions, increasing the iteration number can more carefully analyze the features, improve the sensitivity of the detection, and through multiple iterations, the feature changes in the block are analyzed from different scales, which can more comprehensively capture the subtle changes of potential defects, and improve the adaptability of the algorithm to different types of defects.

[0008] Preferably, the gray image is preprocessed to obtain a surface texture image of a part region, comprising:

[0009] The semantic segmentation method is used to extract the part region in the gray image to obtain a binary image, and the binary image is multiplied by the gray image to obtain the gray value of the part region, and the pixel points of the outer contour of the part region are deleted, and the surface of the part region after deletion is subjected to edge detection to obtain a surface texture image of the part region.

[0010] The effect is that: through semantic segmentation and multiplication operation, the part region is accurately extracted, the background interference is removed, the accuracy of subsequent analysis is ensured, the outer contour pixel points are deleted, the interference of the outer contour edge effect on the internal texture analysis is avoided, the internal texture features are more prominent, through edge detection, the surface texture features are enhanced, the potential bubble defect region is more obvious, and the accuracy of defect detection is improved.

[0011] Preferably, the surface texture image is divided into blocks using a fuzzy entropy method, comprising:

[0012] Taking the upper left corner of the surface texture image as a reference, the surface texture image is divided into blocks of a predetermined size, and an initial size is set for the sub-blocks of each block;

[0013] The product of the difference between the block width and the sub-block side length plus 1 and the difference between the block length and the sub-block side length plus 1 is taken as the number of sub-blocks within the block;

[0014] The initial size of the sub-blocks is iterated, and one is added to the side length of the previous sub-block.

[0015] The effect is that: through multiple iterations, the feature changes within the block are analyzed from different scales, which can more comprehensively capture the subtle changes of potential defects, especially for small bubble defects, which are similar to the texture features of the part surface and have low contrast, and are easily missed or misdetected by traditional methods. According to the abnormal degree of the block, the iteration number of the sub-blocks is dynamically adjusted, so that the algorithm can better adapt to image regions of different complexities. For potential bubble defect regions, increasing the iteration number can more carefully analyze the features and improve the sensitivity of detection.

[0016] Preferably, the gray difference degree within the block is calculated, comprising:

[0017] Taking any block as a marker block, calculating the absolute difference between the gray mean value of all pixel points within the marker block and the gray mean value of all pixel points in the surface texture image and performing normalization processing to obtain a local contrast;

[0018] The ratio between the number of pixel points of different gray values within the marker block and the total number of all pixel points within the marker block is taken as a texture complexity;

[0019] The product between the local contrast and the texture complexity is taken as the gray difference degree of the marker block.

[0020] The effect is that: by calculating the local contrast and the texture complexity, and taking the product of them as the gray difference degree, the gray and texture information are comprehensively considered, the potential bubble defect area can be more accurately identified, the calculation of the gray difference degree considers the distribution of the gray values in the block, and the misjudgment and missed detection caused by uneven distribution of the gray values or complex texture are reduced.

[0021] Preferably, the calculating the gray difference degree in the block further comprises:

[0022] Taking any block as a marker block, calculating the absolute difference value between the gray value of each pixel point in the marker block and the average of the gray values of all pixel points in the marker block to obtain the local contrast;

[0023] Taking the average of the sum of the local contrasts of all pixel points in the marker block as the gray difference degree in the marker block.

[0024] Preferably, the abnormal degree comprises:

[0025] Taking the Euclidean distance between the pixel point corresponding to the maximum gray value and the pixel point corresponding to the minimum gray value in the marker block as the gray distribution range, taking the difference between the maximum gray value and the minimum gray value in the marker block as the extreme difference degree, and taking the ratio between the gray distribution range and the extreme difference degree as the gray gradual change degree;

[0026] Taking the ratio between the information entropy value of the sine value of the included angle between the gradient direction and the horizontal reverse direction of all groups of adjacent edge pixel points in the marker block and the variance of the sine value of the included angle between the gradient direction and the horizontal reverse direction of all groups of adjacent edge pixel points in the marker block, multiplying the product of the ratio and the gray gradual change degree by the sum of the hyperparameters, multiplying the result by the gray difference degree and performing normalization processing, correcting the normalized result according to the preset adjustment factor, and obtaining the abnormal degree in the marker block.

[0027] The effect is that: by comprehensively considering the ratio of the gray gradual change degree, the texture complexity and the smoothness, and the gray difference degree, the potential bubble defect area can be more comprehensively identified; by analyzing the ratio of the texture complexity and the smoothness, the algorithm can adapt to different types of surface textures, improving the adaptability to different part surfaces; by calculating the ratio of the gray gradual change degree and the texture complexity and the smoothness, complex image processing operations are avoided, and the calculation efficiency is improved.

[0028] Preferably, the abnormal degree further comprises:

[0029] Taking any sub-block as a marker sub-block, marking the chain code value of the surface texture edge in the marker sub-block, taking the information entropy value of the chain code value as the complexity of the surface texture edge, calculating the sum of the absolute values of the difference between all adjacent chain code values in the marker sub-block to obtain the smoothness;

[0030] Calculating the ratio between the complexity and the smoothness, adding the ratio to the sum of the hyperparameters, multiplying the gray difference degree of the marker sub-block, and performing normalization processing, correcting the normalized result according to a preset adjustment factor to obtain the abnormality degree in the marker sub-block.

[0031] Preferably, the method further comprises:

[0032] If the significant fuzzy entropy value is greater than a preset threshold, then the position of the surface coating of the automobile part corresponding to the sub-block has a bubble defect region, otherwise, the position of the surface coating of the automobile part corresponding to the sub-block is normal.

[0033] In a second aspect, a machine vision-based part defect detection system is provided, comprising a processor and a memory, wherein the memory stores computer program instructions which, when executed by the processor, implement the machine vision-based part defect detection method described above.

[0034] The present application has the following effects:

[0035] 1. The present application can more accurately identify potential bubble defect regions by analyzing the gray difference degree and texture changes in each sub-block, combined with the fuzzy entropy method. Especially for small bubble defects, these defects are similar to the texture features of the part surface, and the contrast is low, so traditional methods are prone to miss detection or false detection. This method significantly improves the accuracy of detection by considering gray and texture information, reducing false positives and missed detections.

[0036] 2. The present application combines texture features and edge information through gray difference, so that the algorithm can adapt to different types of surface textures and defect features. By dynamically adjusting the number of iterations of the sub-block, it can better handle image regions of different complexity, improving the adaptability of the algorithm to different part surfaces. This adaptability enables the detection system to run stably in various production environments, improving the reliability and robustness of the detection. BRIEF DESCRIPTION OF DRAWINGS

[0037] The above and other objects, features and advantages of the exemplary embodiments of the present application will be more apparent from the following detailed description taken in conjunction with the accompanying drawings, in which several embodiments of the present application are shown by way of example, and wherein like reference numerals refer to like elements throughout. In the drawings:

[0038] Figure 1 is a method flowchart of steps S1-step S3 in the part defect detection method based on machine vision of the embodiment of the present application.

[0039] Figure 2 is a structural block diagram of the part defect detection system based on machine vision of the embodiment of the present application. DETAILED DESCRIPTION

[0040] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0041] The specific embodiments of the present application will be described in detail below with reference to the drawings.

[0042] Referring to Figure 1 The part defect detection method based on machine vision includes steps S1-step S3, and specifically as follows:

[0043] S1: Obtain the gray image of the surface of the automobile part for pretreatment to obtain the surface texture image of the part region.

[0044] A deep learning model (such as U-Net) is used to process the gray image, and the part region in the image is distinguished from other background regions to generate a binary image; in the binary image, the pixel value of the part region is 1, and the pixel value of the background region is 0;

[0045] The binary image is multiplied pixel by pixel with the original gray image, the gray value of the part region is retained, the gray value of the background region is set to 0, the gray value of the part region is obtained, and the pixel points of the outer contour of the part are deleted. The surface of the deleted part region is edge detected to obtain the surface texture image of the part region.

[0046] For example, in the present embodiment, U-Net semantic segmentation model and canny edge detection are used. This method is well known to those skilled in the art and will not be described in detail.

[0047] S2: Use the fuzzy entropy method to block the surface texture image, calculate the gray difference degree in each block based on the gray value change in each block, calculate the texture change in each block based on the texture performance in each block, and obtain the abnormal degree of each block.

[0048] The upper left corner of the surface texture image is taken as a reference, the surface texture image is divided into a plurality of blocks of a predetermined size, and the initial size of each sub-block of each block is set;

[0049] The product of the difference between the block width and the sub-block side length plus 1 and the difference between the block length and the sub-block side length plus 1 is the number of sub-blocks within the block;

[0050] The sub-block size iteration rule is: add one to the side length of the previous sub-block.

[0051] Specifically, the number of sub-blocks satisfies the following relationship:

[0052] ;

[0053] In the formula, Indicates the number of sub-blocks. Indicates the width of the block. Indicates the length of the block. This represents the side length of the sub-block.

[0054] In this embodiment, the preset size of the blocks is The initial size of the sub-blocks within the block is... Using the top-left corner of the grayscale image as a reference, if the width or length of the region formed by pixels at the right or bottom edge of a component image is less than 5 pixels, it is divided into the image block immediately to its left or top, avoiding the situation where the region is too small to be effectively analyzed as a separate block. For example, in the first iteration, the sub-window size will be... Iterate to .

[0055] Further analysis reveals that coatings in areas with potential air bubbles may exhibit different grayscale values ​​than normal coatings due to the refractive or reflective properties of the bubbles. The grayscale value of the bubble region may differ from the surrounding area. Therefore, when analyzing the grayscale difference within each block, a greater difference between the average grayscale value within each image block and the average grayscale value in the image, and a higher number of pixels with different grayscale values ​​within each block, indicates that this block is more likely to belong to a potential air bubble defect area, and its corresponding grayscale difference will be greater. The calculation of the grayscale difference within a block includes the following steps:

[0056] Using any block as the labeled block, calculate the absolute difference between the mean gray value of all pixels in the labeled block and the mean gray value of all pixels in the surface texture image, and perform normalization to obtain the local contrast.

[0057] The ratio between the number of pixels with different gray values ​​within a marked block and the total number of pixels within the marked block is used as the texture complexity.

[0058] The product of local contrast and texture complexity is used as the grayscale difference of the marked blocks.

[0059] Specifically, the degree of grayscale difference satisfies the following relationship:

[0060] ;

[0061] In the formula, Indicates the first The degree of grayscale difference within each block Indicates the first The average gray level within each block This represents the average grayscale value of the entire surface image of the automotive component. Indicates the first The number of pixels with different grayscale values ​​in each memory block. No. The number of pixels in each block This represents the normalization function.

[0062] In other words, Quantified the first The larger the difference between the mean gray level within each block and the mean gray level in the image, the stronger the difference. The greater the difference between the mean gray value within an image block and the mean gray value in the image, the more it indicates that the... The more likely a segment is to belong to a potential bubble defect area, the greater the corresponding grayscale difference will be.

[0063] Quantified the first The number of pixels with different grayscale values ​​in each block represents the percentage of pixels within that block. A larger value indicates a higher percentage of pixels in the first block. The greater the difference between the mean gray level within an image block and the mean gray level in the image, the greater the reliability. This indicates that the... The more likely a segment is to belong to a potential bubble defect area, the greater the corresponding grayscale difference will be.

[0064] In addition, another embodiment includes:

[0065] Using any block as the marked block, calculate the absolute difference between the gray value of each pixel in the marked block and the average gray value of all pixels in the marked block to obtain the local contrast.

[0066] The average of the local contrast of all pixels within the marked block is taken as the degree of grayscale difference within the marked block.

[0067] Specifically, the degree of grayscale difference satisfies the following relationship:

[0068] ;

[0069] In the formula, indicates the degree of gray scale difference in the first indicates the number of pixel points in the first indicates the gray scale value of the first

[0070] That is, reflects the difference between the gray scale value of each pixel point in the block and the average gray scale value of the block, which can be regarded as the contrast between each pixel point and the average brightness of the block, the greater, the more extensive the distribution of gray scale values in the block, the more likely it is a potential bubble defect area.

[0071] Through the above analysis, the gray scale difference in each block is obtained, and the possibility of a block belonging to a potential bubble defect is preliminarily analyzed based on the performance of the pixel gray scale value in each block. However, due to the fact that some potential bubble defects are relatively subtle and have low contrast with the surrounding normal area, and there may be some pre-designed textures on the surface of the part, the existence of the above two situations will lead to that the gray scale difference in a block cannot accurately reflect the possibility of a block belonging to a potential bubble defect. Then, according to the scene investigation, the interface between the potential bubble defect and the coating layer shows a blurred or gradual transition effect due to surface tension, light refraction and other factors.

[0072] Potential bubble defects often appear as local protruding areas, which are usually close to circular in shape. Therefore, in this step, the texture performance in each block will be analyzed, and the abnormality degree in each block will be optimized based on the gray scale difference in each block. When analyzing the abnormality degree in each block, the more gradual the change of the gray scale value in the block and the closer the edge shape in the block to the arc shape, the greater the possibility that the block belongs to a potential bubble defect, and the greater the abnormality degree;

[0073] If there is no gray scale change in a block, the corresponding gray scale difference degree is smaller. If there is no gray scale change in a block, it is defined as 0 through indicators such as gray scale gradual change and edge shape, and then the abnormality degree in the block is calculated, including the steps:

[0074] Take any block as a marker block, take the Euclidean distance between the pixel point corresponding to the maximum gray scale value and the pixel point corresponding to the minimum gray scale value in the marker block as the gray scale distribution range of the marker block, take the difference between the maximum gray scale value and the minimum gray scale value in the marker block as the extreme difference degree of the marker block, and take the ratio between the gray scale distribution range and the extreme difference degree as the gray scale gradual change degree; ​​​​

[0075] The ratio between the information entropy value of the sine of the included angle between the gradient direction and the horizontal reverse direction of all groups of adjacent edge pixel points in the marking block and the variance of the sine of the included angle between the gradient direction and the horizontal reverse direction of all groups of adjacent edge pixel points in the marking block is obtained, the product of the ratio and the gray value gradual change degree is added to the sum of the hyperparameters, multiplied by the gray value difference degree, and normalized, the normalized result is corrected according to a preset adjustment factor, and the abnormality degree in the marking block is obtained.

[0076] Specifically, the abnormality degree satisfies the following relationship:

[0077] ;

[0078] In the formula, represents the abnormality degree in the i-th block, represents the gray value difference degree in the i-th block, represents the gray value difference degree in the i-th block, represents the gray value difference degree in the i-th block, represents the gray value difference degree in the i-th block, represents the gray value difference degree in the i-th block, represents the gray value difference degree in the i-th block, represents the gray value difference degree in the i-th block, represents the gray value difference degree in the i-th block, represents the gray value difference degree in the i-th block, represents the gray value difference degree in the i-th block, represents the gray value difference degree in the i-th block, represents the hyperparameter, , both represent the adjustment factor of the abnormality degree value range, represents the normalization function.

[0079] Exemplarily, , the purpose of setting is to prevent the case where the block does not have indicators such as the gray value gradual change degree and the arc degree of the edge shape when there is no gray value change pixel point in the block;

[0080] and are both adjustment factors of the abnormality degree value range in the block, exemplarily, , and finally limit the abnormality degree value range in each block to the interval , which can be adjusted according to specific conditions.

[0081] That is, the greater the value is, the greater the abnormality degree in the i-th block is. The greater the likelihood that a pixel within a block belongs to a potential bubble defect area from the perspective of grayscale value analysis, the greater the degree of abnormality.

[0082] Reflects the first The greater the ratio of the grayscale value gradient within a block, the greater the distance between the two pixels with the highest and lowest grayscale values ​​within that block, and the greater the degree of grayscale gradient. In this case, the block is more likely to be a potential bubble defect, and the corresponding degree of abnormality is greater.

[0083] Reflects the first The degree of curvature of the inner edge shape of each block; the larger this ratio, the more pronounced the curvature of the first block. The greater the likelihood that the edge shape of a segment is arc-shaped, the greater the likelihood that the segment belongs to a potential bubble defect, and the greater the corresponding degree of abnormality.

[0084] It should also be noted that if only analysis is performed... There may be interference from straight edge shapes, therefore, in Based on Quantization can eliminate some cases where the edge shape is a straight line.

[0085] In addition, another embodiment includes:

[0086] Using any block as a labeled block, mark the chain code value of the surface texture edge within the labeled block, and use the information entropy value of the chain code value as the complexity of the surface texture edge. Calculate the sum of the absolute values ​​of the differences between all adjacent chain code values ​​within the labeled block to obtain the smoothness.

[0087] The ratio between complexity and smoothness is calculated, and the ratio is multiplied by the sum of hyperparameters and the grayscale difference of the marked blocks and normalized. The normalized result is then corrected according to a preset adjustment factor to obtain the degree of anomaly within the marked blocks.

[0088] It should be noted that the label chain code value is a well-known technique to those skilled in the art and will not be described in detail here. In this embodiment, it is labeled according to the edge of the block surface texture, starting from the top left corner and according to the encoding corresponding to the 8-neighbor direction of the preset pixel point. The resulting encoding sequence of the surface texture edge is the information entropy of the encoding sequence. This information entropy is a well-known technique to those skilled in the art and will not be described in detail here. The information entropy can reflect the degree of disorder of the encoding sequence.

[0089] It should also be noted that the surface texture edges of components may not exist within the segment; therefore, hyperparameters are set. There may be multiple surface texture edges. If there are multiple, the information entropy of the link code corresponding to each surface texture edge is calculated, and the average value is used as the information entropy value of all link code values ​​in the block.

[0090] Specifically, the degree of anomaly satisfies the following relationship:

[0091] ;

[0092] In the formula, Indicates the first The degree of anomaly within each block, Indicates the first The degree of grayscale difference within each block Indicates the first The information entropy value of all chaincode values ​​within each block. Indicates the first The sum of the absolute values ​​of the differences between all adjacent chaincode values ​​within a block, Indicates hyperparameters, , Both represent adjustment factors for the range of abnormality levels. This represents the normalization function.

[0093] In other words, This reflects the relationship between the complexity and smoothness of the edge shape within the segment. The higher the complexity and the lower the smoothness, the more likely it is to be a bubble defect area, because bubble defects often appear as locally raised circular areas with arc-shaped edges.

[0094] S3: The product of the anomaly degree of the block and the iteration number of the sub-blocks within the block in the existing fuzzy entropy method is rounded up to obtain the iteration number of the sub-block; the existing fuzzy entropy method is optimized based on the iteration number to obtain the significant fuzzy entropy value of each block, and the presence of bubble defect areas in automotive parts is determined based on the significant fuzzy entropy value.

[0095] It should be noted that the iteration number of the sub-block size within each block is adaptively adjusted based on the degree of anomaly. The greater the degree of anomaly within each block, the more likely that the block belongs to the potential bubble defect of the automotive part surface coating. Therefore, in order to more accurately classify the block as the potential bubble defect area of ​​the automotive part surface coating, the calculation of the fuzzy entropy value within the block should involve more iterations of the sub-block size to obtain more average fuzzy membership values ​​under different sub-block sizes. This will result in a larger sum of the differences in the average fuzzy membership values ​​between each sub-block before and after each iteration (i.e., the significant fuzzy entropy value).

[0096] The optimized fuzzy entropy method is used to detect potential bubble defects in the surface coating of automotive parts. The specific procedure is as follows:

[0097] First, according to step S2, the preset block size and the number of iterations for the sub-blocks are determined. Second, the similarity tolerance is determined, and the similarity tolerance for calculating the fuzzy membership degree between each sub-block in the fuzzy entropy method is preset to an empirical value of 0.5. Then, the fuzzy membership function is introduced to obtain the average fuzzy membership degree between each sub-block before the sub-block size iteration and in each subsequent iteration. The fuzzy membership degree is obtained by a well-known technique in the fuzzy entropy method, which will not be elaborated here. In this embodiment, the calculation of the fuzzy membership degree has been adjusted, and the corresponding value in this embodiment is the significant fuzzy entropy value.

[0098] The significant fuzzy entropy value of a block is calculated, specifically, the significant fuzzy entropy value satisfies the following relationship:

[0099] ;

[0100] In the formula, Indicates the first The fuzzy entropy value within each block Indicates the first The number of iterations for the size of sub-blocks within a block. Indicates the first The size of the sub-blocks within the first block is... The average fuzzy membership degree between each sub-block within the corresponding block after the next iteration. Indicates the first The average fuzzy membership degree among the sub-blocks within the corresponding block after the next iteration. This represents the normalization function.

[0101] In other words, when When the sub-blocks within the block have not yet started iterating (i.e., the sub-block size is in the initial state), it indicates that the sub-blocks within the block have not yet started iterating.

[0102] If the significant fuzzy entropy value is greater than a preset threshold, then the location of the coating on the surface of the corresponding automotive part is considered to have a bubble defect area; otherwise, the location of the coating on the surface of the corresponding automotive part is considered to be normal.

[0103] It should be noted that the preset threshold is 0.9.

[0104] This invention also provides a machine vision-based component defect detection system. For example... Figure 2 As shown, the system includes a processor and a memory, the memory storing computer program instructions, which, when executed by the processor, implement the machine vision-based component defect detection method according to the first aspect of the present invention.

[0105] The system also includes other components known to those skilled in the art such as a communication bus and a communication interface, etc., the arrangement and function of which are known in the art and thus will not be described here in detail.

[0106] In the present application, the aforementioned memory can be any tangible medium that contains or stores a program which can be used by or in connection with an instruction execution system, apparatus, or device. For example, the computer readable storage medium can be any suitable magnetic storage medium or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random-Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc., or any other medium that can be used to store the desired information and that can be accessed by an application, module, or both. Any such computer storage media can be part of the device or accessible or connectable thereto. Any application or module described in the present application can be implemented by computer readable / executable instructions stored or otherwise held by such computer readable media.

[0107] In the description of the present specification, the meaning of "a plurality of", "several" is at least two, for example, two, three or more, etc., unless otherwise explicitly specified.

[0108] Although the present specification has shown and described a number of embodiments of the application, it will be apparent to those skilled in the art that many modifications, variations, and alternatives to the embodiments described herein can be made in the light of the teachings herein. It is therefore to be understood that changes can be made in the form, details, and / or arrangements of the herein described embodiments of the application without departing from the spirit and intent of the application.

Claims

1. A method for detecting defects in parts based on machine vision, characterized in that, The application relates to a method for detecting bubble defects of automobile parts. The method comprises the following steps: acquiring a gray image of a surface of an automobile part for pretreatment to obtain a surface texture image of a part region; using a fuzzy entropy method to block the surface texture image, calculating the gray difference degree in each block, calculating the texture change in each block based on the texture performance in each block, and obtaining the abnormal degree of the block; based on the product of the abnormal degree of the block and the iteration number of the sub-block in the fuzzy entropy method, the iteration number of the sub-block is obtained by rounding up; according to the iteration number, the fuzzy entropy method is optimized to obtain the significant fuzzy entropy value of each block, and whether the automobile part has a bubble defect region is judged based on the significant fuzzy entropy value; wherein, represents the significant fuzzy entropy value within the th block, represents the iteration number of the sub-block size within the th block, represents the sub-block size within the th block, represents the average fuzzy membership degree between the sub-blocks within the corresponding block after the th iteration, represents the average fuzzy membership degree between the sub-blocks within the corresponding block after the th iteration, represents a normalization function.

2. The machine vision based part defect detection method of claim 1, wherein the significant fuzzy entropy value satisfies the following relationship: the gray image is pretreated to obtain a surface texture image of a part region, which comprises the following steps:

3. The machine vision based part defect detection method of claim 1, wherein, using a semantic segmentation method to extract the part region in the gray image to obtain a binary image, multiplying the binary image with the gray image to obtain the gray value of the part region, deleting the pixel points of the outer contour of the part, and performing edge detection on the surface of the part region after deletion to obtain a surface texture image of the part region. the surface texture image is blocked using the fuzzy entropy method, which comprises the following steps: taking the upper left corner of the surface texture image as a reference, the surface texture image is divided into a plurality of blocks with a preset size, and the initial size of the sub-block of each block is set; the product of the difference between the block width and the sub-block side length plus 1 and the difference between the block length and the sub-block side length plus 1 is taken as the number of sub-blocks in the block; 4. The machine vision based part defect detection method of claim 1, wherein, the initial size of the sub-block is iterated, and the side length of the last sub-block is increased by one. the gray difference degree in the block is calculated, which comprises the following steps: taking any block as a marker block, calculating the absolute difference between the gray mean value of all pixel points in the marker block and the gray mean value of all pixel points in the surface texture image and performing normalization processing to obtain a local contrast; taking the ratio between the number of pixel points with different gray values in the marker block and the total number of all pixel points in the marker block as a texture complexity; 5. The machine vision-based part defect detection method of claim 1, wherein, the product between the local contrast and the texture complexity is taken as the gray difference degree of the marker block. the gray difference degree in the block also comprises the following steps: taking any block as a marker block, calculating the absolute difference between the gray value of each pixel point in the marker block and the gray mean value of all pixel points in the marker block to obtain a local contrast; 6. The machine vision-based part defect detection method of claim 1, wherein, the average of the sum of the local contrasts of all pixel points in the marker block is taken as the gray difference degree in the marker block. the abnormal degree comprises the following steps: taking any block as a marker block, taking the Euclidean distance between the pixel point corresponding to the maximum gray value in the marker block and the pixel point corresponding to the minimum gray value as a gray distribution range, taking the difference between the maximum gray value and the minimum gray value in the marker block as an extreme difference degree, and taking the ratio between the gray distribution range and the extreme difference degree as a gray gradual change degree. The ratio between the information entropy value of the sine value of the included angle between the gradient direction corresponding to all groups of adjacent edge pixels in the marked block and the horizontal reverse direction and the variance of the sine value of the included angle between the gradient direction corresponding to all groups of adjacent edge pixels in the marked block and the horizontal reverse direction is calculated, the product of the ratio and the gray gradient degree is added to the sum of the hyperparameters, multiplied by the gray difference degree, and normalized, the normalized result is corrected according to a preset adjustment factor, and the abnormality degree in the marked block is obtained.

7. The machine vision-based part defect detection method of claim 1, wherein, The abnormality degree further includes: Taking any block as a marked block, the chain code value of the surface texture edge in the marked block is marked, the information entropy value of the chain code value is taken as the complexity degree of the surface texture edge, the sum of the absolute values of the differences between all adjacent chain code values in the marked block is calculated, and the smoothness degree is obtained. The ratio between the complexity degree and the smoothness degree is calculated, the ratio is added to the sum of the hyperparameters, multiplied by the gray difference degree of the marked block, and normalized, the normalized result is corrected according to a preset adjustment factor, and the abnormality degree in the marked block is obtained.

8. The machine vision-based part defect detection method of claim 1, wherein, The method for judging whether the automobile part has a bubble defect area based on the significant fuzzy entropy value includes: If the significant fuzzy entropy value is greater than a preset threshold value, then the position of the surface coating of the automobile part corresponding to the block has a bubble defect area, otherwise, the position of the surface coating of the automobile part corresponding to the block is normal.

9. A machine vision based system for detecting defects in parts, characterized in that, The method includes: A processor and a memory, the memory stores computer program instructions, when the computer program instructions are executed by the processor, the method for detecting defects of a part based on machine vision according to any one of claims 1-8 is realized.

Citation Information

Patent Citations

  • Automobile part surface defect detection method

    CN117197141A

  • Connector surface defect detection method and system based on image processing

    CN119693358A

  • Method for finding optimal threshold for image segmentation

    US20040208367A1