A capacitor defect detection method and system

By extracting the initial connected domain in the capacitor image and calculating the gradient angle data, the image is enhanced, which solves the problem of capacitor defect detection accuracy under the influence of uneven illumination and improves the recognition accuracy.

CN118505692BActive Publication Date: 2024-10-11LIAONING YIJIN ELECTRONICS
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410961341.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-18
Publication Date
2024-10-11
Estimated Expiration
2044-07-18

Smart Images

  • Figure CN118505692B_ABST
    Figure CN118505692B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image data processing technology, and in particular to a capacitor defect detection method and system, comprising: obtaining the standard label text content of the capacitor surface, the capacitor grayscale image and the initial connected domain, obtaining a gradient angle data sequence according to the difference between the pixel points on the boundary of the initial connected domain; obtaining the deviation value of each gradient angle data according to the difference between the gradient angle data, obtaining the reference value to be adjusted of each initial connected domain according to the difference between the deviation values ​​of the gradient angle data, obtaining the transformation parameter according to the reference value to be adjusted, performing image enhancement on each initial connected domain according to the transformation parameter corresponding to each initial connected domain, obtaining an enhanced capacitor grayscale image, and obtaining a final recognition result according to the enhanced capacitor grayscale image. The present invention improves the clarity of the capacitor grayscale image by enhancing the capacitor grayscale image, thereby improving the recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image data processing, and in particular to a capacitor defect detection method and system. Background Art

[0002] A capacitor is an electronic component used to store charge and electrical energy. It consists of a medium between two conductors. Due to different products, the required capacitor specifications are also different, which also causes the capacitor to be labeled with the corresponding capacitor specifications and related information when it leaves the factory. However, during the production process, due to problems such as improper operation, the capacitor label is blurred or lost, and the user may find it difficult to determine the specifications and performance of the capacitor, which may lead to the selection of an inappropriate capacitor.

[0003] Existing problem: Although The algorithm has many advantages in capacitor defect identification, but The algorithm has high requirements on image quality. When the capacitor image is affected by uneven lighting, the clarity of the capacitor image may be reduced, making it difficult to pass The algorithm performs accurate analysis and is prone to identifying errors, which can lead to false detections and false alarms. Summary of the invention

[0004] The present invention provides a capacitor defect detection method and system to solve the existing problems.

[0005] A capacitor defect detection method and system of the present invention adopts the following technical solutions:

[0006] An embodiment of the present invention provides a capacitor defect detection method, the method comprising the following steps:

[0007] Obtain standard label text content on the capacitor surface and capacitor grayscale image;

[0008] Obtaining several initial connected domains in the grayscale image of the capacitor;

[0009] According to the differences between all pixel points on the boundary of each initial connected domain, a plurality of gradient angle data sequences of each initial connected domain are obtained; according to the differences between all gradient angle data of each gradient angle data sequence of each initial connected domain, a deviation value of each gradient angle data sequence of each initial connected domain is obtained; according to the differences between all gradient angle data of each gradient angle data sequence of each initial connected domain and the deviation values ​​of all gradient angle data, a reference value to be adjusted of each initial connected domain is obtained;

[0010] According to the reference value to be adjusted of each initial connected domain, the transformation parameter of each initial connected domain is obtained; in the grayscale image of the capacitor, each initial connected domain is enhanced according to the transformation parameter corresponding to each initial connected domain to obtain an enhanced grayscale image of the capacitor; according to the enhanced grayscale image of the capacitor and the standard label text content on the surface of the capacitor, the final recognition result is obtained.

[0011] Furthermore, the step of obtaining a plurality of initial connected domains in the grayscale image of the capacitor includes the following specific steps:

[0012] According to the grayscale value of the pixel point in the capacitor grayscale image, the edge detection of the capacitor grayscale image is performed using the Sobel edge detection algorithm to obtain several edge pixel points in the capacitor grayscale image;

[0013] According to all edge pixels in the capacitor grayscale image, a connected domain labeling algorithm is used to extract connected domain labels from the capacitor grayscale image, and several initial connected domains in the capacitor grayscale image are obtained.

[0014] Furthermore, the step of obtaining a plurality of gradient angle data sequences of each initial connected domain according to the differences between all pixel points on the boundary of each initial connected domain includes the following specific steps:

[0015] Use the Sobel edge detection algorithm to operate on the capacitor grayscale image to obtain the gradient angle value of each pixel;

[0016] In the Perform the following operations on any pixel point on the boundary of the initial connected domain:

[0017] Step (1): Any pixel point on the boundary of the initial connected domain is recorded as the first starting point;

[0018] Step (2): Start from the first starting point and move in a clockwise direction along the The boundary of the initial connected domain is traversed pixel by pixel one by one, and the straight line connecting the first starting point and the first traversed pixel point is recorded as the initial straight line. When the minimum angle between the initial straight line and the straight line connecting the first starting point and any traversed pixel point is greater than T, any traversed pixel point is recorded as the first cutoff point; the first gradient angle data sequence is formed according to the gradient angle values ​​of all the traversed pixel points from the first starting point to the first cutoff point; wherein T is a preset angle threshold;

[0019] Step (3): record the first cutoff point as the second starting point, and repeat step (2) to obtain the second cutoff point and the second gradient angle data sequence;

[0020] Step (4): record the second cutoff point as the third starting point, and repeat steps (2) and (3) until the number of pixels traversed from the first starting point to any cutoff point is greater than When , stop traversal and get the Several gradient angle data sequences corresponding to the initial connected domains; among them, is the preset ratio threshold, For the The number of pixels on the boundary of the initial connected domain.

[0021] Furthermore, the specific calculation formula for obtaining the deviation value of each gradient angle data of each gradient angle data sequence of each initial connected domain according to the difference between all gradient angle data of each gradient angle data sequence of each initial connected domain is:

[0022]

[0023] in, Indicates The first The first gradient angle data sequence Deviation value of gradient angle data; Indicates The first The number of all gradient angle data in a gradient angle data sequence; Indicates The first The first gradient angle data sequence Gradient angle data; Indicates The first The first gradient angle data sequence Gradient angle data; Indicates The first The mean of all gradient angle data in a gradient angle data sequence.

[0024] Furthermore, the reference value to be adjusted of each initial connected domain is obtained according to all gradient angle data of each gradient angle data sequence of each initial connected domain and the difference between the deviation values ​​of all gradient angle data, including the following specific steps:

[0025] According to The first The deviation value of all gradient angle data in the gradient angle data sequence is obtained The first Fluctuation reference value of a gradient angle data series;

[0026] According to The fluctuation reference value of each gradient angle data sequence of the initial connected domain and all the gradient angle data are obtained. The reference value to be adjusted for the initial connected domain.

[0027] Furthermore, according to The first The deviation value of all gradient angle data in the gradient angle data sequence is obtained The first The specific calculation formula for the fluctuation reference value of a gradient angle data sequence is:

[0028]

[0029] in, Indicates The first Fluctuation reference value of a gradient angle data series; Indicates The first The number of all gradient angle data in a gradient angle data sequence; Indicates The first The first gradient angle data sequence Deviation value of gradient angle data; Indicates The first The mean of the deviation values ​​of all gradient angle data of a gradient angle data sequence; Represents the square root operation.

[0030] Furthermore, according to The fluctuation reference value of each gradient angle data sequence of the initial connected domain and all the gradient angle data are obtained. The specific calculation formula for the reference value to be adjusted of an initial connected domain is:

[0031]

[0032] in, Indicates The reference value to be adjusted of the initial connected domain; Indicates The first Fluctuation reference value of a gradient angle data series; Indicates The number of all gradient angle data sequences of the initial connected domain; Indicates The first The mean value of all gradient angle data of a gradient angle data sequence; Indicates The first The mean value of all gradient angle data of a gradient angle data sequence; Indicates The first The mean value of all gradient angle data of a gradient angle data sequence; It indicates the absolute value.

[0033] Furthermore, the step of obtaining the transformation parameters of each initial connected domain according to the reference value to be adjusted of each initial connected domain includes the following specific steps:

[0034] The first Substitute the reference value to be adjusted for the initial connected domain into The function is operated and the Transformation parameters of the initial connected domain;

[0035] No. The calculation formula of the transformation parameters of the initial connected domain is:

[0036] ;

[0037] in, For the Transformation parameters of the initial connected domain; For the The reference value to be adjusted of the initial connected domain;

