Part defect detection method and system based on machine vision

The coating surface of automotive parts is segmented and processed by machine vision and fuzzy entropy methods to identify small bubble defects, which solves the detection difficulties in existing technologies and achieves high-accuracy and sensitive detection effects.

CN120707541AActive Publication Date: 2025-09-26MAIWEI TECH (GUANGZHOU) CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies have difficulty accurately identifying small bubble defects on the coating surface of automotive parts, especially because the shape contrast of small bubble defects is low and similar to the texture features of the part surface, making detection difficult.

Method used

A component defect detection method based on machine vision is adopted. The grayscale image is obtained for preprocessing, and the surface texture image is divided into blocks using the fuzzy entropy method. The grayscale difference and texture change within the block are calculated. The bubble defect area is judged by combining the significant fuzzy entropy value. The number of iterations of the sub-block is dynamically adjusted to improve the detection accuracy.

Benefits of technology

The accuracy and sensitivity of detecting small bubble defects are improved, misjudgments and missed detections are reduced, and the adaptability and reliability of the algorithm to image areas of different complexity are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120707541A_ABST
    Figure CN120707541A_ABST
Patent Text Reader

Abstract

The invention relates to the field of image data processing, in particular to a part defect detection method and system based on machine vision, and the method comprises the steps: obtaining a gray image of the surface of an automobile part, carrying out the preprocessing, and extracting a surface texture image of a part region; using a fuzzy entropy method to block the surface texture image, and obtaining the gray difference degree and the abnormal degree in each block according to the gray value change and the texture expression in each block; dynamically adjusting the number of iterations of the sub-blocks based on the abnormal degree of the blocks; and optimizing an existing fuzzy entropy method according to the number of iterations to obtain a significant fuzzy entropy value of each block, and judging whether the automobile part has a bubble defect area or not based on the significant fuzzy entropy values. According to the method, the gray difference degree and the texture change in each block are analyzed, and the fuzzy entropy method is combined, so that the potential bubble defect area can be identified more accurately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image data processing, and more particularly to a component defect detection method and system based on machine vision. Background Art

[0002] With the rapid development of the automotive industry, especially in the areas of automated production and quality control, companies are placing increasingly high demands on component quality. The production process for automotive parts is complex, and surface coating is crucial for ensuring component quality and durability. Bubble defects that may occur during the coating process not only affect the component's appearance but also its long-term performance and reliability. Machine vision defect detection systems can efficiently identify potential bubble defects on the coating surface, reducing the subjectivity and error rate of manual inspection, ensuring component surface quality, and improving the safety and reliability of the entire vehicle.

[0003] A Chinese patent application with publication number CN117197141A discloses a method for detecting surface defects in automotive parts. The method involves obtaining a grayscale image of the surface of an automotive part, determining an initial threshold based on the grayscale values ​​of the pixels, and then obtaining a threshold to be tested, as well as preliminary defective and normal areas. Because bright areas can be misjudged due to illumination, the method uses the direction and positional relationship between the final defective areas to filter out discontinuous defect areas. An illumination impact value is obtained based on the grayscale values ​​of the pixels, and then the grayscale values ​​of the pixels are adjusted and combined with the grayscale values ​​of the pixels in the normal area to obtain a grayscale adjustment value. A comparison threshold is obtained based on the adjusted grayscale values ​​of the pixels and compared with the threshold to be tested to obtain the optimal threshold for defect detection in the grayscale image.

[0004] This application document analyzes the impact of lighting to obtain the optimal threshold, effectively improving the accuracy of defect detection. Currently, the fuzzy entropy method is used for component defect detection. Components may have small bubble defects. Since small bubble defects have irregular shapes and unclear boundaries with the surrounding normal areas, the grayscale difference is small, resulting in a lower contrast in the image. The surface of the component itself has texture features, which are similar to the texture of small bubble defects and can easily interfere with defect detection, making it difficult to accurately identify defects against a texture background. Summary of the Invention

