Defect Recognition Method for High-Voltage Power Supply Components Based on Computer Vision

Through a computer vision-based method, combined with connectivity domain analysis and Fourier descriptor, the problem of low defect recognition accuracy of high-voltage power supply components is solved, and more accurate scratch defect recognition is achieved, and the detection effect is enhanced.

CN119863467BActive Publication Date: 2025-07-08TESLAMAN HVPS(XIAN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510353206.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-07-08
Estimated Expiration
2045-03-25

AI Technical Summary

Technical Problem

The existing defect recognition methods of high-voltage power supply components are disturbed by camera jitter and environmental noise, resulting in poor defect recognition accuracy. The traditional filtering methods lead to loss of image details, affecting the defect recognition effect.

Method used

Using a computer vision-based method, through connectivity domain analysis, Fourier descriptor and Pearson correlation coefficient and other technologies, we comprehensively consider the local texture characteristics of the image and the spatial relationship between pixels, and identify scratch defects of high-voltage power components to avoid information loss and light noise sensitivity problems of traditional methods.

Benefits of technology

It improves the accuracy of surface defect detection of high-voltage power supply components, enhances the ability to describe scratch features, reduces dependence on a single feature, and improves the accuracy of defect recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119863467B_ABST
    Figure CN119863467B_ABST
Patent Text Reader

Abstract

This application relates to the field of image processing technology, specifically to a method for identifying defects in high-voltage power supply components based on computer vision. The method includes: collecting surface images of high-voltage power supply components; obtaining grayscale images and their connected components, obtaining the main direction of the connected components, constructing a width sequence based on the length perpendicular to the main direction, obtaining a width change coefficient according to the width sequence, and obtaining the blurriness of pixel points based on the gray values of the pixel point neighborhoods; constructing windows for edge pixel points, obtaining the correlation of edge pixel points according to the classification of the connected components within the windows, obtaining the similarity between connected components according to the Fourier descriptors of the connected components, and obtaining the scratch fitness of edge pixel points based on this; screening edge points of the scratch area according to the scratch fitness of edge pixel points and the blurriness of edge pixel points, and completing defect identification. This application improves the detection efficiency of surface defects of high-voltage power supply components.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and specifically relates to a method for identifying defects in high-voltage power supply components based on computer vision. Background Art

[0002] High-voltage power supply components are each module that makes up a high-voltage power supply, including devices such as transformers, rectifiers, filters, and amplifiers. Usually, they are integrated together as a high-voltage power supply device. Due to its own characteristics, it has a very wide range of uses, and its applications involve from aerospace to deep-sea exploration, from semiconductor processing equipment to nanotechnology, from detection instruments to environmental protection equipment, from new materials to high-energy physics, and plays an important role in the industrial field.

[0003] Since the manufacturing process of high-voltage power supply components is complex and delicate, it will inevitably lead to design and manufacturing defects such as scratches, nicks, and burrs. For example, the equipment on the production line may be worn after long-term use, resulting in an uneven surface. These uneven surfaces are likely to cause scratches when contacting the components. These defects may cause various problems and consequences, which in turn affect the performance of the equipment and cause some potential safety hazards such as electric leakage and short circuit, leading to subsequent product quality problems, and may even have a negative impact on the entire production line. At present, the visual inspection method is usually interfered by factors such as camera jitter and environmental noise. Therefore, the images of high-voltage power supply components obtained are usually filtered and denoised, such as Gaussian filtering, wavelet denoising, etc., to enhance the image quality. However, it ignores the impact of the additional blur caused by the loss of details during the Gaussian filtering smoothing process on the defect recognition result, resulting in poor defect recognition accuracy. Summary of the Invention

[0004] In order to solve the technical problem of poor defect recognition accuracy, this application provides a method for identifying defects in high-voltage power supply components based on computer vision. The specific technical solutions adopted are as follows:

[0005] This application proposes a method for identifying defects in high-voltage power supply components based on computer vision. The method includes the following steps:

[0006] Collect the surface image of the high-voltage power supply component;

[0007] After denoising and graying the surface image, a grayscale image is obtained. Connected component analysis is performed on the grayscale image to obtain several connected components. For each pixel point in the connected component, a vector is obtained. The longest straight line in the direction with the largest number of vectors is recorded as the main direction line segment. According to the lengths of the pixel points in the connected component perpendicular to the main direction line segment, a width sequence is formed. Based on the slope of the line fitted from the width sequence and the ratio of the number of pixel points on the main direction line segment to the number of edge pixel points in the connected component, the width change coefficient of the connected component is obtained. According to the neighborhood grayscale value, width, and width change coefficient of each pixel point in the connected component, the blurriness of each pixel point is obtained.

[0008] For each edge pixel point of the connected component, a window is constructed. According to the grayscale values of the pixel points belonging to the connected component and the pixel points not belonging to the connected component within the window, the correlation of the edge pixel point is calculated. The Fourier descriptor of the connected component is calculated. Based on the grayscale value of the Fourier descriptor and the similarity of the Fourier descriptors of different connected components, the scratch saliency of the connected component is obtained. According to the scratch saliency of the connected component and the correlation of the edge pixel point, the scratch fitness of the edge pixel point is obtained.

[0009] According to the scratch fitness of the edge pixel point and the blurriness of the edge pixel point, the edge points of the scratch area are screened, and defect recognition is completed.

[0010] In the above solution, based on the actual morphological characteristics of the scratch area, the changing law of the area width is analyzed using the main direction and width change sequence of the connected component. Based on this changing law, the edge blur discrimination degree is calculated. The beneficial effect is that it can further distinguish the pixel points in the scratch edge area from the pixel points at the inherent edge of the component, avoiding the problem of information loss in the traditional image sampling process. The scratch saliency is calculated based on the Fourier descriptor and dtw distance within the connected component. Finally, based on the edge blur discrimination degree, scratch saliency, grayscale values inside and outside the connected component, and Pearson correlation coefficient, the scratch fitness is calculated. The beneficial effect is that it comprehensively considers the local texture characteristics of the image and the spatial relationship between pixels, captures scratch features more comprehensively. Secondly, the pixel points in the scratch area are quantified, enhancing the description ability of scratch features, avoiding over-reliance on a single feature in the traditional method, and reducing the problem of sensitivity to light and noise in traditional threshold segmentation or edge detection. Then, for the determined scratch area, the surface defects of the high-voltage power supply component are identified, improving the accuracy of surface defect detection of the high-voltage power supply component.

[0011] In one embodiment, the method for obtaining a grayscale image after denoising and graying the surface image and performing connected component analysis on the grayscale image to obtain several connected components is as follows:

[0012] The surface image is denoised by the Gaussian filtering algorithm. For the denoised surface image, graying is performed by the weighted grayscale method to obtain a grayscale image. The seed filling method is used for the grayscale image to obtain several connected components.

[0013] In one embodiment, the method of obtaining a vector for each pixel point in a connected component and designating the longest straight line in the direction with the largest number of vectors as the main direction line segment is as follows:

[0014] For each connected component, obtain the vector from each pixel point to the centroid of the connected component, and statistically obtain the direction histogram according to the directions of all vectors; designate the direction with the largest number as the main direction of the connected component, and designate the longest straight line in the main direction within the connected component as the main direction line segment.

[0015] In one embodiment, the method of forming a width sequence according to the lengths of the pixel points in the connected component perpendicular to the main direction line segment is as follows:

[0016] For each pixel point on the main direction line segment, draw a straight line perpendicular to the main direction line segment, designate the intersection point of the straight line and the edge of the connected component as the boundary feature point, and use the Euclidean distance between the boundary feature points corresponding to the same pixel point as the main direction width of each pixel point;

[0017] Taking the center point of the connected component as a reference, draw a perpendicular line perpendicular to the main direction through the center point of the connected component. For each side of the perpendicular line, sort the main direction widths in the order of the distance of the pixel points from the center point of the connected component from far to near, and obtain a width sequence for each side.

[0018] In one embodiment, the method of obtaining the width change coefficient of the connected component according to the slope of the straight line fitted from the width sequence and the ratio of the number of edge pixels of the connected component to the number of pixels on the main direction line segment is as follows:

[0019] Designate the width sequence as the left width sequence and the right width sequence, and obtain the fitted straight line of each width sequence;

[0020] The expression of the width change coefficient is ; represents the slope of the fitted straight line corresponding to the left width sequence of the i-th connected component, represents the slope of the fitted straight line corresponding to the right width sequence of the i-th connected component, represents the number of boundary feature points in the i-th connected component, represents the number of pixels on the main direction line segment in the i-th connected component.

[0021] In one embodiment, the method of obtaining the blur degree of each pixel point according to the neighborhood gray value, width, and width change coefficient of the connected component corresponding to each pixel point is as follows:

[0022] For each pixel point, preset K nearest neighbor boundary feature points of the pixel point, and calculate the gray mean value of the eight neighborhoods of each pixel point;

[0023] The blurriness of each pixel is positively correlated with the main direction width difference of neighboring boundary feature points, the gray mean value of the pixel neighborhood, and the width change coefficient of the connected domain.

[0024] In one embodiment, the method for constructing a window for each edge pixel of the connected domain and calculating the correlation of the edge pixel according to the gray values of the pixels belonging to the connected domain and the pixels not belonging to the connected domain in the window is as follows:

[0025] Set a window centered on the edge pixel in the connected domain, denote the pixels not belonging to the connected domain in the window as external pixels, and denote the pixels belonging to the connected domain as internal pixels;

[0026] Sort all internal pixels and external pixels respectively from small to large according to the gray value to obtain the internal gray sequence and the external gray sequence;

[0027] Calculate the correlation between the internal gray sequence and the external gray sequence as the correlation of the edge pixel.

[0028] In one embodiment, the method for calculating the Fourier descriptor of the connected domain and obtaining the scratch saliency of the connected domain according to the gray value of the Fourier descriptor and the similarity of the Fourier descriptors of different connected domains is as follows:

[0029] Extract the Fourier descriptor of each connected domain, and calculate the mean value of the gray values of the corresponding pixels of all its Fourier descriptors; form a sequence of the gray values of all Fourier descriptors in the connected domain and denote it as the Fourier sequence, and calculate the similarity of the Fourier sequences between the connected domains;

[0030] The expression of the scratch saliency of the connected domain is , represents the mean value of the gray values of the Fourier sequence corresponding to the i-th connected domain, represents the mean value of the DTW distances between the Fourier sequences of the i-th connected domain and the Fourier sequences of all the other connected domains, represents the scratch saliency of the i-th connected domain.

[0031] In one embodiment, the method for obtaining the scratch fitness of the edge pixel according to the scratch saliency of the connected domain and the correlation of the edge pixel is as follows:

[0032] The expression of the scratch fitness of the edge pixel is: , where represents the correlation of the p-th edge pixel in the i-th connected domain, represents the scratch fitness of the p-th edge pixel in the i-th connected domain, takes a preset value, and norm() represents the linear normalization function.

[0033] In one embodiment, the method for screening the edge points of the scratch area according to the scratch fitness degree of the edge pixel points and the blurriness of the edge pixel points is as follows:

[0034] Obtain the screening coefficient of the edge pixel points according to the scratch fitness degree of the edge pixel points and the blurriness of the edge pixel points;

[0035] The screening coefficient of the edge pixel points is: , where is the weight parameter, is the screening coefficient of the edge pixel points, represents the scratch fitness degree of the p-th edge pixel point in the i-th connected domain, represents the blurriness of the p-th edge pixel point in the i-th connected domain;

[0036] Take the edge pixel points with the screening coefficient greater than the preset segmentation threshold as the edge pixel points of the scratch area on the surface of the high-voltage power supply component.

[0037] The beneficial effects of this application are as follows: Based on the actual morphological characteristics of the scratch area, use the main direction of the connected domain and the width change sequence to analyze the variation law of the regional width. Based on this variation law, calculate the edge blur discrimination degree. The beneficial effect is that it can further distinguish the pixel points in the scratch edge area and the pixel points at the inherent edge of the component, and avoid the information loss problem in the traditional image sampling process. Calculate the scratch saliency based on the Fourier descriptor and dtw distance within the connected domain. Finally, calculate the scratch fitness degree based on the edge blur discrimination degree, scratch saliency, gray values inside and outside the connected domain, and Pearson correlation coefficient. The beneficial effect is that it comprehensively considers the local texture characteristics of the image and the spatial relationship between pixels, captures the scratch features more comprehensively. Secondly, quantifies the pixel points in the scratch area, enhances the description ability of the scratch features, avoids the over-reliance on a single feature in the traditional method, and can reduce the problems of sensitivity to illumination and noise in the traditional threshold segmentation or edge detection. Then, for the determined scratch area, it realizes the identification of the surface defects of the high-voltage power supply component, and improves the accuracy of the surface defect detection of the high-voltage power supply component. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0039] Figure 1 It is a flowchart of a method for identifying defects of high-voltage power supply components based on computer vision provided by an embodiment of the present application;

