Surface inspection method for electrophoresis processed automobile parts based on machine vision

By using agglomerative hierarchical clustering and edge detection algorithms based on machine vision, the image is divided into sub-blocks and the fiber factor is calculated, which solves the problem of detection accuracy caused by fabric fiber interference and improves the accuracy of electrophoretic processing surface detection of automotive parts.

CN120355699BActive Publication Date: 2025-09-16SHAANXI SANYUAN YANGYIHAO AUTOMOBILE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510811451.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-09-16
Estimated Expiration
2045-06-18

AI Technical Summary

Technical Problem

During the electrophoretic processing of automotive parts, fabric fiber interference leads to low accuracy in scratch defect detection, affecting the protective performance of the electrophoretic coating.

Method used

A surface inspection method for electrophoretic machining of automotive parts based on machine vision is adopted. Through agglomerative hierarchical clustering and edge detection algorithms, the image is divided into sub-blocks. The fiber factors of the sub-blocks are calculated, and secondary cropping is performed to remove fabric fiber interference and improve detection accuracy.

Benefits of technology

It effectively reduces fabric fiber interference, improves the accuracy of electrophoretic surface inspection of automotive parts, and ensures accurate identification of scratch defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120355699B_ABST
    Figure CN120355699B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image data processing, and in particular to a method for detecting the electrophoretic processing surface of an automobile part based on machine vision. The method comprises the following steps: dividing an image of the electrophoretic processing surface of an automobile part into multiple sub-blocks, obtaining an initial clustering result of the image of the electrophoretic processing surface of the automobile part using an agglomerative hierarchical clustering method; obtaining the primary fiber properties of the sub-block based on the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixels in the sub-block; calculating the fiber factor of the sub-block; and performing a secondary cropping of the initial clustering result based on the fiber factor of each sub-block in the initial clustering result to obtain an inspection result of the electrophoretic processing surface of the automobile part, thereby effectively improving the accuracy of the inspection result of the electrophoretic processing surface of the automobile part.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image data processing, in particular to a method for detecting the electrophoresis processed surface of automobile parts based on machine vision. Background Art

[0002] The automotive industry has high requirements for the precision and surface quality of automotive parts. Electrophoretic processing is a surface coating technology that can be applied to automotive parts. In particular, electrophoretic coating plays an important role in providing good corrosion resistance, durability and aesthetics.

[0003] During the electrophoretic coating process, factors such as surface wear of the conveyor belt, burrs on the metal brackets, and loose suspension chain clamps may cause the automotive parts to rub against the equipment during processing and transmission, forming long scratches along the transmission direction. These scratches have inconsistent widths and will expose the bright metal of the underlying automotive parts, causing the metal to come into contact with the outside air and destroying the protective properties of the electrophoretic coating.

[0004] When identifying such scratch defects through agglomerative hierarchical clustering algorithm, larger clusters can be formed by gradually merging adjacent clusters, and the number of clusters can be automatically adjusted according to actual conditions, thereby more accurately identifying various types of scratch defects.

[0005] However, when using high-definition industrial cameras to capture surface images of automotive parts for scratch defect detection, tiny fabric fibers in the air may be adsorbed onto the surface images of the automotive parts due to static electricity. The fabric fibers and scratch defects are mixed together, resulting in interference from the fabric fibers in the final scratch defect detection results, and low accuracy.

[0006] Based on this, how to effectively reduce the interference of fabric fibers in scratch defect detection, thereby improving the accuracy of the detection results of electrophoretic processed surfaces of automotive parts, is a problem that needs to be solved urgently by those skilled in the art. Summary of the Invention

[0007] In order to solve the technical problem of how to effectively reduce fabric fiber interference in scratch defect detection, thereby improving the accuracy of automobile part electrophoretic processing surface detection results, the present invention provides an automobile part electrophoretic processing surface detection method based on machine vision.

[0008] In a first aspect, the present invention provides a method for detecting the electrophoresis-processed surface of automobile parts based on machine vision, which adopts the following technical solutions:

[0009] A method for detecting the electrophoresis processed surface of automobile parts based on machine vision includes the following steps:

[0010] The electrophoresis processed surface image of automobile parts is divided into multiple sub-blocks. The initial clustering results of the electrophoresis processed surface image of automobile parts are obtained by the agglomerative hierarchical clustering method. The primary fiber properties of the sub-block are obtained by the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixels in the sub-block. The fiber factor of the sub-block is calculated as follows:

[0011] ;

[0012] For the The fiber factor of each sub-block, For the The primary fiber properties of each sub-block, For the The grayscale mean of all edge pixels in a sub-block, For the The number of edges in the sub-block, For the In the sub-block The variance of the number of similar pixels of each edge pixel in the edge, is the linear normalization function, is an exponential function with e as the base; the initial clustering results are trimmed twice based on the fiber factor of each sub-block in the initial clustering results to obtain the electrophoresis processed surface inspection results of automobile parts.