[0005] In order to solve the problem that small bubble defects have low shape contrast and are similar to the texture features on the surface of the component itself, which easily interferes with defect detection and makes it difficult to accurately identify defects against the texture background, the present invention provides solutions in the following aspects.

[0006] In a first aspect, a component defect detection method based on machine vision includes: obtaining a grayscale image of the surface of an automotive component and preprocessing it to obtain a surface texture image of the component area; using a fuzzy entropy method to divide the surface texture image into blocks, calculating the grayscale difference degree within each block based on the grayscale value change within the block, and calculating the texture change within the block based on the texture performance within each block to obtain the abnormality degree of the block; rounding up the product between the abnormality degree of the block and the number of iterations of the sub-block within the block in the existing fuzzy entropy method to obtain the number of iterations of the sub-block; optimizing the existing fuzzy entropy method according to the number of iterations to obtain a significant fuzzy entropy value for each block, and judging whether the automotive component has a bubble defect area based on the significant fuzzy entropy value; wherein the significant fuzzy entropy value satisfies the following relationship: Where, Indicates the The fuzzy entropy value within each block is Indicates the The number of iterations of sub-block size within a block, Indicates the The size of the sub-chunks within a chunk The average fuzzy membership between each sub-block in the corresponding block after iterations is: Indicates the After the iteration, the average fuzzy membership between each sub-block in the corresponding block is Represents the normalization function.

[0007] The effect is that by calculating the grayscale difference and texture changes within each block, the grayscale and texture information are comprehensively considered, which can more comprehensively reflect the feature changes within the block. It is beneficial to detect small bubble defects. These defects are similar to the texture features of the component surface and have low contrast. Traditional methods are prone to missed detection or false detection. The bubble defect area is judged based on the significant fuzzy entropy value. The significant fuzzy entropy value is calculated through multiple iterations and can more accurately reflect the degree of abnormality within the block. Normalization processing ensures the comparability of results between different blocks, improves the accuracy and reliability of detection, and dynamically adjusts the number of iterations of the sub-block according to the degree of abnormality of the block, so that the algorithm can better adapt to image areas of different complexities. For potential bubble defect areas, increasing the number of iterations can more carefully analyze their characteristics and improve the sensitivity of detection. Through multiple iterations, the feature changes within the block are analyzed at 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 grayscale image is preprocessed to obtain a surface texture image of the component area, including: The semantic segmentation method is used to extract the component area in the grayscale image to obtain a binary image. The binary image is multiplied with the grayscale image to obtain the grayscale value of the component area. The pixels of the component outer contour are deleted, and the edge detection is performed on the surface of the deleted component area to obtain the surface texture image of the component area.

[0009] The effect is: through semantic segmentation and multiplication operations, the component area is accurately extracted, background interference is removed, the accuracy of subsequent analysis is ensured, the outer contour pixels are deleted, and the interference of the outer contour edge effect on the internal texture analysis is avoided, making the internal texture features more prominent; through edge detection, the surface texture features are enhanced, the potential bubble defect area is made more obvious, and the accuracy of defect detection is improved.

[0010] Preferably, the using of the fuzzy entropy method to divide the surface texture image into blocks comprises: Taking the upper left corner of the surface texture image as a reference, the surface texture image is divided into a number of blocks of preset sizes, and an initial size is set for the sub-blocks of each block; 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; Iterate the initial size of the sub-block, adding one to the side length of the previous sub-block.

[0011] The effect is that by analyzing feature variations within a block at different scales through multiple iterations, the algorithm can more comprehensively capture subtle changes in potential defects. This is particularly true for small bubble defects, which resemble the texture features of the component surface and have low contrast, making them easily missed or misdetected by traditional methods. By dynamically adjusting the number of sub-block iterations based on the degree of abnormality, the algorithm can better adapt to image regions of varying complexity. Increasing the number of iterations for potential bubble defect areas allows for more detailed feature analysis and improves detection sensitivity.

