A magnetic core detection method, system and computer based on computer vision

Through the magnetic core inspection method based on computer vision, image processing and neural network models are used to automatically identify defects and dirt in the magnetic core, solving the problems of low manual inspection efficiency and large errors, and achieving efficient and accurate core surface quality. detection.

CN118365638BActive Publication Date: 2024-08-23江西省检验检测认证总院 +2
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410781203.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-18
Publication Date
2024-08-23
Estimated Expiration
2044-06-18

AI Technical Summary

Technical Problem

In the existing technology, magnetic core surface quality detection relies on manual detection, which has low efficiency and high error rate, and cannot meet the needs of industrial automation for efficient detection.

Method used

Using a magnetic core detection method based on computer vision, by acquiring and preprocessing images, the corner points, contours, and edge features of the magnetic core are determined, and defects and dirt are judged to achieve automated detection.

Benefits of technology

It improves the efficiency of magnetic core surface quality detection, reduces the error rate, and realizes automated and intelligent detection of magnetic cores.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118365638B
    Figure CN118365638B
Patent Text Reader

Abstract

The present invention provides a magnetic core detection method, system and computer based on computer vision, the method comprising: obtaining an initial image to be inspected corresponding to the magnetic core; adjusting the position and tilting the initial image to be inspected to obtain a final image to be inspected; determining the four corner points of the magnetic core in the final image to be inspected, judging whether there is a missing corner defect based on the corner point feature vector; performing contour extraction on the final image to be inspected to judge whether there is a broken edge defect; defining a first detection area at the edge of the final image to be inspected to judge whether there is a black edge defect; defining a second detection area in the final image to be inspected to determine whether there is a dirty defect and a blurred defect; judging the surface quality of the magnetic core based on the judgment results of the missing corner defect, the broken edge defect, the black edge defect, the dirty defect and the blurred defect. The automatic and intelligent detection of the surface quality of the magnetic core is completed, replacing manual work, improving the detection efficiency and reducing the detection error rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of image data processing, and in particular to a magnetic core detection method, system and computer based on computer vision. Background Art

[0002] A magnetic core refers to a sintered magnetic core metal oxide composed of a mixture of various iron oxides. It is generally set in the magnetic circuit of an inductor coil to reduce electromagnetic interference by converting current into magnetic force or using heat, thereby increasing the magnetic induction intensity.

[0003] With the rapid development of industrial automation technology, the performance requirements for electronic components are getting higher and higher. The surface quality of the magnetic core determines the performance of its components. Poor surface quality will affect the magnetic permeability, high-frequency magnetic loss and other properties of the magnetic core. At the same time, the magnetic core with poor surface quality will also affect the performance of the components associated with it. Therefore, in order to ensure the overall quality of electronic components, the surface quality detection of the magnetic core is an indispensable part.

[0004] The current method of inspecting the surface quality of magnetic cores is still manual inspection, that is, observing the surface condition of the magnetic cores with human eyes to judge the surface quality. However, with the gradual increase in the output of magnetic cores, judging the surface quality of a large number of magnetic cores through manual inspection will not only consume a lot of manpower and have low efficiency, but also have a high probability of misjudgment, resulting in a high error rate in the detection of the surface quality of the magnetic cores. Summary of the invention

[0005] The embodiments of the present application provide a magnetic core detection method, system and computer based on computer vision to solve the technical problem that the surface quality detection of the magnetic core by manual detection in the prior art not only has low detection efficiency but also has high detection error rate.

[0006] In a first aspect, an embodiment of the present application provides a magnetic core detection method based on computer vision, comprising the following steps:

[0007] Acquire a captured image of a magnetic core group in a fixture, wherein the magnetic core group includes a plurality of magnetic cores in a uniform array, and pre-process the captured image to acquire an initial image to be inspected corresponding to the magnetic core;

[0008] Performing position adjustment on the initial image to be inspected to obtain an adjusted image, and performing tilt correction on the adjusted image to obtain a final image to be inspected;

[0009] Determine four corner points of the magnetic core in the final image to be inspected, obtain corner point feature vectors of the corner points, and input the corner point feature vectors into a pre-trained neural network model to determine whether there is a missing corner defect;

[0010] Performing contour extraction on the final image to be inspected to obtain an image contour, and comparing the image contour with a standard contour to determine whether there is an edge break defect;

[0011] Delimiting a first detection area at the edge of the final image to be inspected, determining a first eigenvalue and a second eigenvalue from the first detection area, and judging whether there is a black edge defect based on the first eigenvalue and the second eigenvalue;

[0012] Delimiting a second inspection area in the final image to be inspected, and performing a dirtiness judgment and a boundary blur judgment in the second inspection area to determine whether there is a dirtiness defect and a blurry defect;

[0013] The surface quality of the magnetic core is determined based on the judgment results of the missing corner defect, the broken edge defect, the black edge defect, the dirt defect and the fuzzy defect.

[0014] Furthermore, the step of preprocessing the captured image to obtain an initial image to be inspected corresponding to the magnetic core includes:

[0015] Binarizing the captured image to obtain a binary image;

[0016] Obtaining a first X-axis projection curve and a first Y-axis projection curve of the binary image, and setting an X-axis start projection calibration value, an X-axis end projection calibration value, a Y-axis start projection calibration value, and a Y-axis end projection calibration value;

[0017] Determine an X-axis starting point and an X-axis ending point in the first X-axis projection curve by using the X-axis starting projection calibration value and the X-axis ending projection calibration value, and determine a Y-axis starting point and a Y-axis ending point in the first Y-axis projection curve by using the Y-axis starting projection calibration value and the Y-axis ending projection calibration value;

[0018] Delimiting a frame selection range in the captured image by using the X-axis starting point, the X-axis ending point, the Y-axis starting point, and the Y-axis ending point to extract a frame selection image;

[0019] The frame-selected image is segmented to obtain an initial image to be inspected, where the initial image to be inspected corresponds to the magnetic core.

