Visual detection method and system for metal wire winding gap, electronic equipment and medium

By capturing and processing inspection images of cylindrical magnetic cores using an industrial camera array, extracting the core contour and wire edges, and calculating the winding gap using radial scan lines, the problem of image distortion caused by the curvature of the cylindrical magnetic core is solved, achieving high-precision detection of the wire winding gap.

CN121883380APending Publication Date: 2026-04-17SUZHOU YIMAISHI OPTOELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SUZHOU YIMAISHI OPTOELECTRONICS TECH CO LTD
Filing Date
2025-12-20
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In the existing technology, image distortion caused by the curvature of the cylindrical magnetic core surface affects the visual detection accuracy of the wire winding gap, making it difficult to meet product quality control requirements.

Method used

The detection image is captured along the axis of the cylindrical magnetic core by an industrial camera group. The circular outline boundary of the cylindrical magnetic core is extracted and the coordinates of the core center and the projection radius are calculated. Combined with the angle and distance information of the radial scan line, the pixel coordinates are projected onto the cylindrical coordinate system of the magnetic core. The cylindrical arc length distance between the edge contours of adjacent metal wires is calculated to eliminate the influence of image distortion.

Benefits of technology

This improves the accuracy of visual inspection of the gap in the wire winding, ensuring the precision and reliability of the inspection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121883380A_ABST
    Figure CN121883380A_ABST
Patent Text Reader

Abstract

The invention discloses a visual detection method and system for a metal wire winding gap, electronic equipment and a medium, and relates to the technical field of image processing. The method comprises the following steps: acquiring an axial parallel detection image of a metal wire on a cylindrical magnetic core through an industrial camera; performing magnetic core boundary detection on the image, extracting a circular contour boundary and calculating a circle center coordinate and a projection radius; based on the circle center position and the radius, radial scanning lines are generated according to preset angle intervals; metal wire edge detection is carried out on the image, and pixel point coordinates of adjacent metal wire edge contour lines are extracted; projecting the coordinates of the pixel points to the cylindrical surface of the magnetic core by using the angle and distance information of the radial scanning line to obtain the cylindrical surface coordinates of the edge contour line; and finally, calculating the cylindrical arc distance between the edge contour lines of the adjacent metal wires to obtain a winding gap detection result. By implementing the technical scheme provided by the invention, the visual detection accuracy of the metal wire winding gap can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to a visual detection method, system, electronic device, and medium for the gap of metal wire winding. Background Technology

[0002] With the trend towards miniaturization and high performance of electronic components, increasingly stringent requirements are being placed on the winding quality of metal wires in the production of magnetic components such as transformers and inductors. The uniformity of the gaps between the metal wires directly affects the electrical performance and reliability of the magnetic components; therefore, strict inspection of the winding gaps of the metal wires is necessary during the production process.

[0003] Currently, machine vision technology is widely used in industrial production to detect the winding gaps of metal wires. This is achieved by placing a single industrial camera around the magnetic core to acquire images of the metal wires, and then using image processing techniques to extract the wire edge features and calculate the gap distance between adjacent wires.

[0004] However, in practical applications, the curved surface of the cylindrical magnetic core causes image distortion when a single industrial camera captures the image, affecting the accuracy of edge feature extraction. This distortion deforms the edge contours of the metal wires in the image, resulting in low accuracy in visually detecting gaps in the wire winding, making it difficult to meet product quality control requirements. Summary of the Invention

[0005] This application provides a visual inspection method, system, electronic device, and medium for the gap in wire winding, which can improve the accuracy of visual inspection of the gap in wire winding.

[0006] In a first aspect, this application provides a visual detection method for the gap in wire winding, comprising: An industrial camera array is used to acquire detection images of a metal wire wound around a cylindrical magnetic core, wherein the shooting direction of the detection images is parallel to the axis of the cylindrical magnetic core. The detection image is subjected to magnetic core boundary detection to extract the circular outline boundary of the cylindrical magnetic core, and the center coordinate position of the magnetic core in the image coordinate system and the projection radius of the cylindrical magnetic core are calculated based on the circular outline boundary. Based on the center coordinates and the projection radius, the circular detection area centered on the magnetic core center is radially sampled at preset angle intervals to generate a radial scan line from the center to the circumference. The detected image is subjected to metal wire edge detection, the edge contour lines of adjacent metal wires are extracted, and the pixel coordinates of each edge contour line in the image coordinate system are obtained. By using the angle information and radial distance information of the radial scan line, the coordinate positions of each pixel point are projected onto the magnetic core cylinder to obtain the cylindrical coordinate positions of each edge contour line on the magnetic core cylinder. Based on the coordinate positions of each cylindrical surface, the cylindrical arc length distance between the edge contour lines of adjacent metal wires is calculated to obtain the detection result of the metal wire winding gap.

[0007] By employing the above technical solution, images are captured along the axial direction of the cylindrical magnetic core using an industrial camera array, avoiding image distortion caused by the curvature of the magnetic core surface during single-camera shooting. By extracting the circular outline boundary of the cylindrical magnetic core and calculating the core center coordinates and projection radius, combined with the angle and distance information of the radial scan lines, the pixel coordinates in the image coordinate system can be accurately projected onto the cylindrical surface coordinate system of the magnetic core, thus eliminating the influence of image distortion caused by the curvature of the magnetic core surface on edge feature extraction. Furthermore, by calculating the cylindrical arc length distance between the edge contours of adjacent metal wires, the actual winding gap of the metal wires on the magnetic core surface can be accurately obtained, improving the visual detection accuracy of the wire winding gap.

[0008] Optionally, a first industrial camera is positioned directly above the cylindrical magnetic core, with its optical axis parallel to the axial direction of the cylindrical magnetic core. A second and a third industrial camera are respectively positioned obliquely on both sides of the cylindrical magnetic core, with their optical axes parallel to the axial direction of the cylindrical magnetic core. A first ring light source is arranged within a preset coverage area of ​​the first industrial camera, and second ring light sources are respectively arranged within the preset coverage areas of the second and third industrial cameras, wherein the emitting surfaces of the first and second ring light sources face the surface of the cylindrical magnetic core. The luminous intensity of the first and second ring light sources is adjusted until the brightness difference between the metal wire and the surface of the cylindrical magnetic core is a preset brightness difference value. The first, second, and third industrial cameras are used as an industrial camera group, and the image of the surface of the cylindrical magnetic core is acquired through the industrial camera group as a detection image.

[0009] Optionally, the detected image is converted into a grayscale image, and Gaussian filtering is applied to the grayscale image for noise reduction. A segmentation threshold is determined based on the grayscale distribution characteristics of the grayscale image, and the filtered grayscale image is binarized according to the segmentation threshold to obtain a binarized image. Edge extraction is performed on the binarized image to obtain the edge contour of the cylindrical magnetic core. The Hough circle transform algorithm is used to fit the edge contour to a circular boundary to obtain the circular contour boundary of the cylindrical magnetic core.

[0010] Optionally, the coordinates of multiple boundary points uniformly distributed on the circular contour boundary are extracted, and the number of boundary point coordinates is not less than a preset multiple of the number of turns of metal wire wound on the cylindrical magnetic core; the boundary point coordinates are fitted to a circle using the least squares fitting method, and the fitting parameters are iteratively optimized until the fitting error is less than a preset threshold to obtain the center coordinates and radius value of the fitted circle; calibration points are set on the surface of the cylindrical magnetic core, and a scale relationship is established based on the pixel coordinates and physical coordinates of the calibration points in the detection image, and the radius value of the fitted circle is converted into the projection radius through the scale relationship; the center coordinates are mapped to the image coordinate system through perspective transformation to obtain the center coordinate position.

[0011] Optionally, within a circular detection area centered on the magnetic core's center, starting from the center's coordinates, multiple radial scan lines are generated at preset angle intervals, wherein the preset angle interval is less than the minimum angle between adjacent metal wires in the detection image. Based on the angle parameters and the projection radius, the sampling endpoint coordinates of each radial scan line are calculated, and an initial scan line pointing from the center's coordinates to the sampling endpoint coordinates is generated using a linear interpolation algorithm. The pixel coordinates on each radial scan line are traversed, and the initial scan line whose pixel coordinates are all within the circular contour boundary is taken as the radial scan line pointing from the center to the circumference.

[0012] Optionally, based on the angle information of the radial scan line, the circumferential angle coordinates of the cylindrical magnetic core are determined, and the radial distance information is normalized by the projection radius to obtain the radial distance ratio; the product of the actual radius of the cylindrical magnetic core and the radial distance ratio is used as the mapping radius, and the circumferential angle coordinates are used as the mapping angle to determine the projection position of the pixel point of each edge contour line on the surface of the cylindrical magnetic core; each projection position is converted into radial distance, circumferential angle and axial height coordinates in a cylindrical coordinate system with the central axis of the cylindrical magnetic core as the central axis to obtain the cylindrical coordinate position of each edge contour line on the cylindrical surface of the magnetic core.