[0040] Figure 2 Flowchart of the method for obtaining the blurriness of a pixel point Specific implementation manner

[0041] In order to further elaborate on the technical means and effects adopted by this application to achieve the intended invention purpose, the following will, in combination with the accompanying drawings and preferred embodiments, elaborate in detail on the specific implementation manner, structure, features, and effects of the computer vision-based high-voltage power supply component defect recognition method proposed according to this application. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this application belongs.

[0043] Embodiment of the computer vision-based high-voltage power supply component defect recognition method

[0044] The following will specifically describe the specific solution of the computer vision-based high-voltage power supply component defect recognition method provided by this application with reference to the accompanying drawings.

[0045] Please refer to Figure 1 , which shows the flowchart of the computer vision-based high-voltage power supply component defect recognition method provided by an embodiment of this application. The method includes the following steps:

[0046] Step S001: Collect the surface image of the high-voltage power supply component.

[0047] For high-voltage power supplies, their defects are mainly surface scratch defects. Therefore, the surface image of the high-voltage power supply component is collected through a CCD camera. To reduce the influence of uneven illumination, an LED light source is installed below the camera, and the image collected by the CCD camera is recorded as the surface image.

[0048] So far, the surface image of the high-voltage power supply component has been obtained.

[0049] Step S002: Denoise and grayscale the surface image to obtain a grayscale image, perform connected component analysis on the grayscale image to obtain a number of connected components; obtain a vector for each pixel point within the connected component, and record the longest straight line in the direction with the largest number of vectors as the main direction line segment; construct a width sequence according to the length of the pixel points within the connected component perpendicular to the main direction line segment; obtain the width change coefficient of the connected component according to the slope of the straight line fitted by the width sequence and the ratio of the edge pixel points of the connected component to the main direction line segment; obtain the blurriness of each pixel point according to the neighborhood grayscale value, width, and width change coefficient of the connected component corresponding to each pixel point