[0020] Furthermore, the step of performing separation processing on the frame-selected image to obtain an initial image to be inspected includes:

[0021] Obtaining a width reference value and a height reference value of the magnetic core group, and obtaining an actual width and an actual height of the framed image, obtaining a width scaling ratio according to the actual width and the width reference value, and obtaining a height scaling ratio according to the actual height and the height reference value;

[0022] Obtaining a standard width and a standard height of the magnetic core, and obtaining a transverse spacing and a longitudinal spacing between adjacent magnetic cores, and modifying the standard width, the standard height, the transverse spacing, and the longitudinal spacing based on the width scaling ratio and the height scaling ratio to determine a plurality of transverse dividing lines and a plurality of longitudinal dividing lines;

[0023] The framed image is divided based on the plurality of horizontal dividing lines and the plurality of vertical dividing lines to obtain an initial image to be inspected.

[0024] Furthermore, the step of adjusting the position of the initial image to be inspected to obtain an adjusted image includes:

[0025] Expanding the width of the initial image to be inspected to obtain a first image;

[0026] Acquire a second X-axis projection curve of the first image, and acquire a left boundary value and a right boundary value of the second X-axis projection curve, and perform width contraction on the first image based on the left boundary value and the right boundary value to acquire a second image;

[0027] Performing height expansion on the second image to obtain a third image;

[0028] A second Y-axis projection curve of the third image is obtained, and an upper boundary value and a lower boundary value of the second Y-axis projection curve are obtained, and the third image is highly contracted based on the upper boundary value and the lower boundary value to obtain an adjusted image.

[0029] Furthermore, the step of performing tilt correction on the adjusted image to obtain a final image to be inspected includes:

[0030] Acquire a first groove boundary line and a second groove boundary line corresponding to the magnetic core in the adjustment image, and set a first vertical reference line and a second vertical reference line in the adjustment image;

[0031] Determine a first intersection point, a second intersection point, a third intersection point, and a fourth intersection point through the first groove boundary line, the second groove boundary line, the first vertical reference line, and the second vertical reference line;

[0032] Determine a first adjustment angle by using the coordinate values ​​of the first intersection point and the second intersection point, and determine a second adjustment angle by using the coordinate values ​​of the third intersection point and the fourth intersection point;

[0033] An inclination angle is determined based on the first adjustment angle and the second adjustment angle, and the adjusted image is corrected by the inclination angle to obtain a final image to be inspected.

[0034] Furthermore, the step of determining the first characteristic value and the second characteristic value from the first detection area includes:

[0035] Obtaining a third Y-axis projection curve of the first detection area, and obtaining a starting point and an end point of the third Y-axis projection curve;

[0036] Searching in a first preset search range from the starting point to the end point to determine a first calibration point within the first preset search range, and searching in a second preset search range from the first calibration point to the end point to determine a second calibration point within the second preset search range;

[0037] Searching in a third preset search range from the end point to the starting point to determine a third marking point within the third preset search range, and searching in a fourth preset search range from the third marking point to the starting point to determine a fourth marking point within the fourth preset search range;

[0038] A first characteristic value is determined based on the starting point and the second calibration point, and a second characteristic value is determined based on the end point and the fourth calibration point.

[0039] Furthermore, the calculation formula of the first eigenvalue is:

[0040] ,

[0041] in, represents the first eigenvalue, represents the second calibration point, Indicates the starting point;

[0042] The calculation formula of the second eigenvalue is:

[0043] ,

[0044] in, represents the second eigenvalue, represents the fourth calibration point, Indicates the end point.

[0045] Furthermore, the step of judging whether a black edge defect exists based on the first characteristic value and the second characteristic value includes:

[0046] respectively comparing the first characteristic value and the second characteristic value with characteristic thresholds;

[0047] If both the first characteristic value and the second characteristic value are greater than the characteristic threshold, there is no black edge defect;

[0048] If the first characteristic value and / or the second characteristic value is smaller than the characteristic threshold, a black edge defect exists.

[0049] In a second aspect, an embodiment of the present application provides a magnetic core detection system based on computer vision, which is applied to the magnetic core detection method based on computer vision in the above technical solution, and the system includes:

[0050] An acquisition module is used to acquire a captured image of a magnetic core group in a fixture, wherein the magnetic core group includes a plurality of magnetic cores in a uniform array, and pre-process the captured image to acquire an initial image to be inspected corresponding to the magnetic core;

[0051] A preprocessing module, used for adjusting the position of the initial image to be inspected to obtain an adjusted image, and performing tilt correction on the adjusted image to obtain a final image to be inspected;

[0052] A first detection module is used to determine four corner points of the magnetic core in the final image to be inspected, obtain corner point feature vectors of the corner points, and input the corner point feature vectors into a pre-trained neural network model to determine whether there is a missing corner defect;

[0053] The second detection module is used to extract the contour of the final image to be inspected to obtain the image contour, and compare the image contour with the standard contour to determine whether there is a broken edge defect;

[0054] A third detection module is used to define a first detection area at the edge of the final image to be detected, determine a first eigenvalue and a second eigenvalue from the first detection area, and determine whether there is a black edge defect based on the first eigenvalue and the second eigenvalue;

[0055] A fourth detection module is used to define a second detection area in the final image to be detected, and perform dirt determination and boundary blur determination in the second detection area to determine whether there is a dirt defect and a blur defect;

[0056] An execution module is used to determine the surface quality of the magnetic core based on the judgment results of the missing corner defect, the broken edge defect, the black edge defect, the dirt defect and the fuzzy defect.

[0057] In a third aspect, an embodiment of the present application provides a computer, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the computer vision-based magnetic core detection method as described in the first aspect above is implemented.

[0058] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the magnetic core detection method based on computer vision as described in the first aspect above.