[0013] Optionally, based on the coordinate positions of each cylindrical surface, the arc length of adjacent metal wires is determined; based on the arc length of the adjacent metal wires, the cylindrical arc length distance between the edge contour lines of the adjacent metal wires is calculated; based on the cylindrical surface coordinate positions, the width of the overlapping area of ​​the edge contour lines of the adjacent metal wires is calculated, and the ratio of the width of the overlapping area to the cross-sectional width of the metal wire is used as the winding overlap degree; the winding gap value corresponding to the cylindrical arc length distance is obtained; the change of the winding gap value and the winding overlap degree in the circumferential direction of the magnetic core cylindrical surface is calculated, and weighted calculation is performed in combination with the radial position deviation of the edge contour line of the metal wire relative to the standard winding position to obtain the winding tightness of the metal wire; the winding gap value, the winding overlap degree, and the winding tightness degree are used as the metal wire winding gap detection result.

[0014] A second aspect of this application provides a visual inspection system for the gap in wire winding, the system comprising: An image acquisition module is used to acquire detection images of a metal wire wound on a cylindrical magnetic core, wherein the shooting direction of the detection image is parallel to the axis of the cylindrical magnetic core; The radial scan line determination module is used to perform magnetic core boundary detection on the detection image, extract the circular contour boundary of the cylindrical magnetic core, and calculate the center coordinate position of the magnetic core in the image coordinate system and the projection radius of the cylindrical magnetic core based on the circular contour boundary; based on the center coordinate position and the projection radius, the circular detection area centered on the magnetic core center is radially sampled at a preset angle interval to generate a radial scan line from the center to the circumference; The coordinate position determination module is used to perform metal wire edge detection on the detection image, extract the edge contour lines of adjacent metal wires, and obtain the pixel coordinate positions of each edge contour line in the image coordinate system; and project the coordinate positions of each pixel point onto the magnetic core cylinder surface through the angle information and radial distance information of the radial scan line to obtain the cylindrical coordinate positions of each edge contour line on the magnetic core cylinder surface. The winding gap detection module is used to calculate the cylindrical arc length distance between the edge contour lines of adjacent metal wires based on the coordinate positions of each cylindrical surface, and obtain the winding gap detection result of the metal wires.

[0015] A third aspect of this application provides an electronic device including a memory, a processor, and a program stored in the memory and executable on the processor, the program being loaded and executed by the processor to implement a visual detection method for gaps in wire winding.

[0016] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement a visual detection method for gaps in wire winding.

[0017] In summary, one or more technical solutions provided in this application have at least the following technical effects or advantages: By employing the above technical solution, images are captured along the axial direction of the cylindrical magnetic core using an industrial camera array, avoiding image distortion caused by the curvature of the magnetic core surface during single-camera shooting. By extracting the circular outline boundary of the cylindrical magnetic core and calculating the core center coordinates and projection radius, combined with the angle and distance information of the radial scan lines, the pixel coordinates in the image coordinate system can be accurately projected onto the cylindrical surface coordinate system of the magnetic core, thus eliminating the influence of image distortion caused by the curvature of the magnetic core surface on edge feature extraction. Furthermore, by calculating the cylindrical arc length distance between the edge contours of adjacent metal wires, the actual winding gap of the metal wires on the magnetic core surface can be accurately obtained, improving the visual detection accuracy of the wire winding gap. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating a visual inspection method for the gap in wire winding provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a visual inspection system for the gap of wire winding provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0019] Explanation of reference numerals in the attached drawings: 300, electronic device; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. Detailed Implementation

[0020] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0021] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0022] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0023] This application provides a visual inspection method for the gap in wire winding. In one embodiment, please refer to... Figure 1 , Figure 1 This is a flowchart illustrating a visual inspection method for wire winding gaps provided in this application. This method can be implemented using a computer program, which can be integrated into an application or run as a standalone utility application. The method can also be implemented using a microcontroller or run on a von Neumann-based visual inspection system for wire winding gaps. Specifically, the method may include the following steps: Step 101: Obtain a detection image of the metal wire wound on the cylindrical magnetic core using an industrial camera group. The shooting direction of the detection image is parallel to the axis of the cylindrical magnetic core.

[0024] Among them, industrial camera group refers to an image acquisition system composed of multiple industrial cameras, used to acquire image information of the object under test from different angles; cylindrical magnetic core refers to a magnetic material element with a cylindrical shape, used to wind metal wires to form a transformer or inductor; metal wire refers to the conductive metal wire wound on the surface of the magnetic core, usually copper or aluminum wire; detection image refers to the digital image containing image information of the object under test acquired by the industrial camera; axial parallel means that the optical axis of the camera is parallel to the central axis of the cylindrical magnetic core.

[0025] Specifically, this step is performed before detecting the gap in the wire winding and is used to acquire image data of the object to be inspected. First, the cylindrical magnetic core is fixed on the inspection station, ensuring its axis is perpendicular to the horizontal plane. Then, the position and angle of each camera in the industrial camera group are adjusted so that its optical axis is parallel to the magnetic core axis, and the field of view covers the entire inspection area. Simultaneously, a corresponding ring light source is configured, and its brightness is adjusted to create a suitable contrast between the wire and the magnetic core surface. Finally, images are simultaneously acquired through the industrial camera group to obtain inspection images containing information about the wire winding status. During the acquisition process, it is necessary to ensure that the images are clear, properly exposed, and free from severe reflections and obstructions.

[0026] In some embodiments, the acquisition of the detection image can be achieved in several ways: Optionally, a three-camera collaborative acquisition scheme can be adopted: First, a main camera is installed at a 90-degree position directly above the magnetic core, and the focal length is adjusted so that the magnetic core fills the frame; then, two auxiliary cameras are symmetrically installed at 45-degree angles on both sides of the magnetic core, ensuring that their fields of view partially overlap with the main camera; finally, a ring light source is configured and the exposure parameters of the three cameras are adjusted to achieve synchronous triggering of acquisition. Optionally, a single-camera multi-angle acquisition scheme can be adopted: First, a single camera is fixed directly above the magnetic core to acquire a top view image; then, a precision turntable drives the magnetic core to rotate by a preset angle, acquiring side view images at different angles; finally, the acquired multiple images are stitched and fused to reconstruct a complete detection image. It is understood that other image acquisition methods can also be used to acquire the detection image, such as using a ring array camera, a line scan camera, etc., which are not limited here.

[0027] Based on the above embodiments, as an optional embodiment, step 101, which involves acquiring a detection image of the metal wire wound on the cylindrical magnetic core using an industrial camera group, may further include the following steps: Step 201: A first industrial camera is set directly above the cylindrical magnetic core, with the optical axis of the first industrial camera parallel to the axial direction of the cylindrical magnetic core; a second industrial camera and a third industrial camera are respectively set at an angle on both sides of the cylindrical magnetic core, with the optical axes of the second industrial camera and the third industrial camera parallel to the axial direction of the cylindrical magnetic core.

[0028] Among them, the optical axis represents the central axis of light propagation in the camera's optical system, which is used to determine the imaging direction of the camera; axial parallelism refers to the spatial positional relationship where the angle between two direction vectors is zero degrees; tilt setting indicates that the camera mounting bracket forms a certain angle with the horizontal plane; directly above refers to the spatial position that is perpendicular to the horizontal plane and located above the object being measured.

[0029] Specifically, the arrangement of industrial cameras is a crucial step in achieving visual inspection of gaps in wire winding. First, the first industrial camera is fixed on a dedicated bracket, positioned directly above the cylindrical magnetic core. The bracket height is adjusted to ensure the distance between the camera and the top surface of the magnetic core is 300-500mm, while simultaneously ensuring the camera's optical axis coincides with the central axis of the magnetic core. Next, a second and third industrial camera are installed on either side of the magnetic core, with the angle between each camera and the horizontal plane set to 45 degrees, and kept parallel to the magnetic core's axis. The six-degree-of-freedom positions of the three cameras are adjusted using a precision adjustment mechanism, ensuring their fields of view cover the upper and lateral areas of the magnetic core surface, respectively. The fields of view of the three cameras need to have a certain overlap, typically set at 20%-30%, to ensure accurate image stitching. Simultaneously, the working distance of the three cameras should be consistent, and the focal length should be selected appropriately based on the size of the inspection area to ensure the image sharpness meets the requirements for edge feature extraction. The camera's optical axis is calibrated using a laser level, and the tilt angle is measured using an angle meter. Finally, the field of view coverage and imaging effect of each camera are verified using image acquisition software, completing the camera arrangement.

[0030] Step 202: Arrange a first ring light source within the preset coverage area of ​​the first industrial camera, and arrange second ring light sources within the preset coverage areas of the second and third industrial cameras respectively, wherein the light-emitting surfaces of the first and second ring light sources face the surface of the cylindrical magnetic core.

[0031] Among them, the preset coverage area represents the effective imaging area of ​​the industrial camera, which is usually determined by the field of view and working distance; the ring light source refers to the LED light source components distributed in a ring shape, used to provide uniform illumination; the emitting surface refers to the surface area of ​​the light source that emits light; and the orientation indicates the spatial positional relationship between the light source's emission direction and the illuminated object.