[0050] During the processing of high-voltage power supply components, due to the long-term operation of the machine tool, particles are likely to be generated on the surface. These particles come into contact with the components, resulting in scratches, abrasions and other wear on the components. After gray-scale transformation and analysis of the images with surface defects, it is known that there are two types of pixel points that can produce defect effects.

[0051] The first type is the pixel points of the real defects on the surface of the high-voltage power supply components; the second type is the "pseudo" defect pixel points caused by the blurred image edges. The regions where the above two types of pixel points are located have different regional characteristics in the image. For example, when the intensity of scratches or cracks is much higher or lower than the natural texture of the part, the gray value of the scratched part is brighter than that of the surrounding normal part, that is, the gray value of the scratched part is relatively large. At this time, a lower threshold can be used to only display the pixels of scratches or cracks, and the number of these pixels is the defect signal. However, the pixel values exceeding the threshold may be caused by uneven illumination or the structural properties of the components rather than cracks or scratches. The gray values of the pixels in these "pseudo" defect regions are basically close to the gray values of the real defects, and the threshold segmentation method cannot be used for processing. Moreover, most of the defects are some fine scratches on the smooth surface of the components, which are difficult to distinguish, so the gray-scale change of the whole image is generally very uniform and lacks texture features.

[0052] Since environmental noise will have a greater impact on the image quality during the process of image acquisition, it is necessary to denoise the surface image through a filtering algorithm. When smoothing and denoising the surface image through the filtering algorithm, it will cause the surface image to lose details and result in image blurring. This will cause the pixel points at the edges of the scratched area and the edges of the connected regions in the surface image to be located in the blurred area. Therefore, in order to accurately identify the scratch defects of high-voltage power supply components, it is necessary to distinguish the pixel points.