[0012] Preferably, the calculation of the grayscale difference within the blocks includes: Taking any block as a marked block, the absolute difference between the grayscale mean of all pixels in the marked block and the grayscale mean of all pixels in the surface texture image is calculated and normalized to obtain the local contrast; The ratio between the number of pixels with different gray values ​​in the marked block and the total number of all pixels in the marked block is taken as the texture complexity; The product of local contrast and texture complexity is used as the grayscale difference degree of the marked block.

[0013] The effect is: by calculating the local contrast and texture complexity and taking their product as the grayscale difference degree, the grayscale and texture information are comprehensively considered, and the potential bubble defect area can be identified more accurately. The calculation of the grayscale difference degree takes into account the distribution of grayscale values ​​within the block, reducing misjudgment and missed detection caused by uneven grayscale value distribution or complex texture.

[0014] Preferably, the step of calculating the grayscale difference within the blocks further includes: Take any block as the marked block, calculate the absolute difference between the gray value of each pixel in the marked block and the gray mean of all pixels in the marked block, and get the local contrast; The average of the sum of the local contrasts of all pixels in the marked block is taken as the grayscale difference degree in the marked block.

[0015] Preferably, the abnormality degree includes: Take any block as the marked block, take the Euclidean distance between the pixel point corresponding to the maximum grayscale value and the pixel point corresponding to the minimum grayscale value in the marked block as the grayscale distribution range, take the difference between the maximum grayscale value and the minimum grayscale value in the marked block as the extreme difference degree, and take the ratio between the grayscale distribution range and the extreme difference degree as the grayscale gradient degree; The ratio of the information entropy value of the sine value of the angle between the gradient direction and the horizontal opposite direction corresponding to all groups of adjacent edge pixels in the marked block to the variance of the sine value of the angle between the gradient direction and the horizontal opposite direction corresponding to all groups of adjacent edge pixels in the marked block is calculated. The product of the ratio and the grayscale gradient degree is added to the sum of the hyperparameters and multiplied by the grayscale difference degree and normalized. The normalized result is corrected according to the preset adjustment factor to obtain the degree of abnormality in the marked block.

[0016] The effect is that by comprehensively considering the degree of grayscale gradient, the ratio of texture complexity to smoothness, and the degree of grayscale difference, potential bubble defect areas can be identified more comprehensively; by analyzing the ratio of texture complexity to smoothness, the algorithm can adapt to different types of surface textures and improve its adaptability to different component surfaces; by calculating the degree of grayscale gradient and the ratio of texture complexity to smoothness, complex image processing operations are avoided and computational efficiency is improved.

[0017] Preferably, the abnormality degree further includes: Take any block as the marked block, mark the chain code value of the surface texture edge in the marked block, and use the information entropy 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 ​​in the marked block to get the smoothness. Calculate the ratio between the complexity and the smoothness, add the ratio to the sum of the hyperparameters and multiply it by the grayscale difference of the marked block and perform normalization. Correct the normalized result according to the preset adjustment factor to obtain the degree of abnormality within the marked block.

[0018] Preferably, the determining whether there is a bubble defect area in the automobile part based on the significant fuzzy entropy value includes: In response to the significant fuzzy entropy value being greater than a preset threshold, 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 is normal.

[0019] In a second aspect, a component defect detection system based on machine vision includes: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned component defect detection method based on machine vision is implemented.

[0020] The present invention has the following effects: 1. This method analyzes grayscale differences and texture variations within each block, combined with fuzzy entropy methods, to more accurately identify potential bubble defect areas. This is particularly true for small bubble defects, which resemble the texture features of component surfaces and have low contrast, making them prone to missed or false positives with traditional methods. By comprehensively considering both grayscale and texture information, this method significantly improves detection accuracy and reduces false positives and missed detections.