[0032] Specifically, the arrangement of the light sources is a crucial factor in ensuring image quality. The first ring light source is installed around the lens of the first industrial camera. The inner diameter of the light source is larger than the lens diameter, and the outer diameter is determined based on the working distance, typically chosen so that the ratio of the outer diameter to the working distance is between 0.5 and 0.8. The center of the light source coincides with the camera's optical axis, and the installation height ensures that the distance between the emitting surface and the top surface of the magnetic core is within the range of 150-250mm. Second ring light sources are installed around the lenses of the tilted cameras on both sides. Due to the 45-degree tilt angle, elliptical or irregularly shaped ring light sources are required to ensure that the illuminated area completely covers the sides of the magnetic core. The emitting surfaces of the side light sources are parallel to the surface of the magnetic core, and the illumination distance is consistent with that of the top light source. All light sources use high color rendering index LEDs with a color temperature of 5000K-6500K to ensure the contrast of the metal wire image. The power of the light sources needs to be selected based on the working distance and the degree of ambient light interference, generally within the range of 50-200W. By adjusting the luminous intensity of each light source, a clear transition between light and dark is achieved at the edge of the metal wire in the image. The brightness ratio of the top and side light sources is fine-tuned based on the actual image acquisition results until the optimal edge detection effect is achieved. The power supply and control signals of the light sources are uniformly managed through a dedicated controller to ensure synchronous triggering and stable operation.

[0033] Step 203: Adjust the luminous intensity of the first ring light source and the second ring light source until the brightness difference between the metal wire and the cylindrical magnetic core surface is a preset brightness difference value; use the first industrial camera, the second industrial camera and the third industrial camera as an industrial camera group, and use the industrial camera group to acquire the image of the cylindrical magnetic core surface as the detection image.

[0034] Among them, luminous intensity represents the amount of luminous flux emitted per unit area of ​​the light source, usually measured in lux; brightness difference refers to the numerical difference between the gray values ​​of two regions in an image; preset brightness difference represents the target brightness difference value set to ensure the image feature detection effect; industrial camera group refers to an image acquisition system composed of multiple industrial cameras arranged in a specific spatial layout.

[0035] Specifically, the light source intensity adjustment and image acquisition process consists of several steps. First, a preset brightness difference is set, typically between 80-120 for the grayscale difference between the metal wire area and the magnetic core surface. This range ensures accurate edge detection. During adjustment, the first ring light source's luminous intensity is initially set to 50% of its rated power. After image acquisition, the average grayscale values ​​of the metal wire area and the magnetic core surface are measured using image processing software, and the difference is calculated. Based on the measurement results, the light source power is gradually adjusted in increments of 5%-10% until the preset brightness difference is reached. For the second ring light source, the luminous intensity of both sides is adjusted using the same method. Due to the difference in incident angles, the power of the side light source typically needs to be 20%-30% higher than that of the top light source. After completing the light source adjustment, the parameters of the three industrial cameras are set to the same values, including exposure time of 1-2ms, gain of 0-6dB, and aperture of F4-F8. The image acquisition software is then started, and the camera's synchronous trigger mode is set to ensure that all three cameras acquire images simultaneously. The acquired images are set to a resolution of 2048×1536 pixels, a bit depth of 8 bits, and a lossless compressed BMP or TIFF format. Each time the system is triggered, it acquires three images, corresponding to a top view and two side views of the magnetic core, which together constitute the detection image set.

[0036] Step 102: Perform magnetic core boundary detection on the detection image, extract the circular contour boundary of the cylindrical magnetic core, and calculate the center coordinate position of the magnetic core in the image coordinate system and the projection radius of the cylindrical magnetic core based on the circular contour boundary.

[0037] Among them, core boundary detection refers to the process of identifying and locating the outer contour of the magnetic core through image processing algorithms; circular contour boundary refers to the projection boundary curve of the cylindrical magnetic core on the two-dimensional image plane; the center coordinate position represents the position of the center point of the circular projection of the magnetic core in the image coordinate system, usually represented by (x, y) coordinates; the image coordinate system refers to a two-dimensional rectangular coordinate system with the upper left corner of the image as the origin, the positive x-axis to the right, and the positive y-axis downward; the projection radius represents the radius of the circular projection of the cylindrical magnetic core on the imaging plane, used to characterize the actual size of the magnetic core.

[0038] Specifically, this step is performed immediately after acquiring the detection image and is used to determine the position and size parameters of the magnetic core. First, the acquired detection image is preprocessed, including image grayscale conversion and noise reduction filtering to improve image quality. Then, an adaptive threshold segmentation method is used to binarize the image, highlighting the difference between the magnetic core region and the background. Next, an edge detection operator is used to extract the magnetic core contour, obtaining a set of edge points. Then, using methods such as Hough circle transform or least squares circle fitting, the edge point set is fitted to a standard circle to obtain the circular contour boundary. Finally, based on the fitted circular parameters and combined with camera calibration information, the precise position of the magnetic core center in the image coordinate system is calculated, and the actual projected radius of the magnetic core is determined through projection transformation.

[0039] In some embodiments, the detection and parameter calculation of the magnetic core boundary can be achieved in various ways: Optionally, an edge detection-based method can be used: First, the image is Gaussian smoothed to reduce noise interference; then, the Canny operator is used for edge detection to obtain a binarized edge map; next, probabilistic Hough circle transform is applied to detect the circular boundary, and the center position and radius are determined by voting accumulation; finally, sub-pixel edge localization technology is used to optimize the boundary position and improve detection accuracy. Optionally, a region segmentation-based method can be used: First, the OTSU algorithm is used to calculate the optimal segmentation threshold; then, the image is adaptively binarized to obtain a magnetic core region mask; then, morphological operations are used to optimize the region, removing noise and filling holes; then, the region contour point set is extracted, and the least squares method is used to fit a circle and iteratively optimize the fitting parameters; finally, the actual size parameters are calculated through the mapping relationship between the image coordinate system and the world coordinate system. It is understood that other boundary detection and parameter calculation methods can also be used, such as deep learning-based object detection, template matching-based contour extraction, etc., which are not limited here.

[0040] Based on the above embodiments, as an optional embodiment, step 102: performing magnetic core boundary detection on the detection image and extracting the circular contour boundary of the cylindrical magnetic core, this step may further include the following steps: Step 201: Convert the detected image into a grayscale image and perform Gaussian filtering noise reduction on the grayscale image; determine the segmentation threshold based on the grayscale distribution characteristics of the grayscale image, and perform binarization processing on the filtered grayscale image according to the segmentation threshold to obtain a binarized image.

[0041] Among them, grayscale image refers to a single-channel image in which each pixel contains only brightness information, and the pixel value ranges from 0 to 255; Gaussian filtering refers to an image smoothing filtering method that uses a Gaussian function as weights; grayscale distribution characteristics refer to the statistical characteristics of pixel grayscale values ​​in an image, such as the peak and valley values ​​of the grayscale histogram; segmentation threshold refers to the grayscale critical value used to segment an image into target region and background region; binarization processing refers to the process of converting a grayscale image into one that contains only black and white pixel values.

[0042] Specifically, the image preprocessing and segmentation process involves several steps. First, the RGB color detection image is converted to a grayscale image using a weighted average method. The conversion formula is Gray = 0.299 × R + 0.587 × G + 0.114 × B, where R, G, and B represent the pixel values ​​of the red, green, and blue channels, respectively. Next, Gaussian filtering is applied to the grayscale image for noise reduction. A 5 × 5 Gaussian kernel is selected, with a standard deviation σ set to 1.0. Filtering is achieved through two-dimensional discrete convolution. The Gaussian kernel is generated using the formula G(x, y) = (1 / 2πσ²) × exp(-(x² + y²) / 2σ²). Then, the grayscale histogram of the image is analyzed, and the peak positions and peak-valley features are calculated. Based on the histogram features, the OTSU algorithm is used to adaptively calculate the optimal segmentation threshold. This algorithm determines the threshold by maximizing the inter-class variance. The specific calculation process is as follows: First, the probability of each gray level occurring is calculated. Then, all possible thresholds are iterated, and the average gray value and inter-class variance of the foreground and background classes are calculated. Finally, the gray value that maximizes the inter-class variance is selected as the segmentation threshold. Finally, this threshold is used to binarize the filtered grayscale image, setting pixels greater than the threshold to 255 (white) and pixels less than the threshold to 0 (black), resulting in a binarized image that clearly distinguishes the target from the background.

[0043] Step 202: Extract edges from the binarized image to obtain the edge contour of the cylindrical magnetic core; use the Hough circle transform algorithm to fit the edge contour to a circular boundary to obtain the circular contour boundary of the cylindrical magnetic core.

[0044] Edge extraction refers to the process of detecting and extracting object boundaries from an image, usually based on gradient changes in pixel gray values; edge contour refers to a set of continuous pixels that describe the boundary of a target object; the Hough circle transform algorithm is a parametric transformation method for detecting circular structures in an image; circular contour boundary represents a standard circular boundary curve obtained by fitting a mathematical method.

[0045] Specifically, the edge detection and circle fitting process involves multiple steps. First, edge extraction is performed on the binarized image using the Canny edge detection operator, which includes four steps: Gaussian filtering, gradient calculation, non-maximum suppression, and double thresholding. In practice, a 3×3 Sobel operator is used to calculate the gradients in the x and y directions of the image. The gradient magnitude is calculated using the formula M(x, y) = sqrt(Gx² + Gy²), and the gradient direction is calculated using the formula θ(x, y) = arctan(Gy / Gx). Then, non-maximum suppression is performed, comparing the gradient magnitudes along the gradient direction and retaining local maxima. A double thresholding method is used to filter edge points, with a high threshold of 100 and a low threshold of 40. Points above the high threshold are considered strong edges, while points between the high and low thresholds and connected to strong edges are considered weak edges; other points are suppressed. After obtaining the edge point set, Hough circle transform is applied for circle fitting. The Hough circle transform transforms points in a two-dimensional image space to a three-dimensional parameter space (a, b, r), where (a, b) are the coordinates of the circle's center and r is the radius. For each edge point, all possible parameter combinations satisfying the circle equation (xa)² + (yb)² = r² are calculated in the parameter space, and a vote is taken in an accumulator array. By setting a voting threshold and searching for local maxima, the parameter combination with the most votes is found, which is the parameter for fitting the circle. Finally, a standard circular boundary is drawn based on these parameters, resulting in the circular contour boundary of the cylindrical magnetic core.