[0013] The present invention takes into account that the micro-textile fibers and scratch defects on the surface of automobile parts are mixed, which will affect the accuracy of scratch defect detection on the surface of automobile parts. Therefore, by obtaining the possibility that the edges in each sub-block area of ​​the electrophoretic processing surface image of the automobile part are micro-textile fibers, the initial clustering results are secondary cropped, which can effectively improve the accuracy of the detection results of the electrophoretic processing surface of automobile parts. In this process, the present invention takes into account the large difference in shape between micro-textile fibers and scratches. Therefore, by obtaining the aspect ratio of the minimum circumscribed rectangle of the edge, the edge with a shape closer to the micro-textile fiber is accurately obtained. On this basis, the present invention also takes into account that the high grayscale value of the scratch defect area may be closer to the grayscale characteristics of some micro-textile fibers. Therefore, by further obtaining the width change and grayscale fluctuation of each edge, the fiber factor of the sub-block is accurately obtained in combination with the primary fiber property, so that the initial clustering result can be accurately secondary cropped based on the fiber factor of each sub-block, effectively improving the accuracy of scratch defect detection on the surface of automobile parts.

[0014] According to the machine vision-based detection method for the electrophoretic processing surface of automobile parts provided by the present invention, the electrophoretic processing surface image of the automobile part is divided into multiple sub-blocks, and the method also includes: photographing the electrophoretic processing surface of the automobile part and preprocessing it to obtain the electrophoretic processing surface image of the automobile part.

[0015] According to the machine vision-based detection method for the electrophoretic processing surface of automobile parts provided by the present invention, the method of dividing the electrophoretic processing surface image of the automobile part into multiple sub-blocks includes: using the upper left corner of the electrophoretic processing surface image of the automobile part as the starting point, constructing a sliding window of a preset size, and the sliding window is the first sub-block in the electrophoretic processing surface image of the automobile part; using the right edge of the first sub-block as the sliding window to slide to the right at the left edge of the next position to obtain the second sub-block, and repeating this process to obtain the first row of sub-blocks of the electrophoretic processing surface image of the automobile part; using the lower edge of the last sub-block in the first row of sub-blocks as the sliding window to slide downward at the upper edge of the next row position, and then continuing to slide to the left, and finally dividing the electrophoretic processing surface image of the automobile part into multiple sub-blocks.

[0016] The present invention takes into account the large number of pixels in the electrophoretic processing surface image of automobile parts. Therefore, the electrophoretic processing surface image of automobile parts is divided into blocks, so that each block can be processed in parallel subsequently, and the scratch defect area in the electrophoretic processing surface image of automobile parts can be accurately and quickly obtained.

[0017] According to the machine vision-based automobile part electrophoretic processing surface detection method provided by the present invention, the initial clustering results of the automobile part electrophoretic processing surface image are obtained through the agglomerative hierarchical clustering method, including: constructing a block feature vector for each sub-block, taking each sub-block as an initial clustering cluster, constructing a distance matrix between the initial clustering clusters, iteratively merging the two initial clustering clusters with the closest distance, updating the distance matrix, and dividing the sub-blocks into multiple clustering clusters in response to the iterative termination condition to obtain the initial clustering results.

[0018] The present invention obtains the initial clustering results of the electrophoresis processed surface images of automobile parts through the agglomerative hierarchical clustering method, and can gradually merge clusters according to the grayscale changes and texture features in the image, so as to obtain the initial clustering results accurately and quickly.

[0019] According to the machine vision-based detection method for the electrophoretic processing surface of automobile parts provided by the present invention, edges and edge pixels of each edge in the electrophoretic processing surface image of automobile parts are extracted by an edge detection algorithm.

[0020] According to the machine vision-based surface detection method for electrophoretic processing of automobile parts provided by the present invention, the primary fibrousness of the sub-block is obtained by using the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixels in the sub-block, including: recording the negative of the average of the aspect ratios of the minimum circumscribed rectangles of each edge in the sub-block as the border index of the sub-block; and normalizing the border index and multiplying it by the number of edge pixels in the sub-block to obtain the primary fibrousness of the sub-block.

[0021] The present invention provides an accurate method for calculating the primary fiber properties of a sub-block. By analyzing the shape difference between scratches and tiny fabric fibers, the primary fiber properties of the sub-block can be accurately obtained.