[0038] in, Represents an exponential function with a natural constant as its base.

[0039] Furthermore, the method of obtaining the final recognition result based on the enhanced capacitor grayscale image and the standard label text content on the capacitor surface includes the following specific steps:

[0040] The enhanced grayscale image of the capacitor is operated by an OCR algorithm to obtain the text content of the label in the enhanced grayscale image of the capacitor;

[0041] When the text content of the standard label on the surface of the capacitor is the same as the text content of the label in the enhanced grayscale image of the capacitor, it is determined that the text content of the label in the enhanced grayscale image of the capacitor is complete;

[0042] When the text content of the standard label on the capacitor surface is different from the text content of the label in the enhanced capacitor grayscale image, it is determined that the text content of the label in the enhanced capacitor grayscale image is incomplete.

[0043] The present invention also proposes a capacitor defect detection system, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the aforementioned capacitor defect detection method.

[0044] The beneficial effects of the technical solution of the present invention are:

[0045] Obtain the standard label text content of the capacitor surface and the capacitor grayscale image; obtain several initial connected domains in the capacitor grayscale image; obtain several gradient angle data sequences of each initial connected domain according to the differences between all pixel points on the boundary of each initial connected domain; obtain the deviation value of each gradient angle data sequence of each gradient angle data sequence of each initial connected domain according to the differences between all gradient angle data of each gradient angle data sequence of each initial connected domain, and clarify the direction change of all pixel points on the boundary of each initial connected domain. According to the differences between all gradient angle data of each gradient angle data sequence of each initial connected domain and the deviation values ​​of all gradient angle data, obtain the reference value to be adjusted of each initial connected domain, and ensure the possibility that the initial connected domain is a character. According to the reference value to be adjusted of each initial connected domain, obtain the transformation parameter of each initial connected domain, and improve the accuracy of text recognition in the capacitor grayscale image. In the capacitor grayscale image, each initial connected domain is enhanced according to the transformation parameter corresponding to each initial connected domain to obtain the enhanced capacitor grayscale image; according to the enhanced capacitor grayscale image and the standard label text content of the capacitor surface, obtain the final recognition result. The present invention improves the clarity of the capacitor grayscale image by enhancing the capacitor grayscale image, thereby improving the accuracy of recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0047] Figure 1 A flowchart of a capacitor defect detection method according to the present invention;

[0048] Figure 2A grayscale image diagram of a capacitor provided in this embodiment. DETAILED DESCRIPTION

[0049] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a capacitor defect detection method and system proposed by the present invention, its specific implementation, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0050] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0051] The specific scheme of a capacitor defect detection method and system provided by the present invention is described in detail below with reference to the accompanying drawings.

[0052] See also Figure 1 , which shows a flowchart of a capacitor defect detection method provided by an embodiment of the present invention, the method comprising the following steps:

[0053] Step S001: Obtain standard label text content on the capacitor surface and a capacitor grayscale image.

[0054] Through high resolution The camera collects the capacitor image to be detected, and then uses a low-pass filtering algorithm to perform noise reduction on the capacitor image, and converts the noise-reduced image into a grayscale image to obtain a capacitor grayscale image. Figure 2 A grayscale image diagram of a capacitor provided in this embodiment.

[0055] It should be noted that: on the detection platform, a background image without capacitors and a target image with capacitors are collected, and an image difference algorithm is used to differentiate the background image and the target image to obtain a capacitor image, thereby subtracting background interference. The image difference algorithm is a well-known technology and will not be described in detail here.

[0056] Step S002: Acquire a number of initial connected domains in the grayscale image of the capacitor.

[0057] According to the grayscale value of the pixel point in the capacitor grayscale image, the edge detection of the capacitor grayscale image is performed using the Sobel edge detection algorithm to obtain several edge pixel points in the capacitor grayscale image;

[0058] According to all edge pixels in the capacitor grayscale image, a connected domain labeling algorithm is used to extract connected domain labels from the capacitor grayscale image to obtain several initial connected domains in the capacitor grayscale image; wherein, the Sobel edge detection algorithm and the connected domain labeling algorithm are both well-known technologies, and the specific methods are not introduced here.