[0046] Based on the above embodiments, as an optional embodiment, step 102, which calculates the center coordinates of the magnetic core in the image coordinate system and the projected radius of the cylindrical magnetic core based on the circular contour boundary, may further include the following steps: Step 203: Extract the coordinates of multiple boundary points evenly distributed on the circular contour boundary. The number of boundary point coordinates shall not be less than a preset multiple of the number of turns of metal wire wound on the cylindrical magnetic core. Use the least squares fitting method to fit the boundary point coordinates to a circle, and iteratively optimize the fitting parameters until the fitting error is less than a preset threshold to obtain the initial center coordinates and radius value of the fitted circle.

[0047] Among them, the boundary point coordinates represent the two-dimensional spatial position of the sampling points on the circular contour boundary, represented by pixel coordinates (x, y); the number of turns refers to the number of complete turns of the metal wire wound on the cylindrical magnetic core; the preset multiple represents the proportional relationship between the number of boundary points and the number of turns; the least squares fitting is a mathematical method to determine the optimal fitting parameters by minimizing the sum of squared errors; the fitting error refers to the distance deviation from the actual boundary point to the fitted circle.

[0048] Specifically, the boundary point extraction and circle fitting process includes the following steps. First, determine the number of boundary point samples, calculated by multiplying the number of wire turns by a preset factor. For example, if the number of wire turns is 100, and the preset factor is set to 3, then the number of sampling points is 300. Sampling is performed at equal angular intervals on the circular contour boundary, with the sampling angle interval θ = 360° / number of sampling points. The coordinates of each sampling point are obtained using a boundary tracking algorithm. Then, the least squares method is used for circle fitting. Let the parametric equation of the fitted circle be (xa)² + (yb)² = r², where (a, b) are the initial center coordinates and r is the radius. For each boundary point (xi, yi), calculate the distance error from it to the fitted circle: di = sqrt((xi-a)² + (yi-b)²) - r. An error sum of squares function F(a, b, r) = Σdi² is constructed, and initial fitting parameters are obtained by solving three equations: ∂F / ∂a = 0, ∂F / ∂b = 0, and ∂F / ∂r = 0. An iterative algorithm is used to optimize the fitting parameters. In each iteration, the parameter increment is calculated and the parameter values ​​are updated until the parameter change between two adjacent iterations is less than 0.001 pixels or the error sum of squares is less than a preset threshold (usually set to 0.1% of the number of boundary points). Finally, the optimized center coordinates (a, b) and radius value r are output, and these parameters accurately describe the circular boundary characteristics of the cylindrical magnetic core.

[0049] Step 204: Set calibration points on the surface of the cylindrical magnetic core. Based on the pixel coordinates and physical coordinates of the calibration points in the detection image, establish a scale relationship and convert the radius value of the fitted circle into the projection radius through the scale relationship. Map the initial center coordinates to the image coordinate system through perspective transformation to obtain the center coordinate position.

[0050] Among them, calibration points refer to reference marks set on the surface of cylindrical magnetic cores to establish dimensional correspondences; pixel coordinates refer to the positional values ​​of a point in the image; physical coordinates refer to the positional dimensions in actual space; scale relationship refers to the conversion relationship between image size and actual size; perspective transformation refers to the coordinate transformation method when projecting a three-dimensional object onto a two-dimensional plane.

[0051] Specifically, the calibration and coordinate transformation process involves several steps. First, four black circular calibration points are set on the surface of the cylindrical magnetic core, arranged in a rectangular pattern with a spacing of 20 mm. High-precision measuring tools are used to measure the three-dimensional position coordinates of each calibration point relative to the center of the magnetic core's bottom surface, and these physical coordinate values ​​are recorded. Image processing software is used to extract the positions of the calibration points in the image, and the pixel coordinates of the calibration points are calculated using the centroid method, which provides sub-pixel-level positioning accuracy. A correspondence is established between the physical coordinates and pixel coordinates of the calibration points, and the conversion coefficient between pixel size and actual size is calculated. Specifically, the physical distance and pixel distance between adjacent calibration points are calculated, and the scaling factor is determined by averaging multiple sets of data. This scaling factor is used to convert the pixel value of the circle radius obtained in the previous step into the actual projected radius value. For the initial circle center coordinates, the perspective effect during camera imaging needs to be considered, and a coordinate transformation relationship is established based on the correspondence of the calibration points. This transformation takes into account the camera's installation angle and distance factors, accurately mapping the initial coordinates of the fitted circle center to the image coordinate system. The transformed circle center coordinate position is the reference position required for subsequent processing. The entire process was completed automatically by software, ensuring the accuracy of the coordinate transformation.

[0052] Step 103: Based on the center coordinates and projection radius, the circular detection area centered on the magnetic core center is radially sampled at preset angle intervals to generate a radial scan line from the center to the circumference.

[0053] Among them, the circular detection area represents the circular range to be detected centered on the center of the magnetic core; the preset angle interval refers to the angle between two adjacent radial scan lines; radial sampling represents the process of sampling at equal intervals from the center to the circumference; the radial scan line refers to the straight sampling path from the center to the circumference; the circumference represents the set of points on the circular boundary; and the sampling point represents the discrete data points acquired on the scan line.

[0054] Specifically, this step is performed after obtaining the center position and projection radius of the magnetic core, and is used to establish the reference path for image scanning. First, a preset angle interval value is determined based on the winding characteristics of the metal wires. This angle value should be less than the minimum angle between adjacent metal wires in the image, typically set to 0.5 to 1 degree. Starting from the center coordinate position, an angle sequence is generated within the range of 0 to 360 degrees according to the preset angle interval. For each angle value, the coordinate position of the scanning endpoint on the circumference is calculated. A pixel-level sampling point sequence is generated between the center and the endpoint using a linear interpolation algorithm, with a sampling interval of 1 pixel. Valid radial scanning lines are selected by verifying that the sampling points on each scanning line are all within the circular boundary. Finally, a set of scanning paths uniformly diverging from the center is formed, covering the entire circular detection area.

[0055] In some embodiments, radial scan lines can be generated in several ways: Optionally, a polar coordinate transformation method can be used: First, the circular region is transformed into a polar coordinate system to establish a gridded sampling matrix of angles and radii; then, a sampling angle sequence is calculated according to a preset angle interval; next, trigonometric functions are used to calculate the coordinates of the scan line endpoints corresponding to each angle; finally, the Bressenham line algorithm is used to generate a pixel-level scan path. Optionally, a vector scanning method can be used: First, a unit vector is constructed as a reference direction; then, angle increments are achieved through matrix rotation, and the unit vector in each direction is calculated; next, the unit vector is extended radially to the circumference to form a complete scan path; finally, the scan path is pixelated to ensure sampling continuity. It is understood that other scan line generation methods, such as adaptive angle division and curve fitting scanning, can also be used to achieve radial sampling, which is not limited here.

[0056] Based on the above embodiments, as an optional embodiment, in step 103: based on the center coordinate position and projection radius, the circular detection area centered on the magnetic core center is radially sampled at preset angle intervals to generate a radial scan line from the center to the circumference. This step may further include the following steps: Step 301: Within the circular detection area centered on the magnetic core, starting from the coordinate position of the center, generate the angle parameters of multiple radial scan lines at preset angle intervals. The value of the preset angle interval is less than the minimum included angle between adjacent metal wires in the detection image.

[0057] Among them, the circular detection area represents the circular image range containing the target to be detected; the angle parameter refers to the angle between the radial scan line and the horizontal direction; the preset angle interval represents the angle difference between two adjacent scan lines; and the minimum angle refers to the minimum angle interval between two adjacent wound metal wires in the image.

[0058] Specifically, this step is performed after the center position is determined and is used to generate an angle parameter sequence covering the entire detection area. First, the winding parameters of the metal wire are obtained, including the number of turns and the winding pitch. Based on the winding pitch, the projected angle between adjacent metal wires on the image plane is calculated. This angle is related to the winding pitch and the core diameter. For example, when the metal wire winding pitch is 2 mm and the core diameter is 20 mm, the minimum angle between adjacent metal wires is approximately 5.7 degrees. A preset angle interval is set to 1 / 6 of the minimum angle to ensure at least 6 scan lines between adjacent metal wires. Starting from 0 degrees, the angle parameter sequence is generated incrementally according to the preset angle interval until 360 degrees is reached. Each angle parameter records the direction information of the corresponding scan line, which will be used to generate subsequent scan lines. By reasonably setting the angle interval, the integrity of the detection is ensured while avoiding computational redundancy caused by overly dense sampling. Simultaneously, because the preset angle interval is less than the minimum angle between adjacent metal wires, a sufficient number of scan lines are guaranteed between each pair of adjacent metal wires, improving the reliability and accuracy of the detection.