[0059] Compared with the prior art, the beneficial effects of the present invention are as follows: in the production line, the magnetic cores are all placed in a jig for batch production, and by acquiring the captured images, pictures corresponding to the magnetic core group can be acquired in batches, and by performing the position adjustment and the tilt correction, a single magnetic core can be separated from the magnetic core group and corrected to the correct position, so as to facilitate the subsequent accurate and rapid detection of the surface quality of the magnetic core; silver-plated areas need to be formed at both ends of the magnetic core, and an insulating area is formed in the middle, the missing corner defect is whether the corner of the magnetic core is damaged, the broken edge defect is whether the edge of the magnetic core is damaged, the black edge defect is whether there is leakage magnetism in the silver-plated area of ​​the magnetic core, the dirty defect is whether there is a stain in the insulating area of ​​the magnetic core, and the fuzzy defect is whether there is ambiguity at the junction of the silver-plated area and the insulating area of ​​the magnetic core. For the above defects, a detection method based on computer vision is designed accordingly, thereby completing the automatic and intelligent detection of the surface quality of the magnetic core, thereby replacing the manual detection method, effectively improving the detection efficiency, and reducing the error rate of detection.

[0060] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 It is a flowchart of the magnetic core detection method based on computer vision in the first embodiment of the present invention;

[0062] Figure 2 It is a structural block diagram of a magnetic core detection system based on computer vision in the second embodiment of the present invention;

[0063] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0065] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.

[0066] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0067] It should be noted that in the production line, the magnetic cores are placed in a jig for batch production. Furthermore, the magnetic cores are arranged in a uniform array on the jig for spraying and silver plating, that is, silver-plated areas need to be formed at both ends of the magnetic core, and an insulating area is formed in the middle. During its arrangement, it is not in an absolutely facing state. In the production process of the magnetic core, affected by the operation of the production line, surface quality problems are prone to occur, including missing corner defects, broken edge defects, black edge defects, dirty defects and blurred defects. The missing corner defect refers to whether the corner of the magnetic core is damaged, the broken edge defect refers to whether the edge of the magnetic core is damaged, the black edge defect refers to whether there is leakage magnetism in the sprayed silver plating layer of the magnetic core, the dirty defect refers to whether there are stains in the insulating area of ​​the magnetic core, and the blurred defect refers to whether the boundary between the silver-plated area and the insulating area of ​​the magnetic core is unclear.

[0068] See also Figure 1 The first embodiment of the present invention provides a magnetic core detection method based on computer vision, comprising the following steps:

[0069] Step S10: obtaining a captured image of a magnetic core group in a fixture, wherein the magnetic core group includes a plurality of magnetic cores in a uniform array, and preprocessing the captured image to obtain an initial image to be inspected corresponding to the magnetic core;

[0070] In this embodiment, the captured image is obtained by an industrial camera. Specifically, step S10 includes:

[0071] S110: performing binarization processing on the captured image to obtain a binary image;

[0072] The binarization process has been widely used in the field of image processing and will not be described in detail here.

[0073] S120: Obtain a first X-axis projection curve and a first Y-axis projection curve of the binary image, and set an X-axis start projection calibration value, an X-axis end projection calibration value, a Y-axis start projection calibration value, and a Y-axis end projection calibration value;

[0074] Specifically, each row of pixels and each column of pixels of the binary image are projected onto the X-axis and the Y-axis respectively to obtain an X-axis projection vector and a Y-axis projection vector, and then to obtain the first X-axis projection curve and the first Y-axis projection curve.

[0075] The formula for obtaining the X-axis projection vector is:

[0076] ,

[0077] in, represents the sum of the pixels in the jth column of a binary image, where j = 1, 2, ..., n, represents the pixel in the i-th row and j-th column of the binary image, represents the number of pixels in the jth column of the binary image, Represents the maximum value of the sum of pixels in different columns in a binary image. Represents the X-axis projection vector.

[0078] The formula for obtaining the Y-axis projection vector is the same as the formula for obtaining the X-axis projection vector, and will not be repeated here. It should be noted that the values ​​of the X-axis starting projection calibration value, the X-axis ending projection calibration value, the Y-axis starting projection calibration value, and the Y-axis ending projection calibration value can be set according to empirical values. In this embodiment, the values ​​of the X-axis starting projection calibration value, the X-axis ending projection calibration value, the Y-axis starting projection calibration value, and the Y-axis ending projection calibration value are all 0.2.

[0079] S130: determining an X-axis starting point and an X-axis ending point in the first X-axis projection curve by using the X-axis starting projection calibration value and the X-axis ending projection calibration value, and determining a Y-axis starting point and a Y-axis ending point in the first Y-axis projection curve by using the Y-axis starting projection calibration value and the Y-axis ending projection calibration value;

[0080] Specifically, taking the X-axis starting projection calibration value as the starting point, searching in the direction opposite to the X-axis ending projection calibration value, when the zero point or the first lowest point is obtained, it is set as the X-axis starting point. It should be noted that the first lowest point is the curve change point, and from the X-axis starting projection calibration value to the first lowest point, the X-axis projection vector gradually decreases, and from the first lowest point to the direction opposite to the X-axis starting projection calibration value, the X-axis projection vector gradually increases. Taking the X-axis ending projection calibration value as the starting point, searching in the direction opposite to the X-axis starting projection calibration value, when the zero point or the second lowest point is obtained, it is set as the X-axis ending point. The determination method of the Y-axis starting point and the Y-axis ending point is the same, which will not be repeated here.

[0081] S140: Delimiting a frame selection range in the captured image by using the X-axis starting point, the X-axis ending point, the Y-axis starting point, and the Y-axis ending point to extract a frame selection image;

[0082] The acquisition of the frame-selected image is completed by connecting the X-axis starting point, the X-axis ending point, the Y-axis starting point and the Y-axis ending point. By acquiring the captured images, pictures corresponding to the magnetic core group can be acquired in batches.

[0083] S150: performing segmentation processing on the frame-selected image to obtain an initial image to be inspected, where the initial image to be inspected corresponds to the magnetic core;

[0084] The purpose of performing the separation process on the framed image is to select the individual magnetic cores from the magnetic core group and then perform surface quality inspection on each of the magnetic cores.