[0059] Step S003: According to the differences between all pixel points on the boundary of each initial connected domain, several gradient angle data sequences of each initial connected domain are obtained; according to the differences between all gradient angle data of each gradient angle data sequence of each initial connected domain, the deviation value of each gradient angle data sequence of each initial connected domain is obtained; according to the differences between all gradient angle data of each gradient angle data sequence of each initial connected domain and the deviation values ​​of all gradient angle data, the reference value to be adjusted of each initial connected domain is obtained.

[0060] What needs to be explained is that: since the shape of the edge formed by the reflection of the raised area is relatively simple or regular, and the area is large, the edge segment with similar gradient direction and corresponding pixel points adjacent to each other is longer. If it is divided into several segments with different gradient change rates, it has fewer segments and the fluctuation between each segment is smaller; and due to the independence of characters, the edge shape of the character area is more complex, each stroke is shorter, and the directions of different strokes are different, so the fluctuation frequency of the gradient direction is larger, that is, each segment has a shorter edge with similar gradient direction, has more sequential segments, and the gradient direction of each segment varies greatly; the enhancement coefficient is constructed based on this.

[0061] The capacitor grayscale image is operated using the Sobel edge detection algorithm to obtain the gradient angle value of each pixel point; wherein the Sobel edge detection algorithm is a well-known technology, and the specific method is not introduced here.

[0062] The preset angle threshold T is 15 degrees, which is taken as an example for description.

[0063] In the Perform the following operations on any pixel point on the boundary of the initial connected domain:

[0064] Step (1): Any pixel point on the boundary of the initial connected domain is recorded as the first starting point;

[0065] Step (2): Start from the first starting point and move in a clockwise direction along the The boundary of the initial connected domain is traversed pixel by pixel, and the straight line connecting the first starting point and the first traversed pixel is recorded as the initial straight line. When the minimum angle between the initial straight line and the straight line connecting the first starting point and any traversed pixel is greater than T, any traversed pixel is recorded as the first cutoff point; the first gradient angle data sequence is formed according to the gradient angle values ​​of all the traversed pixels from the first starting point to the first cutoff point;

[0066] Step (3): record the first cutoff point as the second starting point, and repeat step (2) to obtain the second cutoff point and the second gradient angle data sequence;

[0067] Step (4): record the second cutoff point as the third starting point, and repeat steps (2) and (3) until the number of pixels traversed from the first starting point to any cutoff point is greater than When , stop traversal and get the Several gradient angle data sequences corresponding to the initial connected domains; among them, is a preset ratio threshold. In this embodiment, the preset ratio threshold is 0.5. This example is used for description. For the The number of pixels on the boundary of the initial connected domain.

[0068] The first The first The first gradient angle data sequence The specific calculation formula for the deviation value of the gradient angle data is:

[0069]

[0070] in, Indicates The first The first gradient angle data sequence Deviation value of gradient angle data; Indicates The first The number of all gradient angle data in a gradient angle data sequence; Indicates The first The first gradient angle data sequence Gradient angle data; Indicates The first The first gradient angle data sequence Gradient angle data; Indicates The first The mean of all gradient angle data in a gradient angle data sequence.

[0071] What needs to be explained is: The larger the value of The first The first gradient angle data sequence The greater the change in the direction of the gradient angle data relative to the entire sequence.

[0072] Through the above process, we obtain The first The first gradient angle data sequence The deviation value of the gradient angle data.

[0073] Each gradient angle data of each gradient angle data sequence of each initial connected domain is operated according to the above process to obtain the deviation value of each gradient angle data of each gradient angle data sequence of each initial connected domain.

[0074] The first The first The specific calculation formula for the fluctuation reference value of a gradient angle data sequence is:

[0075]

[0076] in, Indicates The first Fluctuation reference value of a gradient angle data series; Indicates The first The number of all gradient angle data in a gradient angle data sequence; Indicates The first The first gradient angle data sequence Deviation value of gradient angle data; Indicates The first The mean of the deviation values ​​of all gradient angle data of a gradient angle data sequence; Represents the square root operation.

[0077] What needs to be explained is: Indicates The first The greater the fluctuation degree of the gradient direction in the gradient angle data sequence, the greater the fluctuation degree is. The first The edge fluctuations corresponding to the gradient angle data sequence are more frequent, indicating that the edge is more tortuous, that is, The first The shape near the edge segment corresponding to the gradient angle data sequence is more complex, indicating that The greater the possibility that the initial connected domain belongs to the character area.