[0053] Preferably, the filtering algorithm used in this embodiment is the Gaussian filtering algorithm; it should be noted that the role of the filtering algorithm here is to denoise the surface image, so other filtering algorithms can also be selected for denoising, such as bilateral filtering.

[0054] Perform gray-scale processing on the denoised surface image to obtain a gray-scale image. In this embodiment, the gray-scale method used is the weighted gray-scale method. Gray-scale is only one method for gray-scaling the surface image, and implementers can use other gray-scale methods for processing, such as the average value method.

[0055] For the gray-scale image, use the connected component algorithm to divide the gray-scale image into multiple different connected components. In this embodiment, the algorithm for connected components uses the seed filling method, and its role is only to perform connected component segmentation on the gray-scale image. Implementers can use other connected component algorithms, such as the eight-connected component algorithm.

[0056] For the scratched area, since the scratched area is caused by the contact between particles and components, resulting in wear such as scratches and abrasions on the components, the main direction of the scratched area is the direction of the wear force. Moreover, with the change of the contact area, the widths of different positions within the scratched area are significantly different, showing the characteristics of being narrower at both ends and wider in the middle position. Usually, the scratched area is not a regular area.

[0057] For each connected component in the grayscale image, obtain the coordinates of all pixel points within the connected component. Based on this, obtain the centroid of each connected component, obtain the vectors from each pixel point within the connected component to the centroid, count the direction distribution of all vectors, and calculate the number of vectors in each direction. Thus, a direction histogram is formed, where the highest peak will represent the main direction of the connected component.

