A circular magnetic core side defect detection device and method
By designing a circular magnetic core side defect detection device, using rotation and image processing technology, the problems of difficulty in obtaining side images of the circular magnetic core and low detection efficiency are solved, and efficient and accurate detection of side defects of the magnetic core are achieved.
Patent Information
- Application Number
- CN202411697194.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-26
AI Technical Summary
In the prior art, the side image of the circular magnetic core is difficult to acquire, the shooting and imaging are not clear, and the detection efficiency is low, so it is impossible to efficiently detect defects of multiple magnetic cores.
A circular magnetic core side defect detection device is designed. Through the cooperation of the conveyor belt and the turntable, the magnetic core to be tested is rotated about its axis, and the limit and rotation are achieved using components such as photoelectric switches, motors and rollers, and the captured side images are processed in combination with image processing technology.
The problems of difficulty in acquiring the side image of the circular core and unclear imaging are solved, and the simultaneous detection of the sides of multiple cores are realized, which improves the detection efficiency and reduces the requirements for lighting conditions.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of quality inspection, and in particular to a circular magnetic core side defect inspection device and method. Background Art
[0002] Quality inspection of industrial products is an important part of product quality. In the actual production process, various defects may occur, and these defects will affect the actual use of the product. At present, most manufacturers mainly use human eye recognition methods. People will experience visual fatigue after working for a long time, resulting in false detection and missed detection. At the same time, human eye quality inspection requires a lot of labor costs, which greatly increases the production costs of enterprises.
[0003] Electronic products have become indispensable in daily life, and magnetic cores are one of the important components of electronic products. Collisions, frictions and other phenomena in the actual production process can cause various defects on the product surface, affecting product quality. At present, the detection method for the side of the magnetic core is mainly based on manual identification, which is inefficient and costly. If it is identified by non-manual methods, only a single magnetic core can be detected each time, and the detection efficiency is low. If it is identified by non-manual methods, the existing technology has the problems of difficulty in obtaining the side image of the circular magnetic core and unclear imaging, and only a single magnetic core can be detected each time, and the detection efficiency is low. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides a circular magnetic core side defect detection device and method.
[0005] The specific technical solutions are as follows:
[0006] A circular magnetic core side defect detection device comprises a conveyor belt, a turntable, a fixing module, a detection module, and a processor; the conveyor belt moves in the positive direction along the x-axis of the world coordinate system, the turntable is installed on the conveyor belt, a magnetic core to be tested is coaxially placed on the turntable and limited, the magnetic core to be tested is formed by stacking a plurality of circular magnetic cores, and the axis thereof is parallel to the z-axis;
[0007] The fixing module includes: a photoelectric switch, a motor, a slider, a motor, a first roller, and two second rollers; the slider is arranged on one side of the conveyor belt, and driven by the motor, the slider moves forward and backward along the y-axis direction, and the second rollers are fixedly connected to both sides of one end of the slider close to the conveyor belt; the first roller is arranged on the other side of the conveyor belt and driven by the motor;
[0008] The photoelectric switches are arranged on both sides of the conveyor belt to detect whether the turntable passes by. When the turntable passes by, the motor is triggered to start, driving the slider and the two second rollers thereon to move toward the middle of the conveyor belt; at the same time, the motor is triggered to start, driving the first roller to rotate; when the turntable reaches the position to be detected, the conveyor belt stops running, the first roller and the second roller contact the turntable, and the turntable is limited, and the turntable rotates at a constant speed under the action of the first roller;
[0009] The detection component is arranged on one side of the conveyor belt, and is used to capture the side image of the magnetic core to be tested and transmit each captured image to the processor; the processor is used to process the side image, detect whether there are defects on the side of the magnetic core to be tested and output it.
[0010] Furthermore, the turntable includes: a limit baffle, and a coaxially arranged inner disk, a connecting shaft, and an outer disk; the inner disk is located at the bottom, and its lower surface is in direct contact with the conveyor belt, and a through hole is provided in the center of the inner disk; the connecting shaft is divided into two coaxial upper and lower sections, wherein the upper section can coaxially rotate relative to the lower section; the outer disk is sleeved on the upper end of the inner disk, and a blind hole is provided on its lower end surface, the upper section of the connecting shaft is embedded in the blind hole, and the lower section is embedded in the through hole of the inner disk, and the inner disk and the outer disk are rotatably connected through the connecting shaft; the magnetic core to be tested is coaxially mounted on the upper surface of the outer disk;
[0011] The limit baffle includes two limit main boards and a connecting piece. The two limit main boards are arc-shaped and symmetrically arranged on the outer periphery of the magnetic core to be tested. One end of the connecting piece is fixedly connected to the limit main board, and the other end is fixedly connected to the lower outer wall of the inner disk.
[0012] Furthermore, balls are arranged on the inner wall surface of the limiting main plate of the limiting baffle.
[0013] Furthermore, the detection component includes a camera and a light source, which are arranged on one side of the conveyor belt; the light source adopts bright field illumination, which can completely illuminate the magnetic core to be tested located at the position to be tested, and will not block the camera shooting; the camera adopts a linear array industrial camera, and its shooting direction is parallel to the y-axis and is directly opposite to the magnetic core to be tested, and is used to collect the side image of the magnetic core to be tested; the parameters of the camera match the rotation speed of the turntable.
[0014] A method for detecting defects on the side of a circular magnetic core comprises the following steps:
[0015] S1: Collect and stitch together a complete side image of the circular magnetic core, which is recorded as the original image A;
[0016] S2: Perform histogram equalization on the original image A to obtain an enhanced image B;
[0017] S3: Use Butterworth low-pass filtering to transform the enhanced image B into a smoothed image C;
[0018] S4: Binarize the smoothed image C using the Otsu threshold method to obtain the boundary coordinates of the side image of the magnetic core to be tested;
[0019] S5: Segment the original image A into multiple images D according to the number of magnetic cores and the boundary coordinates obtained in S4;
[0020] S6: Use the method of S5 to split the smooth image C into multiple images ,right Remove the boundary interference to get the mask image E, then add the mask of each mask image E to the corresponding image D to get the image ;
[0021] S7: Image of the side of a single circular core , the defect area is divided by the image segmentation method based on region growing to obtain image F;
[0022] S8: Perform morphological processing on image F to obtain image G;
[0023] S9: searching the contour of the image G through the connected domain to obtain the contour of each defect; calculating the area and length and width of each connected domain according to its contour; if the length, width and area of a connected domain are all greater than the threshold, the connected domain is judged to be a defect; otherwise, the connected domain is judged not to be a defect;
[0024] S10: Draw a minimum circumscribed rectangle, mark the defects determined to be true in S9, and output the defect detection results.
[0025] Furthermore, the specific operation of S5 is as follows: the boundary coordinate information (z0, z1) of the magnetic core to be measured is obtained from the smoothed image C, along the axis direction of the magnetic core to be measured, z1 represents the coordinate of the top end of the magnetic core to be measured, and z0 represents the coordinate of the bottom end of the magnetic core to be measured; the original image A is divided into multiple images D of the side surfaces of single circular magnetic cores according to the boundary coordinate information and the number of magnetic cores; the boundary coordinate expression of the side surface of the i-th circular magnetic core from bottom to top is as follows:
[0026] ;
[0027] ;
[0028] Where, I represents the total number of circular cores contained in the magnetic core to be tested, x i_top represents the coordinates of the top of the i-th circular core, x i_down Represents the coordinates of the bottom end of the i-th circular magnetic core, i=1,2,3,…,I.
[0029] Furthermore, the S7 is specifically implemented through the following sub-steps:
[0030] S7.1: Set the seed point and region growth threshold. The seed point is the image A set of pixels randomly selected from the image; create A completely black image F of the same size;
[0031] S7.2: Create a stack and add the neighborhood pixels of the seed point to the stack;
[0032] S7.3: Determine whether the stack is empty. If so, it means that all pixels have been visited, end the loop, and execute S8; if not, execute S7.4;
[0033] S7.4: Take a pixel from the stack as the current pixel, and check whether the pixel has been visited. If so, return to S7.3; if not, mark the current pixel as visited, and execute S7.5;
[0034] S7.5: Determine whether the absolute value of the grayscale difference between the current pixel and the seed point is less than or equal to the regional growth threshold. If so, mark the current pixel as normal, set the corresponding pixel in image F to white, add the neighboring pixels of the current pixel to the stack, and return to S7.3; otherwise, return directly to S7.3.
[0035] Furthermore, S3 is specifically implemented through the following sub-steps:
[0036] (3.1) Calculate the frequency domain of the enhanced image B, the expression is as follows:
[0037] ;
[0038] Where f(x,y) represents the pixel value corresponding to the (x,y) coordinate of the enhanced image B, (u,v) represents the two-dimensional frequency domain coordinate corresponding to (x,y), and F(u,v) represents the frequency domain value corresponding to f(x,y);
[0039] (3.2) Multiply the frequency domain of the enhanced image B by the update factor to obtain the updated frequency domain:
[0040] ;
[0041] ;
[0042] Where H(u,v) represents the update factor, D(u,v) is the distance from the point (u,v) to the center of the two-dimensional frequency domain image; D0 is the cutoff frequency, and n represents the filter order;
[0043] (3.3) Perform a two-dimensional discrete Fourier inverse transform on the updated frequency domain to obtain a smoothed image C, which is expressed as follows:
[0044] ;
[0045] In the formula, is the pixel value of the smoothed image C at point (x, y).
[0046] Furthermore, the specific operation of S4 is as follows: traverse all possible Otsu thresholds, and for each threshold, divide all pixels of the image into two categories, where pixels less than or equal to the Otsu threshold TH are classified into the C1 category, and pixels greater than TH are classified into the C2 category; calculate the inter-class variance σ, which is expressed as follows:
[0047] ;
[0048] ;
[0049] ;
[0050] In the formula, p1 represents the probability that the pixel is classified into the C1 category, p2 represents the probability that the pixel is classified into the C2 category; m1 represents the pixel mean of the C1 category pixels, m2 represents the pixel mean of the C2 category pixels, and m g represents the global mean;
[0051] The maximum value of all inter-class variances is taken, and the corresponding Otsu threshold is used for binary segmentation to obtain the boundary coordinates of the side image of the magnetic core to be tested.
[0052] Furthermore, in S6, the specific operation of removing boundary interference is as follows: Perform statistics in the row direction. If the ratio of white pixels in a row to the total number of pixels in the row is less than the set ratio threshold, the pixels in the row are considered to be the gap area between the two circular magnetic cores, and all pixel values of the pixels in the row are set to 0 to obtain the mask image E; otherwise, they are all set to white.
[0053] The beneficial effects of the present invention are:
[0054] (1) The device of the present invention allows the magnetic core to be tested to rotate around its axis by fixing the components, thereby solving the problems of difficulty in obtaining the side image of the circular magnetic core and unclear imaging.
[0055] (2) The device of the present invention can detect the side surfaces of multiple circular magnetic cores at the same time, and has high detection efficiency.
[0056] (3) The method of the present invention uses image processing technology to process the captured side image, which has lower lighting conditions than the existing technology and is easier to implement. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 Schematic diagram of the structure of a circular magnetic core side defect detection device in an embodiment of the present invention.
[0058] Figure 2 2 is a cross-sectional view of a turntable in an embodiment of the present invention.
[0059] Figure 3 4 is a flow chart of a method for detecting side defects of a circular magnetic core in an embodiment of the present invention.
[0060] Figure 4 It is a flow chart of dividing defective areas by an image segmentation method based on region growing in an embodiment of the present invention.
[0061] In the figure, there are a conveyor belt 1, a turntable 2, a camera 3, a light source 4, a magnetic core to be tested 5, a photoelectric switch 6, a motor 7, a slider 8, a motor 9, and a roller 10. DETAILED DESCRIPTION
[0062] The present invention will be described in detail below according to the accompanying drawings and preferred embodiments, and the purpose and effect of the present invention will become more clear. The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0063] like Figure 1 As shown, a circular magnetic core side defect detection device includes: a conveyor belt 1, a turntable 2, a fixing module, a detection module, and a processor. The conveyor belt 1 is placed horizontally and moves along the positive x-axis of the world coordinate system; the magnetic core 5 to be tested is composed of multiple circular magnetic cores stacked up and down along the cross section, and its axis is parallel to the z-axis.
[0064] The turntable 2 is installed on the conveyor belt 1, and is used to support the magnetic core 5 to be tested, and act to make it rotate around the axis later, and at the same time limit it to prevent the magnetic core 5 to be tested from tilting during the transmission and rotation process.
[0065] When the turntable 2 arrives at the position to be detected along with the conveyor belt 1, the fixing module is used to fix the turntable 2 and rotate it around the axis. Specifically, the fixing module includes: a photoelectric switch 6, a motor 7, a slider 8, a motor 9, a first roller 10, and a second roller 11. The motor 7 is arranged on one side of the conveyor belt 1, and a slider 8 is arranged on its upper surface. Driven by the motor 7, the slider 8 can move forward and backward along the y-axis direction; the slider 8 is provided with a groove matching the size of the turntable 2 at one end facing the conveyor belt 1, which is used to accommodate the turntable 2; the two sides of the end of the slider 8 are respectively connected to the second roller 11 that can rotate around its axis. The motor 9 is fixedly connected to the other side of the conveyor belt 1, and the upper surface of the motor 9 is fixedly connected to the first roller 10. The first roller 10 is fixedly connected to the output shaft of the motor 9 and can rotate around its axis under the drive of the motor 9.
[0066] The photoelectric switch 6 is arranged on both sides of the conveyor belt 1 to detect whether the turntable 2 passes. When the turntable 2 passes, the motor 7 is triggered to start, driving the slider 8 and the two second rollers 11 thereon to move toward the middle of the conveyor belt 1; the motor 9 is triggered and started by the photoelectric switch 6 at the same time, driving the first roller 10 thereon to rotate. When the turntable 2 reaches the position to be detected, the conveyor belt stops running; the time when the turntable 2 reaches the position to be detected is calculated based on the time when the turntable 2 passes the photoelectric switch 6 and the conveying speed of the conveyor belt 1. When the slider 8 moves forward, the first roller 10 and the second roller 11 contact the turntable 2, limit the turntable 2, and fix it at the position to be detected. At the same time, the rotation of the first roller 10 drives the turntable 2 to rotate, and then drives the second roller 11 to rotate, so that the turntable 2 and the magnetic core 5 to be tested thereon rotate at a uniform speed around the fixed axis, which is convenient for taking a more complete side image of the magnetic core.
[0067] The detection component includes a camera 3 and a light source 4, which are arranged on one side of the conveyor belt 1, which side can be the motor 7 side or the motor 9 side. In this embodiment, it is arranged on the motor 7 side. The light source 4 uses bright field illumination, which can completely illuminate the magnetic core 5 to be tested at the position to be detected, and will not block the camera 3 from photographing the side of the magnetic core 5 to be tested. The camera 3 uses a linear array industrial camera, and its shooting direction is perpendicular to the movement direction of the conveyor belt 1. It is used to capture the side image of the magnetic core 5 to be tested, and transmits each captured image to the processor. The processor is used to process the side image, detect whether there are defects on the side of the magnetic core 5 to be tested, and output it. The parameters of the camera 3 need to match the rotation speed of the turntable 2 (that is, the rotation speed of the motor 9) so that the camera 3 can capture a clear image.
[0068] like Figure 2 As shown, the turntable 2 includes: a limit baffle 2-1, and a coaxially arranged inner disk 2-2, a connecting shaft 2-3, and an outer disk 2-4. The inner disk 2-2 is located at the bottom, and its lower surface is in direct contact with the conveyor belt 1. A through hole is provided in the center of the inner disk 2-2. The connecting shaft 2-3 is divided into two coaxial upper and lower sections, wherein the upper section can coaxially rotate relative to the lower section; the lower section of the connecting shaft 2-3 is embedded in the through hole of the inner disk 2-2 and has an interference fit therewith, thereby realizing the fixed connection between the connecting shaft 2-3 and the inner disk 2-2. The outer disk 2-4 is sleeved on the upper end of the inner disk 2-2, and a blind hole is provided on its lower end surface. The upper section of the connecting shaft 2-3 is embedded in the blind hole and has an interference fit therewith, thereby realizing the fixed connection between the connecting shaft 2-3 and the outer disk 2-4, thereby realizing that when the inner disk 2-2 is fixed, the outer disk 2-4 can rotate around the axis. This design reduces the torque required for the initial rotation of the turntable 2, and prevents the limit baffle 2-1 from rotating together with the magnetic core 5 to be tested, thereby affecting the shooting of the side image. The magnetic core 5 to be tested is coaxially mounted on the upper surface of the outer disk 2-4.
[0069] The limit baffle 2-1 includes two limit main boards and a connector, which are used to limit the position of the magnetic core 5 to be tested. For the convenience of description, the structure is explained below based on the situation that the magnetic core 5 to be tested has been arranged on the turntable 2. The two limit main boards are arc-shaped and have a moderate arc length, and are symmetrically arranged on the outer periphery of the magnetic core 5 to be tested; the arc length of the limit main board is moderate, which will not cause the magnetic core to be tested to expose too little side part for shooting due to being too long, affecting image acquisition, and will not cause insufficient limit on the magnetic core 5 to be tested due to being too short, causing it to move or even fall, affecting image acquisition. Ball bearings are arranged on the inner wall surface of the limit main board of the limit baffle 2-1 to reduce the friction between the magnetic core 5 to be tested and the magnetic core 5 to be tested can rotate more smoothly. One end of the connector is fixedly connected to the limit main board, and the other end is fixedly connected to the outer wall of the lower end of the inner disk 2-2. This design makes the limit baffle 2-1 stable under the support of the inner disk 2-2 and will not rotate with the outer disk 2-4.
[0070] The device of the present invention can realize the assembly line measurement of the side defects of the magnetic core 5 to be measured, is suitable for factory assembly line operation, has high efficiency, is simple to install, and has high practical value.
[0071] Based on the above circular magnetic core side defect detection device, this embodiment proposes a circular magnetic core side defect detection method, such as Figure 3 As shown, the specific steps include:
[0072] S1: Use the circular magnetic core side defect detection device to sample the image, transmit it to the processor, and splice it to obtain a complete circular magnetic core side image, which is recorded as the original image A.
[0073] S2: Perform histogram equalization on the original image A to obtain an enhanced image B.
[0074] Histogram equalization is used to increase image contrast. The specific conversion formula is as follows:
[0075]
[0076] In the formula, a represents the grayscale level corresponding to the original image A, h(a) represents the number of pixels corresponding to each grayscale value of the original image A, q represents the grayscale cumulative distribution function of the original image A; p represents the grayscale level corresponding to the enhanced image B, f(p) represents the grayscale cumulative distribution function of the enhanced image B; M represents the number of pixel rows of the original image A, N represents the number of pixel columns of the original image A, Indicates the maximum grayscale level that the image format can achieve.
[0077] S3: Use Butterworth low-pass filtering to transform the enhanced image B into a smoothed image C.
[0078] Butterworth low-pass filtering is a low-pass filtering. The specific conversion formula is divided into the following three steps:
[0079] (3.1) Calculate the frequency domain of the enhanced image B, the expression is as follows:
[0080]
[0081] Where f(x,y) represents the pixel value corresponding to the (x,y) coordinate of the enhanced image B, (u,v) represents the two-dimensional frequency domain coordinate corresponding to (x,y), and F(u,v) represents the frequency domain value corresponding to f(x,y).
[0082] (3.2) Multiply the frequency domain of the enhanced image B by the update factor to obtain the updated frequency domain:
[0083]
[0084]
[0085] Where H(u,v) represents the update factor, D(u,v) is the distance from point (u,v) to the center of the two-dimensional frequency domain image; D0 is the cutoff frequency, that is, the frequency when the amplitude drops to -3 dB; n represents the filter order, generally n=2.
[0086] (3.3) Perform a two-dimensional discrete Fourier inverse transform on the updated frequency domain to obtain a smoothed image C, which is expressed as follows:
[0087]
[0088] In the formula, is the pixel value of the smoothed image C at point (x, y).
[0089] S4: Binarize the smoothed image C using the Otsu threshold method to obtain the boundary coordinates of the side image of the magnetic core to be tested.
[0090] The Otsu method determines the threshold for image binarization (i.e., the Otsu threshold TH) based on the principle of maximizing the inter-class variance of pixels to obtain the best segmentation effect. Specifically, all possible Otsu thresholds are traversed, and for each threshold, all pixels in the image are divided into two categories: those less than or equal to the Otsu threshold TH are classified as C1, and those greater than TH are classified as C2.
[0091] The inter-class variance σ is calculated by the following formula:
[0092]
[0093]
[0094]
[0095] In the formula, p1 represents the probability that the pixel is classified into the C1 category, p2 represents the probability that the pixel is classified into the C2 category; m1 represents the pixel mean of the C1 category pixels, m2 represents the pixel mean of the C2 category pixels, and m g represents the global mean.
[0096] The maximum value of all inter-class variances is taken, and the corresponding Otsu threshold is used for binary segmentation to obtain the boundary coordinates of the side image of the magnetic core to be tested.
[0097] S5: According to the number of magnetic cores and the boundary coordinates obtained in S4, the original image A is segmented into multiple images D. The details are as follows:
[0098] The boundary coordinate information (z0, z1) of the magnetic core 5 to be tested is obtained from the smoothed image C. Along the axis direction of the magnetic core 5 to be tested, z1 represents the coordinate of the top of the magnetic core 5 to be tested, and z0 represents the coordinate of the bottom of the magnetic core 5 to be tested. Based on the boundary coordinate information and the number of magnetic cores, the original image A is divided into multiple images D of the side surfaces of single circular magnetic cores. The boundary coordinate z of the side surface of the i-th circular magnetic core from bottom to top is i_top 、z i_down The expression is as follows:
[0099]
[0100]
[0101] Where, I represents the total number of circular magnetic cores contained in the magnetic core 5 to be tested, and x i_top represents the coordinates of the top of the i-th circular core, x i_down Represents the coordinates of the bottom end of the i-th circular magnetic core, i=1,2,3,…,I.
[0102] S6: Use the method of S5 to split the smooth image C into multiple images ,right Remove the boundary interference to get the mask image E, then add the mask of each mask image E to the corresponding image D to get the image .
[0103] Since there is a gap between two adjacent circular cores, boundary interference will occur, which may easily lead to misjudgment during defect detection, and the gap will be judged as a core defect. Therefore, the boundary interference needs to be removed.
[0104] Removing boundary interference can be done by: Perform statistics in the row direction. If the ratio of white pixels in a row to the total number of pixels in the row is less than the set ratio threshold, the pixel points in the row are considered to be the gap area between the two circular magnetic cores, and the pixel values of all pixels in the row are set to 0. Otherwise, the pixel values of all pixels in the row are set to white to obtain the mask image E. The specific expression is as follows:
[0105]
[0106] In the formula, x k Representing images The number of white pixels in the kth row, δ represents the image The total number of pixels per row.
[0107] S7: Image of the side of a single circular core , the defect area is divided by the image segmentation method based on region growing to obtain image F. Figure 4 As shown, it is implemented through the following sub-steps:
[0108] S7.1: Set the seed point and region growth threshold. The seed point is the image A set of pixels randomly selected from the image; create A completely black image F of the same size.
[0109] S7.2: Create a stack and add the neighborhood pixels of the seed point to the stack.
[0110] S7.3: Determine whether the stack is empty. If so, it means that all pixels have been visited, end the loop and execute S8; if not, execute S7.4.
[0111] S7.4: Take a pixel from the stack as the current pixel, and check whether the pixel has been visited. If so, return to S7.3; if not, mark the current pixel as visited and execute S7.5.
[0112] S7.5: Determine whether the absolute value of the grayscale difference between the current pixel and the seed point is less than or equal to the regional growth threshold. If so, mark the current pixel as part of the normal area of the magnetic core, set the pixel corresponding to image F to white, add the neighboring pixels of the current pixel to the stack, and return to S7.3; otherwise, return directly to S7.3.
[0113] S8: Perform morphological processing on image F to obtain image G.
[0114] Specifically, the image F is morphologically processed by a closing operation to remove noise. The expression is as follows:
[0115]
[0116] In the formula, The structural element used for the closing operation is generally a square module with a side length of 3 or 5.
[0117] S9: Through the connected domain, the contour of the image G is searched to obtain the contour of each defect. The definition of the connected domain is that for pixels t1 and t2 with the same grayscale value, if t2 is in the set N8(t1), that is, pixel t2 is located in the 8 neighboring pixels centered on pixel t1, then the two pixels are called connected, and the area formed by all connected pixels is called a connected domain.
[0118] The area, length and width of each connected domain are calculated according to its outline, and it is determined whether the connected domain is a defect. The expression is as follows:
[0119]
[0120] In the formula, Flag is the judgment label for the defect. If Flag=1, it means that the connected domain is a defect. If Flag=0, it means that the connected domain is not a defect. Area represents the area of the defect, L represents the length of the defect, and W represents the width of the defect. The length direction here is parallel to the axial direction of the circular magnetic core, and the width direction is the direction after the circumferential length of the circular magnetic core is expanded. TH1 represents the threshold of the defect area, TH2 represents the threshold of the defect length, and TH3 represents the threshold of the defect width, all of which need to be set manually.
[0121] S10: Draw the minimum circumscribed rectangle and mark the defects judged as true in S9. The final defect detection results are displayed in the form of pictures to complete the defect detection of the side of the circular magnetic core. The detection results help the subsequent sorting and screening of the magnetic core.
[0122] Those skilled in the art can understand that the above are only preferred examples of the invention and are not intended to limit the invention. Although the invention is described in detail with reference to the above examples, those skilled in the art can still modify the technical solutions recorded in the above examples or replace some of the technical features therein with equivalents. Any modification, equivalent replacement, etc. made within the spirit and principle of the invention shall be included in the protection scope of the invention.
Claims
1. A circular magnetic core side defect detection device, characterized in that: It includes a conveyor belt, a turntable, a fixing module, a detection module, and a processor; the conveyor belt moves in the positive direction along the x-axis of the world coordinate system, the turntable is installed on the conveyor belt, and the magnetic core to be tested is coaxially placed on it and limited, and the magnetic core to be tested is formed by stacking multiple circular magnetic cores, and its axis is parallel to the z-axis; The fixing module includes: a photoelectric switch, a motor, a slider, a motor, a first roller, and two second rollers; the slider is arranged on one side of the conveyor belt, and driven by the motor, the slider moves forward and backward along the y-axis direction, and the second rollers are fixedly connected to both sides of one end of the slider close to the conveyor belt; the first roller is arranged on the other side of the conveyor belt and driven by the motor; The photoelectric switches are arranged on both sides of the conveyor belt to detect whether the turntable passes by. When the turntable passes by, the motor is triggered to start, driving the slider and the two second rollers thereon to move toward the middle of the conveyor belt; at the same time, the motor is triggered to start, driving the first roller to rotate; when the turntable reaches the position to be detected, the conveyor belt stops running, the first roller and the second roller contact the turntable, and the turntable is limited, and the turntable rotates at a constant speed under the action of the first roller; The detection module is arranged on one side of the conveyor belt, and is used to capture the side image of the magnetic core to be tested and transmit each captured image to the processor; the processor is used to process the side image, detect whether there are defects on the side of the magnetic core to be tested, and output the defects; The turntable comprises: a limit baffle, and a coaxially arranged inner disk, a connecting shaft, and an outer disk; the inner disk is located at the bottom, and its lower surface is in direct contact with the conveyor belt, and a through hole is provided in the center of the inner disk; the connecting shaft is divided into two coaxial upper and lower sections, wherein the upper section can coaxially rotate relative to the lower section; the outer disk is sleeved on the upper end of the inner disk, and a blind hole is provided on its lower end surface, the upper section of the connecting shaft is embedded in the blind hole, and the lower section is embedded in the through hole of the inner disk, and the inner disk and the outer disk are rotatably connected through the connecting shaft; the magnetic core to be tested is coaxially mounted on the upper surface of the outer disk; The limit baffle includes two limit main boards and a connecting piece. The two limit main boards are arc-shaped and symmetrically arranged on the outer periphery of the magnetic core to be tested. One end of the connecting piece is fixedly connected to the limit main board, and the other end is fixedly connected to the lower outer wall of the inner disk.
2. The circular magnetic core side defect detection device according to claim 1, characterized in that: Ball bearings are arranged on the inner wall surface of the limiting main plate of the limiting baffle.
3. The circular magnetic core side defect detection device according to claim 1, characterized in that: The detection module includes a camera and a light source, which are arranged on one side of the conveyor belt; the light source adopts bright field illumination, which can completely illuminate the magnetic core to be tested at the position to be tested, and will not block the camera shooting; the camera adopts a linear array industrial camera, whose shooting direction is parallel to the y-axis and is directly facing the magnetic core to be tested, and is used to collect the side image of the magnetic core to be tested; the parameters of the camera match the rotation speed of the turntable.
4. A circular magnetic core side defect detection method, implemented based on the circular magnetic core side defect detection device according to any one of claims 1 to 3, characterized in that: The following steps are involved: S1: Collect and stitch together a complete side image of the circular magnetic core, which is recorded as the original image A; S2: Perform histogram equalization on the original image A to obtain an enhanced image B; S3: Use Butterworth low-pass filtering to transform the enhanced image B into a smoothed image C; S4: Binarize the smoothed image C using the Otsu threshold method to obtain the boundary coordinates of the side image of the magnetic core to be tested; S5: Segment the original image A into multiple images D according to the number of magnetic cores and the boundary coordinates obtained in S4; S6: Use the method in S5 to divide the smooth image C into multiple images C′, remove the boundary interference of C′ to obtain the mask image E, and then add the mask of each mask image E to the corresponding image D to obtain the image E′; S7: for the image E′ of the side surface of a single circular magnetic core, the defect region is divided by an image segmentation method based on region growing to obtain an image F; S8: Perform morphological processing on image F to obtain image G; S9: searching the contour of the image G through the connected domain to obtain the contour of each defect; calculating the area and length and width of each connected domain according to its contour; if the length, width and area of a connected domain are all greater than the threshold, the connected domain is judged to be a defect; otherwise, the connected domain is judged not to be a defect; S10: Draw a minimum circumscribed rectangle, mark the defects determined to be true in S9, and output the defect detection results.
5. The circular magnetic core side defect detection method according to claim 4, characterized in that: The specific operation of S5 is as follows: the boundary coordinate information (z0, z1) of the magnetic core to be tested is obtained from the smoothed image C, along the axis direction of the magnetic core to be tested, z1 represents the coordinate of the top end of the magnetic core to be tested, and z0 represents the coordinate of the bottom end of the magnetic core to be tested; the original image A is divided into multiple images D of the side surfaces of single circular magnetic cores according to the boundary coordinate information and the number of magnetic cores; the boundary coordinate expression of the side surface of the i-th circular magnetic core from bottom to top is as follows: Where, I represents the total number of circular cores contained in the magnetic core to be tested, x i_top represents the coordinates of the top of the i-th circular core, x i_down Represents the coordinates of the bottom end of the i-th circular magnetic core, i=1,2,3,…,I.
6. The circular magnetic core side defect detection method according to claim 4, characterized in that: The S7 is specifically implemented through the following sub-steps: S7.1: Set the seed point and region growing threshold, where the seed point is a set of pixels randomly selected from the image E′; create a completely black image F with the same size as the image E′; S7.2: Create a stack and add the neighborhood pixels of the seed point to the stack; S7.3: Determine whether the stack is empty. If so, it means that all pixels have been visited, end the loop, and execute S8; if not, execute S7.4; S7.4: Take a pixel from the stack as the current pixel, and check whether the pixel has been visited. If so, return to S7.3; if not, mark the current pixel as visited, and execute S7.5; S7.5: Determine whether the absolute value of the grayscale difference between the current pixel and the seed point is less than or equal to the regional growth threshold. If so, mark the current pixel as normal, set the corresponding pixel in image F to white, add the neighboring pixels of the current pixel to the stack, and return to S7.3; otherwise, return directly to S7.
3.
7. The circular magnetic core side defect detection method according to claim 4, characterized in that: The S3 is specifically implemented through the following sub-steps: (3.1) Calculate the frequency domain of the enhanced image B, the expression is as follows: Where f(x,y) represents the pixel value corresponding to the (x,y) coordinate of the enhanced image B, (u,v) represents the two-dimensional frequency domain coordinate corresponding to (x,y), and F(u,v) represents the frequency domain value corresponding to f(x,y); (3.2) Multiply the frequency domain of the enhanced image B by the update factor to obtain the updated frequency domain: F(u,v)′=H(u,v)*F(u,v); Where H(u,v) represents the update factor, D(u,v) is the distance from the point (u,v) to the center of the two-dimensional frequency domain image; D0 is the cutoff frequency, and n represents the filter order; (3.3) Perform a two-dimensional discrete Fourier inverse transform on the updated frequency domain to obtain a smoothed image C, which is expressed as follows: Where f(x, y)′ is the pixel value of the smoothed image C at point (x, y).
8. The circular magnetic core side defect detection method according to claim 4, characterized in that: The specific operation of S4 is as follows: traverse all possible Otsu thresholds, and for each threshold, divide all pixels of the image into two categories, where pixels less than or equal to the Otsu threshold TH are classified into the C1 category, and pixels greater than TH are classified into the C2 category; calculate the inter-class variance σ, which is expressed as follows: σ 2 =p1p2(m1-m2) 2 m g =p1m1+p2m2 p1+p2=1 In the formula, p1 represents the probability that the pixel is classified into the C1 category, p2 represents the probability that the pixel is classified into the C2 category; m1 represents the pixel mean of the C1 category pixels, m2 represents the pixel mean of the C2 category pixels, and m g represents the global mean; The maximum value of all inter-class variances is taken, and the corresponding Otsu threshold is used for binary segmentation to obtain the boundary coordinates of the side image of the magnetic core to be tested.
9. The circular magnetic core side defect detection method according to claim 4, characterized in that: In S6, the specific operation of removing boundary interference is as follows: count the image C′ in the row direction, if the ratio of white pixels in a row to the total number of pixels in the row is less than the set ratio threshold, the pixel points in the row are considered to be the gap area between the two circular magnetic cores, and all pixel values of the pixel points in the row are set to 0 to obtain the mask image E; otherwise, they are all set to white.
Citation Information
Patent Citations
Electromagnetic product quality automatic detection method and classification device based on image recognition
CN112927191A
Round magnetic core side defect detection device and method thereof
CN115615998A