[0059] Step 302: Calculate the sampling endpoint coordinates of each radial scan line based on the angle parameters and projection radius, and generate an initial scan line pointing from the center coordinates to the sampling endpoint coordinates using a linear interpolation algorithm.

[0060] Among them, the sampling endpoint coordinates represent the position of the termination point of the radial scan line on the circumference; the linear interpolation algorithm refers to the calculation method for generating a continuous sequence of pixels between two points; the initial scan line represents the complete pixel sequence pointing from the center of the circle to the circumference; and the projection radius refers to the radius length of the circular detection area on the image plane.

[0061] Specifically, this step is performed after obtaining the angle parameter sequence, which is used to generate the actual scan line pixel sequence. First, the endpoint coordinates of each scan line are calculated using the angle parameters and the projection radius. The calculation formula is: the endpoint x-coordinate equals the center x-coordinate plus the projection radius multiplied by the angle cosine; the endpoint y-coordinate equals the center y-coordinate plus the projection radius multiplied by the angle sine. For each scan line, the Bresenham line interpolation algorithm is used to generate a continuous sequence of pixels between the center and endpoint. This algorithm determines the pixel position by accumulating error terms, ensuring that the generated line pixels are continuous and non-repeating. In practice, the slope of the line is first calculated, and the x-axis or y-axis is selected as the main scanning direction based on the absolute value of the slope. Then, the slope is gradually increased along the main scanning direction, and the error accumulation determines whether to move one pixel in the secondary direction. In this way, each scan line is discretized into a series of continuous pixel coordinates, arranged in order from the center to the circumference, forming the initial scan line. The pixel sequence of all scan lines is recorded for subsequent image sampling and feature extraction. The number of scan lines generated is determined by the angle interval. For example, when the angle interval is 1 degree, a total of 360 initial scan lines are generated.

[0062] Step 303: Traverse the pixel coordinates on each radial scan line, and take the initial scan line where all pixel coordinates are within the circular contour boundary as the radial scan line from the center of the circle to the circumference.

[0063] In this context, pixel coordinates represent the position of each sampling point on the scan line in the image; traversal refers to checking each pixel on the scan line in sequence; circular contour boundary refers to the outer boundary of the detection area; and radial scan line represents the validated effective scan path.

[0064] Specifically, this step is performed after generating the initial scan lines to filter valid scan lines. First, the mathematical description of the circular contour boundary is obtained, including the center coordinates and radius. For each initial scan line, all pixels on it are checked sequentially, starting from the center. The distance from each pixel to the center is calculated and compared to the radius of the circular contour boundary. If the distances of all pixels on the scan line are less than or equal to the boundary radius, the scan line is considered to be completely within the detection area and is marked as a valid radial scan line. Conversely, if any pixel's distance is greater than the boundary radius, the scan line is considered to be outside the detection area and is removed from the scan line set. This verification method ensures that all retained scan lines completely cover the area from the center to the boundary, avoiding the problem of sampling outside the target range. The filtered set of radial scan lines forms the basis for subsequent feature extraction. Furthermore, the angle parameters and length information of each valid scan line need to be recorded; this information will be used to determine the sampling position and calculate the actual distance.

[0065] Step 104: Perform metal wire edge detection on the detection image, extract the edge contour lines of adjacent metal wires, and obtain the pixel coordinates of each edge contour line in the image coordinate system.

[0066] Among them, metal wire edge detection refers to the process of identifying the boundary of metal wires through image processing algorithms; edge contour line represents a continuous curve describing the shape of the metal wire boundary; pixel point coordinate position refers to the two-dimensional position representation of the edge point in the image coordinate system; image coordinate system refers to a two-dimensional rectangular coordinate system with the upper left corner of the image as the origin; adjacent metal wires refer to two wires that are adjacent to each other on the surface of the magnetic core.

[0067] Specifically, this step is performed after the radial scan line generation is completed, and is used to extract the edge features of the metal wire. First, the detection image is preprocessed, including image enhancement and noise suppression. Adaptive histogram equalization is used to improve image contrast, and a Gaussian filter is used to reduce image noise. Then, the gradient magnitude and direction of the image are calculated, and the Sobel operator is selected to calculate the gradients in the horizontal and vertical directions respectively. Non-maximum suppression is applied to the gradient image to retain local maximum gradient points. A double thresholding method is used to detect and connect edges, with the high threshold set to 40% of the maximum gradient value and the low threshold set to 40% of the high threshold. The detected edges are then thinned to obtain edge contour lines with a single pixel width. Finally, the row and column numbers of each point on the edge contour line are converted to coordinate values ​​in the image coordinate system, and these coordinate values ​​are recorded for subsequent processing.

[0068] In some embodiments, the extraction and coordinate acquisition of the wire edge can be achieved in several ways: Optionally, a multi-scale edge detection method can be used: First, a Gaussian pyramid of the image is constructed to generate images at different scales; then, Canny edge detection is performed at each scale to obtain edge candidate points; next, the edge points at different scales are fused to remove false edges; finally, the fused edge points are fitted and smoothed to obtain a complete edge contour. Optionally, a region growing method can be used: First, seed points of the wire region are selected; then, the region is expanded to the surrounding area based on the gray-level similarity criterion; next, the boundary points of the expanded region are extracted as the edge contour; finally, the edge contour is refined and its coordinates are transformed. It is understood that other edge detection methods can also be used, such as edge extraction based on active contour models, morphological edge detection, etc., to achieve edge feature extraction, which is not limited here.

[0069] Step 105: Using the angle information and radial distance information of the radial scan line, project the coordinate position of each pixel point onto the magnetic core cylinder to obtain the cylindrical coordinate position of each edge contour line on the magnetic core cylinder.

[0070] Among them, the angle information represents the angle between the radial scan line and the reference direction; the radial distance information refers to the distance from the pixel to the center of the circle; the pixel coordinate position represents the two-dimensional position of the edge point on the image plane; the cylindrical coordinate position refers to the three-dimensional spatial position of the point after the cylinder is unfolded, including radial distance, circumferential angle and axial height; the magnetic core cylinder refers to the outer surface of the cylindrical magnetic core; and the edge contour line represents the continuous curve of the metal wire edge.

[0071] Specifically, this step is performed after obtaining the pixel coordinates of the edge contour lines, and is used to convert two-dimensional planar coordinates into three-dimensional cylindrical coordinates. First, the correspondence between the image coordinate system and the cylindrical coordinate system is determined, with the center of the circle set as the origin of the cylindrical coordinate system. The radial distance from each edge point to the center of the circle is calculated, and this distance is divided by the projected radius to obtain a normalized radial scaling factor. The angle value of the scan line is directly used as the circumferential angle of the cylindrical coordinate system. The axial height of the edge points is calculated based on the camera's imaging parameters, and the planar coordinates are mapped to cylindrical space considering the projection transformation relationship. The radial scaling factor is multiplied by the actual radius of the magnetic core to obtain the actual radial distance. Combining the circumferential angle and axial height, the coordinate transformation from the two-dimensional image to the three-dimensional cylinder is completed. Each edge contour line is mapped to its actual position on the cylinder; this positional information is used for subsequent gap measurement.

[0072] In some embodiments, coordinate projection and transformation can be achieved in various ways: Optionally, a geometric transformation method can be used: First, establish the geometric mapping relationship between the image plane and the cylinder; then, calculate the projection position of the edge points on the cylinder based on the projection principle; next, combine the camera calibration parameters to perform coordinate system transformation and obtain the cylinder coordinates of the edge points. Optionally, a depth mapping method can be used: First, construct a depth model of the cylinder; then, calculate the depth value of the edge points based on the angle and distance information of the scan lines; next, reconstruct the three-dimensional position of the edge points using the depth information and camera parameters. It is understood that other coordinate transformation methods can also be used, such as transformation methods based on three-dimensional reconstruction, transformation methods based on parametric modeling, etc., to achieve coordinate projection, which is not limited here.

[0073] Based on the above embodiments, as an optional embodiment, in step 105: the coordinate positions of each pixel are projected onto the magnetic core cylinder using the angle information and radial distance information of the radial scan line to obtain the cylindrical coordinate positions of each edge contour line on the magnetic core cylinder. This step may further include the following steps: Step 401: Based on the angle information of the radial scan line, determine the circumferential angle coordinates of the cylindrical magnetic core, and obtain the radial distance ratio by normalizing the radial distance information through the projection radius.

[0074] Among them, the angle information represents the angle between the radial scan line and the horizontal direction; the circumferential angle coordinate refers to the circumferential position angle of a point on the cylindrical surface; the radial distance information represents the straight-line distance from the midpoint of the image to the center of the circle; the projection radius refers to the radius of the projection circle of the cylindrical magnetic core on the image plane; the normalization process refers to the calculation process of converting the actual distance into a relative proportion; the radial distance ratio represents the ratio of the actual distance to the projection radius.

[0075] Specifically, this step is performed after edge detection to establish the correspondence between the image plane and the cylindrical space. First, the angle information of the radial scan lines is directly mapped to circumferential angle coordinates in the cylindrical coordinate system, keeping the angle values ​​constant. For each edge point, its Euclidean distance to the center of the circle is calculated; this distance is the radial distance information. The calculated radial distance is divided by the projection radius to obtain the normalized radial distance ratio. This ratio reflects the relative position of the edge point in the radial direction, ranging from 0 to 1. A ratio close to 0 indicates the point is near the center of the circle, while a ratio close to 1 indicates the point is near the circumferential boundary. This normalization process eliminates the influence of image size, facilitating the subsequent mapping of edge points to the actual cylindrical space. Each edge point obtains its corresponding circumferential angle coordinates and radial distance ratio; these two parameters together determine the point's position in the cylindrical unfolded space.