[0022] According to the machine vision-based electrophoresis processed surface detection method for automobile parts provided by the present invention, a method for obtaining the number of similar pixels of an edge pixel point includes: obtaining a pixel point in the gradient change direction of the edge pixel point, taking the edge pixel point as a starting point, obtaining pixels in the gradient change direction whose grayscale difference with the edge pixel point is not greater than a difference threshold, and recording them as similar pixels of the edge pixel point, until the grayscale difference between the edge pixel point and the pixel point in the gradient change direction is greater than the difference threshold, stopping obtaining similar pixels, and obtaining the number of similar pixels of the edge pixel point.

[0023] The present invention takes into account that the width of the scratch defect area changes irregularly, while the width of tiny fabric fibers changes slightly. Therefore, by obtaining the variance of the number of similar pixel points of each edge pixel in the gradient change direction, the change consistency of each edge pixel in the edge can be accurately obtained, preparing for the subsequent accurate acquisition of the fiber factor of the sub-block.

[0024] According to the machine vision-based electrophoresis processed surface detection method for automobile parts provided by the present invention, the initial clustering results are subjected to secondary trimming based on the fiber factor of each sub-block in the initial clustering results, including: based on the comparison result of the fiber factor mean of the sub-blocks in the cluster cluster and the fiber threshold, the initial clustering results are subjected to secondary trimming to obtain the final cluster cluster.

[0025] According to the machine vision-based electrophoretic processing surface detection method for automobile parts provided by the present invention, the initial clustering results are subjected to secondary cropping based on the fiber factors of each sub-block in the initial clustering results to obtain the electrophoretic processing surface detection results of automobile parts, including: secondary cropping the clusters whose sub-blocks' fiber factor mean value is greater than the fiber threshold as fiber clusters; otherwise, they are retained to obtain the electrophoretic processing surface detection results of automobile parts.

[0026] According to the machine vision-based automobile part electrophoretic processing surface detection method provided by the present invention, the above-mentioned automobile part electrophoretic processing surface detection result is obtained, and then the fiber clusters and scratch defect clusters in the automobile part electrophoretic processing surface detection result are respectively marked.

[0027] The present invention has the following technical effects:

[0028] Based on the above technical solution, the present invention provides a method for detecting the electrophoretic processing surface of automobile parts based on machine vision. By obtaining the possibility that the edges in each sub-block area of ​​the electrophoretic processing surface image of the automobile part are tiny fabric fibers, the initial clustering results are subjected to secondary cropping, which can effectively improve the accuracy of the detection results of the electrophoretic processing surface of automobile parts. In this process, the present invention takes into account the large difference in shape between tiny fabric fibers and scratches, and therefore accurately obtains edges whose shapes are closer to tiny fabric fibers by obtaining the aspect ratio of the minimum circumscribed rectangle of the edge. On this basis, the present invention also takes into account that the high grayscale value of the scratch defect area may be closer to the grayscale characteristics of some tiny fabric fibers. Therefore, by further obtaining the width change and grayscale fluctuation of each edge, the fiber factor of the sub-block is accurately obtained in combination with the primary fiber property, so that the initial clustering result can be accurately cropped based on the fiber factor of each sub-block, effectively improving the accuracy of scratch defect detection on the surface of automobile parts. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 A schematic diagram of the process of detecting the electrophoresis processed surface of automobile parts based on machine vision provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, but not all of the embodiments.

[0031] In order to reduce the interference of fabric fibers in scratch defect detection and thus improve the accuracy of the detection results of electrophoretic processing surfaces of automobile parts, an embodiment of the present invention discloses a method for detecting electrophoretic processing surfaces of automobile parts based on machine vision. This method can accurately distinguish scratch defects and fabric fibers on the surface of automobile parts based on the characteristic differences between scratch defects and fabric fibers on the surface of automobile parts, thereby improving the accuracy of the detection results of electrophoretic processing surfaces of automobile parts.

[0032] For details, please see Figure 1 As shown, Figure 1 This is a flow chart of a method for detecting the surface of an automobile part electrophoresis-processed based on machine vision provided by an embodiment of the present invention. The method specifically includes the following steps:

[0033] S1: Obtain the electrophoretic processing surface image of the automobile part, and obtain the initial clustering result of the electrophoretic processing surface image of the automobile part through the agglomerative hierarchical clustering method.

[0034] For example, in an embodiment of the present invention, before obtaining the electrophoretic processed surface image of an automobile part, the surface of the automobile part can be photographed by a high-definition industrial camera, and the surface photo of the automobile part can be preprocessed to obtain the electrophoretic processed surface image of the automobile part.

[0035] The pre-processing method may be image denoising, image enhancement, grayscale processing, etc., which may be specifically configured according to actual needs and is not excessively limited in the embodiment of the present invention.

[0036] Specifically, after the electrophoretic processing is completed on the surface of the automobile part, the surface image of the automobile part is captured on the front of the automobile part to ensure that the camera lens can completely cover the surface of the automobile part. The shooting frame rate of the camera can be set to 2 frames per second, and the resolution of the surface image of the automobile part can be set to 5 million pixels.