[0085] Since the sizes of the magnetic cores and the jig are fixed, and the magnetic cores are arranged on the jig according to a certain arrangement rule, therefore, the width reference value and height reference value of the magnetic core group are obtained, and the actual width and actual height of the framed image are obtained, and the width scaling ratio is obtained through the actual width and the width reference value, and the height scaling ratio is obtained through the actual height and the height reference value; the standard width and standard height of the magnetic core are obtained, and the lateral spacing and longitudinal spacing between adjacent magnetic cores are obtained, and the standard width, standard height, lateral spacing and longitudinal spacing are corrected based on the width scaling ratio and the height scaling ratio to determine a number of lateral dividing lines and a number of longitudinal dividing lines; the framed image is separated based on the number of lateral dividing lines and the number of longitudinal dividing lines to obtain the initial image to be inspected. Through the arrangement rule and size of the magnetic cores, according to the proportional relationship between the jig and the framed image, the magnetic cores can be quickly separated, that is, the initial image to be inspected is obtained.

[0086] S20: adjusting the position of the initial image to be inspected to obtain an adjusted image, and performing tilt correction on the adjusted image to obtain a final image to be inspected;

[0087] Because the magnetic cores are not all arranged in strict alignment during the array arrangement process, by performing the position adjustment and the tilt correction, individual magnetic cores can be separated from the magnetic core group and corrected to the correct alignment, so as to facilitate subsequent accurate and rapid detection of the surface quality of the magnetic cores.

[0088] The step S20 comprises:

[0089] S210: Expand the width of the initial image to be inspected to obtain a first image;

[0090] The width expansion is to expand the left edge and the right edge of the initial image to be inspected by the same width.

[0091] S220: Acquire a second X-axis projection curve of the first image, and acquire a left boundary value and a right boundary value of the second X-axis projection curve, and perform width contraction on the first image based on the left boundary value and the right boundary value to acquire a second image;

[0092] The method for obtaining the second X-axis projection curve is consistent with step S10, and will not be described again here. At this time, the width of the first image is greater than the standard width of the magnetic core, and the left boundary value is compared with the right boundary value. If the left boundary value is greater than the right boundary value, the width of the left side of the first image is shrunk, and if the left boundary value is less than the right boundary value, the width of the right side of the first image is shrunk, and if the left boundary value is equal to the right boundary value, the width of the left and right sides of the first image are shrunk at the same time to obtain the second image, in which the magnetic core is placed in the middle in the horizontal direction.

[0093] S230: Performing height expansion on the second image to obtain a third image;

[0094] S240: Obtaining a second Y-axis projection curve of the third image, and obtaining an upper boundary value and a lower boundary value of the second Y-axis projection curve, and performing height contraction on the third image based on the upper boundary value and the lower boundary value to obtain an adjusted image;

[0095] This adjustment method is consistent with steps S220 to S230 and will not be described again here.

[0096] S250: Acquire a first groove boundary line and a second groove boundary line corresponding to the magnetic core in the adjustment image, and set a first vertical reference line and a second vertical reference line in the adjustment image;

[0097] The first groove boundary line is the boundary line between the silver-plated area at the upper end of the magnetic core and the insulating area, and the second groove boundary line is the boundary line between the silver-plated area at the lower end of the magnetic core and the insulating area. The first vertical reference line and the second vertical reference line are vertical lines along the vertical direction in the adjustment image.

[0098] S260: determining a first intersection point, a second intersection point, a third intersection point, and a fourth intersection point through the first groove boundary line, the second groove boundary line, the first vertical reference line, and the second vertical reference line;

[0099] It can be understood that there are a first intersection and a second intersection set from left to right between the first groove boundary line and the first vertical reference line and the second vertical reference line, and there are a third intersection and a fourth intersection set from left to right between the second groove boundary line and the first vertical reference line and the second vertical reference line, and the third intersection and the fourth intersection are located below the first intersection and the second intersection.

[0100] S270: Determine a first adjustment angle according to the coordinate values ​​of the first intersection point and the second intersection point, and determine a second adjustment angle according to the coordinate values ​​of the third intersection point and the fourth intersection point;

[0101] The formula for obtaining the first adjustment angle is:

[0102] ,

[0103] in, represents the first adjustment angle, represents the abscissa of the first intersection point, represents the ordinate of the first intersection point, represents the abscissa of the second intersection point, The method for obtaining the second adjustment angle is the same and will not be described in detail here.

[0104] S280: determining a tilt angle based on the first adjustment angle and the second adjustment angle, and correcting the adjusted image by the tilt angle to obtain a final image to be inspected;

[0105] The calculation formula of the inclination angle is:

[0106] ,

[0107] in, represents the tilt angle, By obtaining the average of the two adjustment angles, the accuracy of the tilt angle can be improved, thereby improving the accuracy of adjusting the image to the correct position.

[0108] Furthermore, the adjustment image has two tilt directions, and the adjustment direction of the adjustment image is determined by the ordinate of the first intersection and the ordinate of the second corner point. Specifically, the ordinate of the first intersection is compared with the ordinate of the second intersection, and if the ordinate of the first intersection is greater than the ordinate of the second intersection, the adjustment image is adjusted to the left, and if the ordinate of the first intersection is less than the ordinate of the second intersection, the adjustment image is adjusted to the right.

[0109] In some embodiments, the final image to be inspected may also be subjected to denoising processing, so that subsequent processing of the final image to be inspected is more accurate.

[0110] Step S30: determining four corner points of the magnetic core in the final image to be inspected, obtaining corner point feature vectors of the corner points, and inputting the corner point feature vectors into a pre-trained neural network model to determine whether there is a missing corner defect;

[0111] It can be understood that when the magnetic core in the final image to be inspected is in the correct position, the corner point position is a fixed position. In this embodiment, the step of obtaining the corner point feature vector is:

[0112] A feature range is selected with the corner point as the center, and all pixels within the feature range are extracted to obtain a pixel mean, which is the corner point feature vector.

