A contactless dimensional measurement method for permanent magnet magnetic property measurements
Patent Information
- Application Number
- CN202610238581.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-28
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2046-02-28
AI Technical Summary
[0003]手动测量方式存在明显的技术局限,不仅测量效率低下,难以匹配大批量、快节奏的检测需求,且有限的测量次数无法完整覆盖磁体轮廓,对尺寸不均匀的磁体易产生较大测量偏差,影响后续磁特性计算的精准度
本发明采用视觉识别与智能算法实现永磁体无接触尺寸测量,相较传统手动测量,测量效率大幅提升,可适配磁特性全流程自动化检测工况;通过多高度、360°多角度采样,结合亚像素直线拟合、圆度补偿与多高度融合算法,有效降低永磁体尺寸不均匀带来的测量误差,大幅提升直径与截面积测量的准确度和重复性;位移补偿与自适应边缘提取技术保障了轮廓识别的精准性,加权计算进一步优化测量结果,同时无接触方式避免了对磁体的物理损伤,为磁特性精准计算提供可靠的尺寸参数支撑。
Smart Images

Figure CN122108006B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of permanent magnet magnetic property measurement, and more particularly to a non-contact dimension measurement method for permanent magnet magnetic property measurement. Background Technology
[0002] In the field of rare earth permanent magnet magnetic property testing, the cross-sectional area of the magnet needs to be accurately obtained before measuring key indicators such as hysteresis loop and demagnetization curve. This parameter directly participates in the core calculation of magnetic polarization intensity and magnetic flux density, and is an important prerequisite for ensuring the accuracy of magnetic property measurement results. Currently, the industry generally uses measuring tools such as micrometers and calipers for manual dimensional measurement. The diameter or side length is measured repeatedly at different positions of the magnet at least 5 times, and the average value is taken to convert it into the cross-sectional area. For magnets with non-uniform shapes, the number of measurements needs to be increased further to minimize errors.
[0003] Manual measurement methods have significant technical limitations. Not only are they inefficient, making them unsuitable for high-volume, fast-paced testing, but the limited number of measurements also fails to fully cover the magnet's outline. Furthermore, they are prone to significant measurement deviations for magnets with uneven dimensions, affecting the accuracy of subsequent magnetic property calculations. Meanwhile, with the rapid development of the rare earth industry, market demands for the accuracy and repeatability of magnet magnetic property measurements are continuously increasing. The automation upgrade process in the field of magnetic measurement is accelerating, and fully automated magnetic property testing has become an industry trend. Traditional manual dimensional measurement methods cannot be integrated with automated testing processes, becoming a key factor restricting the automation and intelligent development of magnetic property testing.
[0004] In addition, the shortcomings in the accuracy and efficiency of existing size measurement methods directly affect the overall level of magnetic property measurement. The industry urgently needs a magnet size measurement method that can achieve accuracy, efficiency and automation to adapt to the technical upgrade requirements of magnetic property detection and improve the overall quality and efficiency of rare earth permanent magnet detection. Summary of the Invention
[0005] The purpose of this invention is to provide a non-contact dimension measurement method for measuring the magnetic properties of permanent magnets.
[0006] To achieve the above objectives, the present invention is implemented according to the following technical solution: This invention includes the following steps: A high-contrast contour image of the permanent magnet to be measured is acquired, and the high-contrast contour image is preprocessed. The preprocessing includes Gaussian filtering to suppress noise in the original grayscale image; gradient enhancement using the Sober operator; and automatic delineation of one or more horizontal measurement zones by the user or the system to cover typical height positions of the sample at the top, middle and bottom. The displacement compensation of the permanent magnet to be measured is performed according to the centroid tracking algorithm to obtain the optimized centroid coordinates. The high-contrast contour image is corrected according to the optimized centroid coordinates. Adaptive edge extraction is performed on the high-contrast contour image to obtain the edge points of the permanent magnet. A two-stage fitting strategy is used to perform sub-pixel straight line fitting on the edge points of the permanent magnet to obtain the vertical distance between the fitted lines. The average diameter is obtained by roundness compensation of the vertical distance based on multi-angle sampling. The average diameter is obtained by multi-height fusion, and the equivalent cross-sectional area is calculated by weighted averaging. The average diameter and the equivalent cross-sectional area are then output as measurement results.
[0007] Furthermore, the method for obtaining optimized centroid coordinates by performing displacement compensation on the permanent magnet to be measured based on the centroid tracking algorithm includes: In the first frame image, the region of interest of the permanent magnet is defined according to the preset measurement zone position. The gray value distribution of pixels within the region of interest is statistically analyzed to generate a target gray-level histogram as a template. The initial centroid coordinates are calculated using the gray-level weighted average method.
[0008] in The grayscale value of the pixel within the region of interest. Let these be the initial centroid coordinates. The row coordinates of the pixel. The column coordinates of the pixel; For each subsequent frame, the pixel grayscale value is converted into a probability value under the initial histogram distribution, and a probability map is generated. Starting from the initial centroid, the pattern point of the density distribution is iteratively searched in the probability map through the mean offset vector. The iteration stops when the relative deviation between the average grayscale of the current region and the template grayscale is less than the deviation threshold. A Kalman filter is used to predict the target's position in the next frame. The predicted value is then weighted and fused with the mean drift result to output the optimized centroid coordinates.
[0009] Further, the method for optimizing the high-contrast contour image based on the centroid coordinates includes: Compare the current frame centroid with the initial centroid, calculate the horizontal and vertical displacements, and perform a geometric transformation on the high-contrast contour image of the current frame based on these displacements. The expression is as follows:
[0010] in The corrected pixel grayscale value. This represents the displacement in the horizontal direction. This represents the displacement in the vertical direction; Output the corrected high-contrast contour image based on the corrected pixel grayscale values.
[0011] Furthermore, the method for adaptive edge extraction of the high-contrast contour image to obtain the edge points of the permanent magnet includes: The high-contrast color contour image is converted into an 8-bit grayscale image with a grayscale value range of [0, 255], where the permanent magnet area presents a high grayscale value and the background area presents a low grayscale value. Iterate through all segmentation thresholds, treating grayscale values greater than or equal to the threshold as foreground and those less than the threshold as background, and calculate the variance between foreground and background:
[0012] in This represents the percentage of background pixels. Foreground pixel ratio The average grayscale value of the background pixels. The average grayscale value of the foreground pixels. The variance between the foreground and background; The threshold with the largest variance between the foreground and background is selected as the segmentation threshold to binarize the grayscale image: pixels with grayscale values greater than the segmentation threshold are set to 1, and those with grayscale values less than the segmentation threshold are set to 0, thus obtaining a binarized contour image. Scan the binarized image line by line along the vertical direction of the image. For each scan line, traverse the pixels from left to right and record the coordinates of the first pixel with a gray value of 1 as the left edge candidate point; traverse from right to left and record the coordinates of the first pixel with a gray value of 1 as the right edge candidate point; if there are no foreground pixels in the entire line, mark it as an invalid line; summarize the left and right edge candidate points of all valid lines to form an initial edge point set; A 3×3 square structuring element is used to balance noise reduction and contour detail preservation. Morphological closing operation is performed on the binarized image to fill the small holes in the initial edge candidate point set and eliminate isolated noise. Based on the image after the closing operation, the initial edge point set is re-verified, and candidate points judged as noise are removed to obtain the denoised edge point set. The 3×3 square structuring element is used to perform a morphological closing operation of dilation followed by erosion on the binarized image to fill the small holes in the initial edge candidate point set and eliminate isolated noise. Isolated noise is a discrete point with a distance greater than 2 pixels from the main contour, and small holes are closed regions with an area of less than 5 pixels. Continuity detection is performed on the left and right edge point sets respectively, and the horizontal distance between adjacent points is calculated. If the horizontal distance is greater than 3 pixels, it is determined to be an edge break, and the middle point is supplemented by linear interpolation. Based on the geometric characteristics of the permanent magnet's outline, local slope analysis is performed on the edge point set to eliminate points with abrupt slope changes and retain valid points that conform to the overall outline trend. The processed left and right edge point sets are output as permanent magnet edge points.
[0013] Furthermore, a method for obtaining the vertical distance between fitted lines by performing sub-pixel straight-line fitting on the edge points of the permanent magnet using a two-stage fitting strategy includes: Input the left and right edge points obtained by adaptive edge extraction, assume the equation of the line, minimize the sum of squared residuals by the least squares method, solve for the slope and intercept, and obtain the initial fitted lines of the left and right edges respectively. Use the initial fitted lines as the initial model for sub-pixel optimization. Extract the 3×3 neighborhood grayscale matrix of the edge points and calculate the Zernike moments. , , The sub-pixel offset of the edge is solved by using moment values:
[0014] in For complex numbers The real part, For complex numbers The imaginary part, It is the zeroth Zernike moment. For the negative mode of the first-order Zernike moment, For the positive mode of the first-order Zernike moment, This represents the sub-pixel offset of the edge in the horizontal direction. This represents the sub-pixel offset of the edge in the vertical direction. For scenarios with high computational complexity of Zernike moments, a quadratic interpolation method is used for optimization: a quadratic curve is fitted to the gray values of the neighborhood along the edge normal direction, and the coordinates corresponding to the extreme points of the curve are taken as the sub-pixel edge positions; the left and right edge points are superimposed with the sub-pixel offsets to obtain a sub-pixel level edge point set. The subpixel-level edge point set is refitted with a straight line using weighted least squares method. When the slope change between two consecutive fitted lines is less than 10... -4 And the change in intercept is less than 10. -3 When the pixel reaches a certain value, the iteration stops, and the left sub-pixel line and the right sub-pixel line are output; If the left subpixel line and the right subpixel line are parallel, the vertical distance is calculated according to the line distance formula; if the left subpixel line and the right subpixel line are not parallel, the instantaneous diameter at the current rotation angle is obtained by correcting the average distance from the intersection point to the edge point set.
[0015] Furthermore, the method for obtaining the average diameter by performing roundness compensation on the vertical distance based on multi-angle sampling includes: The precision rotating platform is controlled to rotate the permanent magnet in adjustable fixed angle steps, covering the entire 360° circumference, and multiple sets of diameter data are collected to form a diameter sequence and the corresponding collection angle sequence to obtain the initial average diameter. Based on the ellipticity or irregularity of permanent magnets, angular density weighting is introduced to assign higher weights to regions with larger diameter change rates. The weighted average diameter is then calculated, and the expressions for the weights and the weighted average diameter are as follows:
[0016]
[0017] in The weight of the c-th diameter data point. The initial average diameter, For the c-th diameter data, The standard deviation of the diameter sequence, For the weighted average diameter, This represents the number of diameter data points. Calculate the residual between the diameter data and the weighted average diameter, fit the residual sequence using a Fourier series, and extract the main components of the roundness error. The expression is:
[0018] in The residual between the c-th diameter data point and the weighted average diameter is... Let c be the random error. This is a systematic bias. It is a first harmonic. The error is a first-order eccentricity error. For the c-th acquisition angle, It is a second harmonic. It has an ellipticity of order 2. like If the deviation is greater than the accuracy, the weighted average diameter is corrected, as expressed by: ,in This is the corrected weighted average diameter; the corrected weighted average diameter is then output as the average diameter.
[0019] Furthermore, the method for obtaining the height-average diameter by multi-height fusion of the average diameter includes: Multiple height sections are uniformly collected along the axis of the permanent magnet, and the average diameter of the corresponding sections is marked. The multiple height sections include the top, bottom and middle heights. Using the median height as the axis of symmetry, the weighting coefficients for each height are calculated using a normal distribution function:
[0020] in For the v-th height weight coefficient, For the v-th height, The middle height, The standard deviation of the distribution is adjusted according to the number of sampling points. , This represents the number of sampling points; The height weighting coefficient is normalized, and the diameter measurement value of each height is multiplied by the corresponding normalized height weighting coefficient and then summed to obtain the average diameter at each height.
[0021] Furthermore, the equivalent cross-sectional area is calculated using the weighted average method, expressed as follows:
[0022] in For the number of heights, Let the average diameter be the height of the vth segment. is the equivalent cross-sectional area, and is the normalized height weighting coefficient.
[0023] The beneficial effects of this invention are: This invention provides a non-contact dimensional measurement method for measuring the magnetic properties of permanent magnets. Compared with existing technologies, this invention has the following technical advantages: This invention employs visual recognition and intelligent algorithms to achieve non-contact dimensional measurement of permanent magnets. Compared to traditional manual measurement, this significantly improves measurement efficiency and is adaptable to fully automated magnetic property testing processes. Through multi-height, 360° multi-angle sampling, combined with sub-pixel linear fitting, roundness compensation, and multi-height fusion algorithms, it effectively reduces measurement errors caused by uneven permanent magnet dimensions, greatly improving the accuracy and repeatability of diameter and cross-sectional area measurements. Displacement compensation and adaptive edge extraction technologies ensure the accuracy of contour recognition, and weighted calculations further optimize the measurement results. Meanwhile, the non-contact method avoids physical damage to the magnet, providing reliable dimensional parameter support for accurate magnetic property calculations. Attached Figure Description
[0024] Figure 1 This is a flowchart illustrating the steps of a non-contact dimension measurement method for measuring the magnetic properties of permanent magnets according to the present invention. Figure 2 This is a structural diagram of a non-contact dimension measuring device used for measuring the magnetic properties of permanent magnets in an embodiment of this specification. 1 is a light source, 2 is the column being measured, 3 is a camera, 4 is a fine-tuning stage, 5 is a turntable, 6 is an electric turntable, 7 is a top column inclined rod, 8 is a rotary motor, and 9 is an electric slide. Detailed Implementation
[0025] The present invention will be further described below through specific embodiments. The illustrative embodiments and descriptions herein are used to explain the present invention, but are not intended to limit the present invention.
[0026] The present invention provides a non-contact dimensional measurement method for measuring the magnetic properties of permanent magnets, comprising the following steps: like Figure 1 As shown, this embodiment includes the following steps: A high-contrast contour image of the permanent magnet to be measured is acquired, and the high-contrast contour image is preprocessed. The preprocessing includes Gaussian filtering to suppress noise in the original grayscale image; gradient enhancement using the Sober operator; and automatic delineation of one or more horizontal measurement zones by the user or the system to cover typical height positions of the sample at the top, middle and bottom. In the actual evaluation, a Φ10mm×10mm cylindrical rare earth permanent magnet with slight ellipticity was used as the sample to be measured (actual major axis 10.008mm, minor axis 9.992mm, with obvious roundness deviation). Measurement was carried out based on the non-contact size measurement method and supporting device of the present invention, focusing on verifying the implementation process and effect of the roundness error correction step; the measurement environment was a room temperature laboratory, with an industrial camera resolution of 2048×2048 and a pixel equivalent of 5μm / pixel, and the angle step of the precision rotating platform was set to 5° (360° full circumference to collect 72 sets of diameter data). Three horizontal measurement zones were drawn along the axis of the permanent magnet (corresponding to heights z=2mm, z=5mm, and z=8mm, with z=5mm as the axis of symmetry). The permanent magnet to be measured is fixed on the support rod of the measuring device. The height is adjusted by the electric slide table so that the three horizontal measuring strips are completely within the camera's field of view. The initial 0° position of the rotating platform is calibrated to ensure that the rotation accuracy is ≤0.1°. The coaxial light source is turned on and the brightness is adjusted so that the gray value of the permanent magnet outline is 200~255 and the gray value of the background is 0~50 to form a high contrast. The camera acquisition frame rate is set to 10 frames / second. An industrial camera captures high-contrast contour images of the permanent magnet, automatically converts the color images into 8-bit grayscale images, applies a 5×5 Gaussian filter to the original grayscale images to suppress noise, and then uses the Sober operator for gradient enhancement to highlight the edge contours of the permanent magnet. The system automatically defines three horizontal measurement zones (z=2mm, z=5mm, z=8mm), each with a width of 50 pixels, covering typical height positions at the top, middle, and bottom of the sample. The displacement compensation of the permanent magnet to be measured is performed according to the centroid tracking algorithm to obtain the optimized centroid coordinates. The high-contrast contour image is corrected according to the optimized centroid coordinates. Adaptive edge extraction is performed on the high-contrast contour image to obtain the edge points of the permanent magnet. A two-stage fitting strategy is used to perform sub-pixel straight line fitting on the edge points of the permanent magnet to obtain the vertical distance between the fitted lines. The average diameter is obtained by roundness compensation of the vertical distance based on multi-angle sampling. The average diameter is obtained by multi-height fusion, and the equivalent cross-sectional area is calculated by weighted averaging. The average diameter and the equivalent cross-sectional area are then output as measurement results.
[0027] In this embodiment, the method for obtaining optimized centroid coordinates by performing displacement compensation on the permanent magnet to be measured according to the centroid tracking algorithm includes: In the first frame image, the region of interest of the permanent magnet is defined according to the preset measurement zone position. The gray value distribution of pixels within the region of interest is statistically analyzed to generate a target gray-level histogram as a template. The initial centroid coordinates are calculated using the gray-level weighted average method.
[0028] in The grayscale value of the pixel within the region of interest. Let these be the initial centroid coordinates. The row coordinates of the pixel. The column coordinates of the pixel; For each subsequent frame, the pixel grayscale value is converted into a probability value under the initial histogram distribution, and a probability map is generated. Starting from the initial centroid, the pattern point of the density distribution is iteratively searched in the probability map through the mean offset vector. The iteration stops when the relative deviation between the average grayscale of the current region and the template grayscale is less than the deviation threshold. A Kalman filter is used to predict the target's position in the next frame. The predicted value is then weighted and fused with the mean drift result to output the optimized centroid coordinates. In actual evaluation, the deviation threshold is 5%, which is calculated as |current average gray level - template average gray level| / template average gray level × 100%. In the first frame of the 0° image, regions of interest are defined for the three measurement zones. The initial centroid coordinates are calculated using the gray-level weighted average method. Taking the upper measurement zone (z=2mm) as an example, the initial centroid coordinates are (1024.1, 480.3), the middle measurement zone (1024.0, 1024.0), and the lower measurement zone (1024.2, 1567.9). For each frame of image acquired during the subsequent rotation process, the pixel grayscale value is converted into a probability value under the initial histogram distribution. The density distribution pattern point is found by iteratively searching through the mean offset vector. The deviation threshold is set to 5%, and the iteration stops when the relative deviation is less than 5%.
[0029] In this embodiment, the method for creating the high-contrast contour image based on the optimized centroid coordinates includes: Compare the current frame centroid with the initial centroid, calculate the horizontal and vertical displacements, and perform a geometric transformation on the high-contrast contour image of the current frame based on these displacements. The expression is as follows:
[0030] in The corrected pixel grayscale value. This represents the displacement in the horizontal direction. This represents the displacement in the vertical direction; Output the corrected high-contrast contour image based on the corrected pixel grayscale values.
[0031] In this embodiment, the method for adaptive edge extraction of the high-contrast contour image to obtain the edge points of the permanent magnet includes: The high-contrast color contour image is converted into an 8-bit grayscale image with a grayscale value range of [0, 255], where the permanent magnet area presents a high grayscale value and the background area presents a low grayscale value. Iterate through all segmentation thresholds, treating grayscale values greater than or equal to the threshold as foreground and those less than the threshold as background, and calculate the variance between foreground and background:
[0032] in This represents the percentage of background pixels. Foreground pixel ratio The average grayscale value of the background pixels. The average grayscale value of the foreground pixels. The variance between the foreground and background; The threshold with the largest variance between the foreground and background is selected as the segmentation threshold to binarize the grayscale image: pixels with grayscale values greater than the segmentation threshold are set to 1, and those with grayscale values less than the segmentation threshold are set to 0, thus obtaining a binarized contour image. Scan the binarized image line by line along the vertical direction of the image. For each scan line, traverse the pixels from left to right and record the coordinates of the first pixel with a gray value of 1 as the left edge candidate point; traverse from right to left and record the coordinates of the first pixel with a gray value of 1 as the right edge candidate point; if there are no foreground pixels in the entire line, mark it as an invalid line; summarize the left and right edge candidate points of all valid lines to form an initial edge point set; A 3×3 square structuring element is used to balance noise reduction and contour detail preservation. Morphological closing operation is performed on the binarized image to fill the small holes in the initial edge candidate point set and eliminate isolated noise. Based on the image after the closing operation, the initial edge point set is re-verified, and candidate points judged as noise are removed to obtain the denoised edge point set. The 3×3 square structuring element is used to perform a morphological closing operation of dilation followed by erosion on the binarized image to fill the small holes in the initial edge candidate point set and eliminate isolated noise. Isolated noise is a discrete point with a distance greater than 2 pixels from the main contour, and small holes are closed regions with an area of less than 5 pixels. Continuity detection is performed on the left and right edge point sets respectively, and the horizontal distance between adjacent points is calculated. If the horizontal distance is greater than 3 pixels, it is determined to be an edge break, and the middle point is supplemented by linear interpolation. Based on the geometric characteristics of the permanent magnet's outline, local slope analysis is performed on the edge point set to eliminate points with abrupt slope changes and retain valid points that conform to the overall outline trend. The processed left and right edge point sets are output as permanent magnet edge points; In actual evaluation, all division thresholds within the grayscale value range [0,255] are traversed, and grayscale values greater than or equal to the division threshold in the grayscale image are taken as foreground, and those less than the threshold are taken as background; if the horizontal distance is greater than 3 pixels, the edge continuity determination threshold is set according to the image resolution for 3 pixels. Traversing the grayscale value range [0, 255], the segmentation threshold is determined by maximizing the inter-class variance. The segmentation threshold for all three measurement zones is 180. The grayscale image is binarized (grayscale > 180 is set to 1, otherwise it is set to 0). The image is scanned line by line along the vertical direction to extract candidate points of the left and right edges, forming an initial edge point set. Morphological closing operations (dilation followed by erosion) are performed using 3×3 square structuring elements to eliminate isolated noise points (distance from the main body contour > 2 pixels) and fill small holes (area < 5 pixels). Then, the edge point set is subjected to continuity detection. Linear interpolation is performed on edge breaks with a horizontal distance > 3 pixels to remove abrupt slope changes. Finally, the denoised and completed permanent magnet edge point set is obtained. Each measurement zone contains approximately 200 valid points in the left and right edge point sets.
[0033] In this embodiment, a method for obtaining the vertical distance between fitted lines by performing sub-pixel straight-line fitting on the edge points of the permanent magnet using a two-stage fitting strategy includes: Input the left and right edge points obtained by adaptive edge extraction, assume the equation of the line, minimize the sum of squared residuals by the least squares method, solve for the slope and intercept, and obtain the initial fitted lines of the left and right edges respectively. Use the initial fitted lines as the initial model for sub-pixel optimization. Extract the 3×3 neighborhood grayscale matrix of the edge points and calculate the Zernike moments. , , The sub-pixel offset of the edge is solved by using moment values:
[0034] in For complex numbers The real part, For complex numbers The imaginary part, It is the zeroth Zernike moment. For the negative mode of the first-order Zernike moment, For the positive mode of the first-order Zernike moment, This represents the sub-pixel offset of the edge in the horizontal direction. This represents the sub-pixel offset of the edge in the vertical direction. For scenarios with high computational complexity of Zernike moments, a quadratic interpolation method is used for optimization: a quadratic curve is fitted to the gray values of the neighborhood along the edge normal direction, and the coordinates corresponding to the extreme points of the curve are taken as the sub-pixel edge positions; the left and right edge points are superimposed with the sub-pixel offsets to obtain a sub-pixel level edge point set. The subpixel-level edge point set is refitted with a straight line using weighted least squares method. When the slope change between two consecutive fitted lines is less than 10... -4 And the change in intercept is less than 10. -3 When the pixel reaches a certain value, the iteration stops, and the left sub-pixel line and the right sub-pixel line are output; If the left subpixel line and the right subpixel line are parallel, the vertical distance is calculated according to the line distance formula; if the left subpixel line and the right subpixel line are not parallel, the instantaneous diameter at the current rotation angle is obtained by correcting the average distance from the intersection point to the edge point set. In actual evaluation, the 3×3 neighborhood gray matrix of the edge point is extracted, and the zero-order Zernike moment, the negative mode of the first-order Zernike moment, and the positive mode of the first-order Zernike moment are calculated. By fitting a straight line to the left and right edge point sets using the least squares method, an initial fitted straight line is obtained. Taking the above measurement zone 0° image as an example, the initial straight line equation for the left edge is: The initial straight line equation on the right edge is: ; The left and right subpixel lines of the three measurement bands are approximately parallel. The vertical distance is calculated using the straight-line distance formula to obtain the instantaneous diameter at each angle. At 0°, the diameter of the upper measurement band is 10.007mm, the diameter of the middle measurement band is 10.008mm, and the diameter of the lower measurement band is 10.007mm. At 180°, the diameters of the upper measurement band, the middle measurement band, and the lower measurement band are 9.993mm, which clearly exhibit ellipticity characteristics.
[0035] In this embodiment, the method for obtaining the average diameter by performing roundness compensation on the vertical distance based on multi-angle sampling includes: The precision rotating platform is controlled to rotate the permanent magnet in adjustable fixed angle steps, covering the entire 360° circumference, and multiple sets of diameter data are collected to form a diameter sequence and the corresponding collection angle sequence to obtain the initial average diameter. Based on the ellipticity or irregularity of permanent magnets, angular density weighting is introduced to assign higher weights to regions with larger diameter change rates. The weighted average diameter is then calculated, and the expressions for the weights and the weighted average diameter are as follows:
[0036]
[0037] in The weight of the c-th diameter data point. The initial average diameter, For the c-th diameter data, The standard deviation of the diameter sequence, For the weighted average diameter, This represents the number of diameter data points. Calculate the residual between the diameter data and the weighted average diameter, fit the residual sequence using a Fourier series, and extract the main components of the roundness error. The expression is:
[0038] in The residual between the c-th diameter data point and the weighted average diameter is... Let c be the random error. This is a systematic bias. It is a first harmonic. For first-order eccentricity error, For the c-th acquisition angle, It is a second harmonic. It has an ellipticity of order 2. like If the deviation is greater than the accuracy, the weighted average diameter is corrected, as expressed by: ,in This is the corrected weighted average diameter; the corrected weighted average diameter is then output as the average diameter. In the actual evaluation, the precision rotating platform was controlled to rotate the permanent magnet in 5° increments, collecting a total of 72 sets of diameter data in 360°, forming a diameter sequence and a collection angle sequence. The initial average diameter was calculated for each measurement zone: 10.000 mm for the upper measurement zone, 10.000 mm for the middle measurement zone, and 10.000 mm for the lower measurement zone. Diameter sequence standard deviation All are equal to 0.004mm. The weighted average diameter is then obtained by using the weighted average formula: 10.0002mm for the upper measuring zone, 10.003mm for the middle measuring zone, and 10.0002mm for the lower measuring zone. The core error parameters of the three measurement zones were calculated to be consistent, specifically: systematic deviation of 0.0012 mm, first harmonic error of 0.0078 mm, first eccentricity error of 0.0003 mm, second harmonic error of 0.0002 mm, second ellipticity of 0.0079 mm, and random error less than or equal to 0.0005 mm. Set the deviation accuracy to 0.001mm, because If the difference is greater than 0.001 mm, the weighted diameter is corrected to obtain the corrected average diameter: 9.999 mm for the upper measuring band, 9.9991 mm for the middle measuring band, and 9.999 mm for the lower measuring band.
[0039] In this embodiment, the method for obtaining the height-average diameter by multi-height fusion of the average diameter includes: Multiple height sections are uniformly collected along the axis of the permanent magnet, and the average diameter of the corresponding sections is marked. The multiple height sections include the top, bottom and middle heights. Using the median height as the axis of symmetry, the weighting coefficients for each height are calculated using a normal distribution function:
[0040] in For the v-th height weight coefficient, For the v-th height, The middle height, The standard deviation of the distribution is adjusted according to the number of sampling points. , This represents the number of sampling points; The height weighting coefficient is normalized, and the diameter measurement value of each height is multiplied by the corresponding normalized height weighting coefficient and then summed to obtain the average diameter at each height. In the actual assessment, the number of sampling points was 3, and the standard deviation of the distribution was 0.75 mm; with the median height of 5 mm as the axis of symmetry, It is 0.135. =1, It is 0.135. It is 0.107. It is 0.786. The value is 0.107, and the average diameter at height is 9.9991.
[0041] In this embodiment, the weighted average method is used to calculate the equivalent cross-sectional area, and the expression is:
[0042] in For the number of heights, Let the average diameter be the height of the vth segment. Where is the equivalent cross-sectional area, and is the normalized height weighting coefficient; In the actual assessment, the height is 3, and the equivalent cross-sectional area is 78.538 mm. 2 .
[0043] Figure 2 This is a structural diagram of a non-contact dimension measuring device for measuring the magnetic properties of permanent magnets, as described in the embodiments of this specification. The electric turntable rotates and drives different columns to move to the measuring position via the turntable. The rotary motor drives the top column material rod to rotate 360 degrees. The motor slide drives the rotary motor to lift and lower the material to the measuring height, and then rotates 360 degrees for measurement.
[0044] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A non-contact dimensional measurement method for measuring the magnetic properties of permanent magnets, characterized in that, Includes the following steps: A high-contrast contour image of the permanent magnet to be measured is acquired, and the high-contrast contour image is preprocessed. The preprocessing includes Gaussian filtering to suppress noise in the original grayscale image; gradient enhancement using the Sober operator; and automatic delineation of one or more horizontal measurement zones by the user or the system to cover typical height positions of the sample at the top, middle and bottom. The displacement compensation of the permanent magnet to be measured is performed according to the centroid tracking algorithm to obtain the optimized centroid coordinates. The high-contrast contour image is corrected according to the optimized centroid coordinates. Adaptive edge extraction is performed on the high-contrast contour image to obtain the edge points of the permanent magnet. A two-stage fitting strategy is used to perform sub-pixel straight line fitting on the edge points of the permanent magnet to obtain the vertical distance between the fitted lines. The average diameter is obtained by roundness compensation of the vertical distance based on multi-angle sampling. The average diameter is obtained by multi-height fusion, and the equivalent cross-sectional area is calculated by weighted averaging. The average diameter and the equivalent cross-sectional area are then output as measurement results.
2. The non-contact dimension measurement method for measuring the magnetic properties of permanent magnets according to claim 1, characterized in that, A method for obtaining optimized centroid coordinates by displacement compensation of the permanent magnet to be measured based on a centroid tracking algorithm includes: In the first frame image, the region of interest of the permanent magnet is defined according to the preset measurement zone position. The gray value distribution of pixels within the region of interest is statistically analyzed to generate a target gray-level histogram as a template. The initial centroid coordinates are calculated using the gray-level weighted average method. in The grayscale value of the pixel within the region of interest. Let these be the initial centroid coordinates. The row coordinates of the pixel. The column coordinates of the pixel; For each subsequent frame, the pixel grayscale value is converted into a probability value under the initial histogram distribution, and a probability map is generated. Starting from the initial centroid, the pattern point of the density distribution is iteratively searched in the probability map through the mean offset vector. The iteration stops when the relative deviation between the average grayscale of the current region and the template grayscale is less than the deviation threshold. A Kalman filter is used to predict the target's position in the next frame. The predicted value is then weighted and fused with the mean drift result to output the optimized centroid coordinates.
3. The non-contact dimension measurement method for measuring the magnetic properties of permanent magnets according to claim 1, characterized in that, The method for correcting the high-contrast contour image based on the optimized centroid coordinates includes: Compare the current frame centroid with the initial centroid, calculate the horizontal and vertical displacements, and perform a geometric transformation on the high-contrast contour image of the current frame based on these displacements. The expression is as follows: in The corrected pixel grayscale value. This represents the displacement in the horizontal direction. This represents the displacement in the vertical direction; Output the corrected high-contrast contour image based on the corrected pixel grayscale values.
4. The non-contact dimension measurement method for measuring the magnetic properties of permanent magnets according to claim 1, characterized in that, A method for adaptive edge extraction of the high-contrast contour image to obtain the edge points of the permanent magnet includes: The high-contrast color contour image is converted into an 8-bit grayscale image with a grayscale value range of [0, 255], where the permanent magnet area presents a high grayscale value and the background area presents a low grayscale value. Iterate through all segmentation thresholds, treating grayscale values greater than or equal to the threshold as foreground and those less than the threshold as background, and calculate the variance between foreground and background: in This represents the percentage of background pixels. Foreground pixel ratio The average grayscale value of the background pixels. The average grayscale value of the foreground pixels. The variance between the foreground and background; The threshold with the largest variance between the foreground and background is selected as the segmentation threshold to binarize the grayscale image: pixels with grayscale values greater than the segmentation threshold are set to 1, and those with grayscale values less than the segmentation threshold are set to 0, thus obtaining a binarized contour image. Scan the binarized image line by line along the vertical direction of the image. For each scan line, traverse the pixels from left to right and record the coordinates of the first pixel with a gray value of 1 as the left edge candidate point; traverse from right to left and record the coordinates of the first pixel with a gray value of 1 as the right edge candidate point; if there are no foreground pixels in the entire line, mark it as an invalid line; summarize the left and right edge candidate points of all valid lines to form an initial edge point set; A 3×3 square structuring element is used to balance noise reduction and contour detail preservation. Morphological closing operation is performed on the binarized image to fill the small holes in the initial edge candidate point set and eliminate isolated noise. Based on the image after the closing operation, the initial edge point set is re-verified, and candidate points judged as noise are removed to obtain the denoised edge point set. The 3×3 square structuring element is used to perform a morphological closing operation of dilation followed by erosion on the binarized image to fill the small holes in the initial edge candidate point set and eliminate isolated noise. Isolated noise is a discrete point with a distance greater than 2 pixels from the main contour, and small holes are closed regions with an area of less than 5 pixels. Continuity detection is performed on the left and right edge point sets respectively, and the horizontal distance between adjacent points is calculated. If the horizontal distance is greater than 3 pixels, it is determined to be an edge break, and the middle point is supplemented by linear interpolation. Based on the geometric characteristics of the permanent magnet's outline, local slope analysis is performed on the edge point set to eliminate points with abrupt slope changes and retain valid points that conform to the overall outline trend. The processed left and right edge point sets are output as permanent magnet edge points.
5. The non-contact dimension measurement method for measuring the magnetic properties of permanent magnets according to claim 1, characterized in that, A method for obtaining the perpendicular distance between fitted lines by performing sub-pixel straight-line fitting on the edge points of the permanent magnet using a two-stage fitting strategy includes: Input the left and right edge points obtained by adaptive edge extraction, assume the equation of the line, minimize the sum of squared residuals by the least squares method, solve for the slope and intercept, and obtain the initial fitted lines of the left and right edges respectively. Use the initial fitted lines as the initial model for sub-pixel optimization. Extract the 3×3 neighborhood grayscale matrix of the edge points and calculate the Zernike moments. , , The sub-pixel offset of the edge is solved by using moment values: in For complex numbers The real part, For complex numbers The imaginary part, It is the zeroth Zernike moment. For the negative mode of the first-order Zernike moment, For the positive mode of the first-order Zernike moment, This represents the sub-pixel offset of the edge in the horizontal direction. This represents the sub-pixel offset of the edge in the vertical direction. For scenarios with high computational complexity of Zernike moments, a quadratic interpolation method is used for optimization: a quadratic curve is fitted to the gray values of the neighborhood along the edge normal direction, and the coordinates corresponding to the extreme points of the curve are taken as the sub-pixel edge positions; the left and right edge points are superimposed with the sub-pixel offsets to obtain a sub-pixel level edge point set. The subpixel-level edge point set is refitted with a straight line using weighted least squares method. When the slope change between two consecutive fitted lines is less than 10... -4 And the change in intercept is less than 10. -3 When the pixel reaches a certain value, the iteration stops, and the left sub-pixel line and the right sub-pixel line are output; If the left subpixel line and the right subpixel line are parallel, the vertical distance is calculated according to the line distance formula; if the left subpixel line and the right subpixel line are not parallel, the instantaneous diameter at the current rotation angle is obtained by correcting the average distance from the intersection point to the edge point set.
6. The non-contact dimension measurement method for measuring the magnetic properties of permanent magnets according to claim 1, characterized in that, A method for obtaining the average diameter by performing roundness compensation on the vertical distance based on multi-angle sampling includes: The precision rotating platform is controlled to rotate the permanent magnet in adjustable fixed angle steps, covering the entire 360° circumference, and multiple sets of diameter data are collected to form a diameter sequence and the corresponding collection angle sequence to obtain the initial average diameter. Based on the ellipticity or irregularity of permanent magnets, angular density weighting is introduced to assign higher weights to regions with larger diameter change rates. The weighted average diameter is then calculated, and the expressions for the weights and the weighted average diameter are as follows: in The weight of the c-th diameter data point. The initial average diameter, For the c-th diameter data, The standard deviation of the diameter sequence, For the weighted average diameter, This represents the number of diameter data points. Calculate the residual between the diameter data and the weighted average diameter, fit the residual sequence using a Fourier series, and extract the main components of the roundness error. The expression is: in The residual between the c-th diameter data point and the weighted average diameter is... Let c be the random error. This is a systematic bias. It is a first harmonic. The error is a first-order eccentricity error. For the c-th acquisition angle, It is a second harmonic. It has an ellipticity of order 2. like If the deviation is greater than the accuracy, the weighted average diameter is corrected, as expressed by: ,in This is the corrected weighted average diameter; the corrected weighted average diameter is then output as the average diameter.
7. The non-contact dimensional measurement method for measuring the magnetic properties of permanent magnets according to claim 1, characterized in that, A method for obtaining a height-average diameter by multi-height fusion of the average diameter includes: Multiple height sections are uniformly collected along the axis of the permanent magnet, and the average diameter of the corresponding sections is marked. The multiple height sections include the top, bottom and middle heights. Using the median height as the axis of symmetry, the weighting coefficients for each height are calculated using a normal distribution function: in For the v-th height weight coefficient, For the v-th height, The middle height, The standard deviation of the distribution is adjusted according to the number of sampling points. , This represents the number of sampling points; The height weighting coefficient is normalized, and the diameter measurement value of each height is multiplied by the corresponding normalized height weighting coefficient and then summed to obtain the average diameter at each height.
8. The non-contact dimension measurement method for measuring the magnetic properties of permanent magnets according to claim 1, characterized in that, The equivalent cross-sectional area is calculated using the weighted average method, and the expression is as follows: in For the number of heights, Let the average diameter be the height of the vth segment. For equivalent cross-sectional area, This is the normalized height weighting coefficient.
Citation Information
Patent Citations
Diameter measuring method and device for highly reflective cylinder and use method
CN109945792A
Optical fiber diameter measuring method
CN110954002A