[0021] 2. This invention leverages grayscale differences and combines texture features with edge information, enabling the algorithm to adapt to different types of surface textures and defect characteristics. By dynamically adjusting the number of sub-block iterations, it can better handle image regions of varying complexity, improving the algorithm's adaptability to diverse component surfaces. This adaptability enables the inspection system to operate stably in a variety of production environments, enhancing detection reliability and robustness. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an illustrative and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 It is a method flow chart of steps S1 to S3 in the component defect detection method based on machine vision in an embodiment of the present invention.

[0023] Figure 2 This is a structural block diagram of a component defect detection system based on machine vision according to an embodiment of the present invention. DETAILED DESCRIPTION

[0024] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.

[0025] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0026] Reference Figure 1 The component defect detection method based on machine vision includes steps S1 to S3, which are specifically as follows: S1: Obtain a grayscale image of the surface of an automobile part and perform preprocessing to obtain a surface texture image of the part area.

[0027] Use a deep learning model (such as U-Net) to process the grayscale image and distinguish the component area from other background areas in the image to generate a binary image. In the binary image, the pixel value of the component area is 1, and the pixel value of the background area is 0. Multiply the binary image with the original grayscale image pixel by pixel, retain the grayscale value of the component area, set the grayscale value of the background area to 0, obtain the grayscale value of the component area, delete the pixel points of the component outer contour, perform edge detection on the surface of the deleted component area, and obtain the surface texture image of the component area.

[0028] For example, in this embodiment, a 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.

[0029] S2: Use the fuzzy entropy method to divide the surface texture image into blocks, calculate the grayscale difference within each block based on the grayscale value change, and calculate the texture change within the block based on the texture performance within each block to obtain the abnormality degree of the block.

[0030] Taking the upper left corner of the surface texture image as a reference, the surface texture image is divided into a number of blocks of preset sizes, and an initial size is set for the sub-blocks of each block; 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; The sub-block size iteration rule is: add one to the side length of the previous sub-block.

[0031] Specifically, the number of sub-blocks satisfies the following relationship: ; Where, Indicates the number of sub-blocks, Indicates the width of the block, Indicates the length of the block, Indicates the side length of the sub-block.

[0032] In this embodiment, the preset size of the block is , where the initial size of the sub-blocks in the block is , taking the upper left corner of the grayscale image as the reference, if the width or length of the area formed by the pixels at the right edge or bottom edge of the component image is less than 5 pixels, it will be divided into the image block immediately to the left or above it to avoid the area being too small to be effectively analyzed as a separate block. For example, in the first iteration, the sub-window size will be reduced from Iterate to .

[0033] Further analysis shows that the coating in the potential bubble area in the image may show grayscale values ​​different from normal coatings due to the refractive or reflective properties of the bubbles, and the grayscale value of the bubble area may be inconsistent with the surrounding area. Therefore, when analyzing the degree of grayscale difference within each block, the greater the difference between the grayscale mean within each image block and the grayscale mean in the image, and the greater the number of pixels with different grayscale values ​​within each image block, it can be said that the block is more likely to be a potential bubble defect area, and the corresponding grayscale difference will also be greater. Then, the grayscale difference degree within the block is calculated, including the following steps: Taking any block as a marked block, the absolute difference between the grayscale mean of all pixels in the marked block and the grayscale mean of all pixels in the surface texture image is calculated and normalized to obtain the local contrast; The ratio between the number of pixels with different gray values ​​in the marked block and the total number of all pixels in the marked block is taken as the texture complexity; The product of local contrast and texture complexity is used as the grayscale difference degree of the marked block.

[0034] Specifically, the grayscale difference degree satisfies the following relationship: ; Where, Indicates the The grayscale difference within each block, Indicates the The grayscale mean within each block, Represents the grayscale mean of the entire automobile parts surface image, Indicates the The number of pixels with different grayscale values ​​in each block, No. The number of pixels in a block, Represents the normalization function.