[0037] The shooting frame rate and resolution can be set according to actual needs, and the embodiment of the present invention does not impose too many restrictions on this.

[0038] After obtaining the electrophoretic processing surface image of the automobile part based on the above steps, the initial clustering result of the electrophoretic processing surface image of the automobile part can be obtained by a conventional agglomerative hierarchical clustering method.

[0039] For example, in an embodiment of the present invention, the initial clustering results of the electrophoretic processing surface image of automobile parts are obtained by an agglomerative hierarchical clustering method, including: constructing a block feature vector for each sub-block, taking each sub-block as an initial clustering cluster, constructing a distance matrix between the initial clustering clusters, iteratively merging the two initial clustering clusters with the closest distance, updating the distance matrix, and dividing the sub-blocks into multiple clustering clusters in response to the iteration termination condition to obtain the initial clustering results.

[0040] The grayscale mean values ​​of the sub-blocks may be obtained first, and the absolute value of the difference between the grayscale mean values ​​of two sub-blocks may be used as the distance between the two sub-blocks.

[0041] For example, the iteration termination condition may be set as that the distances between the initial clusters are all greater than a distance threshold.

[0042] The distance threshold may be set to 0.2; the specific setting may be made according to actual needs.

[0043] Specifically, after iteratively merging the two initial clusters with the closest distance, a new cluster can be obtained. Then, the distance between the new cluster and other clusters is recalculated, and the initial distance matrix is ​​updated. The clusters with the closest distance are further merged, and finally multiple clusters are obtained, each of which contains multiple sub-blocks.

[0044] The specific steps of obtaining the initial clustering results of the electrophoresis processed surface images of automobile parts by using the agglomerative hierarchical clustering method can be achieved by existing technologies, and will not be described in detail in the embodiment of the present invention.

[0045] It's understandable that the initial clustering results obtained by the aforementioned clustering algorithm after processing the electrophoretic processing surface image of an automotive part are the scratch defect clusters in the electrophoretic processing surface image of the automotive part obtained by the agglomerative hierarchical clustering method. However, in reality, the scratch defect clusters in the initial clustering results may contain both true scratch defect clusters and fabric fiber clusters. The fabric fibers and scratch defects are mixed together, affecting the accuracy of scratch defect detection on the automotive part surface.

[0046] Based on this, the embodiment of the present invention can analyze the grayscale features of the pixel points to calculate the possibility that each pixel point is a tiny fabric fiber, and perform secondary cropping on the initial clustering results based on the possibility that each pixel point is a tiny fabric fiber, and finally obtain the true scratch defect cluster, that is, execute the following steps.

[0047] S2: Divide the electrophoresis processed surface image of the automobile part into multiple sub-blocks, and obtain the edges and edge pixels in the sub-blocks.

[0048] It should be noted that there are a large number of pixels in the electrophoretic processed surface image of automobile parts. If the possibility of each pixel being a tiny fabric fiber is calculated, it may generate excessive data processing and cause waste of resources.

[0049] Based on this, the embodiment of the present invention can divide the electrophoretic processed surface image of automobile parts into multiple sub-blocks, each sub-block contains some local features of the image, and performs grayscale feature analysis on each sub-block, so that the algorithm can process multiple sub-blocks in parallel, thereby more accurately and quickly extracting and identifying edges in the image, thereby improving the efficiency and accuracy of image processing.

[0050] For example, in an embodiment of the present invention, the electrophoretic processing surface image of an automobile part is divided into multiple sub-blocks, including: taking the upper left corner of the electrophoretic processing surface image of the automobile part as the starting point, constructing a sliding window of a preset size, and the sliding window is the first sub-block in the electrophoretic processing surface image of the automobile part; using the right edge of the first sub-block as the left edge of the sliding window at the next position to slide to the right to obtain the second sub-block, and repeating this cycle to obtain the first row of sub-blocks of the electrophoretic processing surface image of the automobile part; using the lower edge of the last sub-block in the first row of sub-blocks as the upper edge of the sliding window at the next row position to slide downward, and then continue to slide to the left, and finally dividing the electrophoretic processing surface image of the automobile part into multiple sub-blocks.

[0051] The size of the sliding window can be set to 11×11, where the size of the sliding window is the number of pixels contained in the sliding window. The size of the sliding window can be set according to actual needs, and the embodiment of the present invention does not impose any excessive restrictions on this.

[0052] It is understandable that the left edge and right edge described in the above embodiment are only for ease of understanding and are not real edges. Therefore, when the edges in the sub-block are subsequently obtained, the left edge and right edge mentioned in the above embodiment are not included.

