Coil winding detection method and device, electronic equipment and storage medium
By simplifying the coil winding detection method and using the distance between the wire vertex and the reference straight line to determine the coil winding qualification, the problem of large computational load and long time consumption of existing algorithms is solved, and efficient coil winding detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU MEGAROBO TECH CO LTD
- Filing Date
- 2022-12-07
- Publication Date
- 2026-04-17
AI Technical Summary
Existing coil winding detection algorithms are computationally intensive, resource-intensive, and time-consuming, making it difficult to complete real-time detection and output results in a short time, and thus unable to meet the detection requirements of high-throughput scenarios.
By acquiring the image to be tested, the positions of multiple conductor segments of the coil are determined, conductor segments that do not conform to the reference length are filtered out, and the distance between the conductor vertex and the reference straight line is used to determine whether the coil winding is qualified, thus simplifying the calculation process.
It improves detection efficiency, saves computing resources, is suitable for high-throughput detection scenarios, and can quickly determine whether the coil winding is qualified.
Smart Images

Figure CN115775245B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of semiconductor processing technology, and more specifically to a method for detecting coil windings, a device for detecting coil windings, an electronic device, and a storage medium. Background Technology
[0002] Typically, after electronic devices (hereinafter referred to as "devices") are manufactured, they need to undergo defect detection before leaving the factory to eliminate devices with quality defects. Defect detection of devices generally requires the use of specialized testing equipment. With the continuous development of technology, the structural complexity of various devices and the production capacity of devices are also constantly increasing, which correspondingly places higher demands on device testing equipment.
[0003] Machine vision is a rapidly developing sunrise industry, and visual inspection equipment has been widely used in various fields and production processes of manufacturing. Visual inspection equipment uses cameras to capture images of components and then uses visual inspection algorithms to analyze and process these images to determine the quality of the components.
[0004] Inductors are typically prone to various defects after manufacturing, with wire overlap being a common one. To inspect the quality of inductors, vision inspection equipment usually needs to be equipped with image processing algorithms capable of detecting wire overlap to identify this type of defect.
[0005] In many current production testing scenarios, there are high requirements for the speed (throughput) of device inspection, and the sorting and unloading of good and defective products must be carried out immediately after inspection. This requires algorithms to complete the detection of device assembly gaps in an image within a very short time, so as to determine whether the devices are good or defective before unloading, and thus place the devices in the correct bins during unloading. Although existing image processing algorithms are capable of detecting wire overlap, these existing algorithms often require edge detection, connected component (Blob) analysis, or the identification of specific objects such as wires. Both edge detection and object recognition algorithms have problems such as large computational load, high resource consumption, long time consumption, or complex parameter adjustment, which are not suitable for scenarios that require real-time detection and quick completion of calculations and output of results. Summary of the Invention
[0006] The present invention was proposed in view of the above-mentioned problems. The present invention provides a method for detecting coil winding, a device for detecting coil winding, an electronic device, and a storage medium.
[0007] According to one aspect of the present invention, a method for detecting coil winding is provided, comprising: acquiring a test image, the test image including a coil formed by winding at least one conductor in a predetermined direction; determining the positions of multiple conductor segments of the coil based on the test image; determining the positions of the vertices of the first portion of conductor segments based on the positions of the first portion of conductor segments, wherein the first portion of conductor segments is at least a portion of the multiple conductor segments; determining a reference straight line based on the positions of the vertices of the second portion of conductor segments, wherein the reference straight line is a line connecting the vertices of qualified conductor segments, and the second portion of conductor segments is at least a portion of the first portion of conductor segments; and determining whether the winding of the coil is qualified based on the distance between the vertices of the multiple conductor segments or the first portion of conductor segments and the reference straight line.
[0008] For example, between the steps of determining the positions of multiple conductor segments of the coil based on the image to be tested and determining the position of the conductor vertex of the first part of the conductor segments based on the position of the first part of the conductor segments, the method further includes: calculating the length of the corresponding conductor segment in a direction perpendicular to a predetermined direction based on the position of each conductor segment among the multiple conductor segments; determining a reference length based on the length of the multiple conductor segments; and filtering out conductor segments among the multiple conductor segments whose length is greater than the reference length to obtain the first part of the conductor segments.
[0009] For example, between the steps of determining the positions of multiple conductor segments of the coil based on the image to be tested and determining the position of the conductor vertex of the first part of the conductor segments based on the position of the first part of the conductor segments, the method further includes: calculating the length of the corresponding conductor segment in a direction perpendicular to a predetermined direction based on the position of each conductor segment among the multiple conductor segments; determining a reference length based on the length of the multiple conductor segments; and filtering out conductor segments among the multiple conductor segments whose length is less than the reference length to obtain the first part of the conductor segments.
[0010] For example, determining a reference length based on the lengths of multiple conductor segments includes: taking the median or average of the lengths of the multiple conductor segments to obtain the reference length.
[0011] For example, determining a reference straight line based on the position of the vertices of the second part of the conductor segment includes: for every two adjacent conductor segments in the first part of the conductor segment, determining the line connecting the vertices of the two adjacent conductor segments; calculating the angle between each line and a predetermined direction; removing lines whose angle is greater than a first preset angle threshold; and performing line fitting on the remaining lines to obtain a reference straight line; wherein the second part of the conductor segment is the conductor segment corresponding to the line participating in the line fitting.
[0012] For example, determining the positions of multiple conductor segments of a coil based on an image to be tested includes: determining a target region based on the image to be tested, the target region containing at least one conductor and a background; removing the background from the target region to obtain a winding region to be tested; and determining the positions of multiple conductor segments based on the winding region to be tested.
[0013] For example, determining a target region based on a test image includes: acquiring a template image, on which a region of interest is marked to indicate the location of a wire on a coil; determining a second identifier feature in the test image that matches the first identifier feature based on a first identifier feature in the template image; determining a positional offset between the image position of the first identifier feature in the template image and the image position of the second identifier feature in the test image; adjusting the position of the region of interest in the template image according to the positional offset; and determining the region in the test image corresponding to the adjusted region of interest as the target region.
[0014] For example, removing the background from the target region to obtain the winding region to be tested includes: extracting an initial winding region within the target region by segmentation using a dynamic thresholding method; and performing a morphological closing operation on the initial winding region in a direction perpendicular to a predetermined direction to obtain the winding region to be tested.
[0015] For example, determining the positions of multiple conductor segments based on the winding region to be tested includes: performing a morphological opening operation on the winding region to be tested in a direction perpendicular to a predetermined direction to divide the winding region to be tested into multiple independent conductor regions, each conductor region corresponding to a conductor segment; and determining the positions of multiple conductor segments based on the multiple conductor regions.
[0016] For example, determining the positions of multiple conductor segments based on multiple conductor regions includes: extracting and trimming the skeletons of the multiple conductor regions to obtain the skeletons of the multiple conductor segments, wherein the skeleton of any conductor segment is used to indicate the position of the conductor segment.
[0017] For example, removing the background from the target area to obtain the winding area to be tested includes: extracting the edge contour of the winding area to be tested after removing the background based on the target area; wherein the edge contour is used to indicate the location of multiple conductor segments, and the position of the conductor vertex of each conductor segment is represented by the corresponding position of the conductor segment on the edge contour.
[0018] For example, extracting the edge contour of the test winding region after removing the background based on the target region includes: obtaining region images corresponding to the first color channel and the second color channel respectively based on the target region; subtracting the grayscale values of the region image corresponding to the first color channel and the region image corresponding to the second color channel to obtain an initial difference image; extracting the background region containing the background by binarizing the initial difference image; removing the background region from the target region; and extracting the contour from the remaining region of the target region as the edge contour of the test winding region.
[0019] For example, determining a reference straight line based on the position of the vertices of the second part of the guide line segment includes: extracting continuous contour segments from the edge contour where the angle change value along a predetermined direction is less than a second preset angle threshold; selecting the continuous contour segment in the middle when there are multiple continuous contour segments, and selecting the single continuous contour segment when there is only one continuous contour segment; performing line fitting on the selected continuous contour segment to obtain a reference straight line; wherein, the second part of the guide line segment is the guide line segment corresponding to the selected continuous contour segment.
[0020] For example, determining whether the winding of the coil is qualified based on the distance between the vertices of multiple conductor segments or a first portion of conductor segments and a reference straight line includes: for each conductor segment in the multiple conductor segments or the first portion of conductor segments, if the distance between the vertices of the conductor segment and the reference straight line is greater than a preset distance threshold, the conductor segment is determined to be unqualified; if the distance between the vertices of the conductor segment and the reference straight line is less than or equal to the preset distance threshold, the conductor segment is determined to be qualified, so as to obtain the qualification judgment result corresponding to the conductor segment; and determining whether the winding of the coil is qualified based on the qualification judgment results corresponding to each conductor segment in the multiple conductor segments or the first portion of conductor segments.
[0021] According to another aspect of the present invention, a coil winding detection device is also provided, comprising: an acquisition module for acquiring a test image, the test image including a coil formed by winding at least one conductor in a predetermined direction; a first determination module for determining the positions of multiple conductor segments of the coil based on the test image; a second determination module for determining the position of the conductor vertex of a first portion of conductor segments based on the position of the first portion of conductor segments, wherein the first portion of conductor segments is at least a portion of the multiple conductor segments; a third determination module for determining a reference straight line based on the position of the conductor vertex of a second portion of conductor segments, wherein the reference straight line is a line connecting the vertices of qualified conductor segments, and the second portion of conductor segments is at least a portion of the first portion of conductor segments; and a fourth determination module for determining whether the coil winding is qualified based on the distance between the conductor vertex of the multiple conductor segments or the first portion of conductor segments and the reference straight line.
[0022] According to another aspect of the present invention, an electronic device is also provided, characterized in that it includes a processor and a memory, the memory storing a computer program, the processor executing the computer program to implement the above-described coil winding detection method.
[0023] According to one aspect of the present invention, a storage medium is also provided, characterized in that it stores a computer program / instructions, which, when executed by a processor, implement the above-described coil winding detection method.
[0024] According to embodiments of the present invention, the coil winding detection method, coil winding detection device, electronic device, and storage medium determine a reference straight line by the position of the vertices of at least a portion of the conductor segments of the coil, and determine whether the coil winding is qualified by the distance between the vertices of each conductor segment and the reference straight line. This scheme does not employ complex calculation methods, thus achieving high computational efficiency and effectively saving computational resources, making it suitable for scenarios with high throughput requirements.
[0025] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0026] The above and other objects, features, and advantages of the present invention will become more apparent from the more detailed description of the embodiments of the invention in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same parts or steps.
[0027] Figure 1 A schematic flowchart of a coil winding detection method according to an embodiment of the present invention is shown;
[0028] Figure 2 An example of a test image including a coil is shown according to an embodiment of the present invention;
[0029] Figure 3 A schematic diagram of the connection of the vertices of a conductor according to an embodiment of the present invention is shown;
[0030] Figure 4 A schematic diagram showing the position of a conductor according to an embodiment of the present invention is provided;
[0031] Figure 5 A schematic diagram of a binarized image obtained by binarizing an initial difference image according to an embodiment of the present invention is shown;
[0032] Figure 6 A schematic block diagram of a coil winding detection device according to an embodiment of the present invention is shown; and
[0033] Figure 7 A schematic block diagram of an electronic device according to an embodiment of the present invention is shown. Detailed Implementation
[0034] To make the objectives, technical solutions, and advantages of the present invention more apparent, exemplary embodiments according to the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely a part of the embodiments of the present invention, and not all of the embodiments of the present invention. It should be understood that the present invention is not limited to the exemplary embodiments described herein. Based on the embodiments of the present invention described herein, all other embodiments obtained by those skilled in the art without inventive effort should fall within the protection scope of the present invention.
[0035] To at least partially solve the above problems, embodiments of the present invention provide a method for detecting coil windings. Figure 1 A schematic flowchart of a coil winding detection method 100 according to an embodiment of the present invention is shown. Figure 1 As shown, the method 100 may include the following steps: S110, S120, S130, S140 and S150.
[0036] Step S110: Obtain the image to be tested, which contains a coil formed by at least one wire wound in a predetermined direction.
[0037] For example, the image to be tested can be any image containing a coil, which is formed by winding at least one wire in a predetermined direction. The predetermined direction can be understood as the direction of extension of the winding axis around which the at least one wire is wound, such as the horizontal direction. For example, the coil may include at least one wire and an insulating conduit, with the at least one wire wound around the insulating conduit, and the winding axis being the central axis of the insulating conduit. The image to be tested can be a still image or any video frame in a dynamic video. The image to be tested can be the original image captured by the image acquisition device, or an image obtained after preprocessing (such as digitization, normalization, smoothing, etc.) the original image captured by the image acquisition device. It is understood that preprocessing the original image may include the operation of extracting a sub-image containing the coil from the original image captured by the image acquisition device to obtain the image to be tested.
[0038] Step S120: Based on the image to be tested, determine the positions of multiple conductor segments of the coil.
[0039] Based on the image to be tested, the positions of multiple conductor segments can be determined. Exemplarily, and not limitingly, the positions of conductor segments can be represented by their conductor profiles. Exemplarily, the conductor profile of each conductor segment can be its skeleton or envelope, etc.
[0040] For example, since the coil's wire is wound one turn (i.e., loop) around an insulating conduit, each turn contains a portion of the wire, such as a wire knot. Whether there is overlap in the coil's windings can be determined by judging the difference in length between the wire knots corresponding to different turns or the height difference between the vertices. Figure 2 An example of a test image including a coil is shown according to an embodiment of the present invention. See also Figure 2 Therefore, for each turn of the coil, what is displayed on the image under test is at least a portion of the conductor joint corresponding to that turn. For ease of description, this article refers to at least a portion of the conductor joint as a conductor segment. Typically, for each turn, the conductor segment displayed on the image under test is the one located on the front side of the coil, while the conductor segments on the back side are not visible (see [link to image]). Figure 2 (As shown). However, the present invention is not limited to this case. For example, an image containing a complete conductor segment of each turn of the coil (i.e., containing both the front and back conductor segments) can be obtained by means of image stitching, etc. In this case, the position of each conductor segment (which is a complete conductor segment at this time) can also be determined by step S120.
[0041] Step S130: Based on the positions of multiple conductor segments, determine the positions of the conductor vertices of the multiple conductor segments or the first part of the conductor segments, wherein the first part of the conductor segments is at least a portion of the multiple conductor segments.
[0042] For each of the multiple conductor segments, the position of the conductor vertex can be determined based on the position of the conductor segment. In one embodiment, all conductor segments in the multiple conductor segments can be directly used as the first part of conductor segments, and the positions of the conductor vertices of these conductor segments can be determined. In another embodiment, the multiple conductor segments can be filtered according to a preset standard (first preset standard) to obtain the remaining conductor segments as the first part of conductor segments. For example, based on the obtained multiple conductor segments, conductor segments located in obviously concave or convex parts can be discarded, and the remaining conductor segments can be used as the first part of conductor segments. Based on the position of the first part of conductor segments, the position of the conductor vertex of the first part of conductor segments can be determined. The device (e.g., a computer system) for performing the coil winding detection 100 can automatically determine the position of the conductor vertex of the first part of conductor segments. The conductor vertex can be the highest point of the corresponding conductor segment in its extension direction. It is understood that the extension direction of the conductor segment is perpendicular to the extension direction of the winding axis (i.e., the predetermined direction). Therefore, for example, the highest point can be found on the conductor profile of the conductor segment along a direction perpendicular to the predetermined direction and determined as the conductor vertex of the corresponding conductor segment.
[0043] Step S140: Determine a reference straight line based on the position of the vertices of the second part of the conductor segment, wherein the reference straight line is the line connecting the vertices of the qualified conductor segments, and the second part of the conductor segment is at least a portion of the conductor segments in the first part of the conductor segment.
[0044] It is understood that the vertices of the first part of the conductor segments are not necessarily all located on a straight line. Therefore, the vertices of qualified conductor segments (the second part of the conductor segments) that are approximately located on a straight line can be selected, and a reference straight line can be obtained based on these vertices. For example, the first part of the conductor segments can be screened according to a preset standard (the second preset standard) to obtain the remaining conductor segments as the second part of the conductor segments. For example, the first part of the conductor segments obtained above may also include one or more conductor segments located in obvious concave or convex parts. Therefore, these conductor segments located in obvious concave or convex parts can be optionally discarded to obtain the second part of the conductor segments. The reference straight line can be determined based on the vertices of the second part of the conductor segments. The reference straight line can be the line connecting the vertices of the second part of the conductor segments or a straight line obtained by line fitting based on the line connecting the vertices of the second part of the conductor segments. The reference straight line can be understood as a reference position that the vertices of each conductor segment of the coil should theoretically be in, that is, the position that the conductor segments of the coil should be in under normal non-overlapping conditions. By comparing the positions of the vertices of other conductor segments with the reference straight line, it is possible to determine whether there are any anomalies in other conductor segments, such as whether there are overlapping defects.
[0045] Step S150: Determine whether the coil winding is qualified based on the distance between the apex of the multiple conductor segments or the first part of the conductor segment and the reference straight line.
[0046] For example, when determining the position of the wire vertex of the first portion of the wire segment, the positions of the wire vertices of other wire segments can also be determined; that is, the positions of the wire vertices of all wire segments (i.e., the multiple wire segments in step S120) can be optionally determined. The winding qualification of the coil can be determined based on the distance between the wire vertices of the multiple wire segments and the reference line. The winding qualification of the coil can also be determined based on the distance between the wire vertices of the first portion of the wire segment and the reference line.
[0047] In one embodiment, the first portion of the conductor segment is a conductor segment obtained by filtering out conductor segments that exceed the length limit from multiple conductor segments. The aforementioned conductor segments exceeding the length limit can be understood as conductor segments with a length greater than the reference length, as can be understood from the embodiments described below. Furthermore, the method of obtaining the first portion of the conductor segment by filtering out conductor segments exceeding the length limit can be called a long conductor segment filtering method. In this embodiment, the vertices of the conductor segments can be compared with a reference straight line, and the winding qualification of the coil can be determined based on the distance between the vertices of the conductor segments and the reference straight line.
[0048] In another embodiment, the first portion of the conductor segment is all the conductor segments among multiple conductor segments, or the first portion of the conductor segment is a conductor segment obtained by filtering multiple conductor segments using a method other than the long conductor segment filtering method described above. In this case, at least two methods can be used to determine whether the coil winding is qualified. One method is to compare the conductor vertices of the multiple conductor segments with a reference straight line, and determine whether the coil winding is qualified based on the distance between the conductor vertices of the multiple conductor segments and the reference straight line. Another method is to compare the conductor vertices of the first portion of the conductor segment with a reference straight line, and determine whether the coil winding is qualified based on the distance between the conductor vertices of the first portion of the conductor segment and the reference straight line.
[0049] According to the coil winding detection method of the present invention, a reference straight line is determined by the position of the vertices of at least a portion of the conductor segments of the coil, and the winding qualification of the coil is determined by the distance between the vertices of each conductor segment and the reference straight line. This scheme does not employ complex calculation methods, thus achieving high computational efficiency and effectively saving computational resources, making it suitable for scenarios with high throughput requirements.
[0050] For example, between the step of determining the positions of multiple conductor segments of the coil based on the image to be tested (step S120) and the step of determining the position of the conductor vertex of the first part of the conductor segments based on the position of the first part of the conductor segments (step S130), method 100 may further include: calculating the length of the corresponding conductor segment in the direction perpendicular to the predetermined direction based on the position of each conductor segment among the multiple conductor segments; determining a reference length based on the length of the multiple conductor segments; filtering out conductor segments among the multiple conductor segments whose length is greater than the reference length to obtain the first part of the conductor segments.
[0051] In one embodiment, after determining the positions of multiple conductor segments of the coil based on the image under test, the length of the corresponding conductor segment in a direction perpendicular to the predetermined direction can be calculated based on the position of each conductor segment. This direction can also represent the extension direction of the conductor segment. In the image under test, the length of each conductor segment in its extension direction is calculated. A reference length can be obtained based on the lengths of the multiple conductor segments. The reference length can be determined in any suitable manner. For example, the median or average length of the multiple conductor segments can be calculated, and the length corresponding to the median or average length can be determined as the reference length. Based on the reference length, conductor segments with lengths greater than the reference length can be selected from the multiple conductor segments and discarded, with the remaining conductor segments being used as the first part of the conductor segments.
[0052] Since the lengths of the multiple conductor segments vary considerably, and the reference straight line is mainly used to characterize the reference position of the conductor vertices of each conductor segment in the normal, non-overlapping state of the coil, conductor segments that are too protruding or concave are not suitable as reference conductor segments (i.e., the second part of the conductor segments). Therefore, it is possible to filter out some obviously protruding conductor segments before determining the reference straight line or before determining the conductor vertices of each conductor segment. This can be achieved through the method of this embodiment (i.e., the long conductor segment filtering method described above).
[0053] According to the above technical solution, based on the reference length, conductor segments longer than the reference length are filtered out from multiple conductor segments to obtain the first batch of conductor segments. This method can filter out some conductor segments that are not suitable as reference conductor segments, which helps to reduce the amount of calculation when determining the reference straight line and helps to improve the accuracy of the reference straight line determination.
[0054] For example, between the step of determining the positions of multiple conductor segments of the coil based on the image to be tested (step S120) and the step of determining the position of the conductor vertex of the first part of the conductor segments based on the position of the first part of the conductor segments (step S130), method 100 may further include: calculating the length of the corresponding conductor segment in the direction perpendicular to the predetermined direction based on the position of each conductor segment among the multiple conductor segments; determining a reference length based on the length of the multiple conductor segments; filtering out conductor segments among the multiple conductor segments whose length is less than the reference length to obtain the first part of the conductor segments.
[0055] The method for determining the reference length in this embodiment is similar to that in the previous embodiment, and will not be repeated here. Based on the reference length, conductor segments with lengths shorter than the reference length can be selected from multiple conductor segments and discarded, with the remaining conductor segments serving as the first part of the conductor segments.
[0056] As mentioned above, excessively concave conductor segments are also unsuitable as reference conductor segments. Furthermore, the coil wire may be wound in more than one layer, and concave conductor segments typically belong to the lower layer, not the same layer as most of the currently detected conductor segments (i.e., the upper layer). Lower layer conductor segments can interfere with upper layer conductor segments and are not suitable for determining winding overlap; therefore, these conductor segments can be filtered out.
[0057] According to the above technical solution, conductor segments shorter than the reference length are filtered out from multiple conductor segments to obtain the first batch of conductor segments. This method can filter out some conductor segments that are not suitable as reference conductor segments, preventing false detections due to interference from lower conductors when judging winding overlap. In addition, this solution also helps to reduce the amount of calculation when determining the reference straight line.
[0058] For example, determining a reference length based on the lengths of multiple conductor segments may include taking the median or average of the lengths of the multiple conductor segments to obtain the reference length.
[0059] As mentioned above, the reference length can be determined by taking the median or average of the lengths of multiple conductor segments. The average can be calculated using algorithms such as weighted average, arithmetic average, or geometric average.
[0060] According to the above technical solution, the reference length is obtained by calculating the median or average length of multiple conductor segments. This method of determining the reference length is simple and efficient.
[0061] For example, determining a reference straight line based on the position of the vertices of the second part of the conductor segment may include: for every two adjacent conductor segments in the first part of the conductor segment, determining the line connecting the vertices of the two adjacent conductor segments; calculating the angle between each line and a predetermined direction; removing lines whose angle is greater than a first preset angle threshold; and performing line fitting on the remaining lines to obtain a reference straight line; wherein the second part of the conductor segment is the conductor segment corresponding to the line participating in the line fitting.
[0062] In one embodiment, for every two adjacent wire segments in the first portion of the wire segment, the vertices of these two wire segments can be connected. This allows for the obtaining of lines connecting all the vertices of the wires in the first portion of the wire segment. Figure 3 A schematic diagram of the connection of wire vertices according to an embodiment of the present invention is shown. Figure 3 As shown, each arrowed straight line represents the line connecting the vertices of two adjacent conductor segments in the first section of the conductor segment. The direction of each connection relative to the predetermined direction (as described above) can be calculated. Figure 3 The angle between (represented by a white dashed line). For example... Figure 3 If the angle 'a' between line A and the predetermined direction is greater than a first preset angle threshold, then line A corresponding to angle 'a' can be discarded. The first preset angle threshold can be set to any suitable angle value as needed. For example, the first preset angle threshold can be in the range of [3, 30] degrees. For instance, the first preset angle threshold can be equal to 5 degrees, 8 degrees, 10 degrees, 15 degrees, 20 degrees, etc. Similarly, lines with angles greater than the first preset angle threshold can be removed sequentially. Fitting the remaining lines yields a baseline straight line. The second part of the guide segment can be the guide segment corresponding to the line participating in the straight line fitting.
[0063] Under normal circumstances, the angle between the line connecting the vertices of adjacent conductor segments and the predetermined direction is close to 0. If there is a significant indentation or protrusion (e.g., a protrusion due to overlap), the angle will be relatively large. Therefore, screening unqualified lines based on the angle between the line connecting the vertices of the conductors and the predetermined direction can ensure the accuracy of the baseline line fitted based on the remaining lines.
[0064] For example, determining the positions of multiple conductor segments of a coil based on an image to be tested may include: determining a target region based on the image to be tested, the target region containing at least one conductor and a background; removing the background from the target region to obtain a winding region to be tested; and determining the positions of multiple conductor segments based on the winding region to be tested.
[0065] In one embodiment, a target region can be determined based on the obtained image to be tested. The target region may contain at least one wire and a background. For the obtained target region, a threshold-based image segmentation method, such as the minimum error method or the maximum entropy method, can be used to segment the target region. Alternatively, edge-based segmentation methods, such as the Robert operator, the Prewitt operator, the Sobel operator, the Laplacian operator, and the Canny operator, can also be used to segment the target region. After image segmentation, a test winding region excluding the background can be obtained. Based on the obtained test winding region, the positions of multiple wire segments in the test winding region can be determined by manual annotation or by automatic annotation by the device (e.g., a computer system) used to perform the coil winding detection method 100. In one example, the position of the corresponding wire segment can be represented by the wire outline of each wire segment.
[0066] According to the above technical solution, the target region in the image to be tested is segmented to determine the winding region to be tested. Then, the positions of multiple conductor segments are determined based on the winding region to be tested. This image segmentation method is relatively mature, therefore it is low-cost and easy to implement. Furthermore, determining the positions of multiple conductor segments based on the winding region to be tested obtained after image segmentation can effectively eliminate background interference, thus making it more accurate.
[0067] For example, determining a target region based on a test image may include: acquiring a template image, on which a region of interest is marked to indicate the location of a wire on a coil; determining a second identifier feature in the test image that matches the first identifier feature based on a first identifier feature in the template image; determining a positional offset between the image position of the first identifier feature in the template image and the image position of the second identifier feature in the test image; adjusting the position of the region of interest in the template image according to the positional offset; and determining the region in the test image corresponding to the adjusted region of interest as the target region.
[0068] In one embodiment, the method of acquiring the template image is similar to step S110, and will not be repeated here for brevity. The template image and the image to be tested have the same image size. The template image is pre-marked with a Region of Interest (ROI) to indicate the location of the wires on the coil. The position of the wire in the template image and its position in the image to be tested may be offset, that is, they may not be perfectly aligned. In order to accurately determine the target area corresponding to the ROI, the offset between the wire in the template image and the wire in the image to be tested can be optionally determined, and the ROI can be adjusted based on the offset. For example, the template image may contain a first identification feature. Based on the first identification feature in the template image, a second identification feature matching the first identification feature can be determined in the image to be tested. The first identification feature and the second identification feature may be the same feature on both the template image and the image to be tested, such as two wire segments of the coil that are not wrapped around the insulating pipe. These two wire segments belong to the beginning and end of the wire and are used to extend out and connect with other circuit elements. Since the test image and the template image are the same size, the positional offset between the first identifier feature in the template image and the second identifier feature in the test image can be determined based on the pixel positions in both images. Based on this offset, the position of the region of interest (ROI) in the template image can be adjusted so that it covers the corresponding region in the test image. The region in the test image corresponding to the adjusted ROI is then defined as the target region. This adjustment of the ROI based on the offset to determine the target region is optional; the target region can also be determined directly based on the initial, unadjusted ROI when necessary.
[0069] According to the above technical solution, the target region in the test image corresponding to the region of interest on the template image is determined. This method determines the target region accurately, and the technology is relatively mature, thus offering low cost and high efficiency.
[0070] For example, removing the background from the target region to obtain the winding region to be tested may include: extracting an initial winding region within the target region by segmentation using a dynamic thresholding method; and performing a morphological closing operation on the initial winding region in a direction perpendicular to a predetermined direction to obtain the winding region to be tested.
[0071] In one embodiment, based on the obtained target region, an initial winding region can be extracted from the target region by using a dynamic thresholding method, such as an image smoothing-based dynamic thresholding method. For example, based on the position and grayscale features of each pixel in the target region, a corresponding grayscale threshold can be set for different pixels or pixel regions. Then, the grayscale value of each pixel in the target region is compared with its corresponding grayscale threshold, and the region to which the pixels with grayscale values greater than the grayscale threshold belong is retained as the initial winding region.
[0072] Because the conductor itself is affected by its own posture and shape during imaging, the imaging is not very stable, resulting in uneven grayscale, uneven brightness distribution, and large fluctuations in color values, making it difficult to perform image segmentation with a fixed threshold using only color component values. Dynamic thresholding segmentation can effectively resist the influence of imaging differences, thereby stably extracting the initial winding region. After determining the initial winding region, morphological closing operations can be performed on the initial winding region in a direction perpendicular to the predetermined direction described in this paper to obtain the winding region to be measured.
[0073] According to the above technical solution, the initial winding region is extracted by segmentation using a dynamic thresholding method within the target area. This segmentation method can effectively resist the influence of imaging differences in the image under test, thus ensuring stable extraction of the initial winding region and laying a necessary foundation for subsequent detection of the coil winding's quality. Performing morphological closing operations on the initial winding region in a direction perpendicular to the predetermined direction can eliminate the influence of foreign objects on the conductor or poor reflectivity, thereby obtaining a more accurate winding region to be tested.
[0074] For example, determining the positions of multiple conductor segments based on the winding region to be tested may include: performing a morphological opening operation on the winding region to be tested in a direction perpendicular to a predetermined direction to divide the winding region to be tested into multiple independent conductor regions, each conductor region corresponding to a conductor segment; and determining the positions of multiple conductor segments based on the multiple conductor regions.
[0075] In one embodiment, performing a morphological opening operation on the winding region to be tested in a direction perpendicular to a predetermined direction can divide the winding region into individual conductor regions. Each conductor region corresponds to a conductor segment. Based on multiple conductor regions, the conductor positions of multiple conductor segments can be determined for each conductor region using methods such as skeleton extraction. Figure 4 A schematic diagram showing the position of the conductor according to an embodiment of the present invention is illustrated. Figure 4 In the diagram, the white arrows indicate the outlines of two of the multiple conductor segments. The outlines of the other conductor segments can be understood from these outlines. Each conductor outline represents the position of the corresponding conductor segment.
[0076] According to the above technical solution, performing morphological opening operations on the winding area to be tested in a direction perpendicular to the predetermined direction can eliminate the influence of wire adhesion between two adjacent wire areas, thereby ensuring the accuracy of the obtained wire position.
[0077] For example, determining the positions of multiple conductor segments based on multiple conductor regions may include: extracting and trimming the skeletons of the multiple conductor regions to obtain the skeletons of the multiple conductor segments, wherein the skeleton of any conductor segment is used to indicate the position of the conductor segment.
[0078] In one embodiment, based on multiple conductor regions, skeleton extraction can be performed on each conductor region using methods such as fire simulation-based extraction, maximum disk-based extraction, or 3D model skeleton extraction from the Scikit-based image processing library. Optionally, some post-processing can be performed after skeleton extraction. Post-processing may include cropping (or trimming) the extracted skeleton. After skeleton extraction, some noise, such as skeleton burrs, may exist. Cropping can remove this noise. After cropping, skeletons of multiple conductor segments can be obtained to represent the positions of each conductor segment.
[0079] According to the above technical solution, extracting and trimming the skeleton in multiple conductor regions can further eliminate interference from conductor adhesion in multiple conductor regions.
[0080] For example, removing the background from the target area to obtain the winding area to be tested may include: extracting the edge contour of the winding area to be tested after removing the background based on the target area; wherein the edge contour is used to indicate the location of multiple conductor segments, and the position of the conductor vertex of each conductor segment is represented by the corresponding position of the conductor segment on the edge contour.
[0081] In one embodiment, the edge contour of the winding region to be tested can be extracted from the obtained target area. Extracting the edge contour of the winding region to be tested can be achieved through a fully convolutional encoder-decoder network, Holistically-Nested Edge Detection (HED), or similar methods. The extracted edge contour can represent the location of multiple conductor segments. The top contour point on the edge contour of any conductor segment can represent the conductor vertex of the corresponding conductor segment. The top contour point is the contour point at the highest position along the extension direction of the conductor segment on the edge contour.
[0082] For example, the image to be tested obtained in step S110 can be a mirror image including a mirror image of the physical wire. The mirror image can be a reflection formed on an object due to the physical wire or a coil containing the physical wire being placed on an object with a mirror-like imaging effect. In this case, the positions of multiple wire segments on the mirror image of the physical wire can be determined in step S120. At this time, it is not necessary to extract individual wire regions; only the edge contour needs to be extracted. Continuous contour segments with small angular changes on the edge contour can be fitted into a straight line. The degree of overlap can be determined by measuring the height of the contour portion exceeding this straight line. Since detection and measurement are performed through the contour, it is unaffected by wire reflection and wire imaging effects. Furthermore, the edge contour imaging is stable and clear, with high contrast, resulting in high detection stability.
[0083] According to the above technical solution, the winding area to be tested is obtained by extracting the edge contour of the winding area to be tested. This method is not affected by wire reflection or the imaging effect of the image to be tested, and the edge contour is displayed more stably and clearly with higher contrast. Therefore, the stability of detecting whether the winding of the coil is qualified is also higher.
[0084] For example, extracting the edge contour of the test winding region after removing the background based on the target region may include: obtaining region images corresponding to the first color channel and the second color channel respectively based on the target region; subtracting the grayscale values of the region image corresponding to the first color channel and the region image corresponding to the second color channel to obtain an initial difference image; extracting the background region containing the background by binarizing the initial difference image; removing the background region from the target region; and extracting the contour from the remaining region of the target region as the edge contour of the test winding region.
[0085] In one embodiment, the image to be tested can be an RGB image. Channel images corresponding to the R channel, G channel, and B channel can be obtained for the image to be tested. Any two of the three color channels can be selected as the first color channel and the second color channel, respectively. For example, the first color channel can be the R channel, and the second color channel can be the G channel. Based on the target region in the image to be tested, region images corresponding to the first color channel (R channel) and the second color channel (G channel) can be obtained. The region image corresponding to any color channel refers to the image obtained by extracting the image patch belonging to the target region from the channel image corresponding to that color channel. Subtracting the grayscale value of each pixel in the region image corresponding to the first color channel (R channel) from the corresponding pixel in the region image corresponding to the second color channel (G channel) yields an initial difference image. Binarizing the initial difference image allows for the extraction of the background region. Figure 5A schematic diagram is shown of a binarized image obtained by binarizing an initial difference image according to an embodiment of the present invention. Figure 5 As shown, the white area represents the background area. Removing the background area from the target area leaves the area to be tested (the winding area). The winding area to be tested is... Figure 5 The black area shown represents the area to be tested (the wire-bearing region), which can be understood as the region containing the wire, and the background region as the region containing the background excluding the wire. In the remaining region after removing the background region, the contour of that region can be extracted to obtain the edge contour of the wire-bearing region to be tested.
[0086] According to the above technical solution, region images corresponding to the first and second color channels can be obtained based on the target region to obtain an initial difference image. Further, the background region is extracted from the initial difference image to obtain the edge contour of the test winding region excluding the background region. Based on this method, by subtracting the corresponding region images under the two color channels, the contrast between the background region and the test winding region can be highlighted, thus facilitating the determination of the edge contour and improving the accuracy of the determined edge contour. Furthermore, this solution is simple to implement and highly efficient.
[0087] For example, determining a reference straight line based on the position of the vertices of the second part of the guide line segment includes: extracting continuous contour segments from the edge contour where the angle change value along a predetermined direction is less than a second preset angle threshold; selecting the continuous contour segment in the middle when there are multiple continuous contour segments, and selecting the single continuous contour segment when there is only one continuous contour segment; performing line fitting on the selected continuous contour segment to obtain a reference straight line; wherein, the second part of the guide line segment is the guide line segment corresponding to the selected continuous contour segment.
[0088] In one embodiment, continuous contour segments whose angular variation along the predetermined direction is less than a second preset angle threshold can be extracted from the edge contour. The second preset angle threshold can be set to any suitable angle value as needed. For example, the second preset angle threshold can be in the range of [3, 30] degrees. For instance, the second preset angle threshold can be equal to 5 degrees, 8 degrees, 10 degrees, 15 degrees, 20 degrees, etc. See also... Figure 5 In this context, the contour segments corresponding to all conductor segments from conductor segment b to conductor segment c can be considered as a continuous contour segment. If multiple continuous contour segments exist, any one of them or the one in the middle can be selected for straight-line fitting. The continuous contour segment in the middle can be any conductor segment other than the one at the beginning or end along the extension direction of the conductor segment. Straight-line fitting can be performed using methods such as least squares or gradient descent. Based on the results of the straight-line fitting, a reference straight line (e.g., ...) can be obtained. Figure 5The black straight line in the image is also a solid black line. In this embodiment, the second conductor segment can be the conductor segment corresponding to the selected continuous contour segment.
[0089] According to the above technical solution, a reference straight line is obtained by fitting a continuous contour segment. This method determines a continuous contour segment through the edge contour. Since the edge contour is not affected by the imaging effect of the image under test, the determined continuous contour segment is more accurate. Furthermore, obtaining the reference straight line based on the continuous contour segment can ensure the accuracy of determining whether the coil winding is qualified.
[0090] For example, determining whether the winding of the coil is qualified based on the distance between the vertices of multiple conductor segments or a first portion of conductor segments and a reference straight line may include: for each conductor segment in the multiple conductor segments or the first portion of conductor segments, if the distance between the vertices of the conductor segment and the reference straight line is greater than a preset distance threshold, then the conductor segment is determined to be unqualified; if the distance between the vertices of the conductor segment and the reference straight line is less than or equal to the preset distance threshold, then the conductor segment is determined to be qualified, thereby obtaining the qualification judgment result corresponding to the conductor segment; and determining whether the winding of the coil is qualified based on the qualification judgment results corresponding to each conductor segment in the multiple conductor segments or the first portion of conductor segments.
[0091] The preset distance threshold can be set to any suitable value as needed, and the present invention does not limit this. For example, the preset distance threshold can be in the range of [0.05, 0.25] mm. For instance, the preset distance threshold can be equal to 0.05 mm, 0.1 mm, 0.15 mm, 0.2 mm, etc.
[0092] For each conductor segment, the distance between its vertex and the reference line can be used to determine if there is an overlap problem. If the distance between the conductor segment and the reference line is greater than a preset distance threshold, then an overlap problem is identified, meaning the segment is considered unqualified. (Refer to...) Figure 5 If the distance H between the vertex of conductor segment d and the reference line is greater than the preset distance threshold H T If the distance H between the vertex of conductor segment d and the reference line is less than the preset distance threshold H, then it can be determined that the conductor segment has an overlap problem, i.e., it is unqualified; conversely, if the distance H between the conductor vertex of conductor segment d and the reference line is less than the preset distance threshold H, then it is considered unqualified. T If this is confirmed, it can be determined that the conductor segment does not have an overlap problem, meaning it is qualified. This method defines overlap by measuring the height of the conductor's apex protrusion, which allows for specific quantification of the degree of overlap, facilitating on-site adjustments based on specific circumstances and increasing adaptability to different needs.
[0093] Exemplarily, based on the qualified judgment results corresponding to each wire segment in multiple wire segments or the first part of wire segments, determining whether the winding of the coil is qualified may include: if the number of unqualified wire segments exceeds a preset number threshold, determining that the winding of the coil is unqualified; otherwise, determining that the winding of the coil is qualified.
[0094] Regarding the judgment of the winding of the entire coil, the preset number threshold can be further combined to judge whether the winding of the coil is qualified. Of course, the preset number threshold can be set to 1. At this time, as long as there is 1 wire segment with an overlapping problem, it can be determined that there is an overlapping defect in the winding of the coil, which belongs to unqualified. Of course, the preset number threshold can also be set to other values greater than 1.
[0095] Exemplarily, the preset number threshold can be within the range of [1, 20]. For example, the preset number threshold can be equal to 3, 5, 8, 10, 15, etc. Hereinafter, an example with the preset number threshold being 3 will be used for illustration. In one embodiment, if the distances between the wire vertices of 3 or more wire segments in multiple wire segments or the first part of wire segments and the reference straight line are all greater than the preset distance threshold H T , it can be determined that the winding of the coil is unqualified. On the contrary, if the number of wire segments in multiple wire segments or the first part of wire segments whose distances between the wire vertices and the reference straight line are greater than the preset distance threshold H T is less than 3, it can be determined that the winding of the coil is qualified.
[0096] According to the above technical solution, by judging whether the distance between the wire vertex of the wire segment and the reference straight line is greater than the preset distance threshold, it is determined whether the winding of the coil is qualified. This method is convenient to operate and simple, and is relatively easy to implement.
[0097] According to another aspect of the present invention, a detection device for coil winding is further provided. Figure 6 Fig. shows a schematic block diagram of a detection device 600 for coil winding according to an embodiment of the present invention. As Figure 6 shown, the device 600 may include an acquisition module 610, a first determination module 620, a second determination module 630, a third determination module 640, and a fourth determination module 650.
[0098] The acquisition module 610 is configured to acquire a to-be-detected image, and the to-be-detected image includes a coil formed by winding at least one wire along a predetermined direction.
[0099] The first determination module 620 is configured to determine the positions of multiple wire segments of the coil based on the to-be-detected image.
[0100] The second determination module 630 is configured to determine the positions of the wire vertices of the first part of wire segments based on the positions of the first part of wire segments, wherein the first part of wire segments is at least part of the multiple wire segments.
[0101] The third determining module 640 is used to determine a reference straight line based on the position of the vertices of the second part of the conductor segment, wherein the reference straight line is the line connecting the vertices of qualified conductor segments, and the second part of the conductor segment is at least a portion of the conductor segments in the first part of the conductor.
[0102] The fourth determining module 650 is used to determine whether the winding of the coil is qualified based on the distance between the vertices of multiple conductor segments or the first part of the conductor segment and the reference straight line.
[0103] For example, the device 600 further includes: a calculation module, used to calculate the length of the corresponding wire segment in a direction perpendicular to a predetermined direction based on the position of each wire segment among the multiple wire segments, between the first determining module 620 determining the positions of multiple wire segments of the coil based on the image to be tested and the second determining module 630 determining the position of the wire vertex of the first portion of wire segments based on the position of the first portion of wire segments; a fifth determining module, used to determine a reference length based on the length of the multiple wire segments; and a first filtering module, used to filter out wire segments among the multiple wire segments whose length is greater than the reference length, to obtain the first portion of wire segments.
[0104] For example, the device 600 further includes: a calculation module, used to calculate the length of the corresponding wire segment in a direction perpendicular to a predetermined direction based on the position of each wire segment among the multiple wire segments, between the first determining module 620 determining the positions of multiple wire segments of the coil based on the image to be tested and the second determining module 630 determining the position of the wire vertex of the first portion of wire segments based on the position of the first portion of wire segments; a fifth determining module, used to determine a reference length based on the length of the multiple wire segments; and a second filtering module, used to filter out wire segments among the multiple wire segments whose length is less than the reference length, to obtain the first portion of wire segments.
[0105] For example, the fifth determining module includes a value taking submodule, used to take the median or average value of the lengths of multiple conductor segments to obtain a reference length.
[0106] For example, the third determining module 640 includes: a first determining submodule, used to determine the connecting line between the vertices of the two adjacent conductor segments for each of the first part of the conductor segments; a calculation submodule, used to calculate the angle between each connecting line and a predetermined direction; a first removing submodule, used to remove connecting lines whose angle is greater than a first preset angle threshold; and a first fitting submodule, used to perform straight line fitting on the remaining connecting lines to obtain a reference straight line; wherein, the second part of the conductor segments are the conductor segments corresponding to the connecting lines participating in the straight line fitting.
[0107] For example, the first determining module 620 includes: a second determining submodule for determining a target area based on the image to be tested, the target area containing at least one wire and a background; a second removing submodule for removing the background from the target area to obtain the winding area to be tested; and a third determining submodule for determining the positions of multiple wire segments based on the winding area to be tested.
[0108] For example, the second determining submodule includes: an acquisition unit for acquiring a template image, the template image having a region of interest marked on it to indicate the location of the wire on the coil; a first determining unit for determining a second identifier feature in the image to be tested that matches the first identifier feature based on a first identifier feature in the template image; a second determining unit for determining a positional offset between the image position of the first identifier feature in the template image and the image position of the second identifier feature in the image to be tested; an adjustment unit for adjusting the position of the region of interest in the template image according to the positional offset; and a third determining unit for determining the region in the image to be tested that corresponds to the adjusted region of interest as the target region.
[0109] For example, the second removal submodule includes: a segmentation unit, used to segment and extract the initial winding region within the target region using a dynamic threshold method; and a closing operation unit, used to perform a morphological closing operation on the initial winding region in a direction perpendicular to a predetermined direction to obtain the winding region to be tested.
[0110] For example, the third determining submodule includes: an opening operation unit, used to perform a morphological opening operation on the winding region to be tested in a direction perpendicular to a predetermined direction, so as to divide the winding region to be tested into multiple independent conductor regions, each conductor region corresponding to a conductor segment; and a fourth determining unit, used to determine the positions of multiple conductor segments based on multiple conductor regions.
[0111] For example, the fourth determining unit includes a skeleton extraction and trimming subunit, which is used to extract and trim the skeletons of multiple conductor regions respectively to obtain the skeletons of multiple conductor segments, wherein the skeleton of any conductor segment is used to indicate the position of the conductor segment.
[0112] For example, the second removal submodule includes: an extraction unit, used to extract the edge contour of the test winding area after background removal based on the target area; wherein, the edge contour is used to indicate the location of multiple wire segments, and the position of the wire vertex of each wire segment in the multiple wire segments is represented by the corresponding position of the wire segment on the edge contour.
[0113] For example, the extraction unit includes: an acquisition subunit, used to acquire region images corresponding to the first color channel and the second color channel respectively based on the target region; a grayscale subtraction subunit, used to subtract the grayscale values of the region image corresponding to the first color channel and the region image corresponding to the second color channel to obtain an initial difference image; a binarization subunit, used to extract a background region containing the background by binarizing the initial difference image; a removal subunit, used to remove the background region from the target region; and an extraction subunit, used to extract the contour from the remaining region of the target region as the edge contour of the winding region to be tested.
[0114] For example, the third determining module 640 includes: an extraction submodule, used to extract continuous contour segments from the edge contour where the angle change value along a predetermined direction is less than a second preset angle threshold; a selection submodule, used to select the continuous contour segment in the middle when there are multiple continuous contour segments, and to select the single continuous contour segment when there is a single continuous contour segment; and a second fitting submodule, used to perform straight line fitting on the selected continuous contour segments to obtain a reference straight line; wherein, the second part of the guide segment is the guide segment corresponding to the selected continuous contour segment.
[0115] For example, the fourth determining module 650 includes: a fourth determining submodule, used to determine that for each of the multiple conductor segments or the first part of conductor segments, if the distance between the conductor vertex of the conductor segment and the reference straight line is greater than a preset distance threshold, the conductor segment is unqualified; if the distance between the conductor vertex of the conductor segment and the reference straight line is less than or equal to the preset distance threshold, the conductor segment is qualified, so as to obtain the qualification judgment result corresponding to the conductor segment; and a fifth determining submodule, used to determine whether the winding of the coil is qualified based on the qualification judgment results corresponding to each conductor segment in the multiple conductor segments or the first part of conductor segments.
[0116] According to another aspect of the present invention, an electronic device is also provided. Figure 7 A schematic block diagram of an electronic device 700 according to an embodiment of the present invention is shown. Figure 7 As shown, the electronic device 700 includes a processor 710 and a memory 720. The memory 720 stores computer program instructions, which are executed by the processor 710 to perform the aforementioned coil winding detection method 100.
[0117] According to another aspect of the present invention, a storage medium is also provided. A computer program / instructions are stored on the storage medium, which, when executed, performs the coil winding detection method 100 as described above. The storage medium may, for example, include a storage component of a tablet computer, a hard disk of a personal computer, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disc read-only memory (CD-ROM), a USB memory, or any combination of the above storage media. The computer-readable storage medium may be any combination of one or more computer-readable storage media.
[0118] Those skilled in the art can understand the specific implementation schemes of the above-mentioned coil winding detection device, electronic equipment and storage medium by reading the relevant description of the coil winding detection method. For the sake of brevity, they will not be described in detail here.
[0119] Although exemplary embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above exemplary embodiments are merely illustrative and are not intended to limit the scope of the invention. Various changes and modifications can be made therein by those skilled in the art without departing from the scope and spirit of the invention. All such changes and modifications are intended to be included within the scope of the invention as claimed in the appended claims.
[0120] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0121] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed.
[0122] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0123] Similarly, it should be understood that, in order to streamline the invention and aid in understanding one or more of the various aspects of the invention, features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the description of exemplary embodiments of the invention. However, this approach should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the corresponding claims, its inventive point lies in solving the corresponding technical problem with fewer features than all of those in a single disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of the invention.
[0124] Those skilled in the art will understand that, apart from the mutual exclusion of features, all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or elements of any method or apparatus so disclosed can be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0125] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features but not others included in other embodiments, combinations of features from different embodiments are intended to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments can be used in any combination.
[0126] The various component embodiments of the present invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some modules in the coil winding detection device according to embodiments of the present invention. The present invention can also be implemented as an apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such programs implementing the present invention can be stored on a computer-readable medium or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0127] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0128] The above description is merely a specific embodiment of the present invention or an explanation of that embodiment. The scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. The scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method of detecting a coil winding, characterized by, include: Acquire a test image, wherein the test image contains a coil formed by winding at least one wire in a predetermined direction; Based on the image to be tested, determine the positions of multiple conductor segments of the coil; Calculate the length of the corresponding conductor segment in the direction perpendicular to the predetermined direction based on the position of each conductor segment among the multiple conductor segments; The reference length is determined based on the lengths of the multiple conductor segments; Filter out the conductor segments whose length is greater than the reference length from the multiple conductor segments to obtain the first part of the conductor segments; Based on the position of the first part of the conductor segment, the position of the conductor vertex of the first part of the conductor segment is determined, wherein the first part of the conductor segment is at least a portion of the conductor segments among the plurality of conductor segments; A reference straight line is determined based on the position of the vertices of the second part of the conductor segment, wherein the reference straight line is the line connecting the vertices of qualified conductor segments, and the reference straight line is used to indicate the theoretical position of the vertices of the conductor segments of the coil in a normal non-overlapping state, and the second part of the conductor segment is at least a portion of the conductor segments in the first part of the conductor segment. The quality of the coil winding is determined based on the distance between the apex of the multiple conductor segments or the first portion of the conductor segments and the reference straight line.
2. The method of claim 1, wherein, Between the step of determining the positions of multiple conductor segments of the coil based on the image to be tested and the step of determining the position of the conductor vertex of the first portion of conductor segments based on the position of the first portion of conductor segments, the method further includes: Calculate the length of the corresponding conductor segment in the direction perpendicular to the predetermined direction based on the position of each conductor segment among the multiple conductor segments; The reference length is determined based on the lengths of the multiple conductor segments; Filter out the conductor segments whose length is less than the reference length from the multiple conductor segments to obtain the first part of the conductor segments.
3. The method of claim 1 or 2, wherein, The determination of the reference length based on the lengths of the multiple conductor segments includes: The median or average length of the multiple conductor segments is taken to obtain the reference length.
4. The method of claim 1 or 2, wherein, The determination of the reference straight line based on the position of the vertices of the second section of the conductor segment includes: For each pair of adjacent conductor segments in the first part of the conductor segments, determine the line connecting the vertices of the two adjacent conductor segments; Calculate the angle between each connecting line and the predetermined direction; Remove lines whose angle is greater than the first preset angle threshold; The remaining lines are fitted with straight lines to obtain the reference straight line; The second part of the conductor segment refers to the conductor segment corresponding to the line that participates in the straight line fitting.
5. The method of claim 1 or 2, wherein, Determining the positions of multiple conductor segments of the coil based on the image to be tested includes: A target region is determined based on the image to be tested, the target region including the at least one wire and the background; Remove the background from the target area to obtain the winding area to be tested; Based on the winding area to be tested, the positions of the multiple conductor segments are determined.
6. The method of claim 5, wherein, The step of determining the target region based on the image to be tested includes: Obtain a template image, on which a region of interest is marked to indicate the location of the wires on the coil; Based on the first identification feature in the template image, a second identification feature matching the first identification feature is determined in the image to be tested; Determine the positional offset between the image position of the first identification feature in the template image and the image position of the second identification feature in the image to be tested; Adjust the position of the region of interest on the template image according to the position offset; The region on the image to be tested that corresponds to the adjusted region of interest is determined as the target region.
7. The method of claim 5, wherein, The step of removing the background from the target area to obtain the winding area to be tested includes: Within the target area, the initial winding region is extracted by segmentation using a dynamic threshold method; A morphological closing operation is performed on the initial winding region in a direction perpendicular to the predetermined direction to obtain the winding region to be tested.
8. The method of claim 5, wherein, Determining the positions of the multiple conductor segments based on the winding region to be tested includes: A morphological opening operation is performed on the winding region to be tested in a direction perpendicular to the predetermined direction to divide the winding region to be tested into multiple independent conductor regions, each conductor region corresponding to a conductor segment. The positions of the multiple conductor segments are determined based on the multiple conductor regions.
9. The method of claim 8, wherein, Determining the positions of the multiple conductor segments based on the multiple conductor regions includes: The skeletons of the multiple conductor regions are extracted and trimmed to obtain the skeletons of the multiple conductor segments, wherein the skeleton of any conductor segment is used to indicate the position of the conductor segment.
10. The method of claim 5, wherein, The step of removing the background from the target area to obtain the winding area to be tested includes: Based on the target region, the edge contour of the test winding region after removing the background is extracted; The edge contour is used to indicate the location of the plurality of conductor segments, and the position of the conductor vertex of each conductor segment is represented by the corresponding position of the conductor segment on the edge contour.
11. The method of claim 10, wherein, The step of extracting the edge contour of the test winding region after removing the background based on the target region includes: Based on the target region, obtain the region images corresponding to the first color channel and the second color channel, respectively; Subtract the grayscale values of the region image corresponding to the first color channel from those of the region image corresponding to the second color channel to obtain an initial difference image; The background region containing the background is extracted by binarizing the initial difference image; Remove the background region from the target region; Extract the contour from the remaining area of the target area as the edge contour of the winding area to be tested.
12. The method of claim 10, wherein, The determination of the reference straight line based on the position of the vertices of the second section of the conductor segment includes: Extract continuous contour segments from the edge contour whose angle change value along the predetermined direction is less than a second preset angle threshold; When multiple continuous contour segments exist, the continuous contour segment in the middle position is selected; when a single continuous contour segment exists, the single continuous contour segment is selected. The selected continuous contour segment is fitted with a straight line to obtain the reference straight line; The second part of the guide segment is the guide segment corresponding to the selected continuous contour segment.
13. The method of claim 1 or 2, wherein, Determining whether the coil winding is qualified based on the distance between the vertices of the multiple conductor segments or the first portion of the conductor segments and the reference straight line includes: For each of the multiple conductor segments or the first part of the conductor segments, if the distance between the conductor vertex of the conductor segment and the reference line is greater than a preset distance threshold, the conductor segment is determined to be unqualified; if the distance between the conductor vertex of the conductor segment and the reference line is less than or equal to the preset distance threshold, the conductor segment is determined to be qualified, so as to obtain the qualified judgment result corresponding to the conductor segment. Based on the qualification judgment results corresponding to the multiple conductor segments or each conductor segment in the first part of the conductor segments, it is determined whether the winding of the coil is qualified.
14. A coil winding inspection apparatus, characterized by comprising: include: An acquisition module is used to acquire an image to be tested, wherein the image to be tested contains a coil formed by at least one wire wound in a predetermined direction; The first determining module is used to determine the positions of multiple conductor segments of the coil based on the image to be tested; The filtering module is used to calculate the length of the corresponding conductor segment in the direction perpendicular to the predetermined direction based on the position of each conductor segment in the plurality of conductor segments; it is also used to determine a reference length based on the length of the plurality of conductor segments; and it is also used to filter out conductor segments in the plurality of conductor segments whose length is greater than the reference length to obtain a first part of conductor segments. The second determining module is used to determine the position of the wire vertex of the first part of the wire segment based on the position of the first part of the wire segment, wherein the first part of the wire segment is at least a portion of the multiple wire segments; The third determining module is used to determine a reference straight line based on the position of the vertices of the second part of the conductor segment, wherein the reference straight line is the line connecting the vertices of qualified conductor segments, and the reference straight line is used to indicate the theoretical position of the vertices of the conductor segments of the coil in a non-overlapping normal state, and the second part of the conductor segment is at least a portion of the conductor segments in the first part of the conductor segment; The fourth determining module is used to determine whether the winding of the coil is qualified based on the distance between the vertices of the multiple conductor segments or the first part of the conductor segments and the reference straight line.
15. An electronic device, comprising: It includes a processor and a memory, the memory storing a computer program, the processor executing the computer program to implement the coil winding detection method as described in any one of claims 1-13.
16. A storage medium, characterized by The device stores a computer program / instructions that, when executed by a processor, implement the coil winding detection method as described in any one of claims 1-13.
Citation Information
Patent Citations
Object edge burr detection method and device and storage medium
CN113362308A
Inspection device of motor coil and inspection method
JP2006014470A