[0035] That is to say, Quantified the The difference between the grayscale mean value in each block and the grayscale mean value in the image, the larger the value, the The greater the difference between the grayscale mean value in each image block and the grayscale mean value in the image, the greater the difference between the grayscale mean value in the image block and the grayscale mean value in the image. The more likely a block is to belong to a potential bubble defect area, the greater the corresponding grayscale difference will be; Quantified the The ratio of the number of pixels with different gray values ​​in each block is greater. The greater the difference between the grayscale mean value in the image block and the grayscale mean value in the image, the greater the credibility is, which can indicate that the The more likely a block is to belong to a potential bubble defect area, the greater the corresponding grayscale difference will be.

[0036] In addition, another embodiment further comprises: Take any block as the marked block, calculate the absolute difference between the gray value of each pixel in the marked block and the gray mean of all pixels in the marked block, and get the local contrast; The average of the sum of the local contrasts of all pixels in the marked block is taken as the grayscale difference degree in the marked block.

[0037] Specifically, the grayscale difference degree satisfies the following relationship: ; Where, Indicates the The grayscale difference within each block, No. The number of pixels in a block, Indicates the In the block The gray value of a pixel.

[0038] That is to say, It reflects the difference between the gray value of each pixel in the block and the average gray value of the block, which can be regarded as the contrast between each pixel and the average brightness of the block. The larger it is, the wider the distribution of grayscale values ​​within the block is, and the more likely it is a potential bubble defect area.

[0039] Through the above analysis steps, the degree of grayscale difference within each block was determined. Based on the grayscale value performance of the pixels within each block, a preliminary analysis of the possibility that a block is a potential bubble defect was made. However, because some potential bubble defects are relatively subtle and have low contrast with the surrounding normal areas, and because some pre-designed textures may exist on the surface of the component, the average of the above two situations results in the degree of grayscale difference within a block not accurately reflecting the possibility that a block is a potential bubble defect. Therefore, based on the scenario research, the interface between the potential bubble defect and the coating exhibits a blurred or gradual transition effect due to factors such as surface tension and light refraction.

[0040] Potential bubble defects often appear as localized raised areas, often close to circular in shape. Therefore, in this step, the texture within each block is analyzed, and the degree of grayscale difference within each block is optimized to determine the degree of abnormality within each block. When analyzing the degree of abnormality within each block, the more gradual the grayscale value changes within the block and the closer the edge shape within the block is to an arc, the more likely this block is a potential bubble defect and the greater its degree of abnormality. If there is no grayscale change in a pixel within a block, the corresponding grayscale difference is smaller. If there is no grayscale change in a block, the corresponding grayscale gradient and edge shape indicators are defined as 0, and then the abnormality degree within the block is calculated, including the following steps: Take any block as the marked block, take the Euclidean distance between the pixel corresponding to the maximum grayscale value and the pixel corresponding to the minimum grayscale value in the marked block as the grayscale distribution range of the marked block, take the difference between the maximum grayscale value and the minimum grayscale value in the marked block as the extreme difference degree of the marked block, and take the ratio between the grayscale distribution range and the extreme difference degree as the grayscale gradient degree; Obtain the ratio of the grayscale difference degree within the marked block, the information entropy value of the sine value of the angle between the gradient direction and the horizontal opposite direction corresponding to all groups of adjacent edge pixels in the marked block, and the variance of the sine value of the angle between the gradient direction and the horizontal opposite direction corresponding to all groups of adjacent edge pixels in the marked block. Add the product of the ratio and the grayscale gradient degree, add the sum of the hyperparameters, and multiply by the grayscale difference degree and perform normalization. Correct the normalized result according to the preset adjustment factor to obtain the degree of abnormality within the marked block.