[0053] Take an example to illustrate the steps of dividing sub-blocks: Assume that the size of the electrophoretic processing surface image of the automobile part is 22×22. Take the upper left corner pixel point (0, 0) of the electrophoretic processing surface image of the automobile part as the starting point, and get an 11×11 sliding window, which is the first sub-block. The coordinates of the upper left corner and lower right corner of the first sub-block are (0, 0) and (11, 11) respectively; slide the sliding window to the right, and get the coordinates of the upper left corner and lower right corner of the second sub-block respectively (11, 0) and (22, 11). The first sub-block The coordinates of the upper right corner of the second sub-block are the same, and the coordinates of the lower right corner of the first sub-block are the same as the lower left corner of the second sub-block, and finally the first row of sub-blocks are obtained; slide the sliding window downward, and the coordinates of the upper left corner and lower right corner of the third sub-block are obtained as (11, 11) and (22, 22) respectively. Finally, slide the sliding window to the left, and the coordinates of the upper left corner and lower right corner of the fourth sub-block are obtained as (0, 11) and (11, 22) respectively. Finally, the electrophoresis processed surface image of the automobile parts is divided into four sub-blocks.

[0054] It is understandable that during the sliding window's movement, some side regions in the electrophoretic processed surface image of an automotive part may be smaller than the size of the sliding window. For such regions, the position of the side region can be used as the final position of the sliding window in the row containing the side region during the initial sub-block division process, allowing continued division. After the initial sub-block division is completed, the size of the side region is obtained. If the length or width of the side region is less than or equal to 7, the side region can be merged into an adjacent sub-block, with no more than one side region being merged into each sub-block. If the length or width of the side region is greater than 7 and less than 11, the side region can be treated as a new sub-block.

[0055] For example, in an embodiment of the present invention, the electrophoretic processing surface image of an automobile part is divided into multiple sub-blocks. The size of the sub-block can also be set based on the size of the electrophoretic processing surface image of the automobile part, and the electrophoretic processing surface image of the automobile part is evenly divided into multiple sub-blocks.

[0056] The size of the sub-blocks may be set based on the size of the electrophoresis processed surface image of the automobile part according to actual needs, and the embodiment of the present invention does not impose any restrictions thereon.

[0057] For example, in an embodiment of the present invention, edges and edge pixel points of each edge in an image of an electrophoresis-processed surface of an automobile part may be extracted using an edge detection algorithm.

[0058] The edge detection algorithm may be a Sobel operator, a Canny edge detection algorithm, etc., which may be set according to actual needs, and the embodiment of the present invention does not impose any excessive restrictions thereon.

[0059] It should be noted that based on the above steps, the various sub-blocks in the electrophoretic processing surface image of automobile parts can be obtained. The sub-blocks without scratch defects or tiny fabric fiber interference appear smooth, and the grayscale difference within the sub-block is small; while the sub-blocks with scratch defects or tiny fabric fiber interference will have edges, and the edges contain multiple edge pixels.

[0060] Based on this, the embodiment of the present invention can obtain the contour shape and grayscale features of the edge composed of each edge pixel point, and obtain the possibility of tiny fabric fiber interference in each sub-block, that is, continue to perform the following steps.

[0061] S3: Obtain the primary fiber properties of the sub-block through the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixels in the sub-block.

[0062] It should be noted that the pixels in the tiny fabric fiber area usually have a relatively obvious grayscale value difference from the pixels in the non-fiber area. The fabric fibers are in a curly shape, while the scratches are in a linear shape. The more edge pixels there are in a sub-block, the greater the possibility of the presence of tiny fabric fibers.

[0063] Based on this, the embodiment of the present invention can obtain the shape of the edges and the number of edge pixels in each sub-block, and obtain the possibility of the existence of curved edges. Such edges are closer to the shape of tiny fabric fibers, while the scratch edges are linear and relatively slender. By analyzing the number of edge pixels and edge shape in the sub-block, the primary fiber properties of the sub-block can be accurately obtained.

[0064] For example, in an embodiment of the present invention, the primary fibrousness of the sub-block is obtained by the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixels in the sub-block, including: recording the negative of the average of the aspect ratios of the minimum circumscribed rectangles of each edge in the sub-block as the border index of the sub-block; normalizing the border index and multiplying it by the number of edge pixels in the sub-block to obtain the primary fibrousness of the sub-block.

[0065] The normalization process may be performed by standard normalization, an exponential function with base e, etc., and specific settings may be made according to actual needs.

[0066] For example, in an embodiment of the present invention, the calculation The primary fiber properties of each sub-block can be specifically referred to the following relationship:

[0067] ;