[0113] The neural network model is a classifier. When the neural network model is pre-trained, the mean of the training pixels is used as the input value of the neural network model, and the judgment result of the missing corner defect is used as the output value of the neural network model to complete the pre-training. The corner point feature vector is input into the pre-trained neural network model to determine whether the corner point has the missing corner defect.

[0114] Step S40: extracting the contour of the final image to be inspected to obtain the image contour, and comparing the image contour with the standard contour to determine whether there is a broken edge defect;

[0115] The contour extraction algorithm has been widely used and will not be described here. In this embodiment, the contour extraction is performed by the boundary tracking method to extract the contour of the magnetic core with better surface quality, so as to obtain the standard contour. The standard contour is used to determine whether there are breakpoints in the image contour, so as to complete the judgment of the broken edge defect. Preferably, the feature range can be eliminated in the image contour. In the step S30, the area where the corner point is used has been judged. Therefore, by eliminating the feature range, the processing amount can be reduced and the judgment efficiency of the broken edge defect can be improved.

[0116] Step S50: defining a first detection area at the edge of the final image to be detected, determining a first eigenvalue and a second eigenvalue in the first detection area, and judging whether there is a black edge defect based on the first eigenvalue and the second eigenvalue;

[0117] The first detection area is the silver-plated area at the upper end and the silver-plated area at the lower end of the magnetic core, the first characteristic value is the height of the silver-plated area at the upper end, and the second characteristic value is the height of the silver-plated area at the lower end. It can be understood that both the silver-plated area at the upper end and the silver-plated area at the lower end have characteristic thresholds, and the characteristic threshold is the height of the magnetic core with better surface quality.

[0118] Specifically, the step S50 includes:

[0119] S510: Obtain a third Y-axis projection curve of the first detection area, and obtain a starting point and an end point of the third Y-axis projection curve;

[0120] The method for obtaining the third Y-axis projection curve is the same as the method for obtaining the first Y-axis projection curve, which will not be described in detail here.

[0121] S520: Searching in a first preset search range from the starting point to the end point to determine a first calibration point within the first preset search range, and searching in a second preset search range from the first calibration point to the end point to determine a second calibration point within the second preset search range;

[0122] In this embodiment, the first preset search range is half of the feature threshold. Within the first preset search range, the maximum value is determined as the first calibration point. The second preset search range is consistent with the first preset search range in size. Within the second preset search range, the minimum value is determined as the second calibration point. It should be noted that within the second preset search range, if the first calibration point is the minimum value, the first calibration point is determined as the second calibration point.

[0123] S530: searching in a third preset search range from the end point to the start point to determine a third calibration point within the third preset search range, and searching in a fourth preset search range from the third calibration point to the start point to determine a fourth calibration point within the fourth preset search range;

[0124] The acquisition method of the fourth calibration point is consistent with that of the second calibration point. The third preset search range and the fourth preset search range are the same as the first preset search range, and are not described in detail here.

[0125] S540: Determine a first characteristic value based on the starting point and the second calibration point, and determine a second characteristic value based on the end point and the fourth calibration point;

[0126] The calculation formula of the first eigenvalue is:

[0127] ,

[0128] in, represents the first eigenvalue, represents the second calibration point, Indicates the starting point;

[0129] The calculation formula of the second eigenvalue is:

[0130] ,

[0131] in, represents the second eigenvalue, represents the fourth calibration point, Indicates the end point.

[0132] S550: Compare the first characteristic value and the second characteristic value with characteristic thresholds respectively;

[0133] S560: If both the first characteristic value and the second characteristic value are greater than the characteristic threshold, there is no black edge defect;

[0134] S570: If the first characteristic value and / or the second characteristic value is smaller than the characteristic threshold, a black edge defect exists.

[0135] Step S60: defining a second inspection area in the final image to be inspected, and performing a dirtiness judgment and a boundary blur judgment in the second inspection area to determine whether there is a dirtiness defect and a blurry defect;

[0136] The second detection area corresponds to the insulating area of ​​the magnetic core, and the second detection area covers the boundary line between the silver-plated area and the insulating area. That is, in this embodiment, the second detection area includes a dirty detection area adapted to the insulating area and a fuzzy detection area adapted to the boundary line.

[0137] Specifically, the step S60 includes:

[0138] S610: Divide the dirt detection area into a plurality of sub-areas, obtain the total pixel value of the sub-area to form a sub-area feature, compare the sub-area feature with a standard feature, and if the difference between the sub-area feature and the standard feature is greater than a feature threshold, determine that there is a dirt defect in the dirt detection area;

[0139] By dividing the area into several sub-areas, the location of the contamination defect can be determined while the contamination defect is determined, thereby providing more accurate surface quality detection data.

[0140] S620: extracting the image to be checked in the blur detection area, obtaining the upper boundary line and the lower boundary line of the image to be checked, delineating a first horizontal standard line and a second horizontal standard line in the image to be checked, obtaining a fifth intersection point, a sixth intersection point, a seventh intersection point and an eighth intersection point based on the upper boundary line, the lower boundary line, the first horizontal standard line and the second horizontal standard line, and judging whether there is a blur defect based on the fifth intersection point, the sixth intersection point, the seventh intersection point and the eighth intersection point;

[0141] It can be understood that the fifth intersection and the sixth intersection are formed from left to right between the upper boundary line and the first horizontal standard line, and the seventh intersection and the eighth intersection are formed from left to right between the lower boundary line and the second horizontal standard line. The first angle between the upper boundary line and the first standard line is obtained by the coordinate values ​​of the fifth intersection and the sixth intersection, and the second angle between the lower boundary line and the second standard line is obtained by the coordinate values ​​of the seventh intersection and the eighth intersection. The first angle and the second angle are respectively compared with the angle threshold. If the first angle and the second angle are both less than the angle threshold, it is judged that the blur defect does not exist. If the first angle and / or the second angle are greater than the angle threshold, it is judged that the blur defect exists. It should be noted that if the fifth intersection, the sixth intersection, the seventh intersection and the eighth intersection cannot be obtained, it is judged that the blur defect does not exist.