[0058] Within the connected component, obtain all the lines with the same main direction, and denote the longest line with the same main direction within the connected component as the main direction line segment.

[0059] For each pixel point on the main direction line segment, draw a line perpendicular to the main direction line segment, and denote the intersection points of the line and the edge of the connected component as the boundary feature points. Take the Euclidean distance between the boundary feature points corresponding to the same pixel point as the main direction width of each pixel point.

[0060] Further, take the main direction width of the pixel point on the main direction line segment that is closest to the center point of the connected component as the standard width of the connected component. In this embodiment, take the Euclidean distance between the pixel point and the center point as the distance between the two.

[0061] On the main direction, with the center point of the connected component as the reference, draw a perpendicular line to the main direction passing through the center point of the connected component. Denote the two sides of the perpendicular line as the left side and the right side respectively. For each side, sort the main direction widths in the order of the distance from the pixel point to the center point of the connected component from far to near. Obtain a width sequence for each side, denoted as the left width sequence and the right width sequence respectively. Take the left width sequence and the right width sequence as the input of the line fitting algorithm to obtain the fitting lines. Any line fitting algorithm can be used here.

[0062] Further, obtain the slope corresponding to each fitting line. The slope can characterize the variation law of the width within the connected component. Therefore, obtain the width variation coefficient of each connected component based on the slopes of the two fitting lines and the number of pixel points.

[0063] Preferably, the width variation coefficient of the connected component in this embodiment is , where represents the slope of the fitting line corresponding to the left width sequence of the i-th connected component, represents the slope of the fitting line corresponding to the right width sequence of the i-th connected component. represents the number of boundary feature points in the i-th connected region, represents the number of pixel points on the main direction line segment in the i-th connected region.

[0064] For each pixel point, K nearest neighbor boundary feature points of the preset pixel point are set, and the ambiguity of each pixel point is obtained according to the main direction width difference of the nearest neighbor boundary feature points of each pixel point, the gray mean value of the pixel point neighborhood, and the width change coefficient of the connected region.

[0065] The ambiguity of each pixel point is positively correlated with the main direction width difference of the nearest neighbor boundary feature points, the gray mean value of the pixel point neighborhood, and the width change coefficient of the connected region, respectively.

[0066] It should be noted that positive correlation means that when one variable increases, the other variable also increases, and the change directions of the two variables are the same. When one variable changes from large to small or from small to large, the other variable also changes from large to small or from small to large. There are no special restrictions in this application.

[0067] Preferably, in this embodiment, the variance of the main direction widths of all the nearest neighbor feature points of each pixel point is calculated, and the product of the variance, the gray mean value of the pixel point neighborhood, and the width change coefficient is normalized and used as the ambiguity of the pixel points in the connected region. The selection of the nearest neighbor feature points is 5 in this embodiment, and its value is related to the value accuracy. It can also be 6, 7, etc.; the neighborhood of the pixel point is the eight-neighborhood of the pixel point. The normalization method in this embodiment is the linear normalization method.

[0068] Preferably, in another embodiment of this application, the standard deviation of the main direction widths of all the nearest neighbor feature points of each pixel point is calculated, and the sum value of the standard deviation, the gray mean value of the pixel point neighborhood, and the width change coefficient is normalized and used as the ambiguity of the pixel points in the connected region. The selection of the nearest neighbor feature points is 8 in this embodiment; the neighborhood of the pixel point is the eight-neighborhood of the pixel point. The normalization method in this embodiment is the maximum-minimum normalization method.

[0069] The greater the possibility that the i-th connected region corresponds to the scratch region, the more significant the width change characteristics of the connected region at different positions from both ends to the middle of the i-th connected region, , the greater the value of , and the greater the bending degree and irregularity degree of the i-th connected region, the smaller the number of overlapping pixel points between its main direction and the i-th connected region, The larger the value; if the main direction width corresponding to the neighboring edge pixels of a pixel point changes significantly, it indicates that the probability of the neighboring boundary feature point being located on an irregular edge is higher, that is, the greater the difference in the main direction width; and the greater the gray - level mean value of the pixels within the pixel neighborhood, the more likely it is to be blurred, that is, the greater the blurriness of the pixel point, and the greater the probability that the pixel point is located in the boundary - blurred area caused by scratches. The flowchart for obtaining the blurriness of a pixel point is as Figure 2 shown.