[0068] For the The primary fiber properties of each sub-block, For the The number of edge pixels in a sub-block, For the The number of edges in the sub-block, For the In the sub-block The length of one side of the minimum circumscribed rectangle of the edges , For the In the sub-block The other side length of the minimum circumscribed rectangle of the edges , To obtain the maximum value function, To obtain the minimum function, It is an exponential function with base e, where e is a natural constant.

[0069] It is understandable that the The lengths of the minimum circumscribed rectangle of the edges are The length and width of the minimum circumscribed rectangle of the edges, so To obtain the The length of the minimum circumscribed rectangle of the edges, To obtain the The width of the minimum bounding rectangle of the edges.

[0070] In the above formula, The more edge pixels there are in a sub-block, the In order to distinguish between tiny fabric fibers and printed frame edges, the embodiment of the present invention further obtains the first The size indicator of each sub-block.

[0071] Used for the Sub-block size index Perform normalization processing. Indicates the In the sub-block The aspect ratio of the minimum circumscribed rectangle of the edge. The smaller the value, the The more likely an edge is a tiny curved fabric edge, the less likely it is a scratch.

[0072] It can be understood that some sub-blocks belong to clean surface areas of automobile parts. Such sub-blocks do not contain edges. For such sub-blocks, the primary fibrousness of the sub-block can be set to 0.

[0073] Based on the above steps, the primary fibrousness of each sub-block can be obtained. The primary fibrousness is used to characterize the possibility of the existence of tiny textile fibers in each sub-block. The greater the primary fibrousness, the greater the possibility of the existence of tiny textile fibers in the sub-block.

[0074] S4: Calculate the fiber factor of the sub-block according to the grayscale features and primary fiber properties in the sub-block.

[0075] It should be noted that the primary fiber properties of each sub-block can be determined by analyzing the number of edge pixels in the sub-block and the shape of the edge formed by these edge pixels based on the above steps. However, because the micro-textiles attached to the electrophoretic processed surface of automotive parts are very fine, electrostatic forces can cause the fibers to attract or repel each other, affecting their curved shape. Therefore, they may also appear relatively straight within a block. Therefore, secondary cropping of the clustering results based solely on the primary fiber factor may result in incomplete cropping of the clusters corresponding to the micro-textile areas, ultimately affecting the accurate detection of potential scratch defects.

[0076] It should be further explained that scratches produced by equipment often disrupt the surface consistency of automotive parts, exposing the underlying bright metal structure and resulting in a higher grayscale value. The higher brightness features allow for preliminary identification of scratch edges. However, the grayscale features corresponding to tiny fabric fibers vary with the color of the fabric, and the brightness can be high or low. Identifying scratch edges based solely on high-brightness features can lead to misjudgment. Fabric fibers are woven, and their width varies little. Scratches, however, are caused by mechanical contact with the equipment or process anomalies, and their width varies inconsistently.

[0077] Based on this, the embodiment of the present invention can correct the primary fiber properties of the sub-block by analyzing the grayscale difference between the printed frame scratch defect area and the tiny fabric fibers, combined with the width change of the edge in the sub-block.

[0078] It can be understood that if the number of similar pixel points with smaller grayscale differences in the gradient change direction of all edge pixels on each edge in each sub-block is smaller, it means that it is more consistent with the characteristics of tiny fabric fibers.

[0079] For example, in an embodiment of the present invention, the method for obtaining the number of similar pixels of an edge pixel point is: obtain pixel points in the gradient change direction of the edge pixel point, take the edge pixel point as the starting point, obtain pixel points in the gradient change direction whose grayscale difference with the edge pixel point is not greater than a difference threshold, and record them as similar pixels of the edge pixel point, until the grayscale difference between the edge pixel point and the pixel points in the gradient change direction is greater than the difference threshold, stop obtaining similar pixels, and obtain the number of similar pixels of the edge pixel point.

[0080] The grayscale difference between an edge pixel and a pixel in the gradient change direction is the absolute value of the grayscale difference between the edge pixel and the pixel in the gradient change direction. The difference threshold can be set to 3; the difference threshold can be set based on actual needs and is not limited in this embodiment of the present invention.

[0081] Take an example to illustrate the steps of obtaining the number of similar pixels of an edge pixel: if the grayscale value of an edge pixel is 55, the number of pixels in the gradient change direction of the edge pixel is 5, and their grayscale values ​​are 54, 56, 57, 59, and 55 in order of distance from near to far, then the pixels corresponding to the grayscale values ​​54, 56, 57, and 55 are similar pixels of the edge pixel, but the grayscale difference between the fourth pixel and the edge pixel is greater than 3, so the number of similar pixels of the edge pixel is stopped here, and finally the similar pixels of the edge pixel are the pixels corresponding to the grayscale values ​​54, 56, and 57, that is, the number of similar pixels is 3.