[0142] Step S70: judging the surface quality of the magnetic core based on the judgment results of the missing corner defect, the broken edge defect, the black edge defect, the dirt defect and the fuzzy defect.

[0143] That is, when the judgment results of the missing corner defect, the broken edge defect, the black edge defect, the dirt defect and the blurred defect are all non-existent, the surface quality of the magnetic core is judged to be qualified; if any of the missing corner defect, the broken edge defect, the black edge defect, the dirt defect and the blurred defect is judged to be present, the surface quality of the magnetic core is judged to be unqualified.

[0144] In response to the problem of surface quality of the magnetic core, the present application constructs a corresponding detection method based on computer vision to complete automated and intelligent detection of the surface quality of the magnetic core, thereby replacing manual detection methods, effectively improving the detection efficiency, and reducing the detection error rate.

[0145] See also Figure 2The second embodiment of the present invention provides a magnetic core detection system based on computer vision, which is applied to the magnetic core detection method based on computer vision in the above embodiment, and will not be repeated here. As used below, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0146] The system comprises:

[0147] An acquisition module 10 is used to acquire a captured image of a magnetic core group in a fixture, wherein the magnetic core group includes a plurality of magnetic cores in a uniform array, and pre-process the captured image to acquire an initial image to be inspected corresponding to the magnetic core;

[0148] The acquisition module 10 includes:

[0149] The first unit is used to perform binarization processing on the captured image to obtain a binary image;

[0150] Obtaining a first X-axis projection curve and a first Y-axis projection curve of the binary image, and setting an X-axis start projection calibration value, an X-axis end projection calibration value, a Y-axis start projection calibration value, and a Y-axis end projection calibration value;

[0151] A second unit is used to determine an X-axis starting point and an X-axis ending point in the first X-axis projection curve by using the X-axis starting projection calibration value and the X-axis ending projection calibration value, and to determine a Y-axis starting point and a Y-axis ending point in the first Y-axis projection curve by using the Y-axis starting projection calibration value and the Y-axis ending projection calibration value;

[0152] A third unit is used to define a frame selection range in the captured image by using the X-axis starting point, the X-axis ending point, the Y-axis starting point and the Y-axis ending point to extract a frame selection image;

[0153] The fourth unit is used to perform segmentation processing on the frame-selected image to obtain an initial image to be inspected, where the initial image to be inspected corresponds to the magnetic core.

[0154] The fourth unit is specifically used to obtain the width reference value and the height reference value of the magnetic core group, and obtain the actual width and the actual height of the framed image, obtain the width scaling ratio through the actual width and the width reference value, and obtain the height scaling ratio through the actual height and the height reference value; obtain the standard width and the standard height of the magnetic core, and obtain the lateral spacing and the longitudinal spacing between adjacent magnetic cores, and correct the standard width, the standard height, the lateral spacing and the longitudinal spacing based on the width scaling ratio and the height scaling ratio to determine a number of lateral dividing lines and a number of longitudinal dividing lines; separate the framed image based on the number of lateral dividing lines and the number of longitudinal dividing lines to obtain an initial image to be inspected.

[0155] A preprocessing module 20 is used to adjust the position of the initial image to be inspected to obtain an adjusted image, and to perform tilt correction on the adjusted image to obtain a final image to be inspected;

[0156] The pre-processing module 20 comprises:

[0157] A fifth unit is used to perform width expansion on the initial image to be inspected to obtain a first image;

[0158] a sixth unit, configured to obtain a second X-axis projection curve of the first image, obtain a left boundary value and a right boundary value of the second X-axis projection curve, and perform width contraction on the first image based on the left boundary value and the right boundary value to obtain a second image;

[0159] A seventh unit, configured to perform height expansion on the second image to obtain a third image;

[0160] an eighth unit, configured to obtain a second Y-axis projection curve of the third image, and obtain an upper boundary value and a lower boundary value of the second Y-axis projection curve, and perform height contraction on the third image based on the upper boundary value and the lower boundary value to obtain an adjusted image;

[0161] A ninth unit, configured to obtain a first groove boundary line and a second groove boundary line corresponding to the magnetic core in the adjustment image, and to set a first vertical reference line and a second vertical reference line in the adjustment image;

[0162] A tenth unit, configured to determine a first intersection point, a second intersection point, a third intersection point, and a fourth intersection point through the first groove boundary line, the second groove boundary line, the first vertical reference line, and the second vertical reference line;

[0163] An eleventh unit is used to determine a first adjustment angle according to the coordinate values ​​of the first intersection point and the second intersection point, and to determine a second adjustment angle according to the coordinate values ​​of the third intersection point and the fourth intersection point;

[0164] A twelfth unit is used to determine a tilt angle based on the first adjustment angle and the second adjustment angle, and correct the adjusted image by the tilt angle to obtain a final image to be inspected;

[0165] The first detection module 30 is used to determine the four corner points of the magnetic core in the final image to be inspected, obtain the corner point feature vectors of the corner points, and input the corner point feature vectors into a pre-trained neural network model to determine whether there is a missing corner defect;

[0166] The second detection module 40 is used to extract the contour of the final image to be inspected to obtain the image contour, and compare the image contour with the standard contour to determine whether there is a broken edge defect;

[0167] A third detection module 50 is used to define a first detection area at the edge of the final image to be detected, determine a first eigenvalue and a second eigenvalue from the first detection area, and determine whether there is a black edge defect based on the first eigenvalue and the second eigenvalue;

[0168] The third detection module 50 includes:

[0169] A thirteenth unit is used to obtain a third Y-axis projection curve of the first detection area, and obtain a starting point and an end point of the third Y-axis projection curve;

[0170] A fourteenth unit is used to search in a first preset search range from the starting point to the end point to determine a first calibration point within the first preset search range, and to search in a second preset search range from the first calibration point to the end point to determine a second calibration point within the second preset search range;