[0078] Through the above process, we obtain The first The fluctuation reference value of the gradient angle data series.

[0079] Each gradient angle data sequence of each initial connected domain is operated according to the above process to obtain a fluctuation reference value of each gradient angle data sequence of each initial connected domain.

[0080] The first The specific calculation formula for the reference value to be adjusted of an initial connected domain is:

[0081]

[0082] in, Indicates The reference value to be adjusted of the initial connected domain; Indicates The first Fluctuation reference value of a gradient angle data series; Indicates The number of all gradient angle data sequences of the initial connected domain; Indicates The first The mean value of all gradient angle data of a gradient angle data sequence; Indicates The first The mean value of all gradient angle data of a gradient angle data sequence; Indicates The first The mean value of all gradient angle data of a gradient angle data sequence; It indicates the absolute value.

[0083] What needs to be explained is: Indicates The first The larger the change of the gradient angle data sequence between adjacent gradient angle data sequences, the greater the change of the first gradient angle data sequence. The first The greater the change in the gradient direction of the first gradient angle data sequence relative to the adjacent gradient angle data sequence, the greater the change in the gradient direction of the first gradient angle data sequence. The first The shape near the edge segment corresponding to the gradient angle data sequence is more complex, indicating that The greater the possibility that the initial connected domain belongs to the character area.

[0084] It is further necessary to explain that: When the number of gradient angle data sequences of an initial connected domain is less than three, it means that the edge of the connected domain is less tortuous, and therefore it is less likely to be a character. Therefore, in this embodiment, the transformation parameter of the initial connected domain at this time is set to 1, that is, the initial connected domain is not enhanced.

[0085] Through the above process, we get The reference value to be adjusted for the initial connected domain.

[0086] All initial connected domains are operated according to the above process to obtain the reference value to be adjusted of each initial connected domain.

[0087] Step S004: Obtain the transformation parameters of each initial connected domain according to the reference value to be adjusted of each initial connected domain; in the grayscale image of the capacitor, perform image enhancement on each initial connected domain according to the transformation parameters corresponding to each initial connected domain to obtain an enhanced grayscale image of the capacitor; obtain the final recognition result according to the enhanced grayscale image of the capacitor and the standard label text content on the surface of the capacitor.

[0088] It should be noted that the characters in the image are difficult to recognize due to the reflection of the convex area. The initial connected domain with a larger reference value to be adjusted has a greater possibility of being a character, so the degree of image enhancement is greater, and vice versa. Therefore, the gamma transform is selected to enhance different initial connected domains to different degrees.

[0089] Still As an example, take the first Substitute the reference value to be adjusted for the initial connected domain into The function is operated and the The transformation parameters of the initial connected components.

[0090] Among them, The calculation formula of the transformation parameters of the initial connected domain is:

[0091] ;

[0092] in, For the Transformation parameters of the initial connected domain; For the The reference value to be adjusted of the initial connected domain;

[0093] What needs to be explained is: Represents an exponential function with a natural constant as its base.

[0094] The reference value to be adjusted of each initial connected domain is calculated according to the above process to obtain the transformation parameter of each initial connected domain.

[0095] The transformation parameter of each initial connected domain is used as the gamma value of the gamma correction image enhancement algorithm. In the capacitor grayscale image, the gamma correction image enhancement algorithm is used to enhance all initial connected domains respectively to obtain an enhanced capacitor grayscale image. Among them, gamma correction image enhancement is a well-known technology and will not be described in detail here.

[0096] It should be noted that: in this embodiment, the initial connected domain may include a character area and a reflective area. When the reference value to be adjusted is larger, it is more likely to be a character area, and when the reference value to be adjusted is smaller, it is more likely to be a reflective area. It is known that an increase in the gamma value will increase the contrast of the image, making the difference between the bright and dark parts of the image more obvious. On the contrary, a decrease in the gamma value will reduce the contrast, making the image look flatter. Therefore, this embodiment uses a larger gamma value to enhance the character area, improve the contrast of the character area, and thus improve the accuracy of character recognition, and uses a smaller gamma value to enhance the reflective area, reduce the impact of highlights caused by reflections, and thus improve the accuracy of character recognition.