[0041] Specifically, the abnormality degree satisfies the following relationship: ; Where, Indicates the The degree of abnormality within a block, Indicates the The grayscale difference within each block, Indicates the The grayscale in each block is extremely poor. Indicates the The Euclidean distance between the maximum and minimum grayscale pixel points in a block, Indicates the The variance of the sine value of the angle between the gradient direction and the horizontal reverse direction corresponding to all groups of adjacent edge pixels in a block is Indicates the The information entropy value of the sine value of the angle between the gradient direction and the horizontal reverse direction corresponding to all groups of adjacent edge pixels in a block is: represents the hyperparameter, 、 Both represent adjustment factors for the range of abnormality values. Represents the normalization function.

[0042] For example, ,set up The purpose is to prevent the situation where there is no grayscale change pixel in a block and the block does not have the grayscale value gradient and the arc degree of the edge shape. and are adjustment factors for the range of abnormality within a block, for example, , , and finally limit the range of abnormality value in each block to the interval , which can be adjusted according to specific circumstances.

[0043] That is to say, The larger the The greater the possibility that a pixel point in a block belongs to a potential bubble defect area from the perspective of grayscale value expression, the greater the degree of abnormality; Reflects the The grayscale value gradient within a block. The larger the ratio, the greater the distance between the two pixels with the largest and smallest grayscale values ​​in the block. The greater the grayscale gradient, the greater the possibility that the block is a potential bubble defect, and the greater the corresponding abnormality. Reflects the The arc degree of the edge shape of each block, the larger the ratio is, the The greater the possibility that the edge shape of a block is arc-shaped, the greater the possibility that the block is a potential bubble defect, and the greater the corresponding degree of abnormality.

[0044] It should also be noted that if we only analyze , there may be interference from straight edge shapes, so On the basis of The quantification can exclude the occurrence of situations where some edge shapes are straight lines.

[0045] In addition, another embodiment further includes: Take any block as the marked block, mark the chain code value of the surface texture edge in the marked block, and use the information entropy 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 ​​in the marked block to get the smoothness. Calculate the ratio between the complexity and the smoothness, add the ratio to the sum of the hyperparameters and multiply it by the grayscale difference of the marked block and perform normalization. Correct the normalized result according to the preset adjustment factor to obtain the degree of abnormality within the marked block.

[0046] It should be noted that the marking chain code value is a well-known technology for those skilled in the art and will not be described in detail. In this embodiment, the edge of the block surface texture is marked according to the encoding corresponding to the 8-neighborhood direction of the preset pixel point starting from the upper left corner. The resulting coding sequence of the surface texture edge is calculated, and the information entropy of the coding sequence is calculated. The information entropy is a well-known technology in the art and will not be described in detail. The information entropy can reflect the degree of confusion of the coding sequence.

[0047] It should be further explained that the surface texture edge of the component may not exist in the block, so the hyperparameter is set There may also 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 is calculated as the information entropy value of all chain code values ​​in the block.

[0048] Specifically, the abnormality degree satisfies the following relationship: ; Where, Indicates the The degree of abnormality within a block, Indicates the The grayscale difference within each block, Indicates the The information entropy value of all chain code values ​​in a block, Indicates the The sum of the absolute values ​​of the differences between all adjacent chain code values ​​in a block, represents the hyperparameter, 、 Both represent adjustment factors for the range of abnormality values. Represents the normalization function.

[0049] That is to say, It reflects the relationship between the complexity and smoothness of the edge shape within the block. The higher the complexity and the lower the smoothness, the more likely it is a bubble defect area, because bubble defects often appear as locally raised circular areas with arc-shaped edges.

[0050] S3: The product of the abnormality degree of the block and the number of iterations of the sub-block within the block in the existing fuzzy entropy method is rounded up to obtain the number of iterations of the sub-block; the existing fuzzy entropy method is optimized according to the number of iterations 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.