[0171] A fifteenth unit is used to search in a third preset search range from the end point to the starting point to determine a third calibration point within the third preset search range, and to search in a fourth preset search range from the third calibration point to the starting point to determine a fourth calibration point within the fourth preset search range;

[0172] A sixteenth unit, configured to determine a first characteristic value based on the starting point and the second calibration point, and to determine a second characteristic value based on the end point and the fourth calibration point;

[0173] A seventeenth unit is used to compare the first characteristic value and the second characteristic value with a characteristic threshold value respectively;

[0174] An eighteenth unit, configured to determine that there is no black edge defect if both the first characteristic value and the second characteristic value are greater than the characteristic threshold;

[0175] A nineteenth unit, configured to determine that a black edge defect exists if the first characteristic value and / or the second characteristic value is less than the characteristic threshold;

[0176] A fourth inspection module 60 is used to define a second inspection area in the final image to be inspected, and perform dirt determination and boundary blur determination in the second inspection area to determine whether there is a dirt defect and a blur defect;

[0177] The fourth detection module 60 includes:

[0178] A twentieth unit is used to divide the dirt detection area into a plurality of sub-areas, obtain the total pixel value of the sub-area to form a sub-area feature, compare the sub-area feature with a standard feature, and if the difference between the sub-area feature and the standard feature is greater than a feature threshold, it is determined that there is a dirt defect in the dirt detection area;

[0179] A twenty-first unit is used to extract the image to be checked in the blur detection area, obtain the upper boundary line and the lower boundary line of the image to be checked, draw a first horizontal standard line and a second horizontal standard line in the image to be checked, obtain a fifth intersection point, a sixth intersection point, a seventh intersection point and an eighth intersection point based on the upper boundary line, the lower boundary line, the first horizontal standard line and the second horizontal standard line, and determine whether there is a blur defect based on the fifth intersection point, the sixth intersection point, the seventh intersection point and the eighth intersection point;

[0180] The execution module 70 is used to determine the surface quality of the magnetic core based on the determination results of the missing corner defect, the broken edge defect, the black edge defect, the dirt defect and the fuzzy defect.

[0181] The present invention also provides a computer, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the magnetic core detection method based on computer vision as described in the above technical solution is implemented.

[0182] The present invention also provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer vision-based magnetic core detection method as described in the above technical solution is implemented.

[0183] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0184] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A magnetic core detection method based on computer vision, characterized in that: The following steps are involved: Acquire a captured image of a magnetic core group in a fixture, wherein the magnetic core group includes a plurality of magnetic cores in a uniform array, and pre-process the captured image to acquire an initial image to be inspected corresponding to the magnetic core; Performing position adjustment on the initial image to be inspected to obtain an adjusted image, and performing tilt correction on the adjusted image to obtain a final image to be inspected; The step of adjusting the position of the initial image to be inspected to obtain an adjusted image comprises: Expanding the width of the initial image to be inspected to obtain a first image; Acquire a second X-axis projection curve of the first image, and acquire a left boundary value and a right boundary value of the second X-axis projection curve, and perform width contraction on the first image based on the left boundary value and the right boundary value to acquire a second image; Performing height expansion on the second image to obtain a third image; Acquire a second Y-axis projection curve of the third image, and acquire an upper boundary value and a lower boundary value of the second Y-axis projection curve, and perform height contraction on the third image based on the upper boundary value and the lower boundary value to acquire an adjusted image; The step of performing tilt correction on the adjusted image to obtain a final image to be inspected comprises: Acquire a first groove boundary line and a second groove boundary line corresponding to the magnetic core in the adjustment image, and set a first vertical reference line and a second vertical reference line in the adjustment image; Determine a first intersection point, a second intersection point, a third intersection point, and a fourth intersection point through the first groove boundary line, the second groove boundary line, the first vertical reference line, and the second vertical reference line; Determine a first adjustment angle by using the coordinate values ​​of the first intersection point and the second intersection point, and determine a second adjustment angle by using the coordinate values ​​of the third intersection point and the fourth intersection point; Determine a tilt angle based on the first adjustment angle and the second adjustment angle, and correct the adjusted image by the tilt angle to obtain a final image to be inspected; Determine four corner points of the magnetic core in the final image to be inspected, obtain corner point feature vectors of the corner points, and input the corner point feature vectors into a pre-trained neural network model to determine whether there is a missing corner defect; Performing contour extraction on the final image to be inspected to obtain an image contour, and comparing the image contour with a standard contour to determine whether there is an edge break defect; Delimiting a first detection area at the edge of the final image to be inspected, determining a first eigenvalue and a second eigenvalue from the first detection area, and judging whether there is a black edge defect based on the first eigenvalue and the second eigenvalue; Delimiting a second inspection area in the final image to be inspected, and performing a dirtiness judgment and a boundary blur judgment in the second inspection area to determine whether there is a dirtiness defect and a blurry defect; The surface quality of the magnetic core is determined based on the judgment results of the missing corner defect, the broken edge defect, the black edge defect, the dirt defect and the fuzzy defect.

2. The magnetic core detection method based on computer vision according to claim 1, characterized in that: The step of preprocessing the captured image to obtain an initial image to be inspected corresponding to the magnetic core comprises: Binarizing the captured image to obtain a binary image; Obtaining a first X-axis projection curve and a first Y-axis projection curve of the binary image, and setting an X-axis start projection calibration value, an X-axis end projection calibration value, a Y-axis start projection calibration value, and a Y-axis end projection calibration value; Determine an X-axis starting point and an X-axis ending point in the first X-axis projection curve by using the X-axis starting projection calibration value and the X-axis ending projection calibration value, and determine a Y-axis starting point and a Y-axis ending point in the first Y-axis projection curve by using the Y-axis starting projection calibration value and the Y-axis ending projection calibration value; Delimiting a frame selection range in the captured image by using the X-axis starting point, the X-axis ending point, the Y-axis starting point, and the Y-axis ending point to extract a frame selection image; The frame-selected image is segmented to obtain an initial image to be inspected, where the initial image to be inspected corresponds to the magnetic core.