[0070] Thus, the blurriness of each pixel point is obtained.

[0071] Step S003: For each edge pixel point of a connected component, construct a window, calculate the correlation of the edge pixel point according to the gray - level values of the pixels belonging to the connected component and the pixels not belonging to the connected component in the window; calculate the Fourier descriptor of the connected component, and obtain the scratch saliency of the connected component according to the gray - level value of the Fourier descriptor and the similarity of the Fourier descriptors of different connected components; obtain the scratch fitness of the edge pixel point according to the scratch saliency of the connected component and the correlation of the edge pixel point.

[0072] In the surface image, there is a specific spatial relationship between a pixel point and its neighboring pixel points, and this relationship constitutes the texture feature of the image. As an unnatural image element, the appearance of a scratch will disrupt this spatial relationship, making the texture feature in the scratch area become irregular or blurred. Secondly, the existence of a scratch will weaken the edge contrast, making the edge unclear, thus affecting the edge detection and analysis of the image.

[0073] Since the scratch - defect areas are generally continuously and unevenly distributed on the surface of the high - voltage power supply components. And the original texture structures in the image, such as the text, pattern elements on the component surface, etc., have strong regular distribution rules.

[0074] Extract the Fourier descriptors of each connected component, which are used to characterize the image information of different edge points on the edge of each connected component. If the connected component belongs to the scratch - defect area, the elements in the corresponding Fourier descriptor should show an enhancement of high - frequency components, non - uniformity of the amplitude spectrum, disorder of the phase spectrum, etc. On the contrary, if the connected component belongs to the inherent connected component on the surface of the high - voltage power supply component, the elements in the corresponding Fourier descriptor should show the dominance of low - frequency components, the regularity of the amplitude spectrum and phase spectrum, and the uniformity of energy distribution. Thus, use their characteristic differences to distinguish the scratch - defect area and the inherent connected component on the surface of the high - voltage power supply component.

[0075] Taking the edge pixel points on each connected component as the central pixel points, for each central pixel point, set a A window of a certain size is taken. The pixel points within the window that belong to this connected component are marked as internal pixel points, and the pixel points within the window that do not belong to this connected component are marked as external pixel points. The internal pixel points and external pixel points within each window are sorted separately in ascending order of gray value to obtain the internal gray sequence and external gray sequence of the window.

[0076] For each connected component, calculate the average gray value of the pixel points corresponding to all its Fourier descriptors; form a sequence of the gray values of all the Fourier descriptors within the connected component and denote it as the Fourier sequence, and calculate the DTW distance between the Fourier sequences of different connected components.

[0077] Obtain the scratch saliency of the connected component based on the average gray value of the Fourier sequence corresponding to each connected component and the DTW distance between the Fourier sequence of the connected component and the Fourier sequences of all the other connected components. , where represents the average gray value of the Fourier sequence corresponding to the i-th connected component, represents the average value of the DTW distances between the Fourier sequence of the i-th connected component and the Fourier sequences of all the other connected components, represents the scratch saliency of the i-th connected component. If the average value of the DTW distances is larger, it indicates that the difference between the current connected component and the other connected components is larger, which means that the current connected component is more likely to be a scratch area. And the larger the average value of the Fourier descriptors of the connected component itself, the more prominent it is.

[0078] For each edge pixel point connected, calculate the correlation between its internal gray sequence and external gray sequence. In this embodiment, the correlation is obtained through the Pearson correlation coefficient. In addition, the implementer can use other algorithms for calculating the correlation to obtain it.

[0079] Obtain the scratch fitness of the edge pixel point based on the scratch saliency of the connected component and the correlation of the edge pixel point.

[0080] The scratch fitness of the edge pixel point has a positive correlation with the scratch saliency of the connected component and a negative correlation with the correlation of the edge pixel point.

[0081] Preferably, in this embodiment, , where represents the correlation of the p-th edge pixel point in the i-th connected component, represents the scratch fitness of the p-th edge pixel point in the i-th connected component, The role here is to prevent the denominator from being zero, and its value is 1. norm() represents the linear normalization function. The normalization function can take other normalization functions, such as the maximum-minimum value function.