[0082] It can be understood that the similar pixel points of the edge pixel points obtained based on the above steps are the pixel points with the smaller grayscale difference from the edge pixel points.

[0083] For example, in the embodiment of the present invention, the fiber factor of the sub-block is calculated, and the specific relationship can be referred to as follows:

[0084] ;

[0085] For the The fiber factor of each sub-block, For the The primary fiber properties of each sub-block, For the The grayscale mean of all edge pixels in a sub-block, For the The number of edges in the sub-block, For the In the sub-block The variance of the number of similar pixels of each edge pixel in the edge, is the linear normalization function, is an exponential function with base e.

[0086] In the above formula, Indicates the The negative value of the mean variance of the number of similar pixels of all edge pixels in the sub-block. The smaller the mean variance, the smaller the number of similar pixels. The greater the consistency of the number of similar pixels of all edge pixels in the sub-block, the The more likely the sub-blocks are to be tiny fabric fibers, the less likely they are to be scratch defect areas.

[0087] Based on the above steps, the fiber factor of each sub-block can be obtained. The initial clustering results are trimmed twice by the fiber factor of each sub-block to accurately obtain the electrophoresis processed surface inspection results of automobile parts, that is, perform the following steps.

[0088] S5: The initial clustering results are trimmed again based on the fiber factor of each sub-block in the initial clustering results to obtain the electrophoresis processed surface detection results of automobile parts.

[0089] For example, in an embodiment of the present invention, the initial clustering results are subjected to secondary trimming based on the fiber factor of each sub-block in the initial clustering results, including: based on the comparison result of the fiber factor mean of the sub-blocks in the cluster cluster and the fiber threshold, the initial clustering results are subjected to secondary trimming to obtain the final cluster cluster.

[0090] The fiber threshold may be set to 0.8. The fiber threshold may be set according to actual needs, and the embodiment of the present invention does not impose any additional restrictions thereon.

[0091] For example, in an embodiment of the present invention, the initial clustering results are secondary pruned based on the fiber factors of each sub-block in the initial clustering results to obtain the electrophoretic processing surface detection results of automobile parts, including: secondary pruned the clusters whose fiber factor mean of the sub-blocks in the clusters is greater than the fiber threshold as fiber clusters; otherwise, they are retained to obtain the electrophoretic processing surface detection results of automobile parts.

[0092] It can be understood that the clusters whose fiber factor mean is not greater than the fiber threshold value obtained after secondary trimming of the initial clustering results are the scratch defect areas on the surface of the automobile parts.

[0093] The clusters whose fiber factor mean is not greater than the fiber threshold are retained as scratch defect clusters, and the scratch defects on the electrophoretic processing surface of automobile parts can be obtained. The automobile part surface containing the scratch defect clusters is marked as defective to facilitate classification and identification by staff.

[0094] For example, in an embodiment of the present invention, after obtaining the electrophoresis processed surface inspection result of an automobile part, the method further includes: marking the fiber clusters and scratch defect clusters in the electrophoresis processed surface inspection result of the automobile part respectively.

[0095] Among them, the marking method can be implemented by marking boxes, color highlighting, etc., which can be specifically set according to actual needs. The embodiment of the present invention does not impose too many restrictions here.

[0096] It can be seen that in the embodiment of the present invention, when obtaining the detection results of the electrophoretic processing surface of automobile parts, the electrophoretic processing surface image of the automobile parts can be divided into multiple sub-blocks, and the initial clustering results of the electrophoretic processing surface image of the automobile parts can be obtained by using the agglomerative hierarchical clustering method; the primary fiber properties of the sub-block are obtained by the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixels in the sub-block; and the fiber factor of the sub-block is calculated:

[0097] ;

[0098] For the The fiber factor of each sub-block, For the The primary fiber properties of each sub-block, For the The grayscale mean of all edge pixels in a sub-block, For the The number of edges in the sub-block, For the In the sub-block The variance of the number of similar pixels of each edge pixel in the edge, is the linear normalization function, is an exponential function with e as the base; the initial clustering results are trimmed twice based on the fiber factor of each sub-block in the initial clustering results to obtain the electrophoresis processed surface inspection results of automobile parts, which effectively improves the accuracy of the electrophoresis processed surface inspection results of automobile parts.

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

Claims