[0097] The enhanced capacitor grayscale image is operated by the OCR algorithm to obtain the text content of the label in the enhanced capacitor grayscale image, and the standard label text content of the capacitor surface is compared with the text content of the label in the enhanced capacitor grayscale image. When the standard label text content of the capacitor surface is the same as the text content of the label in the enhanced capacitor grayscale image, it means that the text content of the label in the enhanced capacitor grayscale image is complete. If they are different, it means that the text content of the label in the enhanced capacitor grayscale image is incomplete. Among them, the OCR algorithm is a well-known technology, and the specific method is not introduced here.

[0098] If it is detected that the text content of the label in the enhanced grayscale image of the capacitor is incomplete, a corresponding alarm mechanism will be issued to remind the operator to conduct manual inspection or scrap it, and generate relevant logs for the factory to optimize the production line later.

[0099] So far, the present invention is completed.

[0100] In summary, in an embodiment of the present invention, the standard label text content of the capacitor surface, the capacitor grayscale image and the initial connected domain are obtained, and the gradient angle data sequence is obtained according to the difference between the pixel points on the boundary of the initial connected domain; the deviation value of each gradient angle data is obtained according to the difference between the gradient angle data, and the reference value to be adjusted of each initial connected domain is obtained according to the difference between the deviation values ​​of the gradient angle data, and the transformation parameters are obtained according to the reference value to be adjusted, and each initial connected domain is image enhanced according to the transformation parameters corresponding to each initial connected domain to obtain an enhanced capacitor grayscale image, and the final recognition result is obtained according to the enhanced capacitor grayscale image. The present invention improves the clarity of the capacitor grayscale image by enhancing the capacitor grayscale image, thereby improving the accuracy of recognition.

[0101] The present invention also provides a capacitor defect detection system, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the aforementioned capacitor defect detection method.

[0102] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A capacitor defect detection method, characterized in that: The method comprises the following steps: Obtain standard label text content on the capacitor surface and capacitor grayscale image; Obtaining several initial connected domains in the grayscale image of the capacitor; According to the differences between all pixel points on the boundary of each initial connected domain, a plurality of gradient angle data sequences of each initial connected domain are obtained; according to the differences between all gradient angle data of each gradient angle data sequence of each initial connected domain, a deviation value of each gradient angle data sequence of each initial connected domain is obtained; according to the differences between all gradient angle data of each gradient angle data sequence of each initial connected domain and the differences between the deviation values ​​of all gradient angle data, a reference value to be adjusted of each initial connected domain is obtained; According to the reference value to be adjusted of each initial connected domain, the transformation parameter of each initial connected domain is obtained; in the grayscale image of the capacitor, each initial connected domain is image enhanced according to the transformation parameter corresponding to each initial connected domain to obtain an enhanced grayscale image of the capacitor; according to the enhanced grayscale image of the capacitor and the standard label text content on the surface of the capacitor, the final recognition result is obtained; The method for obtaining the gradient angle is as follows: using the Sobel edge detection algorithm to operate the capacitor grayscale image to obtain the gradient angle value of each pixel point; The method for obtaining the reference value to be adjusted of each initial connected domain is as follows: According to The first The deviation value of all gradient angle data in the gradient angle data sequence is obtained The first Fluctuation reference value of a gradient angle data series; According to The fluctuation reference value of each gradient angle data sequence of the initial connected domain and all the gradient angle data are obtained. The reference value to be adjusted of the initial connected domain; Among them, the specific calculation formula of the reference value to be adjusted is: in, Indicates The reference value to be adjusted of the initial connected domain; Indicates The first Fluctuation reference value of a gradient angle data series; Indicates The number of all gradient angle data sequences of the initial connected domain; Indicates The first The mean value of all gradient angle data of a gradient angle data sequence; Indicates The first The mean value of all gradient angle data of a gradient angle data sequence; Indicates The first The mean value of all gradient angle data of a gradient angle data sequence; It indicates the absolute value; The specific calculation formula for obtaining the deviation value of each gradient angle data of each gradient angle data sequence of each initial connected domain is: in, Indicates The first The first gradient angle data sequence Deviation value of gradient angle data; Indicates The first The number of all gradient angle data in a gradient angle data sequence; Indicates The first The first gradient angle data sequence Gradient angle data; Indicates The first The i-th gradient angle data of a gradient angle data sequence; Indicates The first The mean value of all gradient angle data of a gradient angle data sequence; Among them, the The first The specific calculation formula for the fluctuation reference value of a gradient angle data sequence is: in, Indicates The first Fluctuation reference value of a gradient angle data series; Indicates The first The number of all gradient angle data in a gradient angle data sequence; Indicates The first The first gradient angle data sequence Deviation value of gradient angle data; Indicates The first The mean of the deviation values ​​of all gradient angle data of a gradient angle data sequence; Represents the square root operation; The specific steps of obtaining the transformation parameters of each initial connected domain according to the reference value to be adjusted of each initial connected domain are as follows: The first Substitute the reference value to be adjusted of the initial connected domain into The function is operated and the Transformation parameters of the initial connected domain; No. The calculation formula of the transformation parameters of the initial connected domain is: ; in, For the Transformation parameters of the initial connected domain; For the The reference value to be adjusted of the initial connected domain; in, Represents an exponential function with a natural constant as its base.