[0082] Preferably, in another embodiment of this application, , the scratch fitness of edge pixels is calculated through a logarithmic function.

[0083] Thus, the scratch fitness of edge pixels is obtained.

[0084] Step S004: Screen the edge points of the scratch area according to the scratch fitness of the edge pixels and the blurriness of the edge pixels, and complete defect recognition.

[0085] Obtain the screening coefficient of the edge pixels according to the scratch fitness of the edge pixels and the blurriness of the edge pixels, and screen the edge points of the scratch area according to the screening coefficient.

[0086] Preferably, in this embodiment, , where is the weight parameter, is the screening coefficient of the edge pixels, represents the blurriness of the p-th edge pixel in the i-th connected domain. In this embodiment takes a value of 0.4, and in other embodiments, it can also take values of 0.5 and 0.6.

[0087] Take the screening coefficients of all edge pixels on all connected domains as input, use the Otsu threshold algorithm to obtain the segmentation threshold, and take the edge pixels with screening coefficients greater than the segmentation threshold as the edge pixels of the scratch area on the surface of the high-voltage power supply component. Then mark the pixels at the edges of these scratch areas with a specific color in the feature map, then apply a dilation operation to the marked pixels to enhance the features of the scratch and connect adjacent edge points, and then fuse them into a complete scratch area through connected component analysis and applying the region growing algorithm, that is, realize the recognition of surface defects of high-voltage power supply components. Among them, the dilation operation and the region growing algorithm are both well-known technologies and will not be elaborated here.

[0088] Thus, the recognition of component surface defects is completed.

[0089] It should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

[0090] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between each embodiment can be referred to each other. Each embodiment focuses on the differences from other embodiments.

Claims

1. A method for defect identification of high-voltage power supply components based on computer vision, characterized in that, The method includes the following steps: Collect the surface image of the high-voltage power supply component; After denoising and graying the surface image, obtain a grayscale image. Perform connected component analysis on the grayscale image to obtain several connected components; for each pixel point in the connected component, obtain a vector, and record the longest straight line in the direction with the largest number of vectors as the main direction line segment; construct a width sequence according to the lengths of the pixel points in the connected component perpendicular to the main direction line segment; obtain the width change coefficient of the connected component according to the slope of the straight line fitted by the width sequence and the ratio of the number of pixel points on the connected component edge pixel points to the pixel points on the main direction line segment; obtain the blurriness of each pixel point according to the neighborhood grayscale value, width, and width change coefficient of each pixel point in the connected component; For each connected component edge pixel point, construct a window, and calculate the correlation of the edge pixel point according to the grayscale values of the pixel points belonging to the connected component and the pixel points not belonging to the connected component in the window; calculate the Fourier descriptor of the connected component, and obtain the scratch saliency of the connected component according to the grayscale value of the Fourier descriptor and the similarity of the Fourier descriptors of different connected components; obtain the scratch fitness of the edge pixel point according to the scratch saliency of the connected component and the correlation of the edge pixel point; Screen the edge points of the scratch area according to the scratch fitness of the edge pixel point and the blurriness of the edge pixel point, and complete defect recognition; Among them, the method of obtaining a vector for each pixel point in the connected component and recording the longest straight line in the direction with the largest number of vectors as the main direction line segment is as follows: For each connected component, obtain the vector from each pixel point to the centroid of the connected component, and statistically obtain the direction histogram according to the directions of all vectors; take the direction with the largest number as the main direction of the connected component, and record the longest straight line in the main direction in the connected component as the main direction line segment.

2. The method for identifying defects of high-voltage power supply components based on computer vision according to claim 1, wherein, The method of denoising and graying the surface image to obtain a grayscale image and performing connected component analysis on the grayscale image to obtain several connected components is as follows: Denoise the surface image through the Gaussian filtering algorithm, gray the denoised surface image through the weighted gray method to obtain a grayscale image, and use the seed filling method for the grayscale image to obtain several connected components.

3. The method for identifying defects of high-voltage power supply components based on computer vision according to claim 1, wherein, The method of constructing a width sequence according to the lengths of the pixel points in the connected component perpendicular to the main direction line segment is as follows: For each pixel point on the main direction line segment, make a straight line perpendicular to the main direction line segment, and record the intersection point of the straight line and the connected component edge as the boundary feature point. Take the Euclidean distance between the boundary feature points corresponding to the same pixel point as the main direction width of each pixel point; Taking the center point of the connected component as the reference, make a perpendicular line perpendicular to the main direction through the center point of the connected component. For each side of the perpendicular line, sort the main direction widths in the order of the distance from the pixel point to the center point of the connected component from far to near, and obtain a width sequence for each side.