3. The magnetic core detection method based on computer vision according to claim 2, characterized in that: The step of performing separation processing on the frame-selected image to obtain an initial image to be inspected comprises: Obtaining a width reference value and a height reference value of the magnetic core group, and obtaining an actual width and an actual height of the framed image, obtaining a width scaling ratio according to the actual width and the width reference value, and obtaining a height scaling ratio according to the actual height and the height reference value; Obtaining a standard width and a standard height of the magnetic core, and obtaining a transverse spacing and a longitudinal spacing between adjacent magnetic cores, and modifying the standard width, the standard height, the transverse spacing, and the longitudinal spacing based on the width scaling ratio and the height scaling ratio to determine a plurality of transverse dividing lines and a plurality of longitudinal dividing lines; The framed image is divided based on the plurality of horizontal dividing lines and the plurality of vertical dividing lines to obtain an initial image to be inspected.

4. The magnetic core detection method based on computer vision according to claim 1, characterized in that: The step of determining the first characteristic value and the second characteristic value from the first detection area comprises: Obtaining a third Y-axis projection curve of the first detection area, and obtaining a starting point and an end point of the third Y-axis projection curve; Searching in a first preset search range from the starting point to the end point to determine a first calibration point within the first preset search range, and searching in a second preset search range from the first calibration point to the end point to determine a second calibration point within the second preset search range; Searching in a third preset search range from the end point to the starting point to determine a third marking point within the third preset search range, and searching in a fourth preset search range from the third marking point to the starting point to determine a fourth marking point within the fourth preset search range; A first characteristic value is determined based on the starting point and the second calibration point, and a second characteristic value is determined based on the end point and the fourth calibration point.

5. The magnetic core detection method based on computer vision according to claim 4, characterized in that: The calculation formula of the first eigenvalue is: , in, represents the first eigenvalue, represents the second calibration point, Indicates the starting point; The calculation formula of the second eigenvalue is: , in, represents the second eigenvalue, represents the fourth calibration point, Indicates the end point.

6. The magnetic core detection method based on computer vision according to claim 4, characterized in that: The step of judging whether there is a black edge defect based on the first characteristic value and the second characteristic value comprises: respectively comparing the first characteristic value and the second characteristic value with characteristic thresholds; If both the first characteristic value and the second characteristic value are greater than the characteristic threshold, there is no black edge defect; If the first characteristic value and / or the second characteristic value is smaller than the characteristic threshold, a black edge defect exists.

7. A magnetic core detection system based on computer vision, applied to the magnetic core detection method based on computer vision as claimed in any one of claims 1 to 6, characterized in that: The system comprises: An acquisition module is used to acquire a captured image of a magnetic core group in a fixture, wherein the magnetic core group includes a plurality of magnetic cores in a uniform array, and pre-process the captured image to acquire an initial image to be inspected corresponding to the magnetic core; A preprocessing module, used for adjusting the position of the initial image to be inspected to obtain an adjusted image, and performing tilt correction on the adjusted image to obtain a final image to be inspected; The preprocessing module comprises: A fifth unit is used to perform width expansion on the initial image to be inspected to obtain a first image; a sixth unit, configured to obtain a second X-axis projection curve of the first image, obtain a left boundary value and a right boundary value of the second X-axis projection curve, and perform width contraction on the first image based on the left boundary value and the right boundary value to obtain a second image; A seventh unit, configured to perform height expansion on the second image to obtain a third image; an eighth unit, configured to obtain a second Y-axis projection curve of the third image, and obtain an upper boundary value and a lower boundary value of the second Y-axis projection curve, and perform height contraction on the third image based on the upper boundary value and the lower boundary value to obtain an adjusted image; A ninth unit, configured to obtain a first groove boundary line and a second groove boundary line corresponding to the magnetic core in the adjustment image, and to set a first vertical reference line and a second vertical reference line in the adjustment image; A tenth unit, configured to determine a first intersection point, a second intersection point, a third intersection point, and a fourth intersection point through the first groove boundary line, the second groove boundary line, the first vertical reference line, and the second vertical reference line; An eleventh unit is used to determine a first adjustment angle according to the coordinate values ​​of the first intersection point and the second intersection point, and to determine a second adjustment angle according to the coordinate values ​​of the third intersection point and the fourth intersection point; A twelfth unit is used to determine a tilt angle based on the first adjustment angle and the second adjustment angle, and correct the adjusted image by the tilt angle to obtain a final image to be inspected; A first detection module is used to determine four corner points of the magnetic core in the final image to be inspected, obtain corner point feature vectors of the corner points, and input the corner point feature vectors into a pre-trained neural network model to determine whether there is a missing corner defect; The second detection module is used to extract the contour of the final image to be inspected to obtain the image contour, and compare the image contour with the standard contour to determine whether there is a broken edge defect; A third detection module is used to define a first detection area at the edge of the final image to be detected, determine a first eigenvalue and a second eigenvalue from the first detection area, and determine whether there is a black edge defect based on the first eigenvalue and the second eigenvalue; A fourth detection module is used to define a second detection area in the final image to be detected, and perform dirt determination and boundary blur determination in the second detection area to determine whether there is a dirt defect and a blur defect; An execution module is used to determine the surface quality of the magnetic core based on the judgment results of the missing corner defect, the broken edge defect, the black edge defect, the dirt defect and the fuzzy defect.

8. A computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the magnetic core detection method based on computer vision according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • File image correction method and mobile terminal

    CN107944438A

  • Image processing-based magnetic core defect detection system and method

    CN110470670A

  • Document detection method and device, electronic equipment and storage medium

    CN115063822A

  • Round magnetic core side defect detection device and method thereof

    CN115615998A

  • Defect detection method and device based on machine vision and storage medium

    CN116958019A