[0076] Step 402: Use the product of the actual radius of the cylindrical magnetic core and the ratio of the radial distance as the mapping radius, and the circumferential angle coordinates as the mapping angle to determine the projection position of the pixel points of each edge contour line on the surface of the cylindrical magnetic core.

[0077] Wherein, the actual radius represents the physical radius of the cylindrical magnetic core; the mapped radius refers to the radial distance of the edge point on the actual cylindrical surface; the mapped angle represents the circumferential angular position of the edge point on the cylindrical surface; the projected position refers to the actual spatial position of the edge point on the surface of the cylindrical magnetic core; the radial distance ratio represents the ratio of the distance from the midpoint of the image to the center of the circle to the projected radius; and the edge contour line pixels refer to the discrete sampling points describing the edge of the metal wire.

[0078] Specifically, this step is performed after obtaining the normalized distance ratio to determine the position of the edge points in actual space. First, the actual radius of the cylindrical core is obtained, either through pre-measurement or product specifications. The actual radius is multiplied by the radial distance ratio of each edge point to obtain the radial distance of that point on the actual cylindrical surface, i.e., the mapping radius. Keeping the circumferential angle coordinates unchanged, they are directly used as the mapping angle of the edge point on the cylindrical surface. Based on the mapping radius and mapping angle, polar coordinate transformation is used to calculate the projected position of the edge point on the cylindrical surface. The x-coordinate of the projected position is equal to the mapping radius multiplied by the cosine of the mapping angle, and the y-coordinate is equal to the mapping radius multiplied by the sine of the mapping angle. The same mapping calculation is performed on all pixels along the edge contour line to obtain the complete spatial distribution of the edge contour on the cylindrical surface. This mapping method preserves the shape characteristics of the edge contour while transforming it to the actual physical scale space.

[0079] Step 403: Convert each projection position into radial distance, circumferential angle and axial height coordinates in a cylindrical coordinate system with the central axis of the cylindrical magnetic core as the central axis, and obtain the cylindrical coordinate position of each edge contour line on the cylindrical surface of the magnetic core.

[0080] Among them, the projected position represents the position of the edge point in the spatial rectangular coordinate system; the central axis refers to the central axis of the cylindrical magnetic core; the cylindrical coordinate system refers to the three-dimensional polar coordinate system with the central axis as the central axis; the radial distance represents the perpendicular distance from the point to the central axis; the circumferential angle refers to the angular position of the point on the cross section; the axial height represents the position coordinate of the point in the axial direction; and the cylindrical coordinate position refers to the complete spatial position description of the point in the cylindrical coordinate system.

[0081] Specifically, this step is performed after the projection position is determined, and it is used to complete the final transformation of the coordinate system. First, a cylindrical coordinate system is established with the central axis of the cylindrical magnetic core as the z-axis, and the x-axis direction is aligned with the horizontal direction of the image coordinate system. The coordinate values ​​of each projection position are transformed. The radial distance is obtained by calculating the vertical distance from the point to the z-axis, and the value is equal to the square root of the sum of the squares of the x and y coordinates of the projection position. The circumferential angle is obtained by calculating the angle between the projection position in the xy plane and the x-axis, and the value is equal to the arctangent of the y coordinate divided by the x coordinate, ranging from 0 to 360 degrees. The axial height is equal to the z-coordinate value of the projection position, directly reflecting the point's position in the axial direction. The same coordinate transformation is performed on all points on the edge contour line to obtain the complete spatial distribution of the edge contour in the cylindrical coordinate system. This three-dimensional cylindrical coordinate representation accurately describes the spatial positional relationship of the wire edge on the magnetic core surface, providing basic data for subsequent gap measurement. The transformed coordinate values ​​are expressed in actual physical units, directly reflecting the true spatial dimensions of the edge contour.

[0082] Step 106: Based on the coordinate positions of each cylindrical surface, calculate the cylindrical arc length distance between the edge contour lines of adjacent metal wires to obtain the detection result of the metal wire winding gap.

[0083] Among them, the cylindrical coordinate position represents the three-dimensional position of the edge point of the metal wire in the cylindrical space; the edge contour line refers to the spatial curve describing the boundary of the metal wire; the cylindrical arc length distance represents the distance between the two edge lines measured along the shortest path of the cylindrical surface; the winding gap refers to the size of the gap between adjacent metal wires; and the detection result refers to the numerical output of the gap measurement.

[0084] Specifically, this step is performed after obtaining the cylindrical coordinates of the edge contour lines, which are used to calculate the actual winding gap size. First, adjacent pairs of wire edge contour lines are identified, and their adjacency is determined by comparing circumferential angle values. For each pair of adjacent edge contour lines, corresponding point pairs are selected at the same axial height. The cylindrical arc length distance between these point pairs is calculated by substituting the radial distance and circumferential angle between the two points into the arc length formula; the arc length equals the radial distance multiplied by the angle difference between the two points (in radians). A measurement point is taken every 0.1 mm along the axial direction to obtain the complete gap distribution. Statistical analysis is performed on all measurement results to calculate the maximum, minimum, and average gap values. Simultaneously, the uniformity of the gap is evaluated, and the standard deviation is calculated to reflect the dispersion of the gap distribution. These statistical indicators are output as the detection results of the winding gap.

[0085] In some embodiments, the gap can be measured and evaluated in several ways: Optionally, the shortest path method can be used: First, a sampling point grid is constructed between the two edge lines; then, the shortest path between the grid points is calculated using Dijkstra's algorithm; next, the shortest path is projected onto the cylindrical surface to obtain the actual arc length; finally, the arc lengths at multiple sampling locations are statistically analyzed to obtain the gap distribution characteristics. Optionally, the cross-sectional profile method can be used: First, the cross-sectional profile of the cylindrical surface is obtained at different axial positions; then, the arc length between adjacent wire edges is measured at each cross-section; next, a gap distribution model in the axial direction is established; finally, the size and trend of the gap are comprehensively evaluated. It is understood that other gap measurement methods, such as measurement methods based on three-dimensional reconstruction or measurement methods based on template matching, can also be used to detect the winding gap, which is not limited here.

[0086] Based on the above embodiments, as an optional embodiment, in step 106: calculating the cylindrical arc length distance between the edge contour lines of adjacent metal wires based on the coordinate positions of each cylindrical surface to obtain the metal wire winding gap detection result, this step may further include the following steps: Step 501: Based on the coordinate positions of each cylindrical surface, determine the arc length of adjacent metal wires, and calculate the cylindrical arc length distance between the edge contour lines of adjacent metal wires according to the arc length of adjacent metal wires.

[0087] Among them, the cylindrical coordinate position represents the three-dimensional position parameters of the edge point in the cylindrical space; the arc length refers to the arc length of the wire edge on the cross-section of the cylindrical surface; the edge contour line represents the spatial curve of the wire boundary on the cylindrical surface; the cylindrical arc length distance refers to the shortest distance between two edge lines measured along the cylindrical surface; and adjacent wires refer to two adjacent wires in the winding sequence.

[0088] Specifically, this step is performed after obtaining the cylindrical coordinates of the edge contour lines, and is used to calculate the actual gap distance between adjacent metal wires. First, pair of edge points of adjacent metal wires are selected on cross-sections with the same axial height. For each pair of edge points, the arc length is calculated based on its cylindrical coordinates. The calculation process is as follows: the radial distance value of the edge point is used as the arc radius, the circumferential angle difference between the two points is converted to radians, and the two are multiplied to obtain the arc length. When calculating the arc length, the continuity of angles needs to be considered; when the angle difference exceeds 180 degrees, the supplementary angle is used to calculate the actual arc length. Multiple cross-sections at axial positions are selected for calculation, and a set of arc length values ​​is obtained for each cross-section. For each pair of adjacent metal wires, the cylindrical arc length distance between their edge contour lines is calculated. The specific calculation method is: at each axial position, the arc length at that position is divided by the radial distance of the edge point to obtain a standardized arc length value. The standardized arc length value is multiplied by the actual cylindrical radius to obtain the actual cylindrical arc length distance. This calculation method considers the influence of cylindrical curvature, ensuring that the measurement results reflect the true spatial distance.

[0089] Step 502: Calculate the width of the overlapping area of ​​the edge contours of adjacent metal wires based on the cylindrical coordinate position, and use the ratio of the width of the overlapping area to the cross-sectional width of the metal wire as the winding overlap degree.

[0090] Among them, the cylindrical coordinate position represents the three-dimensional position parameters of the edge point in the cylindrical space; the overlap area width refers to the overlap length of adjacent metal wires on the axial projection; the cross-sectional width represents the actual size of a single metal wire perpendicular to the winding direction; the winding overlap degree refers to the percentage of the overlap area width to the metal wire width; and the edge contour line represents the spatial curve of the metal wire boundary on the cylindrical surface.