4. The method for identifying defects of high-voltage power supply components based on computer vision according to claim 1, characterized in that, The method of obtaining the width change coefficient of the connected component according to the slope of the straight line fitted by the width sequence and the ratio of the number of pixel points on the connected component edge pixel points to the pixel points on the main direction line segment is as follows: Record the width sequence as the left width sequence and the right width sequence, and obtain the fitted straight line of each width sequence; The expression for the width variation coefficient is ; represents the slope of the fitting line corresponding to the left width sequence of the i-th connected region, represents the slope of the fitting line corresponding to the right width sequence of the i-th connected region, represents the number of boundary feature points in the i-th connected region, represents the number of pixel points on the main direction line segment in the i-th connected region.

5. The method for identifying defects of high-voltage power supply components based on computer vision according to claim 3, characterized in that, The method for obtaining the blurriness of each pixel point according to the neighborhood gray value, width, and width change coefficient of the connected component corresponding to each pixel point is as follows: For each pixel point, preset K nearest neighbor boundary feature points of the pixel point, and calculate the gray mean value of the eight-neighborhood of each pixel point; The blurriness of each pixel point is positively correlated with the main direction width difference of the nearest neighbor boundary feature points, the gray mean value of the pixel neighborhood, and the width change coefficient of the connected component.

6. The method for identifying defects of high-voltage power supply components based on computer vision according to claim 1, wherein, The method for constructing a window for each edge pixel point of the connected component and calculating the correlation of the edge pixel point according to the gray values of the pixel points belonging to the connected component and the pixel points not belonging to the connected component in the window is as follows: Set a window with the edge pixel point in the connected component as the center, mark the pixel points not belonging to the connected component in the window as external pixel points, and mark the pixel points belonging to the connected component as internal pixel points; Sort all internal pixel points and external pixel points in ascending order of gray value to obtain the internal gray sequence and the external gray sequence; Calculate the correlation of the internal gray sequence and the external gray sequence as the correlation of the edge pixel point.

7. The method for identifying defects of high-voltage power supply components based on computer vision according to claim 1, wherein The method for calculating the Fourier descriptor of the connected component and obtaining the scratch saliency of the connected component according to the gray value of the Fourier descriptor and the similarity of the Fourier descriptors of different connected components is as follows: Extract the Fourier descriptor of each connected component, and calculate the mean value of the gray values of the corresponding pixel points of all its Fourier descriptors; form a sequence of the gray values of all Fourier descriptors in the connected component and record it as the Fourier sequence, and calculate the similarity of the Fourier sequences between connected components; The expression for the scratch saliency of the connected component is , represents the Fourier sequence corresponding to the i-th connected component, represents the average gray value of the Fourier sequence corresponding to the i-th connected component, represents the average of the DTW distances between the Fourier sequences of the i-th connected component and those of all other connected components, represents the scratch saliency of the i-th connected component.

8. The method for identifying defects of high-voltage power supply components based on computer vision according to claim 1, wherein, The method for obtaining the scratch fitness of the edge pixel point according to the scratch saliency of the connected component and the correlation of the edge pixel point is as follows: The expression for the scratch fit degree of edge pixel points is as follows: , where represents the correlation of the p-th edge pixel point in the i-th connected component, represents the scratch significance of the i-th connected component, represents the scratch fit degree of the p-th edge pixel point in the i-th connected component, takes a preset value, and norm() represents a linear normalization function.

9. The method for identifying defects of high-voltage power supply components based on computer vision according to claim 1, characterized in that, The method for screening the edge points of the scratch area according to the scratch fitness of the edge pixel point and the blurriness of the edge pixel point is as follows: Obtain the screening coefficient of the edge pixel point according to the scratch fitness of the edge pixel point and the blurriness of the edge pixel point; The screening coefficient of the edge pixel points is: , where is the weight parameter, is the screening coefficient of the edge pixel points, represents the scratch fitness of the p-th edge pixel point in the i-th connected domain, represents the blurriness of the p-th edge pixel point in the i-th connected domain; Take the edge pixel points with the screening coefficient greater than the preset segmentation threshold as the edge pixel points of the scratch area on the surface of the high-voltage power supply component.

Citation Information

Patent Citations

  • Printing pattern defect detection method and system for plastic package

    CN118411367A

  • Food packaging bottle defect visual detection method and system

    CN118864468A