1. A method for detecting the electrophoresis processed surface of automobile parts based on machine vision, characterized in that: include: The electrophoresis processed surface image of automobile parts is divided into multiple sub-blocks, and the initial clustering results of the electrophoresis processed surface image of automobile parts are obtained by using the agglomerative hierarchical clustering method; The primary fiber properties of the sub-block are obtained by the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixels in the sub-block; the fiber factor of the sub-block is calculated as: ; For the The fiber factor of each sub-block, For the The primary fiber properties of each sub-block, For the The grayscale mean of all edge pixels in a sub-block, For the The number of edges in the sub-block, For the In the sub-block The variance of the number of similar pixels of each edge pixel in the edge, is the linear normalization function, is an exponential function with base e; The initial clustering results are trimmed again based on the fiber factor of each sub-block in the initial clustering results to obtain the electrophoresis processing surface inspection results of automobile parts; The primary fiber property of the sub-block is obtained by using the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixels in the sub-block, including: The negative of the average of the aspect ratios of the minimum bounding rectangles of each edge in the sub-block is recorded as the border index of the sub-block; The border index is normalized and then multiplied by the number of edge pixels in the sub-block to obtain the primary fiber property of the sub-block.

2. The method for detecting the surface of an automobile part electrophoresis processed by machine vision according to claim 1, characterized in that: The step of dividing the electrophoresis processed surface image of the automobile part into a plurality of sub-blocks also includes: The electrophoresis processed surface of automobile parts is photographed and pre-processed to obtain the electrophoresis processed surface image of automobile parts.

3. The method for detecting the surface of an automobile part electrophoresis processed by machine vision according to claim 1, characterized in that: The step of dividing the electrophoresis processed surface image of the automobile part into a plurality of sub-blocks includes: Starting from the upper left corner of the electrophoretic processing surface image of the automobile part, a sliding window of preset size is constructed. The sliding window is the first sub-block in the electrophoretic processing surface image of the automobile part. The right edge of the first sub-block is used as the sliding window to slide to the right at the left edge of the next position to obtain the second sub-block. This cycle is repeated to obtain the first row of sub-blocks of the electrophoretic processing surface image of the automobile part. The lower edge of the last sub-block in the first row of sub-blocks is used as the sliding window to slide downward at the upper edge of the next row position, and then continue to slide to the left, and finally the electrophoretic processing surface image of the automobile part is divided into multiple sub-blocks.

4. The method for detecting the surface of an automobile part electrophoresis processed by machine vision according to claim 1, characterized in that: The method of obtaining the initial clustering results of the electrophoresis processed surface images of automobile parts by using the agglomerative hierarchical clustering method includes: A block feature vector is constructed for each sub-block, and each sub-block is used as an initial cluster. A distance matrix between the initial clusters is constructed, and the two initial clusters with the closest distance are iteratively merged. The distance matrix is ​​updated, and in response to the iterative termination condition, the sub-block is divided into multiple clusters to obtain the initial clustering result.

5. The method for detecting the surface of an automobile part electrophoresis processed by machine vision according to claim 1, characterized in that: The edges and edge pixels of each edge in the electrophoresis processed surface image of automobile parts are extracted through edge detection algorithm.

6. The method for detecting the surface of an automobile part electrophoresis processed by machine vision according to claim 1, characterized in that: Methods for obtaining the number of similar edge pixels include: Obtain pixel points in the gradient change direction of the edge pixel point. Taking the edge pixel point as the starting point, obtain pixel points in the gradient change direction whose grayscale difference with the edge pixel point is not greater than the difference threshold, and record them as similar pixel points of the edge pixel point. When the grayscale difference between the edge pixel point and the pixel point in the gradient change direction is greater than the difference threshold, stop obtaining similar pixel points and obtain the number of similar pixel points of the edge pixel point.

7. The method for detecting the electrophoresis processed surface of automobile parts based on machine vision according to claim 4, characterized in that: The secondary trimming of the initial clustering result based on the fiber factor of each sub-block in the initial clustering result includes: Based on the comparison between the fiber factor mean of the sub-blocks in the cluster and the fiber threshold, the initial clustering results are trimmed twice to obtain the final cluster.

8. The method for detecting the electrophoresis processed surface of automobile parts based on machine vision according to claim 7, characterized in that: The initial clustering results are trimmed twice based on the fiber factors of each sub-block in the initial clustering results to obtain the electrophoresis processed surface detection results of automobile parts, including: Clusters whose fiber factor mean of sub-blocks is greater than the fiber threshold are treated as fiber clusters for secondary pruning; otherwise, they are retained to obtain the electrophoresis processed surface inspection results of automobile parts.

9. The method for detecting the electrophoresis processed surface of automobile parts based on machine vision according to claim 8, characterized in that: The method further comprises: obtaining the electrophoresis processed surface detection result of the automobile parts; The fiber clusters and scratch defect clusters in the electrophoresis processed surface inspection results of automobile parts are marked separately.

Citation Information

Patent Citations

  • Method for removing edge reflection light spots in electroplated workpiece surface defect visual inspection

    CN112927189A

  • Method and system for detecting electroplating processing defects on surfaces of automobile parts

    CN116342597A