[0091] Specifically, this step is performed after obtaining the cylindrical coordinates of the edge contour lines and is used to evaluate the tightness of the wire winding. First, the edge contour lines are projected onto the axial plane in the cylindrical coordinate system to obtain the axial projected contours of adjacent wires. The maximum and minimum values ​​of the two edge contour lines in the axial direction are calculated, and the range of the overlapping area is determined by comparing these extreme values. The width of the overlapping area is equal to the intersection length of the axial projections of adjacent wires, calculated by subtracting the larger of the axial minimum values ​​from the smaller of the two contour lines' axial maximum values. The nominal cross-sectional width of the wire is obtained, determined by product specifications or actual measurement. The calculated overlapping area width is divided by the cross-sectional width to obtain the winding overlap. This ratio directly reflects the tightness of the winding; a larger value indicates tighter winding. The calculation of the overlap considers the actual coverage of the wires during the winding process, providing a quantitative indicator for evaluating winding quality.

[0092] Step 503: Obtain the winding gap value corresponding to the arc length of the cylindrical surface; calculate the change of winding gap value and winding overlap in the circumferential direction of the magnetic core cylindrical surface, and perform weighted calculation by combining the radial position deviation of the edge contour line of the metal wire relative to the standard winding position to obtain the winding tightness of the metal wire; use the winding gap value, winding overlap and winding tightness as the detection results of the winding gap of the metal wire.

[0093] Among them, the winding gap value represents the actual measured distance between adjacent metal wires; the variation refers to the fluctuation range of the parameter in the circumferential direction; the standard winding position refers to the position where the metal wire should be under ideal winding conditions; the radial position deviation represents the radial distance difference between the actual position and the standard position; the winding tightness refers to the evaluation value of the stability and firmness of the metal wire winding; the test results include comprehensive evaluation data of gap, overlap and tightness.

[0094] Specifically, this step is performed after gap measurement and overlap calculation, and is used to comprehensively evaluate the winding quality. First, the cylindrical arc length is converted into an actual winding gap value, in millimeters. Samples are taken at fixed angles (e.g., 10 degrees) along the circumference of the cylindrical surface, recording the gap value and overlap. The difference between these sampled values ​​and their local average is calculated to obtain the variation. Using a pre-established standard winding model, the ideal radial coordinates of the wire at each position are determined. The actual measured radial coordinates are subtracted from the standard value to obtain the radial position deviation. A weighted calculation method is used to comprehensively evaluate the winding tightness: the weight for gap variation is 0.4, the weight for overlap variation is 0.3, and the weight for radial position deviation is 0.3. The three weighted components are added to obtain the tightness value; the smaller the value, the better the winding quality. Finally, complete test results are output, including statistical values ​​of the gap (maximum, minimum, and average), the distribution characteristics of the overlap, and the tightness score. These data comprehensively reflect the winding quality.

[0095] Reference Figure 2 This application provides a visual inspection system for the gap in wire winding, comprising: an image acquisition module, a radial scan line determination module, a coordinate position determination module, and a winding gap detection module. The image acquisition module is used to acquire detection images of the metal wire wound on the cylindrical magnetic core. The shooting direction of the detection image is parallel to the axis of the cylindrical magnetic core. The radial scan line determination module is used to perform magnetic core boundary detection on the detection image, extract the circular contour boundary of the cylindrical magnetic core, and calculate the center coordinate position of the magnetic core in the image coordinate system and the projection radius of the cylindrical magnetic core based on the circular contour boundary; based on the center coordinate position and projection radius, the circular detection area centered on the magnetic core center is radially sampled at a preset angle interval to generate a radial scan line from the center to the circumference. The coordinate position determination module is used to perform metal wire edge detection on the detection image, extract the edge contour lines of adjacent metal wires, and obtain the pixel coordinate positions of each edge contour line in the image coordinate system; through the angle information and radial distance information of the radial scan line, the coordinate positions of each pixel point are projected onto the magnetic core cylinder to obtain the cylindrical coordinate positions of each edge contour line on the magnetic core cylinder. The winding gap detection module is used to calculate the cylindrical arc length distance between the edge contour lines of adjacent metal wires based on the coordinate position of each cylindrical surface, and obtain the winding gap detection result of the metal wire.

[0096] Based on the above embodiments, the image acquisition module is further configured to: a first industrial camera is positioned directly above the cylindrical magnetic core, with the optical axis of the first industrial camera parallel to the axial direction of the cylindrical magnetic core; a second industrial camera and a third industrial camera are respectively inclinedly positioned on both sides of the cylindrical magnetic core, with the optical axes of the second and third industrial cameras parallel to the axial direction of the cylindrical magnetic core; a first ring light source is arranged within a preset coverage area of ​​the first industrial camera, and second ring light sources are respectively arranged within the preset coverage areas of the second and third industrial cameras, wherein the emitting surfaces of the first and second ring light sources face the surface of the cylindrical magnetic core; the luminous intensity of the first and second ring light sources is adjusted until the brightness difference between the metal wire and the surface of the cylindrical magnetic core is a preset brightness difference value; the first, second, and third industrial cameras are used as an industrial camera group, and the image of the surface of the cylindrical magnetic core is acquired through the industrial camera group as a detection image.

[0097] Based on the above embodiments, the radial scan line determination module is also used to convert the detection image into a grayscale image and perform Gaussian filtering noise reduction on the grayscale image; determine the segmentation threshold based on the grayscale distribution characteristics of the grayscale image, and perform binarization processing on the filtered grayscale image according to the segmentation threshold to obtain a binarized image; perform edge extraction on the binarized image to obtain the edge contour of the cylindrical magnetic core; and use the Hough circle transform algorithm to fit the edge contour to a circular boundary to obtain the circular contour boundary of the cylindrical magnetic core.

[0098] Based on the above embodiments, the radial scan line determination module is also used to extract the coordinates of multiple boundary points uniformly distributed on the circular contour boundary. The number of boundary point coordinates is not less than a preset multiple of the number of turns of metal wire wound on the cylindrical magnetic core. The least squares fitting method is used to fit the boundary point coordinates to a circle, and the fitting parameters are iteratively optimized until the fitting error is less than a preset threshold to obtain the initial center coordinates and radius value of the fitted circle. Calibration points are set on the surface of the cylindrical magnetic core. Based on the pixel coordinates and physical coordinates of the calibration points in the detection image, a scale relationship is established, and the radius value of the fitted circle is converted into the projection radius through the scale relationship. The initial center coordinates are mapped to the image coordinate system through perspective transformation to obtain the center coordinate position.

[0099] Based on the above embodiments, the radial scan line determination module is further used to generate angle parameters of multiple radial scan lines within a circular detection area centered on the magnetic core, starting from the center coordinate position and according to a preset angle interval, wherein the value of the preset angle interval is less than the minimum included angle between adjacent metal wires in the detection image; calculate the sampling endpoint coordinates of each radial scan line according to the angle parameters and the projection radius, and generate an initial scan line pointing from the center coordinate position to the sampling endpoint coordinates through a straight line interpolation algorithm; traverse the pixel coordinates on each radial scan line, and take the initial scan line where all pixel coordinates are located within the circular contour boundary as the radial scan line pointing from the center to the circumference.

[0100] Based on the above embodiments, the coordinate position determination module is further used to determine the circumferential angle coordinates of the cylindrical magnetic core according to the angle information of the radial scan line, and to obtain the radial distance ratio by normalizing the radial distance information through the projection radius; to determine the projection position of the pixel points of each edge contour line on the surface of the cylindrical magnetic core by using the product of the actual radius of the cylindrical magnetic core and the radial distance ratio as the mapping radius and the circumferential angle coordinates as the mapping angle; and to convert each projection position into radial distance, circumferential angle and axial height coordinates in a cylindrical coordinate system with the central axis of the cylindrical magnetic core as the central axis, so as to obtain the cylindrical coordinate position of each edge contour line on the cylindrical surface of the magnetic core.

[0101] Based on the above embodiments, the winding gap detection module is also used to determine the arc length of adjacent metal wires based on the coordinate positions of each cylindrical surface, calculate the cylindrical arc length distance between the edge contour lines of adjacent metal wires based on the arc length of adjacent metal wires, calculate the overlap area width of the edge contour lines of adjacent metal wires based on the cylindrical surface coordinate positions, and use the ratio of the overlap area width to the cross-sectional width of the metal wire as the winding overlap degree; obtain the winding gap value corresponding to the cylindrical arc length distance; calculate the change of the winding gap value and the winding overlap degree in the circumferential direction of the magnetic core cylindrical surface, and perform a weighted calculation in combination with the radial position deviation of the edge contour line of the metal wire relative to the standard winding position to obtain the winding tightness of the metal wire; and use the winding gap value, winding overlap degree, and winding tightness degree as the metal wire winding gap detection result.

[0102] It should be noted that the above embodiments of the apparatus are only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0103] This application also discloses an electronic device. (See reference...) Figure 3 , Figure 3 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. The electronic device 300 may include: at least one processor 301, at least one network interface 304, a user interface 303, a memory 305, and at least one communication bus 302.

[0104] The communication bus 302 is used to enable communication between these components.

[0105] The user interface 303 may include a display interface and a camera interface. Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.

[0106] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0107] The processor 301 may include one or more processing cores. The processor 301 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 305, and by calling data stored in the memory 305. Optionally, the processor 301 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 301 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface graphics, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 301 and may be implemented as a separate chip.

[0108] The memory 305 may include random access memory (RAM) or read-only memory. Optionally, the memory 305 may include a non-transitory computer-readable storage medium. The memory 305 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 305 may also be at least one storage device located remotely from the aforementioned processor 301. (Refer to...) Figure 3 The memory 305, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for a visual inspection method of wire winding gaps.