2. A capacitor defect detection method according to claim 1, characterized in that: The specific steps of obtaining a plurality of initial connected domains in the capacitor grayscale image are as follows: According to the grayscale value of the pixel point in the capacitor grayscale image, the edge detection of the capacitor grayscale image is performed using the Sobel edge detection algorithm to obtain several edge pixel points in the capacitor grayscale image; According to all edge pixels in the capacitor grayscale image, a connected domain labeling algorithm is used to extract connected domain labels from the capacitor grayscale image, and several initial connected domains in the capacitor grayscale image are obtained.

3. A capacitor defect detection method according to claim 1, characterized in that: The method of obtaining a plurality of gradient angle data sequences of each initial connected domain according to the differences between all pixel points on the boundary of each initial connected domain includes the following specific steps: In the Perform the following operations on any pixel point on the boundary of the initial connected domain: Step (1): Any pixel point on the boundary of the initial connected domain is recorded as the first starting point; Step (2): Start from the first starting point and move in a clockwise direction along the The boundary of the initial connected domain is traversed pixel by pixel one by one, and the straight line connecting the first starting point and the first traversed pixel point is recorded as the initial straight line. When the minimum angle between the initial straight line and the straight line connecting the first starting point and any traversed pixel point is greater than T, any traversed pixel point is recorded as the first cutoff point; the first gradient angle data sequence is formed according to the gradient angle values ​​of all the traversed pixel points from the first starting point to the first cutoff point; wherein T is a preset angle threshold; Step (3): record the first cutoff point as the second starting point, and repeat step (2) to obtain the second cutoff point and the second gradient angle data sequence; Step (4): record the second cutoff point as the third starting point, and repeat steps (2) and (3) until the number of pixels traversed from the first starting point to any cutoff point is greater than When , stop traversal and get the Several gradient angle data sequences corresponding to the initial connected domains; among them, is the preset ratio threshold, For the The number of pixels on the boundary of the initial connected domain.

4. A capacitor defect detection method according to claim 1, characterized in that: The method of obtaining the final recognition result based on the enhanced capacitor grayscale image and the standard label text content on the capacitor surface includes the following specific steps: The enhanced grayscale image of the capacitor is operated by an OCR algorithm to obtain the text content of the label in the enhanced grayscale image of the capacitor; When the text content of the standard label on the surface of the capacitor is the same as the text content of the label in the enhanced grayscale image of the capacitor, it is determined that the text content of the label in the enhanced grayscale image of the capacitor is complete; When the text content of the standard label on the capacitor surface is different from the text content of the label in the enhanced capacitor grayscale image, it is determined that the text content of the label in the enhanced capacitor grayscale image is incomplete.

5. A capacitor defect detection system, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the computer program is executed by a processor, the steps of a capacitor defect detection method as described in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Driver license detection identification method based on internal feature and text field layout in complex scene

    CN108427946A

  • Image enhancement method and system for simulated ablation of tumor therapeutic apparatus

    CN116385315A

  • Intelligent detection method for surface flaws and defects of optical film

    CN117232791A