[0051] It should be noted that the number of iterations of the sub-block size within each block is adaptively adjusted according to the degree of abnormality. The greater the degree of abnormality within each block, the more likely this block is to belong to a potential bubble defect in the surface coating of an automotive part. Therefore, in order to more accurately divide this block into a potential bubble defect area in the surface coating of an automotive part, when calculating the fuzzy entropy value within this block, the sub-block size within the block should be iterated more times to obtain more fuzzy membership means under different sub-block sizes, and the final sum (i.e., the significant fuzzy entropy value) obtained by accumulating the difference between the average fuzzy membership of each sub-block before and after each iteration is larger.

[0052] The optimized fuzzy entropy method is used to detect potential bubble defects in the surface coating of automotive parts. The specific approach is as follows: First, according to the preset block size and the number of sub-block iterations in step S2, the similarity tolerance is determined. The similarity tolerance when calculating the fuzzy membership 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 between each sub-block before the sub-block size iteration and each subsequent iteration within each block, wherein the fuzzy membership is obtained by the well-known technology in the fuzzy entropy method and will not be repeated here. In this embodiment, the calculation of the fuzzy membership is adjusted, and the corresponding value in this implementation is the significant fuzzy entropy value; The significant fuzzy entropy value of a block is calculated. Specifically, the significant fuzzy entropy value satisfies the following relationship: ; Where, Indicates the The fuzzy entropy value within each block is Indicates the The number of iterations of sub-block size within a block, Indicates the The size of the sub-chunks within a chunk The average fuzzy membership between each sub-block in the corresponding block after iterations is: Indicates the After the iteration, the average fuzzy membership between each sub-block in the corresponding block is Represents the normalization function.

[0053] That is to say, when , it means that the sub-block within the block has not started iteration (that is, the sub-block size is in the initial state).

[0054] In response to the significant fuzzy entropy value being greater than a preset threshold, 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 is normal.

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

[0056] The present invention also provides a component defect detection system based on machine vision. Figure 2 As shown, the system includes a processor and a memory, wherein the memory stores computer program instructions. When the computer program instructions are executed by the processor, the component defect detection method based on machine vision according to the first aspect of the present invention is implemented.

[0057] The system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface. The configuration and functions of these components are known in the art and therefore will not be described in detail here.

[0058] In the present invention, the aforementioned memory can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, the computer-readable storage medium can be any suitable magnetic 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 required information and can be accessed by an application, module, or both. Any such computer storage medium can be part of, accessible to, or connectable to a device. Any application or module described in the present invention can be implemented by computer-readable / executable instructions stored or otherwise retained by such a computer-readable medium.

[0059] In the description of this specification, "multiple" and "several" mean at least two, such as two, three or more, etc., unless otherwise clearly defined.

[0060] While several embodiments of the present invention have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Numerous modifications, variations, and alternatives will occur to those skilled in the art without departing from the concept and spirit of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in practicing the present invention.

Claims

1. A component defect detection method based on machine vision, characterized in that: include: Obtaining grayscale images of the surface of automotive parts and performing preprocessing to obtain surface texture images of the parts area; The surface texture image is divided into blocks using the fuzzy entropy method. The grayscale value changes in each block are used to calculate the grayscale difference within the block. Based on the texture performance in each block, the texture changes within the block are calculated to obtain the abnormality degree of the block. The product of the abnormality degree of the block and the number of iterations of the sub-block in the block in the existing fuzzy entropy method is rounded up to obtain the number of iterations of the sub-block; The existing fuzzy entropy method is optimized according to the number of iterations to obtain the significant fuzzy entropy value of each block. Based on the significant fuzzy entropy value, it is judged whether there is a bubble defect area in the automotive parts.

2. The component defect detection method based on machine vision according to claim 1, characterized in that: The significant fuzzy entropy value satisfies the following relationship: Where, Indicates the The fuzzy entropy value within each block is Indicates the The number of iterations of sub-block size within a block, Indicates the The size of the sub-chunks within a chunk The average fuzzy membership between each sub-block in the corresponding block after iterations is: Indicates the After the iteration, the average fuzzy membership between each sub-block in the corresponding block is Represents the normalization function.