[0109] exist Figure 3In the illustrated electronic device 300, the user interface 303 is mainly used to provide an input interface for the user and acquire user input data; while the processor 301 can be used to call an application program stored in the memory 305 for visual detection of wire winding gaps. When executed by one or more processors 301, the electronic device 300 performs one or more methods as described in the above embodiments. It should be noted that, for the foregoing method embodiments, for the sake of simplicity, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0110] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0111] In the various embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus 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 system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some service interface; the indirect coupling or communication connection between apparatuses or units may be electrical or other forms.

[0112] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0113] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0114] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0115] The above are merely exemplary embodiments of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Other embodiments of this disclosure will be readily apparent to those skilled in the art upon consideration of the specification and practical disclosure.

[0116] This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are to be considered exemplary only.

Claims

1. A method of visual inspection of a wire-wound gap, characterized in that, include: An industrial camera array is used to acquire detection images of a metal wire wound around a cylindrical magnetic core, wherein the shooting direction of the detection images is parallel to the axis of the cylindrical magnetic core. The detection image is subjected to magnetic core boundary detection to extract the circular outline boundary of the cylindrical magnetic core, and the center coordinate position of the magnetic core in the image coordinate system and the projection radius of the cylindrical magnetic core are calculated based on the circular outline boundary. Based on the center coordinates and the projection radius, the circular detection area centered on the magnetic core center is radially sampled at preset angle intervals to generate a radial scan line from the center to the circumference. The detected image is subjected to metal wire edge detection, the edge contour lines of adjacent metal wires are extracted, and the pixel coordinates of each edge contour line in the image coordinate system are obtained. By using the angle information and radial distance information of the radial scan line, the coordinate positions of each pixel point are projected onto the magnetic core cylinder to obtain the cylindrical coordinate positions of each edge contour line on the magnetic core cylinder. Based on the coordinate positions of each cylindrical surface, the cylindrical arc length distance between the edge contour lines of adjacent metal wires is calculated to obtain the detection result of the metal wire winding gap.

2. The visual inspection method for the gap in wire winding according to claim 1, characterized in that, The acquisition of detection images of the metal wire wound on the cylindrical magnetic core using an industrial camera array includes: A first industrial camera is positioned directly above the cylindrical magnetic core, and the optical axis of the first industrial camera is parallel to the axial direction of the cylindrical magnetic core. A second industrial camera and a third industrial camera are respectively inclinedly arranged on both sides of the cylindrical magnetic core, and the optical axes of the second industrial camera and the third industrial camera are parallel to the axial direction of the cylindrical magnetic core. A first ring light source is arranged within a preset coverage area of ​​the first industrial camera, and second ring light sources are arranged within the preset coverage areas of the second and third industrial cameras, respectively, wherein the light-emitting surfaces of the first and second ring light sources face the surface of the cylindrical magnetic core. Adjust the luminous intensity of the first ring light source and the second ring light source until the brightness difference between the metal wire and the surface of the cylindrical magnetic core is a preset brightness difference value; The first industrial camera, the second industrial camera, and the third industrial camera are used as an industrial camera group, and the images of the cylindrical magnetic core surface are obtained through the industrial camera group as detection images.

3. The visual inspection method for the gap in wire winding according to claim 1, characterized in that, The step of performing magnetic core boundary detection on the detected image and extracting the circular contour boundary of the cylindrical magnetic core includes: The detected image is converted into a grayscale image, and the grayscale image is then subjected to Gaussian filtering for noise reduction. A segmentation threshold is determined based on the grayscale distribution characteristics of the grayscale image, and the filtered grayscale image is binarized according to the segmentation threshold to obtain a binarized image. Edge extraction is performed on the binarized image to obtain the edge contour of the cylindrical magnetic core; The Hough circle transform algorithm is used to fit the edge contour to a circular boundary, thus obtaining the circular contour boundary of the cylindrical magnetic core.

4. The visual inspection method for the gap in wire winding according to claim 1, characterized in that, The calculation of the center coordinates of the magnetic core in the image coordinate system and the projected radius of the cylindrical magnetic core based on the circular contour boundary includes: Extract the coordinates of multiple boundary points evenly distributed on the circular contour boundary, wherein the number of boundary point coordinates is not less than a preset multiple of the number of turns of the metal wire wound on the cylindrical magnetic core; The boundary point coordinates are fitted with a circle using the least squares fitting method, and the fitting parameters are iteratively optimized until the fitting error is less than a preset threshold, so as to obtain the initial center coordinates and radius value of the fitted circle. Calibration points are set on the surface of the cylindrical magnetic core. Based on the pixel coordinates and physical coordinates of the calibration points in the detection image, a scale relationship is established, and the radius value of the fitted circle is converted into the projection radius through the scale relationship. The initial center coordinates are mapped to the image coordinate system through perspective transformation to obtain the center coordinate position.

5. The visual inspection method for the gap in wire winding according to claim 1, characterized in that, Based on the coordinates of the center and the projection radius, the circular detection area centered on the magnetic core center is radially sampled at preset angular intervals to generate multiple radial scan lines pointing from the center to the circumference, including: Within a circular detection area centered on the magnetic core, starting from the coordinate position of the center, multiple radial scan lines are generated with angle parameters at preset angle intervals, wherein the value of the preset angle interval is less than the minimum included angle between adjacent metal wires in the detection image. Based on the angle parameter and the projection radius, the sampling endpoint coordinates of each radial scan line are calculated, and an initial scan line pointing from the center coordinate position to the sampling endpoint coordinates is generated by a linear interpolation algorithm. Traverse the pixel coordinates on each of the radial scan lines, and take the initial scan line where all pixel coordinates are located within the circular contour boundary as the radial scan line from the center of the circle to the circumference.

6. The visual inspection method for the gap in wire winding according to claim 5, characterized in that, The step of projecting the coordinate positions of each pixel onto the magnetic core cylinder using the angle information and radial distance information of the radial scan line to obtain the cylindrical coordinate positions of each edge contour line on the magnetic core cylinder includes: Based on the angle information of the radial scan line, the circumferential angle coordinates of the cylindrical magnetic core are determined, and the radial distance information is normalized by the projection radius to obtain the radial distance ratio. The product of the actual radius of the cylindrical magnetic core and the ratio of the radial distance is used as the mapping radius, and the circumferential angle coordinates are used as the mapping angle to determine the projection position of the pixel points of each edge contour line on the surface of the cylindrical magnetic core. The projection positions are converted into radial distance, circumferential angle and axial height coordinates in a cylindrical coordinate system with the central axis of the cylindrical magnetic core as the central axis, so as to obtain the cylindrical coordinate position of each edge contour line on the cylindrical surface of the magnetic core.

7. The visual inspection method for the gap in wire winding according to claim 1, characterized in that, The calculation of the cylindrical arc length distance between the edge contour lines of adjacent metal wires based on the coordinate positions of each cylindrical surface, to obtain the metal wire winding gap detection result, includes: Based on the coordinate positions of each cylindrical surface, the arc length of adjacent metal wires is determined, and the cylindrical arc length distance between the edge contour lines of adjacent metal wires is calculated according to the arc length of the adjacent metal wires. The width of the overlapping area of ​​the edge contours of adjacent metal wires is calculated based on the cylindrical coordinate position, and the ratio of the width of the overlapping area to the cross-sectional width of the metal wire is used as the winding overlap degree. Obtain the winding gap value corresponding to the arc length of the cylindrical surface; The changes in the winding gap and the winding overlap in the circumferential direction of the magnetic core cylinder are calculated, and weighted calculation is performed in combination with the radial position deviation of the edge contour line of the metal wire relative to the standard winding position to obtain the winding tightness of the metal wire. The winding gap value, the winding overlap, and the winding tightness are used as the detection results of the wire winding gap.

8. A visual inspection system for the gap in wire winding, characterized in that, The system includes: An image acquisition module is used to acquire detection images of a metal wire wound on a cylindrical magnetic core, wherein the shooting direction of the detection image is parallel to the axis of the cylindrical magnetic core; The radial scan line determination module is used to perform magnetic core boundary detection on the detection image, extract the circular contour boundary of the cylindrical magnetic core, and calculate the center coordinate position of the magnetic core in the image coordinate system and the projection radius of the cylindrical magnetic core based on the circular contour boundary; based on the center coordinate position and the projection radius, the circular detection area centered on the magnetic core center is radially sampled at a preset angle interval to generate a radial scan line from the center to the circumference; The coordinate position determination module is used to perform metal wire edge detection on the detection image, extract the edge contour lines of adjacent metal wires, and obtain the pixel coordinate positions of each edge contour line in the image coordinate system; and project the coordinate positions of each pixel point onto the magnetic core cylinder surface through the angle information and radial distance information of the radial scan line to obtain the cylindrical coordinate positions of each edge contour line on the magnetic core cylinder surface. The winding gap detection module is used to calculate the cylindrical arc length distance between the edge contour lines of adjacent metal wires based on the coordinate positions of each cylindrical surface, and obtain the winding gap detection result of the metal wires.

9. An electronic device, characterized in that, The device includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to enable the electronic device to perform the visual inspection method for wire winding gap as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform the visual detection method for the gap in wire winding as described in any one of claims 1-7.