Automobile part electrophoresis machining surface detection method based on machine vision
Through the condensation hierarchical clustering and edge detection algorithm based on machine vision, the surface image of the electrophoretic processing of automobile parts is divided into sub-blocks, and the fiber factor is calculated for secondary cropping, which solves the problem of interference between micro fabric fibers and improves the accuracy of detection.
Patent Information
- Application Number
- CN202510811451.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-06-18
AI Technical Summary
During the electrophoresis processing of automotive parts, tiny fabric fibers are mixed with scratch defects, resulting in low accuracy of detection results. The prior art is difficult to effectively reduce the interference of fabric fibers and affect the detection accuracy.
The surface detection method of electrophoretic processing of automotive parts based on machine vision is adopted. Through the agglomeration hierarchical clustering and edge detection algorithm, the image is divided into multiple sub-blocks, the fiber factors of the sub-blocks are calculated, and the secondary cropping is performed to remove interference from tiny fabric fibers, and the detection accuracy is improved.
It effectively improves the accuracy of the surface detection results of the electrophoretic processing of automobile parts, accurately distinguishes scratch defects and fabric fibers, and improves the accuracy of detection.
Smart Images

Figure CN120355699A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data processing, and particularly to a method for detecting the surface of automotive parts during electrophoresis processing based on machine vision. Background Art
[0002] In the automotive industry, there are relatively high requirements for the precision and surface quality of automotive parts. Electrophoresis processing is a surface coating technology that can be applied to automotive parts. In particular, the electrophoretic coating plays an important role in providing good anti-corrosion, durability, and aesthetics.
[0003] During the electrophoretic coating process, due to factors such as wear on the conveyor belt surface, burrs on metal brackets, and loosening of hanging chain fixtures, the automotive parts may experience hard friction with the equipment during the processing and transmission process, forming long strip-shaped scratches along the transmission direction. These scratches have the characteristic of inconsistent width in shape and will expose the bright metal of the underlying automotive parts, resulting in the contact of the metal with the external air and damaging the protective property of the electrophoretic coating.
[0004] When identifying such scratch defects through the agglomerative hierarchical clustering algorithm, larger classes can be formed by gradually merging adjacent clusters, and the number of clusters can be automatically adjusted according to the actual situation, so as to more accurately identify various different types of scratch defects.
[0005] However, when using a high-definition industrial camera to collect surface images of automotive parts for scratch defect detection, due to electrostatic action, tiny fabric fibers in the air may be adsorbed onto the surface images of the automotive parts, and the fabric fibers are mixed with the scratch defects, resulting in interference from the fabric fibers in the final obtained scratch defect detection results and lower accuracy.
[0006] Based on this, how to effectively reduce the interference of fabric fibers in scratch defect detection and thus improve the accuracy of the surface detection results of automotive parts during electrophoresis processing is an urgent problem to be solved by those skilled in the art. Summary of the Invention
[0007] In order to solve the technical problem of how to effectively reduce the interference of fabric fibers in scratch defect detection and thus improve the accuracy of the surface detection results of automotive parts during electrophoresis processing, the present invention provides a method for detecting the surface of automotive parts during electrophoresis processing based on machine vision.
[0008] In the first aspect, the present invention provides a method for detecting the surface of automotive parts during electrophoresis processing based on machine vision, adopting the following technical solution: The method for detecting the surface of automotive parts during electrophoresis processing based on machine vision includes the steps: Divide the electrophoretic processing surface image of the automotive part into multiple sub - blocks, and obtain the initial clustering result of the electrophoretic processing surface image of the automotive part through the agglomerative hierarchical clustering method; obtain the primary fibrousness of the sub - block by the minimum circumscribed rectangle size of each edge in the sub - block and the number of edge pixel points in the sub - block; calculate the fiber factor of the sub - block: ; is the fiber factor of the th sub - block, is the primary fibrousness of the th sub - block, is the gray - scale mean value of all edge pixel points in the th sub - block, is the number of edges in the th sub - block, is the variance of the number of similar pixel points of each edge pixel point in the th edge in the th sub - block, is the linear normalization function, is the exponential function with base e; perform secondary pruning on the initial clustering result based on the fiber factors of each sub - block in the initial clustering result to obtain the detection result of the electrophoretic processing surface of the automotive part.
[0009] The present invention takes into account that the tiny fabric fibers on the surface of automotive parts are mixed with scratch defects, which will affect the accuracy of scratch defect detection on the surface of automotive parts. Therefore, by obtaining the possibility that the edges in each sub - block area of the electrophoretic processing surface image of the automotive part are tiny fabric fibers, secondary pruning is performed on the initial clustering result, which can effectively improve the accuracy of the detection result of the electrophoretic processing surface of the automotive part. In this process, the present invention takes into account that the shape differences between tiny fabric fibers and scratches are relatively large. Therefore, the aspect ratio of the minimum circumscribed rectangle of the edge is obtained to accurately obtain the edge whose shape is closer to that of the tiny fabric fiber. On this basis, the present invention also takes into account that the high gray - scale value of the scratch defect area may be relatively close to that of some tiny fabric fibers. Therefore, by further obtaining the width change and gray - scale fluctuation of each edge, and combining with the primary fibrousness, the fiber factor of the sub - block is accurately obtained, so that the initial clustering result can be accurately pruned based on the fiber factors of each sub - block, effectively improving the accuracy of scratch defect detection on the surface of automotive parts.
[0010] According to the method for detecting the electrophoretic processing surface of automotive parts based on machine vision provided by the present invention, before dividing the electrophoretic processing surface image of the automotive part into multiple sub - blocks, it further includes: photographing the electrophoretic processing surface of the automotive part and performing pre - processing to obtain the electrophoretic processing surface image of the automotive part.
[0011] According to the method for detecting the surface of an electrophoretically processed automotive part based on machine vision provided by the present invention, dividing the surface image of the electrophoretically processed automotive part into multiple sub-blocks includes: starting from the upper left corner of the surface image of the electrophoretically processed automotive part, constructing a sliding window with a preset size, which is the first sub-block in the surface image of the electrophoretically processed automotive part; taking the right edge of the first sub-block as the left edge of the sliding window at the next position and sliding it to the right to obtain the second sub-block, and so on in a cycle to obtain the first row of sub-blocks of the surface image of the electrophoretically processed automotive part; taking 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 and sliding it downward, and then continuing to slide it to the left, finally dividing the surface image of the electrophoretically processed automotive part into multiple sub-blocks.
[0012] The present invention takes into account that the number of pixel points in the surface image of the electrophoretically processed automotive part is relatively large. Therefore, by dividing the surface image of the electrophoretically processed automotive part into blocks, subsequent parallel processing can be carried out for each block, and the scratch defect area in the surface image of the electrophoretically processed automotive part can be accurately and quickly obtained.
[0013] According to the method for detecting the surface of an electrophoretically processed automotive part based on machine vision provided by the present invention, obtaining the initial clustering result of the surface image of the electrophoretically processed automotive part through the agglomerative hierarchical clustering method includes: 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 in response to the iteration termination condition, dividing the sub-blocks into multiple clustering clusters to obtain the initial clustering result.
[0014] The present invention obtains the initial clustering result of the surface image of the electrophoretically processed automotive part through the agglomerative hierarchical clustering method, and can gradually merge clusters according to the gray-scale change and texture features in the image, so as to accurately and quickly obtain the initial clustering result.
[0015] According to the method for detecting the surface of an electrophoretically processed automotive part based on machine vision provided by the present invention, extracting the edges and the edge pixel points of each edge in the surface image of the electrophoretically processed automotive part through an edge detection algorithm.
[0016] According to the method for detecting the surface of an electrophoretically processed automotive part based on machine vision provided by the present invention, obtaining the primary fibrousness of the sub-block through the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixel points in the sub-block includes: recording the negative value of the average aspect ratio of the length and width of the minimum circumscribed rectangle of each edge in the sub-block as the border index of the sub-block; multiplying the normalized border index by the number of edge pixel points in the sub-block to obtain the primary fibrousness of the sub-block.
[0017] The present invention provides an accurate primary fibrous calculation method for sub-blocks. By analyzing the shape differences between scratches and tiny fabric fibers, the primary fibrousness of sub-blocks can be accurately obtained.
[0018] According to the machine vision-based surface detection method for automotive parts electrophoretic processing provided by the present invention, the method for obtaining the number of similar pixels of an edge pixel point includes: obtaining the pixel points in the gradient change direction of the edge pixel point, starting from this edge pixel point, obtaining the pixel points with a gray level difference not greater than the difference threshold in the gradient change direction, and recording them as the similar pixel points of this edge pixel point until the gray level difference between this edge pixel point and the pixel points in the gradient change direction is greater than the difference threshold, then stopping obtaining similar pixel points, and obtaining the number of similar pixel points of this edge pixel point.
[0019] The present invention takes into account that the width change of the scratch defect area is irregular, while the width change of tiny fabric fibers is small. Therefore, by obtaining the variance of the number of similar pixel points of each edge pixel point in the edge in the gradient change direction, the change consistency of each edge pixel point in the edge can be accurately obtained, preparing for accurately obtaining the fiber factor of the sub-block subsequently.
[0020] According to the machine vision-based surface detection method for automotive parts electrophoretic processing provided by the present invention, the secondary clipping of the initial clustering result based on the fiber factors of each sub-block in the initial clustering result includes: based on the comparison result between the mean value of the fiber factors of the sub-blocks in the clustering cluster and the fiber threshold, performing secondary clipping on the initial clustering result to obtain the final clustering cluster.
[0021] According to the machine vision-based surface detection method for automotive parts electrophoretic processing provided by the present invention, the secondary clipping of the initial clustering result based on the fiber factors of each sub-block in the initial clustering result to obtain the surface detection result of automotive parts electrophoretic processing includes: taking the clustering clusters with the mean value of the fiber factors of the sub-blocks in the clustering cluster greater than the fiber threshold as fiber clusters for secondary clipping; otherwise, retaining them to obtain the surface detection result of automotive parts electrophoretic processing.
[0022] According to the machine vision-based surface detection method for automotive parts electrophoretic processing provided by the present invention, after obtaining the surface detection result of automotive parts electrophoretic processing, it further includes: respectively marking the fiber clusters and scratch defect clusters in the surface detection result of automotive parts electrophoretic processing.
[0023] The present invention has the following technical effects: Based on the above technical solution, the surface detection method for electrophoretic processing of automotive parts based on machine vision provided by the present invention can effectively improve the accuracy of the surface detection result of electrophoretic processing of automotive parts by performing secondary cropping on the initial clustering result according to the possibility that the edges in each sub-block area of the electrophoretic processing surface image of the automotive parts are tiny fabric fibers. During this process, the present invention takes into account that the shapes of tiny fabric fibers and scratches are quite different, so the aspect ratio of the minimum circumscribed rectangle of the edge is obtained to accurately acquire the edge whose shape is closer to that of the tiny fabric fibers. On this basis, the present invention also considers that the high gray value of the scratch defect area may be relatively close to that of some tiny fabric fibers, so by further obtaining the width change and gray value fluctuation of each edge, and combining the primary fiber property, the fiber factor of the sub-block is accurately obtained, so that the initial clustering result can be accurately secondarily cropped based on the fiber factor of each sub-block, effectively improving the accuracy of scratch defect detection on the surface of automotive parts. Brief Description of the Drawings
[0024] Figure 1 It is a schematic flow chart in the surface detection method for electrophoretic processing of automotive parts based on machine vision provided by an embodiment of the present invention. Detailed Embodiment
[0025] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention.
[0026] In order to reduce the interference of fabric fibers in scratch defect detection and thus improve the accuracy of the surface detection result of electrophoretic processing of automotive parts, an embodiment of the present invention discloses a surface detection method for electrophoretic processing of automotive parts based on machine vision. This method can accurately distinguish scratch defects and fabric fibers on the surface of automotive parts according to the characteristic differences between scratch defects and fabric fibers on the surface of automotive parts, and improve the accuracy of the surface detection result of electrophoretic processing of automotive parts.
[0027] Specifically, please refer to Figure 1 as shown in Figure 1 It is a schematic flow chart in the surface detection method for electrophoretic processing of automotive parts based on machine vision provided by an embodiment of the present invention. The method specifically includes the following steps: S1: Obtain an electrophoretic processing surface image of an automotive part, and obtain an initial clustering result of the electrophoretic processing surface image of the automotive part through an agglomerative hierarchical clustering method.
[0028] Exemplarily, in an embodiment of the present invention, before obtaining the electrophoretic processing surface image of the automotive part, the surface of the automotive part can also be photographed by a high-definition industrial camera, and after preprocessing the surface photo of the automotive part, the electrophoretic processing surface image of the automotive part is obtained.
[0029] Among them, the preprocessing method can be image denoising, image enhancement, grayscale processing, etc., which can be specifically set according to actual needs, and the embodiments of the present invention do not limit too much here.
[0030] Specifically, after the electrophoresis processing of the surface of the automotive part is completed, an image of the surface of the automotive part is taken on the front of the automotive part to ensure that the lens of the camera can completely cover the surface of the automotive part. The shooting frame rate of the camera can be set to 2 frames per second, and the resolution of the image of the surface of the automotive part can be set to 5 million pixels.
[0031] Among them, the shooting frame rate and resolution can be specifically set according to actual needs, and the embodiments of the present invention do not limit too much here.
[0032] After obtaining the electrophoretic processing surface image of the automotive part based on the above steps, the initial clustering result of the electrophoretic processing surface image of the automotive part can be obtained by a conventional agglomerative hierarchical clustering method.
[0033] Exemplarily, in the embodiments of the present invention, obtaining the initial clustering result of the electrophoretic processing surface image of the automotive part by the agglomerative hierarchical clustering method includes: 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 in response to the iteration termination condition, dividing the sub-blocks into multiple clustering clusters to obtain the initial clustering result.
[0034] Among them, the grayscale mean value of the sub-block can be obtained first, and the absolute value of the difference between the grayscale mean values of the two sub-blocks is used as the distance between the two sub-blocks.
[0035] Exemplarily, the iteration termination condition can be set such that the distances between the initial clustering clusters are all greater than the distance threshold.
[0036] Among them, the distance threshold can be set to 0.2; it can be specifically set according to actual needs.
[0037] Specifically, after iteratively merging the two initial clustering clusters with the closest distance, a new cluster can be obtained, and then the distances between the new cluster and other clustering clusters are recalculated, and the initial distance matrix is updated, and the clustering clusters with the closest distance are continuously merged until multiple clustering clusters are finally obtained, and each clustering cluster contains multiple sub-blocks.
[0038] Among them, the specific steps of obtaining the initial clustering result of the electrophoretic processing surface image of the automotive part by the agglomerative hierarchical clustering method can be implemented by the prior art, and the embodiments of the present invention do not elaborate here.
[0039] It can be understood that after the above clustering algorithm processes the electrophoretic processing surface image of the automotive parts, the obtained initial clustering result is the scratch defect cluster in the electrophoretic processing surface image of the automotive parts obtained by the agglomerative hierarchical clustering method. However, in fact, the scratch defect clusters in the initial clustering result may simultaneously include true scratch defect clusters and fabric fiber clusters. The fabric fibers are mixed with the scratch defects, affecting the accuracy of scratch defect detection on the surface of automotive parts.
[0040] Based on this, the embodiments of the present invention can analyze the gray-scale features of pixel points to calculate the possibility of each pixel point being a tiny fabric fiber, and perform secondary cropping on the initial clustering result based on the possibility of each pixel point being a tiny fabric fiber, and finally obtain the true scratch defect clustering cluster, that is, perform the following steps.
[0041] S2: Divide the electrophoretic processing surface image of the automotive parts into multiple sub-blocks, and obtain the edges and edge pixel points in the sub-blocks.
[0042] It should be noted that the number of pixel points in the electrophoretic processing surface image of the automotive parts is relatively large. If the possibility of each pixel point being a tiny fabric fiber is calculated for each pixel point, it may generate too much data processing volume and cause waste of resources.
[0043] Based on this, the embodiments of the present invention can divide the electrophoretic processing surface image of the automotive parts into multiple sub-blocks. Each sub-block contains partial local features of the image. Gray-scale feature analysis is performed on each sub-block, so that the algorithm can process multiple sub-blocks in parallel, thereby more accurately and quickly extracting and identifying the edges in the image, and improving the efficiency and accuracy of image processing.
[0044] Exemplarily, in the embodiments of the present invention, dividing the electrophoretic processing surface image of the automotive parts into multiple sub-blocks includes: starting from the upper left corner of the electrophoretic processing surface image of the automotive parts, constructing a sliding window with a preset size, and this sliding window is the first sub-block in the electrophoretic processing surface image of the automotive parts; using the right edge of the first sub-block as the left edge of the sliding window at the next position and sliding it to the right to obtain the second sub-block, and so on in a cycle to obtain the first row of sub-blocks of the electrophoretic processing surface image of the automotive parts; 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 and sliding it downward, and then continuing to slide it to the left, and finally dividing the electrophoretic processing surface image of the automotive parts into multiple sub-blocks.
[0045] Among them, the size of the sliding window can be set to 11×11, and the size of the sliding window is the number of pixel points included in the sliding window; the size of the sliding window can be specifically set according to actual needs, and the embodiments of the present invention do not make too many restrictions here.
[0046] It is understandable that the left and right edges described in the above embodiments are only for the convenience of understanding and not real edges. Therefore, when obtaining the edges in the subsequent sub-blocks, the left and right edges mentioned in the above embodiments are not included.
[0047] The steps of dividing sub-blocks are illustrated by an example: Assume that the size of the electrophoretic processing surface image of the automotive part is 22×22. Starting from the upper left pixel point (0, 0) of the electrophoretic processing surface image of the automotive part, a 11×11 sliding window is obtained, which is the first sub-block. The upper left and lower right coordinates of the first sub-block are (0, 0) and (11, 11) respectively; the sliding window is slid to the right, and the upper left and lower right coordinates of the second sub-block are (11, 0) and (22, 11) respectively. The upper right coordinate of the first sub-block is the same as the upper left coordinate of the second sub-block, and the lower right coordinate of the first sub-block is the same as the lower left coordinate of the second sub-block. Finally, the first row of sub-blocks is obtained; the sliding window is slid downward, and the upper left and lower right coordinates of the third sub-block are (11, 11) and (22, 22) respectively. Finally, the sliding window is slid to the left continuously, and the upper left and lower right coordinates of the fourth sub-block are (0, 11) and (11, 22) respectively. Finally, the electrophoretic processing surface image of the automotive part is divided into four sub-blocks.
[0048] It is understandable that during the sliding process of the sliding window, the size of some side regions in the electrophoretic processing surface image of the automotive part may be smaller than the size of the sliding window. For such regions, the position of such side regions can be used as the final position of the sliding window in the row where the side region is located during the initial sub-block division process, and the division continues. 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 incorporated into the adjacent sub-block, and the number of side regions that each sub-block can merge is no more than 1; if the length or width of the side region is greater than 7 and less than 11, the side region can be used as a new sub-block.
[0049] Exemplarily, in the embodiments of the present invention, the electrophoretic processing surface image of the automotive part is divided into multiple sub-blocks, and the size of the sub-blocks can also be set based on the size of the electrophoretic processing surface image of the automotive part, and the electrophoretic processing surface image of the automotive part is evenly divided into multiple sub-blocks.
[0050] Among them, setting the size of the sub-blocks based on the size of the electrophoretic processing surface image of the automotive part can be specifically set according to actual needs, and the embodiments of the present invention do not limit this too much here.
[0051] Exemplarily, in the embodiments of the present invention, the edges and the edge pixel points of each edge in the electrophoretic processing surface image of the automotive part can be extracted through an edge detection algorithm.
[0052] Among them, the edge detection algorithm can be the Sobel operator, the Canny edge detection algorithm, etc., which can be specifically set according to actual needs, and the embodiments of the present invention do not limit too much here.
[0053] It should be noted that based on the above steps, each sub-block in the electrophoretic processing surface image of the automotive parts can be obtained. The sub-blocks without scratch defects or interference from tiny fabric fibers appear smooth, and the gray-scale difference within the sub-block is small; while the sub-blocks with scratch defects or interference from tiny fabric fibers will have edges, and the edges contain multiple edge pixel points.
[0054] Based on this, the embodiments of the present invention can obtain the contour shape and gray-scale characteristics of the edges composed of each edge pixel point, and obtain the possibility of the existence of tiny fabric fiber interference in each sub-block, that is, continue to execute the following steps.
[0055] S3: Obtain the primary fiberiness of the sub-block through the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixel points in the sub-block.
[0056] It should be noted that the pixel points in the tiny fabric fiber area usually have a relatively obvious gray-scale value difference from the pixel points in the non-fiber area. The shape of the fabric fiber is a curly shape, while the scratch is a linear shape, and if the number of edge pixel points in the sub-block is larger, it indicates that the possibility of the appearance of tiny fabric fibers is greater.
[0057] Based on this, the embodiments of the present invention can obtain the shape of the edges in each sub-block and the number of edge pixel points, and obtain the possibility of the existence of edges with a curved shape. Such edges are relatively close to the shape of tiny fabric fibers, while the scratch edge is linear and relatively slender. By analyzing the number of edge pixel points and the edge shape in the sub-block, the primary fiberiness of the sub-block can be accurately obtained.
[0058] Exemplarily, in the embodiments of the present invention, obtaining the primary fiberiness of the sub-block through the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixel points in the sub-block includes: recording the negative value of the average aspect ratio of the minimum circumscribed rectangle of each edge in the sub-block as the border index of the sub-block; multiplying the normalized border index by the number of edge pixel points in the sub-block to obtain the primary fiberiness of the sub-block.
[0059] Among them, normalization processing can be performed through standard normalization, the exponential function with e as the base, etc., which can be specifically set according to actual needs.
[0060] Exemplarily, in the embodiments of the present invention, calculating the primary fiberiness of the th sub-block, specifically, the following relational expression can be referred to: ; is the The primary fibrousness of the sub-block is the number of edge pixel points in the th sub-block is the number of edges in the th sub-block is one side length of the minimum bounding rectangle of the th edge in the th sub-block , is the other side length of the minimum bounding rectangle of the th edge in the th sub-block , is the maximum function is the minimum function is the exponential function with base e, where e is the natural constant
[0061] It can be understood that the side lengths of the minimum bounding rectangle of the th edge are respectively the length and width of the minimum bounding rectangle of the th edge. Therefore is to obtain the length of the minimum bounding rectangle of the th edge is to obtain the width of the minimum bounding rectangle of the th edge
[0062] In the above formula, the more the number of edge pixel points in the th sub-block, the greater the possibility that there are minute fabric fibers or scratch edges in the th sub-block. In order to distinguish minute fabric fibers from printed border edges, the embodiments of the present invention further obtain the size index of the th sub-block
[0063] is used to normalize the size index of the th sub-block represents the aspect ratio of the minimum bounding rectangle of the th edge in the th sub-block. The smaller this value, the greater the possibility that the th edge belongs to a curved minute fabric edge and the smaller the possibility of being a scratch
[0064] It can be understood that some sub-blocks belong to the clean surface area of automotive parts, and there are no edges in such sub-blocks. For such sub-blocks, the primary fibrousness of the sub-block can be set to 0
[0065] 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 minute fabric fibers in each sub-block. The greater the primary fibrousness, the greater the possibility of the existence of minute fabric fibers in the sub-block.
[0066] S4: Calculate the fiber factor of the sub-block according to the gray-scale feature and the primary fibrousness in the sub-block.
[0067] It should be noted that based on the above steps, by analyzing the number of edge pixel points in the sub-block and the shape contour of the edge formed by the edge pixel points, the primary fibrousness of each sub-block can be obtained. However, since the minute fabrics attached to the surface of the automotive part during electrophoretic processing are very fine, the electrostatic force can cause the fibers to attract or repel each other, thus affecting their bending morphology. Therefore, they may also exhibit relatively straight characteristics within a sub-block. Therefore, only using the primary fiber factor to perform secondary cropping on the clustering results may cause the clusters corresponding to the minute fabric areas not to be completely cropped off, ultimately still affecting the accurate detection of potential scratch defects.
[0068] It should be further noted that the scratches generated by the equipment usually destroy the consistency of the surface of the automotive part, exposing the underlying bright metal structure, resulting in a relatively high gray-scale value. Based on the relatively high brightness feature, the scratch edge can be initially identified. However, the gray-scale features corresponding to the minute fabric fibers change with the color of the fabric, and the brightness may be relatively large or small. Only based on the high brightness feature to identify the scratch edge may result in misjudgment. And the fabric fibers are woven, and their width changes are relatively small, while the scratches are generated due to reasons such as mechanical contact of the equipment or process abnormalities, and the width changes of the scratches are inconsistent.
[0069] Based on this, the embodiment of the present invention can correct the primary fibrousness of the sub-block by analyzing the gray-scale difference between the printed border scratch defect area and the minute fabric fibers, and combining the width change situation of the edge in the sub-block.
[0070] It can be understood that if the difference in the number of homogeneous pixel points with relatively small gray-scale differences in the gradient change direction of all edge pixel points on each edge within each sub-block is smaller, it indicates that it more conforms to the characteristics of minute fabric fibers.
[0071] Exemplarily, in the embodiment of the present invention, the method for obtaining the number of homogeneous pixel points of the edge pixel points is as follows: Obtain the pixel points in the gradient change direction of the edge pixel points. Starting from this edge pixel point, obtain the pixel points whose gray-scale difference from this edge pixel point is not greater than the difference threshold in the gradient change direction, and record them as the homogeneous pixel points of this edge pixel point until the gray-scale difference between this edge pixel point and the pixel points in the gradient change direction is greater than the difference threshold, then stop obtaining the homogeneous pixel points, and obtain the number of homogeneous pixel points of this edge pixel point.
[0072] Among them, the gray - level difference between the edge pixel and the pixel in the gradient change direction is the absolute value of the gray - level difference value 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 specifically set according to actual needs, and the embodiments of the present invention do not limit this too much here.
[0073] The steps to obtain the number of similar pixels of an edge pixel are illustrated by an example: If the gray - level value of an edge pixel is 55, the number of pixels in the gradient change direction of this edge pixel is 5, and their gray - level values are 54, 56, 57, 59, 55 in order from near to far according to the distance, then the pixels corresponding to the gray - level values 54, 56, 57, and 55 are the similar pixels of this edge pixel. However, the gray - level difference between the fourth pixel and this edge pixel is greater than 3. Therefore, stop obtaining the number of similar pixels of this edge pixel here. Finally, the similar pixels of this edge pixel are the pixels corresponding to the gray - level values 54, 56, and 57, that is, the number of similar pixels is 3.
[0074] It can be understood that the similar pixels of the edge pixel obtained based on the above steps are the pixels with a smaller gray - level difference from the edge pixel.
[0075] Exemplarily, in the embodiments of the present invention, calculating the fiber factor of a sub - block can be specifically referred to the following relational expression: ; is the fiber factor of the th sub - block, is the primary fiber property of the th sub - block, is the gray - level mean value of all edge pixels in the th sub - block, is the number of edges in the th sub - block, is the variance of the number of similar pixels of each edge pixel in the rd edge in the th sub - block, is the linear normalization function, is the exponential function with base e.
[0076] In the above formula, represents the negative value of the variance mean of the number of similar pixels of all edge pixels of all edges in the th sub - block. The smaller the variance mean, the greater the consistency of the number of similar pixels of all edge pixels in the th sub - block, the greater the possibility that the th sub - block is a micro - fabric fiber, and the smaller the possibility that it is a scratch defect area.
[0077] Based on the above steps, the fiber factors of each sub-block can be obtained. By using the fiber factors of each sub-block to perform a secondary trimming on the initial clustering result, the surface detection result of the electrophoretic processing of automotive parts can be accurately obtained, that is, the following steps are executed.
[0078] S5: Based on the fiber factors of each sub-block in the initial clustering result, perform a secondary trimming on the initial clustering result to obtain the surface detection result of the electrophoretic processing of automotive parts.
[0079] Exemplarily, in the embodiment of the present invention, performing a secondary trimming on the initial clustering result based on the fiber factors of each sub-block in the initial clustering result includes: based on the comparison result between the average value of the fiber factors of the sub-blocks in the clustering cluster and the fiber threshold, perform a secondary trimming on the initial clustering result to obtain the final clustering cluster.
[0080] Among them, the fiber threshold can be set to 0.8, and the fiber threshold can be specifically set according to actual needs. The embodiment of the present invention does not impose too many restrictions here.
[0081] Exemplarily, in the embodiment of the present invention, performing a secondary trimming on the initial clustering result based on the fiber factors of each sub-block in the initial clustering result to obtain the surface detection result of the electrophoretic processing of automotive parts includes: regarding the clustering clusters with the average value of the fiber factors of the sub-blocks in the clustering cluster greater than the fiber threshold as fiber clusters for secondary trimming; otherwise, retain them to obtain the surface detection result of the electrophoretic processing of automotive parts.
[0082] It can be understood that the clustering clusters with the average value of the fiber factors not greater than the fiber threshold obtained after the secondary trimming of the initial clustering result are the scratch defect areas on the surface of the automotive parts.
[0083] Regarding the clustering clusters with the average value of the fiber factors not greater than the fiber threshold as scratch defect clusters for retention, the scratch defects on the surface of the electrophoretic processing of automotive parts can be obtained, and the surface of the automotive parts containing the scratch defect clusters is marked as defective to facilitate classification and identification by the staff.
[0084] Exemplarily, in the embodiment of the present invention, after obtaining the surface detection result of the electrophoretic processing of automotive parts, it further includes: respectively marking the fiber clusters and scratch defect clusters in the surface detection result of the electrophoretic processing of automotive parts.
[0085] Among them, the marking method can be realized by means of a marking frame, color highlighting, etc., and can be specifically set according to actual needs. The embodiment of the present invention does not impose too many restrictions here.
[0086] It can be seen that in the embodiment of the present invention, when obtaining the detection result of the electrophoretic processing surface of an automotive part, the electrophoretic processing surface image of the automotive part can be divided into multiple sub-blocks, and the initial clustering result of the electrophoretic processing surface image of the automotive part can be obtained by the agglomerative hierarchical clustering method; the primary fibrousness of the sub-block can be obtained through the minimum circumscribed rectangle size of each edge in the sub-block and the number of edge pixel points in the sub-block; calculate the fiber factor of the sub-block: ; is the fiber factor of the th sub-block, is the primary fibrousness of the th sub-block, is the gray-scale mean value of all edge pixel points in the th sub-block, is the number of edges in the th sub-block, is the variance of the number of similar pixel points of the edge pixel points in the th edge in the th sub-block, is the linear normalization function, is the exponential function with e as the base; based on the fiber factors of each sub-block in the initial clustering result, the initial clustering result is secondarily trimmed to obtain the detection result of the electrophoretic processing surface of the automotive part, effectively improving the accuracy of the detection result of the electrophoretic processing surface of the automotive part.
[0087] The above are all the preferred embodiments of the present invention. Without restricting the protection scope of the present invention based on this, therefore: All equivalent changes made according to the structure, shape, and principle of the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for surface inspection of electrophoretic processing of automotive parts based on machine vision, characterized in that, Including: Dividing the electrophoretic processing surface image of the automotive part into multiple sub - blocks, and obtaining the initial clustering result of the electrophoretic processing surface image of the automotive part through the agglomerative hierarchical clustering method; Obtaining the primary fibrousness of the sub - block through the minimum circumscribed rectangle size of each edge in the sub - block and the number of edge pixel points in the sub - block; calculating the fiber factor of the sub - block: ; is the fiber factor of the th sub-block, is the primary fiber property of the th sub-block, is the grayscale mean of all edge pixel points in the th sub-block, is the number of edges in the th sub-block, is the variance of the number of similar pixel points of each edge pixel point in the th edge in the th sub-block, is the linear normalization function, is the exponential function with base e; Based on the fiber factors of each sub - block in the initial clustering result, performing secondary clipping on the initial clustering result to obtain the detection result of the electrophoretic processing surface of the automotive part.
2. The method for detecting the surface of an electrophoretic processed automotive part based on machine vision according to claim 1, wherein Before the step of dividing the electrophoretic processing surface image of the automotive part into multiple sub - blocks, it further includes: Taking a picture of the electrophoretic processing surface of the automotive part and performing pre - processing to obtain the electrophoretic processing surface image of the automotive part.
3. The method for detecting the surface of an electrophoretic processed automotive part based on machine vision according to claim 1, wherein, The step of dividing the electrophoretic processing surface image of the automotive part into multiple sub - blocks includes: Taking the upper - left corner of the electrophoretic processing surface image of the automotive part as the starting point, constructing a sliding window with a preset size, and this sliding window is the first sub - block in the electrophoretic processing surface image of the automotive part; taking the right edge of the first sub - block as the left edge of the sliding window at the next position and sliding it to the right to obtain the second sub - block, and so on, to obtain the first - row sub - blocks of the electrophoretic processing surface image of the automotive part; taking the lower edge of the last sub - block in the first - row sub - blocks as the upper edge of the sliding window at the next - row position and sliding it downward, and then continuing to slide it to the left, finally dividing the electrophoretic processing surface image of the automotive part into multiple sub - blocks.
4. The method for detecting the surface of an electrophoretic processed automotive part based on machine vision according to claim 1, wherein The step of obtaining the initial clustering result of the electrophoretic processing surface image of the automotive part through the agglomerative hierarchical clustering method includes: 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 in response to the iteration termination condition, dividing the sub - blocks into multiple clustering clusters to obtain the initial clustering result.
5. The method for detecting the surface of an electrophoretic processed automotive part based on machine vision according to claim 1, characterized in that, Extracting the edges and the edge pixel points of each edge in the electrophoretic processing surface image of the automotive part through an edge detection algorithm.
6. The method for detecting the surface of an electrophoretic processed automotive part based on machine vision according to claim 1, wherein, The step of obtaining the primary fibrousness of the sub - block through the minimum circumscribed rectangle size of each edge in the sub - block and the number of edge pixel points in the sub - block includes: Denoting the negative value of the average aspect ratio of the minimum circumscribed rectangle of each edge in the sub - block as the border index of the sub - block; multiplying the normalized border index by the number of edge pixel points in the sub - block to obtain the primary fibrousness of the sub - block.
7. The method for detecting the surface of an electrophoretic processed automotive part based on machine vision according to claim 1, wherein The method for obtaining the number of similar pixel points of an edge pixel point includes: Obtaining the pixel points in the gradient change direction of the edge pixel point, taking this edge pixel point as the starting point, and obtaining the pixel points with a gray - level difference not greater than the difference threshold in the gradient change direction as the similar pixel points of this edge pixel point until the gray - level difference between this edge pixel point and the pixel points in the gradient change direction is greater than the difference threshold, and then stopping obtaining similar pixel points to obtain the number of similar pixel points of this edge pixel point.
8. The method for detecting the surface of an electrophoretic processed automotive part based on machine vision according to claim 4, characterized in that, The step of performing secondary clipping on the initial clustering result based on the fiber factors of each sub - block in the initial clustering result includes: Based on the comparison result between the average fiber factor of the sub - blocks in the clustering cluster and the fiber threshold, performing secondary clipping on the initial clustering result to obtain the final clustering cluster.
9. The method for detecting the surface of an electrophoretic processed automotive part based on machine vision according to claim 8, wherein, Performing secondary clipping on the initial clustering result based on the fiber factors of each sub-block in the initial clustering result to obtain the surface detection result of electrophoretic processing of automotive parts, including: Taking the clustering clusters with the average fiber factor of the sub-blocks in the clustering cluster greater than the fiber threshold as fiber clusters for secondary clipping; otherwise, retaining them to obtain the surface detection result of electrophoretic processing of automotive parts.
10. The method for detecting the surface of an electrophoretically processed automotive part based on machine vision according to claim 9, wherein After obtaining the surface detection result of electrophoretic processing of automotive parts, it further includes: Marking the fiber clusters and scratch defect clusters in the surface detection result of electrophoretic processing of automotive parts respectively.
Citation Information
Patent Citations
Smooth paint surface defect detection method based on machine vision
CN112150441A
Method for removing edge reflection light spots in electroplated workpiece surface defect visual inspection
CN112927189A
Automobile model visual inspection method based on artificial intelligence
CN115661105A
Method and system for detecting electroplating processing defects on surfaces of automobile parts
CN116342597A
Vehicle body paint surface defect rapid detection method, image processing equipment and readable medium
CN116883313A
Cited By
Radiator production line real-time monitoring method and system
CN120599314A
A real-time monitoring method and system for a radiator production line
CN120599314B