3. The component defect detection method based on machine vision according to claim 1, characterized in that The grayscale image is preprocessed to obtain a surface texture image of the component area, including: The semantic segmentation method is used to extract the component area in the grayscale image to obtain a binary image. The binary image is multiplied with the grayscale image to obtain the grayscale value of the component area. The pixels of the component outer contour are deleted, and the edge detection is performed on the surface of the deleted component area to obtain the surface texture image of the component area.

4. The component defect detection method based on machine vision according to claim 1, characterized in that: The method of dividing the surface texture image into blocks by using the fuzzy entropy method includes: Taking the upper left corner of the surface texture image as a reference, the surface texture image is divided into a number of blocks of preset sizes, and an initial size is set for the sub-blocks of each block; 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; Iterate the initial size of the sub-block, adding one to the side length of the previous sub-block.

5. The component defect detection method based on machine vision according to claim 1, characterized in that: The calculation of the grayscale difference within the block includes: Taking any block as a marked block, the absolute difference between the grayscale mean of all pixels in the marked block and the grayscale mean of all pixels in the surface texture image is calculated and normalized to obtain the local contrast; The ratio between the number of pixels with different gray values ​​in the marked block and the total number of all pixels in the marked block is taken as the texture complexity; The product of local contrast and texture complexity is used as the grayscale difference degree of the marked block.

6. The component defect detection method based on machine vision according to claim 1, characterized in that: The calculation of the grayscale difference within the blocks further includes: Take any block as the marked block, calculate the absolute difference between the gray value of each pixel in the marked block and the gray mean of all pixels in the marked block, and get the local contrast; The average of the sum of the local contrasts of all pixels in the marked block is taken as the grayscale difference degree in the marked block.

7. The component defect detection method based on machine vision according to claim 1, characterized in that: The degree of abnormality includes: Take any block as the marked block, take the Euclidean distance between the pixel point corresponding to the maximum grayscale value and the pixel point corresponding to the minimum grayscale value in the marked block as the grayscale distribution range, take the difference between the maximum grayscale value and the minimum grayscale value in the marked block as the extreme difference degree, and take the ratio between the grayscale distribution range and the extreme difference degree as the grayscale gradient degree; The ratio of the information entropy value of the sine value of the angle between the gradient direction and the horizontal opposite direction corresponding to all groups of adjacent edge pixels in the marked block to the variance of the sine value of the angle between the gradient direction and the horizontal opposite direction corresponding to all groups of adjacent edge pixels in the marked block is calculated. The product of the ratio and the grayscale gradient degree is added to the sum of the hyperparameters and multiplied by the grayscale difference degree and normalized. The normalized result is corrected according to the preset adjustment factor to obtain the degree of abnormality in the marked block.

8. The component defect detection method based on machine vision according to claim 1, characterized in that: The degree of abnormality also includes: Take any block as the marked block, mark the chain code value of the surface texture edge in the marked block, and use the information entropy 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 ​​in the marked block to get the smoothness. Calculate the ratio between the complexity and the smoothness, add the ratio to the sum of the hyperparameters and multiply it by the grayscale difference of the marked block and perform normalization. Correct the normalized result according to the preset adjustment factor to obtain the degree of abnormality within the marked block.

9. The component defect detection method based on machine vision according to claim 1, characterized in that: The method of judging whether an automobile component has a bubble defect area based on a significant fuzzy entropy value includes: In response to the significant fuzzy entropy value being greater than a preset threshold, 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 is normal.

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

Citation Information

Patent Citations

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

    CN119693358A

  • Method for finding optimal threshold for image segmentation

    US20040208367A1

Cited By

  • Cable surface defect detection method and system based on machine vision

    CN121169927A

  • Method and system for monitoring operation state of metal workpiece pretreatment production line

    CN121708015A

  • Shell repair quality evaluation and judgment method based on visual inspection

    CN121861001A