Bearing double-end face image registration and difference comparison defect detection method and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU DEX MASCH CO LTD
- Filing Date
- 2026-05-08
- Publication Date
- 2026-08-04
AI Technical Summary
采用常规的仿射变换进行全局配准时,虽然可以校正整体伸缩,但往往难以消除因机械夹持或材料应力导致的残留局部形变,从而在差异比较后有可能在环形区域残留环状伪影,进而可能将无缺陷轴承误判为存在划痕或磨损
采用微观纹理锚点构建虚拟约束弦,实现角度旋转补偿和均匀缩放修正,可同步校正轴承翻转、夹持、定位间隙导致的内外圈区域不一致伸缩,解决传统仿射/相似变换无法适配局部形变的问题,从根源消除差异比较后的环状伪影,降低无缺陷轴承的误判率。以倒角曲率极值点、油槽拓扑缺口作为唯一性微观纹理锚点,不受光照、油污、轻微磨损干扰,配准基准稳定可靠;结合虚拟势能场模型与纹理互相关动态引力/斥力调节,实现粗配准和精配准两级精准对齐,在机械振动、夹持波动、定位偏差等工业现场条件下保持稳定配准。基于精配准图像对进行逐像素差分,并滤除机械振动带来的周期性离散噪点,可提取真实缺陷信号,有效区分缺陷与机械扰动噪声;通过连通域投影面积、灰度反差比、几何特征综合判定,实现缺陷类型与位置坐标的自动化、高精度识别。全程为图像算法运算,无复杂人工干预与机械调整,单工件检测流程耗时短,兼容全自动影像检测机的上料、翻面、多工位检测流程,不降低产线产能。全程采用非接触式视觉成像与纯图像算法处理,无挤压、磕碰、划伤、增磁等二次损伤风险,符合轴承高精度外观与尺寸检测的无损要求。基于外圆、内孔几何特征自适应构建环形特征带,对轴承及相近规格工件均能稳定实现配准与缺陷检测。
Smart Images

Figure CN122510192A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision inspection technology, and in particular to a defect detection method and system for image registration and difference comparison of bearing double end faces. Background Technology
[0002] In bearing double-end-face defect detection, surface anomalies are often identified by acquiring images of both end faces separately, then registering and comparing their differences. Existing registration methods mostly employ global transformation models based on feature point matching or grayscale correlation (e.g., affine transformation, similarity transformation). However, in real-world inspection environments, non-uniform radial deformation may sometimes exist between the two bearing end-face images, and the global transformation model's ability to correct such local nonlinear deformations may not always be ideal.
[0003] For example, on an automated inspection line, a bearing is first photographed on its upper surface by a first camera at the loading station. Then, the bearing is flipped by pneumatic grippers and moved to a second station to photograph its lower surface. Due to slight fluctuations in the gripping force of the grippers and occasional slight changes in the clearance between the bearing's inner ring and the positioning mandrel, the annular region (between the outer circle and the inner hole) in the lower surface image may exhibit overall radial stretching (e.g., radial stretching of approximately 0.5%) relative to the upper surface image. While conventional affine transformations can correct for this overall stretching during global registration, they often fail to eliminate residual local deformation caused by mechanical gripping or material stress. Consequently, after comparison, annular artifacts may remain in the annular region, potentially misjudging a defect-free bearing as having scratches or wear. Summary of the Invention
[0004] This invention provides a defect detection method and system for image registration and difference comparison of bearing double end faces, realizing automated and high-precision identification of defect type and location coordinates.
[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: Firstly, a defect detection method for image registration and difference comparison of bearing double-end faces, the method comprising: Step 1: Obtain the original image data of the first end face and the second end face of the bearing, and preprocess the original image data to obtain the standard image of the first end face and the standard image of the second end face. Step 2: Extract the bearing outer circle contour and inner hole edge from the first and second end face standard images to construct an annular feature band; determine the first and second micro-texture anchor points on the annular feature band; establish a local rectangular coordinate system with the first micro-texture anchor point as the origin; when a vector azimuth angle offset of the second micro-texture anchor point relative to the first micro-texture anchor point is detected, calculate the rotation compensation matrix; use the rotation compensation matrix to perform angle correction on the second end face standard image, and construct a virtual constraint chord by connecting the first and second micro-texture anchor points; calculate the radial scaling coefficient based on the length change rate of the virtual constraint chord, and uniformly scale and correct the second end face standard image to obtain a globally coarsely registered image pair; Step 3: Map the corresponding pixels in the global coarse registration image pair to virtual particle nodes to construct a virtual potential energy field model; calculate the texture structure cross-correlation coefficient between adjacent virtual particle nodes, and dynamically adjust the interaction force weight between virtual particle nodes according to the cross-correlation coefficient to obtain the fine registration image pair. Step 4: Perform pixel-by-pixel difference operation on the finely registered image pair to obtain the initial residual map, and filter out periodic discrete noise points to obtain a clean defect mask; perform connected component analysis on the clean defect mask, calculate the projected area of each connected component to determine the defect type and location coordinates.
[0006] Secondly, a defect detection system for image registration and difference comparison of bearing double-end faces includes: The acquisition module is used to acquire the original image data of the first end face and the second end face of the bearing, and to preprocess the original image data to obtain the standard image of the first end face and the standard image of the second end face. The correction module is used to extract the outer circle contour and inner hole edge of the bearing from the first and second end face standard images to construct an annular feature band; determine the first and second micro-texture anchor points on the annular feature band; establish a local rectangular coordinate system with the first micro-texture anchor point as the origin; when a shift in the vector azimuth angle of the second micro-texture anchor point relative to the first micro-texture anchor point is detected, calculate the rotation compensation matrix; use the rotation compensation matrix to perform angle correction on the second end face standard image, and construct a virtual constraint chord by connecting the first and second micro-texture anchor points; calculate the radial scaling coefficient based on the length change rate of the virtual constraint chord, and uniformly scale and correct the second end face standard image to obtain a globally coarsely registered image pair. The calculation module is used to map the corresponding pixels in the global coarse registration image pair to virtual particle nodes in order to construct a virtual potential energy field model; calculate the texture structure cross-correlation coefficient between adjacent virtual particle nodes, and dynamically adjust the interaction force weight between virtual particle nodes according to the cross-correlation coefficient to obtain the fine registration image pair. The judgment module is used to perform pixel-by-pixel difference operations on the finely registered image pairs to obtain the initial residual map and filter out periodic discrete noise to obtain a clean defect mask; the clean defect mask is then subjected to connected component analysis to calculate the projected area of each connected component in order to determine the defect type and location coordinates.
[0007] The above-described solution of the present invention has at least the following beneficial effects: Virtual constraint strings are constructed using micro-texture anchor points to achieve angular rotation compensation and uniform scaling correction. This simultaneously corrects inconsistent expansion and contraction of the inner and outer ring regions caused by bearing flipping, clamping, and positioning gaps, solving the problem that traditional affine / similar transformations cannot adapt to local deformations. It eliminates annular artifacts after difference comparison at the root, reducing the misclassification rate of defect-free bearings. Using chamfer curvature extrema and oil groove topological notches as unique micro-texture anchor points, the registration benchmark is stable and reliable, unaffected by light, oil stains, or slight wear. Combining a virtual potential energy field model with dynamic attraction / repulsion adjustment based on texture cross-correlation, precise alignment at both coarse and fine registration levels is achieved, maintaining stable registration under industrial conditions such as mechanical vibration, clamping fluctuations, and positioning deviations. Pixel-by-pixel differencing is performed on finely registered image pairs, and periodic discrete noise caused by mechanical vibration is filtered out to extract real defect signals, effectively distinguishing defects from mechanical disturbance noise. Automated and high-precision identification of defect types and location coordinates is achieved through comprehensive judgment using connected component projection area, grayscale contrast ratio, and geometric features. The entire process utilizes image algorithms, eliminating complex manual intervention and mechanical adjustments. Single-workpiece inspection is time-efficient and compatible with fully automated image inspection machines for loading, flipping, and multi-station inspection, without reducing production line capacity. The entire process employs non-contact visual imaging and pure image algorithm processing, eliminating the risk of secondary damage such as squeezing, bumping, scratching, and magnetization, meeting the non-destructive requirements for high-precision appearance and dimensional inspection of bearings. Based on the adaptive construction of annular feature bands using the geometric features of the outer circle and inner hole, stable registration and defect detection can be achieved for bearings and workpieces of similar specifications. Attached Figure Description
[0008] Figure 1 This is a schematic flowchart of a defect detection method for image registration and difference comparison of bearing double end faces provided by an embodiment of the present invention.
[0009] Figure 2 This is a schematic diagram of a defect detection system for image registration and difference comparison of bearings at both ends, provided by an embodiment of the present invention.
[0010] Figure 3 This is a trend chart of virtual potential field energy convergence and registration accuracy provided by an embodiment of the present invention.
[0011] Figure 4 This is a statistical graph showing the distribution of cross-correlation coefficients of texture structures provided in an embodiment of the present invention.
[0012] Figure 5 This is a comparison chart of the defect detection effect provided by the embodiments of the present invention with that of traditional methods. Detailed Implementation
[0013] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0014] like Figure 1 As shown, an embodiment of the present invention proposes a defect detection method for image registration and difference comparison of bearing double end faces, the method comprising the following steps: Step 1: Obtain the original image data of the first end face and the second end face of the bearing, and preprocess the original image data to obtain the standard image of the first end face and the standard image of the second end face. Step 2: Extract the bearing outer circle contour and inner hole edge from the first and second end face standard images to construct an annular feature band; determine the first and second micro-texture anchor points on the annular feature band; establish a local rectangular coordinate system with the first micro-texture anchor point as the origin; when a vector azimuth angle offset of the second micro-texture anchor point relative to the first micro-texture anchor point is detected, calculate the rotation compensation matrix; use the rotation compensation matrix to perform angle correction on the second end face standard image, and construct a virtual constraint chord by connecting the first and second micro-texture anchor points; calculate the radial scaling coefficient based on the length change rate of the virtual constraint chord, and uniformly scale and correct the second end face standard image to obtain a globally coarsely registered image pair; Step 3: Map the corresponding pixels in the global coarse registration image pair to virtual particle nodes to construct a virtual potential energy field model; calculate the texture structure cross-correlation coefficient between adjacent virtual particle nodes, and dynamically adjust the interaction force weight between virtual particle nodes according to the cross-correlation coefficient to obtain the fine registration image pair. Step 4: Perform pixel-by-pixel difference operation on the finely registered image pair to obtain the initial residual map, and filter out periodic discrete noise points to obtain a clean defect mask; perform connected component analysis on the clean defect mask, calculate the projected area of each connected component to determine the defect type and location coordinates.
[0015] This embodiment employs micro-texture anchor points to construct virtual constraint strings, achieving angular rotation compensation and uniform scaling correction. It can simultaneously correct inconsistent expansion and contraction of the inner and outer ring regions caused by bearing flipping, clamping, and positioning gaps, solving the problem that traditional affine / similar transformations cannot adapt to local deformations. It eliminates annular artifacts after difference comparison at the root, reducing the misjudgment rate of defect-free bearings. Using chamfer curvature extrema and oil groove topological notches as unique micro-texture anchor points, it is unaffected by light, oil stains, or slight wear, ensuring a stable and reliable registration benchmark. Combining a virtual potential energy field model with dynamic attraction / repulsion adjustment based on texture cross-correlation, it achieves precise alignment at both coarse and fine registration levels, maintaining stable registration under industrial conditions such as mechanical vibration, clamping fluctuations, and positioning deviations. Based on pixel-by-pixel differencing of the finely registered image pairs and filtering out periodic discrete noise caused by mechanical vibration, it can extract real defect signals, effectively distinguishing defects from mechanical disturbance noise. Through comprehensive judgment using connected component projection area, grayscale contrast ratio, and geometric features, it achieves automated and high-precision identification of defect types and location coordinates. The entire process utilizes image algorithms, eliminating complex manual intervention and mechanical adjustments. Single-workpiece inspection is time-efficient and compatible with fully automated image inspection machines for loading, flipping, and multi-station inspection, without reducing production line capacity. The entire process employs non-contact visual imaging and pure image algorithm processing, eliminating the risk of secondary damage such as squeezing, bumping, scratching, and magnetization, meeting the non-destructive requirements for high-precision appearance and dimensional inspection of bearings. Based on the adaptive construction of annular feature bands using the geometric features of the outer circle and inner hole, stable registration and defect detection can be achieved for bearings and workpieces of similar specifications.
[0016] In a preferred embodiment of the present invention, step 1 includes: The original image data of the first and second end faces of the bearing are acquired and preprocessed to obtain a standard image of the first end face and a standard image of the second end face. The first and second standard images of the first and second end faces include the upper surface of the bearing when it passes through image detection station A and the upper surface of the bearing when it enters image detection station B after being flipped by the flipping mechanism. The first standard image of the first end face is acquired and processed by the first camera module arranged in image detection station A, and the second standard image of the second end face is acquired and processed by the second camera module arranged in image detection station B.
[0017] In this embodiment of the invention, the equipment debugging and parameter calibration of the image inspection station are first completed to ensure that the imaging parameters of the first camera module at image inspection station A and the second camera module at station B are consistent, with a resolution of 1920×1080 pixels, a focal length of 16mm, an exposure time of 50ms, and a gain coefficient of 1.2, so as to avoid the influence of equipment parameter deviation on image quality. The bearing is sent to station A via an automated conveyor mechanism. The first camera module is vertically aligned with the upper surface of the unflipped bearing (the vertical distance between the lens and the surface is 300mm), and the original image of the first end face is acquired according to the set parameters. After the bearing is flipped 180 degrees by a flexible silicone gripper (gripping pressure 0.3MPa), it is transferred to station B by the conveyor mechanism. The second camera module acquires the image of the flipped upper surface (corresponding to the original image of the second end face) with the same parameters and the same shooting distance, thus completing the acquisition of the original images of both end faces.
[0018] Standardization preprocessing was performed on the two sets of original images sequentially. A weighted average method (R channel weight 0.299, G channel weight 0.587, B channel weight 0.114) was used to convert the color images to grayscale. The converted grayscale value = 0.299×R + 0.587×G + 0.114×B (where R, G, and B are the red, green, and blue channel pixel values of the color image, respectively). The pixel grayscale values were mapped to the [0, 255] interval using the grayscale mean and standard deviation to eliminate the influence of illumination fluctuations. A 3×3 filter kernel (normalization coefficient 1 / 16) was used to perform convolution operations on the grayscale images for noise reduction. For each pixel, the grayscale values of its 3×3 neighboring pixels were multiplied by the corresponding value of the filter kernel, summed, and then multiplied by the normalization coefficient to preserve contour texture features. Finally, a pre-calibrated camera intrinsic parameter matrix was used. and distortion coefficient (radial) =-0.04、 =0.001, tangential =0.0002、 =-0.0001) to correct distortion, the distortion correction formula is: ; ; in , , These are the original coordinates of the pixels in the image. The distance from the original pixel coordinates to the image origin. The coordinates after pixel distortion, then through Convert the corrected coordinates to normalized coordinates (where...) , These are the canonical coordinates of the pixels after distortion correction. These are the coordinates after pixel distortion correction. (This is the camera intrinsic parameter matrix), eliminating geometric distortion; after preprocessing, we obtain first and second end-face standard images with uniform imaging, clear features, and no noise or distortion.
[0019] In this embodiment, the dual-station camera module acquires end face images of the bearing before and after flipping, and with standardized preprocessing operations, it can provide a clear and stable image foundation for subsequent registration and inspection, ensuring that the image acquisition conditions of both ends are uniform and eliminating interference caused by differences in image quality in the early stage.
[0020] In a preferred embodiment of the present invention, step 2 includes: Step 200a: Perform edge detection processing on the first end face standard image and the second end face standard image respectively, and extract the pixel set of the bearing outer circle contour and the pixel set of the inner hole edge; based on the pixel set of the bearing outer circle contour and the pixel set of the inner hole edge, determine the geometric center of the bearing end face, and with the geometric center as the center, the inner hole edge radius as the inner boundary, and the outer circle contour radius as the outer boundary, extract the corresponding annular region from the first end face standard image and the second end face standard image to construct an annular feature band, specifically including: The first and second end-face standard images obtained after preprocessing are processed using the Canny edge detection algorithm. First, Gaussian smoothing is applied to both standard images (with parameters consistent with the Gaussian filtering in the preprocessing stage) to further suppress the influence of noise on edge detection. Clear thresholds are set: a high threshold of 180 and a low threshold of 60. The high threshold is used to filter out clear, continuous strong edges, while the low threshold is used to connect weak edges between strong edges. Isolated pixels that are not identified as strong edges after high threshold filtering, have a grayscale value greater than the low threshold but less than or equal to the high threshold, and whose Euclidean distance to strong edge pixels is within 3 pixels and do not form continuous lines, are connected to strong edges and adjacent weak edge pixels through low threshold connection, forming continuous edge contours and effectively avoiding edge breaks. Finally, all pixels corresponding to the bearing outer circle contour in the first and second end-face standard images are extracted, forming the outer circle contour pixel set, and all pixels corresponding to the bearing inner hole edge are extracted, forming the inner hole edge pixel set.
[0021] Based on the pixel set of the outer circular contour and the pixel set of the inner hole edge, a least squares fitting algorithm is used to calculate the geometric center coordinates of the bearing end face in the first end face standard image and the second end face standard image, respectively. That is, for the pixel set of the outer circular contour, let the coordinates of each pixel be... (i is the pixel index), assuming the outer circle conforms to the equation of a circle. ,in( , () represents the coordinates of the outer circle's center. Let be the radius of the outer circle. Using least-squares fitting, minimize the sum of squared distances from all pixels on the outer circle contour to the circle's equation to obtain the coordinates of the outer circle's center. Using the same method, perform least-squares fitting on the pixel set at the inner hole's edge, assuming the coordinates of each pixel within the inner hole are... (j is the pixel index of the inner hole), the fitted circular equation is: (in( , ( ) represents the coordinates of the center of the inner hole. The inner hole center coordinates are obtained by solving for the inner hole radius. Since the bearing end face is a symmetrical structure, the outer circle center and the inner hole center theoretically coincide. Therefore, the average value of the outer circle center coordinates and the inner hole center coordinates is taken as the final geometric center coordinates of the bearing end face. The inner hole edge radius (radius of the inner hole fitting circle) and the outer circle contour radius (radius of the outer circle fitting circle) of the first and second end face standard drawings are extracted respectively. Taking the determined bearing end face geometric center as the center, the inner hole edge radius is used as the inner boundary of the annular area, and the outer circle contour radius is used as the outer boundary of the annular area. Annular areas of corresponding sizes are cut out from the first and second end face standard drawings respectively. During the cutting process, precise cutting is performed according to the parameters of geometric center, inner boundary radius, and outer boundary radius to ensure that the cut annular area completely covers the core detection area of the bearing end face (the area between the outer circle and the inner hole). The cut annular area is the final annular feature band to be constructed.
[0022] Step 201a: In the annular feature band, identify the curvature change gradient of the chamfer transition area of the bearing end face, and select the position with the largest curvature change gradient as the first micro-texture anchor point; in the annular feature band, identify the geometric discontinuity structure of the anti-rust oil groove on the bearing end face, and select the asymmetric notch with a unique topological shape as the second micro-texture anchor point, specifically including: Within the annular feature band constructed from the first and second end-face standard images, the chamfer transition area of the bearing end face is first located. This chamfer transition area is the transition region between the bearing's outer circular contour and the end-face plane, and between the inner hole edge and the end-face plane. The curvature of this region changes significantly, making it an inherent feature area of the bearing end face. The curvature values of all pixels in the chamfer transition area are calculated pixel-by-pixel. Specifically, for each pixel, a 3×3 neighborhood of pixels is selected to construct a local contour curve. The curvature value of the pixel is calculated by solving the second derivative of the local contour curve. The curvature gradient of each pixel is then calculated; this gradient is the absolute value of the difference in curvature between the pixel and its neighboring pixels. All pixels in the chamfer transition area are traversed, and the pixel position with the largest curvature gradient is selected and uniformly designated as the first micro-texture anchor point. This anchor point has the largest curvature gradient, possesses significant feature recognition, and has a fixed position within the bearing end face, exhibiting strong stability.
[0023] Within the annular feature band, the geometric discontinuity structure formed by the anti-rust oil groove on the bearing end face is identified by the texture segmentation algorithm. The anti-rust oil groove is an inherent structure of the bearing end face, used to store anti-rust oil. Its shape has fixed topological features, and there are usually asymmetric gaps on the oil groove (for oil flow or positioning). The topological shape of the asymmetric gap is unique and will not be repeated in the bearing end face, so it can be used as a stable feature anchor point. The specific operation is as follows: First, a threshold segmentation algorithm is used to segment the region. The segmentation threshold is explicitly set to 80. All pixels within the annular feature band are traversed. Pixels with a grayscale value less than 80 (i.e., grayscale value < 80) are classified as rust-preventive oil groove regions, while pixels with a grayscale value greater than or equal to 80 (i.e., grayscale value ≥ 80) are classified as non-rust-preventive oil groove regions. Through this precise pixel classification method, the rust-preventive oil groove region within the annular feature band is completely separated from other regions, thus obtaining the complete outline of the rust-preventive oil groove. Then, the outline structure of the rust-preventive oil groove is traversed, its topological features are analyzed, and the asymmetric notch positions with unique topological shapes are identified. The center pixel position of this notch is selected and uniformly determined as the second micro-texture anchor point. Both the first and second micro-texture anchor points are inherent feature points of the bearing end face, possessing uniqueness, stability, and identifiability.
[0024] Step 200b: In the first end-face standard image, using the pixel coordinates of the first micro-texture anchor point as the origin of the local Cartesian coordinate system, determine the vector line segment pointing from the first micro-texture anchor point to the second micro-texture anchor point, and calculate the first direction angle of the vector line segment relative to the X-axis of the local Cartesian coordinate system as the reference direction angle. Specifically, this includes: In the first end-face standard image, using the pixel coordinates of the first micro-texture anchor point determined in step 201a as the origin of the local rectangular coordinate system, a two-dimensional local rectangular coordinate system is constructed. The X-axis is along the horizontal direction of the bearing end face, and the Y-axis is along the vertical direction of the bearing end face. The scale of the coordinate system is consistent with the pixel scale of the image to ensure the accuracy of coordinate calculation. Connect the first and second micro-texture anchor points in the first end-face standard image to form a vector line segment. The starting point of this vector line segment is the first micro-texture anchor point, and the ending point is the second micro-texture anchor point. Calculate the angle between this vector line segment and the X-axis of the local rectangular coordinate system. This angle is the first direction angle, which is defined as the reference direction angle for the registration of the two end faces. It is used as the angle correction reference for the subsequent second end-face image. The formula for calculating the reference direction angle is: ; in, The reference direction angle has a range of values. Here are the pixel coordinates of the first micro-texture anchor point in the first end-face standard image. These are the pixel coordinates of the second micro-texture anchor point in the first end-face standard image. During the calculation process, this is determined by... and The sign of the reference direction angle is used to determine the quadrant in which the angle is located, ensuring the accuracy of the angle calculation and avoiding angle deviation.
[0025] Step 201b: In the second end-face standard drawing, establish the same local rectangular coordinate system with the same first micro-texture anchor point as the origin. Determine the vector line segment pointing from the first micro-texture anchor point to the second micro-texture anchor point in the second end-face standard drawing, and calculate the second direction angle of the vector line segment relative to the X-axis of the local rectangular coordinate system as the current direction angle. Specifically, this includes: In the second end-face standard image, following the local rectangular coordinate system setting rules of the first end-face standard image, a two-dimensional local rectangular coordinate system completely consistent with the first end-face standard image is constructed, using the pixel coordinates of the first micro-texture anchor point determined in step 201a as the origin. That is, the directions of the X and Y axes are consistent with the coordinate system of the first end-face standard image, and the scale of the coordinate system is consistent with the pixel scale of the image, ensuring the uniformity of the coordinate systems of the two ends. Similarly, the first micro-texture anchor point and the second micro-texture anchor point in the second end-face standard image are connected to form a vector line segment. The starting point of this vector line segment is the first micro-texture anchor point, and the ending point is the second micro-texture anchor point, corresponding to the vector line segment in the first end-face standard image. Calculate the angle between the vector line segment and the X-axis of the local Cartesian coordinate system. This angle is the second direction angle, which is also defined as the current direction angle. The difference between the current direction angle and the reference direction angle (i.e., the rotation angle deviation) is used to quantify the magnitude and direction of the angular offset between the second end-face image and the first end-face image, thus visually reflecting the angular offset between the two. The specific formula for calculating the current direction angle is as follows: ; in, The current direction angle, with a value range of [value missing]. Here are the pixel coordinates of the first micro-texture anchor point in the standard image of the second end face. The pixel coordinates of the second micro-texture anchor point in the standard image of the second end face are given; during the calculation process, the same judgment is made. and The sign of the value determines the quadrant in which the current direction angle is located, ensuring complete consistency with the calculation logic and value range of the reference direction angle.
[0026] Step 202b: Calculate the difference between the current orientation angle and the reference orientation angle to obtain the rotation angle deviation; construct a two-dimensional rotation matrix based on the rotation angle deviation as the rotation compensation matrix, specifically including: Calculate the difference between the current orientation angle and the reference orientation angle to obtain the rotation angle deviation of the second end face standard diagram relative to the first end face standard diagram. This deviation reflects the angular offset generated by the bearing during the flipping and conveying process. = Current direction angle - Reference direction angle, where, The range of values is ,when When the value is positive, it indicates that the second end face standard drawing has rotated clockwise relative to the first end face standard drawing; when... A negative value indicates that the second end face standard image has rotated counterclockwise relative to the first end face standard image. Based on the rotation angle deviation, a two-dimensional rotation compensation matrix is constructed. This matrix is used to perform an inverse rotation transformation on the second end face standard image to achieve angle correction, ensuring that the angle of the second end face standard image is consistent with that of the first end face standard image. The specific calculation formula for the rotation compensation matrix is as follows: ; in, For rotation compensation matrix, Rotation angle deviation The cosine value, Rotation angle deviation The sine value; during the calculation process, The conversion between radians and angles is performed to ensure the accuracy of trigonometric function calculations. At the same time, the determinant of the rotation compensation matrix is guaranteed to be 1, satisfying the geometric characteristics of rotation transformation and avoiding angle correction deviations caused by matrix calculation errors.
[0027] Step 200c involves performing an inverse rotation transformation on the second end-face standard image using a rotation compensation matrix to ensure that the vector azimuth angle of the second micro-texture anchor point is consistent with that of the first micro-texture anchor point, thus obtaining an angle-corrected intermediate image. Specifically, this includes: The rotation compensation matrix constructed in step 202b is invoked and fully applied to the second end face standard image. An inverse rotation transformation operation is then performed on the second end face standard image to eliminate the angular offset of the second end face standard image relative to the first end face standard image, i.e., using the pixel coordinates of the first micro-texture anchor point in the second end face standard image. Using the rotation center, iterate through every pixel in the standard image of the second end face and obtain the original coordinates of each pixel. Through coordinate transformation formula The target coordinates of each pixel after inverse rotation transformation are calculated. .
[0028] During the transformation process, calculations are performed according to the above formula to ensure that the coordinate transformation of each pixel is correct and to avoid problems such as pixel offset and image blurring. Through this inverse rotation transformation, the overall angle of the second end face standard image is gradually adjusted until the vector azimuth angle of the second micro-texture anchor point relative to the first micro-texture anchor point in the second end face standard image is completely consistent with the vector azimuth angle of the second micro-texture anchor point relative to the first micro-texture anchor point in the first end face standard image. That is, after adjustment, the vector directions of the first and second micro-texture anchor points in the second end face standard image are completely coincident with the vector directions of the corresponding anchor points in the first end face standard image. After the angle adjustment is completed, it is confirmed that there is no deviation in the vector azimuth angle of the anchor points at both ends. The angle correction process is then completed, and an intermediate image after angle correction is generated. This intermediate image has eliminated the angle offset.
[0029] Step 201c: In the angle-corrected intermediate image, extract the center pixel coordinates of the first micro-texture anchor point and the center pixel coordinates of the second micro-texture anchor point, specifically including: In the intermediate image after angle correction generated in step 200c, the center pixel coordinates of the first micro-texture anchor point and the second micro-texture anchor point are extracted. During the extraction process, the center pixel coordinates of the anchor point are determined by calculating the average coordinate value of the anchor point outline pixels based on the pixel contour of the anchor point. The same method is used to calculate the center pixel coordinates of the second micro-texture anchor point to ensure that the error of the extracted center pixel coordinates is controlled within 1 pixel, thus ensuring the accuracy of the coordinates.
[0030] Step 202c: In virtual space, connect the center pixel coordinates of the first micro-texture anchor point and the center pixel coordinates of the second micro-texture anchor point with a straight line segment to form a virtual constraint chord. This virtual constraint chord serves as a geometric reference for measuring whether the bearing end face undergoes linear tensile or compressive deformation during the flipping process. Specifically, it includes: A two-dimensional coordinate system is constructed in virtual space. This coordinate system has the same specifications and direction as the image pixel coordinate system to ensure the accuracy of the connection of straight line segments. In this virtual coordinate system, the center pixel coordinates of the first micro-texture anchor point and the center pixel coordinates of the second micro-texture anchor point are connected by straight line segments to form a continuous and complete straight line segment structure. This straight line segment is the virtual constraint chord. The core function of the virtual constraint chord is to serve as a geometric benchmark for measuring whether the bearing end face undergoes linear tensile or compressive deformation during the flipping and transportation process. Subsequently, by comparing the length changes of the virtual constraint chord in different images, it is possible to accurately determine whether there is macroscopic linear deformation of the bearing end face.
[0031] Step 200d: Measure the Euclidean distance between the first and second micro-texture anchor points in the first end-face standard image, using this distance as the reference chord length; measure the Euclidean distance between the first and second micro-texture anchor points in the angle-corrected intermediate image, using this distance as the current chord length; calculate the ratio of the current chord length to the reference chord length to obtain the length change rate, specifically including: In the first end-face standard image, the Euclidean distance between the first and second micro-texture anchor points is calculated, and this distance value is defined as the reference chord length L1. In the intermediate image after angle correction, the same Euclidean distance calculation formula is used to calculate the Euclidean distance between the first and second micro-texture anchor points, and this distance value is defined as the current chord length L2. After the chord length calculation is completed, the ratio of the current chord length to the reference chord length is calculated, and this ratio is the rate of change of the virtual constraint chord length. ,when When =1, it indicates that the length of the virtual constraint chord remains unchanged, and the bearing end face undergoes no linear tensile or compressive deformation; when When the value is greater than 1, it indicates that the virtual constraint chord is stretched, and there is tensile deformation on the bearing end face; when... When the value is less than 1, it indicates that the virtual constraint string is compressed and there is compression deformation on the bearing end face. The length change rate reflects the degree of deformation of the bearing end face.
[0032] Step 201d: Derive the radial scaling coefficient based on the length change rate; using the first micro-texture anchor point as the center, uniformly scale the angle-corrected intermediate image using the radial scaling coefficient, so that the scaled position of the second micro-texture anchor point coincides with the corresponding position in the first end-face standard image, eliminating macroscopic linear deformation caused by mechanical clamping or material stress, and obtaining a globally coarsely registered image pair, specifically including: Based on the length change rate calculated in step 200d, the radial expansion coefficient is derived. Since the length change of the virtual constraint chord directly reflects the radial expansion degree of the bearing end face, the radial expansion coefficient is equal to the length change rate, i.e., radial expansion coefficient = After determining the radial scaling factor, the center pixel coordinates of the first microtexture anchor point in the angle-corrected intermediate image are used. Using the radial scaling factor as the scaling center, a uniform scaling transformation is performed on the intermediate image. This involves traversing every pixel in the intermediate image and obtaining the relative coordinates of each pixel relative to the scaling center. ,in The original coordinates of the pixel are obtained; the relative coordinates are multiplied by the radial scaling factor to obtain the scaled relative coordinates; then the scaled relative coordinates are added to the scaling center coordinates to obtain the target coordinates of the pixel after scaling, and the scaling transformation of all pixels is completed in sequence.
[0033] During the scaling transformation, the positional change of the second micro-texture anchor point in the intermediate image is monitored in real time until the center pixel coordinates of the anchor point completely coincide with the center pixel coordinates of the second micro-texture anchor point in the first end-face standard image, ensuring that the scaling correction is in place. This non-uniform scaling transformation effectively eliminates the macroscopic linear deformation caused by mechanical clamping fluctuations, material stress release, and changes in positioning gaps during bearing flipping and conveying, ensuring complete alignment of the anchor point positions between the intermediate image and the first end-face standard image. After scaling correction, the first and second end-face standard images, which have completed global coarse registration, are finally obtained; these two images are collectively referred to as the global coarse registration image pair.
[0034] This embodiment unifies the imaging specifications of the bearing end face images by independently acquiring images at dual workstations and standardizing preprocessing, eliminating acquisition noise and geometric distortion. By extracting the inner and outer circular edges to construct annular feature bands, the registration area is focused on the core detection area of the bearing end face, reducing the feature processing range and improving the efficiency of feature extraction and registration calculation, while avoiding interference from irrelevant background areas. The high curvature position of the chamfer and the asymmetric notch of the anti-rust oil groove are selected as dual micro-texture anchor points. The anchor points have uniqueness and stability, avoiding the problems of easy drift and mismatch of conventional feature points. By constructing a local coordinate system to calculate the direction angle deviation and generate a rotation compensation matrix, the angular offset caused by bearing rollover can be accurately quantified and corrected, achieving precise angular alignment of the two end face images. A virtual constraint chord is constructed to establish an intuitive geometric deformation benchmark, which can directly reflect the linear deformation of the bearing end face during transportation, providing a quantitative basis for subsequent radial expansion correction. By calculating the length change rate and radial expansion coefficient using the chord length ratio, and using non-uniform scaling to correct macroscopic linear deformation, it can adapt to the different radial expansion deformation of the bearing's inner hole and outer circle regions, avoiding the registration residual error caused by conventional global transformation, and reducing the probability of misjudging defect-free bearings.
[0035] In a preferred embodiment of the present invention, step 3 includes: Step 300a: Define the first end-face standard image and the second end-face standard image in the globally coarsely registered image pair as the first image field and the second image field, respectively. Specifically, after completing the global coarse registration, obtain the globally coarsely registered image pair, which includes the first end-face standard image and the second end-face standard image after angle correction and scaling correction. Formally define the first end-face standard image in the globally coarsely registered image pair as the first image field, and formally define the second end-face standard image as the second image field. The imaging specifications of the first image field and the second image field are completely consistent. Both are images within a ring feature band with uniform imaging specifications, clear features, no noise interference, and no geometric distortion. The pixel size and coordinate system of the two are completely synchronized.
[0036] Step 301a: Each pixel in the first image field and the second image field is treated as a virtual particle node. The virtual particle node contains the spatial coordinates and grayscale value of the corresponding pixel in the first image field and the second image field, specifically including: Each pixel in the first and second image fields is treated as an independent virtual particle node, ensuring that all pixels in both image fields are completely mapped to virtual particle nodes without omission or redundancy. Each virtual particle node contains two sets of core parameters: spatial coordinates and grayscale value, and the parameter information is completely consistent with the corresponding pixel. The spatial coordinates of any virtual particle node in the first image field are denoted as follows: The grayscale value is denoted as ( (This refers to the virtual particle node number in the first image field); the virtual particle node in the second image field corresponding to the spatial position of this virtual particle node is denoted as... The grayscale value is denoted as Since global coarse registration has eliminated macroscopic angular offset and linear deformation, the spatial coordinate deviation of the corresponding virtual particle nodes is within a small range, that is, no more than 2 pixel units. In other words, the Euclidean distance between the virtual particle nodes in the first image field and the corresponding virtual particle nodes in the second image field is less than or equal to 2.
[0037] Step 302a: Within the first and second image fields, define virtual elastic connections between each virtual particle node and its adjacent virtual particle nodes in their four-neighbor or eight-neighbor domains. The stiffness coefficient of the virtual elastic connection is determined by the absolute value of the difference in grayscale values between the two connected virtual particle nodes, specifically including: Within the first and second image fields, virtual elastic connections are established for each virtual particle node. The connection range of the virtual elastic connection is limited to adjacent virtual particle nodes within the four-neighbor or eight-neighbor domains of the virtual particle node. Specifically, the four-neighbor domains are adjacent nodes in the four directions (up, down, left, right) of the virtual particle node, with a distance of 1 pixel unit. The eight-neighbor domains are adjacent nodes in the eight directions (up, down, left, right, upper left, upper right, lower left, lower right) of the virtual particle node, with a distance of 1 pixel unit. The selection of the connection range can be flexibly determined according to the complexity of the bearing end face texture. The criterion for dense texture is that the number of grayscale value changes per unit area (100×100 pixel area) is ≥80 times. In this case, the eight-neighbor domain is selected to ensure that the correlation of dense texture can be fully captured. The criterion for sparse texture is that the number of grayscale value changes per unit area (100×100 pixel area) is <80 times. In this case, the four-neighbor domain is selected to reduce the amount of computation while ensuring texture correlation. This method ensures that the virtual elastic connection can fully reflect the texture structure correlation within the image field. The core parameter of the virtual elastic connection is the stiffness coefficient, which is not a fixed value but is determined by the absolute value of the difference in gray values between the two connected virtual particle nodes. The smaller the difference in gray values, the more similar the texture features of the two nodes are, the larger the stiffness coefficient, and the stronger the constraint effect of the virtual elastic connection. Conversely, the larger the difference in gray values, the smaller the stiffness coefficient, and the weaker the constraint effect of the virtual elastic connection.
[0038] stiffness coefficient ,in For the first The virtual particle node and the first Virtual elastic connection stiffness coefficient between adjacent virtual particle nodes The basic stiffness coefficient is set to 1.2 (preset based on the texture characteristics of the bearing end face image to ensure the constraint strength of the elastic connection is suitable). This is the attenuation coefficient, with a value of 0.05 (used to control the influence of grayscale difference on stiffness coefficient). For the first The grayscale value of each virtual particle node For the first The grayscale values of adjacent virtual particle nodes This is the absolute value of the difference in grayscale values between two virtual particle nodes. After calculating the stiffness coefficient of each virtual elastic connection using this formula, the definition of all virtual elastic connections within the first and second image fields is completed, thus forming a stable elastic constraint system within each image field.
[0039] Step 303a: Establish virtual coupling links between virtual particle nodes in the first image field and virtual particle nodes in the second image field that correspond to each other in spatial position. The initial potential energy of each virtual coupling link is set to zero, and the potential energy change of the corresponding virtual coupling link is equal to the square of the difference in grayscale values between the two connected virtual particle nodes. Specifically, this includes: A cross-field virtual coupling link is established between the first and second image fields. The connection rule for this virtual coupling link is that each virtual particle node in the first image field establishes a unique virtual coupling link only with the virtual particle node in the second image field whose spatial position corresponds to it. This ensures the uniqueness and correspondence of the link connections and avoids chaotic many-to-one or one-to-many connection situations. The initial potential energy of each virtual coupling link is set to zero, meaning that in the initial state, there is no potential energy interaction between corresponding virtual particle nodes across fields, ensuring the stability of the initial state. The change in potential energy of the virtual coupling link is determined by the square of the difference in grayscale values between the two connected virtual particle nodes. ,in For the first The potential energy change of the virtual coupling link between the corresponding virtual particle nodes. For the first image field, the first The grayscale value of each virtual particle node For the second image field The grayscale value of each virtual particle node; when the grayscale values of two corresponding virtual particle nodes are exactly the same, the change in potential energy is zero; when there is a difference in grayscale values, the change in potential energy increases as the difference increases.
[0040] Step 304a: Using the above method, all corresponding pixels in the globally coarsely registered image pair are mapped to a virtual particle node system with internal elastic connections and cross-field coupling links, thus completing the construction of the virtual potential energy field model. Specifically, this includes: Through steps 300a to 303a, all corresponding pixels in the globally coarsely registered image pair are completely mapped to virtual particle nodes. Each virtual particle node has a defined spatial coordinate and grayscale value parameter. Simultaneously, an internal elastic constraint system composed of virtual elastic connections is formed within both the first and second image fields. A cross-field coupling system composed of virtual coupling links is formed between the two image fields. The stiffness coefficient of the virtual elastic connections and the potential energy change of the virtual coupling links have been calculated and determined using corresponding formulas. In this way, a complete virtual particle node system containing internal elastic connections and cross-field coupling links is constructed; this system is the virtual potential energy field model.
[0041] Step 300b: In the virtual potential energy field model, the first microscopic texture anchor point is used as the target virtual particle node, and a matching virtual particle node is searched in the corresponding neighborhood of the second image field. Specifically, this includes: In the virtual potential energy field model constructed in step 304a, the virtual particle node corresponding to the first micro-texture anchor point is selected as the target virtual particle node. The determination of the target virtual particle node is based on the fact that the first micro-texture anchor point is an inherent feature point of the bearing end face, possessing uniqueness, stability, and identifiability, and its corresponding virtual particle node coordinates are completely consistent with the center pixel coordinates of the first micro-texture anchor point, denoted as . The grayscale value is denoted as After determining the target virtual particle node, potential matching virtual particle nodes are searched in the neighborhood corresponding to the spatial position of the target virtual particle node in the second image field. The search neighborhood is set as a circular area with a radius of 3 pixels centered on the second image field coordinates corresponding to the target virtual particle node. This range can cover the small positional deviations that may exist after coarse registration, and avoid the reduction in matching efficiency and the risk of mismatch caused by an excessively large search range.
[0042] Step 301b involves extracting the first grayscale distribution matrix within a circular region centered on the target virtual particle node and with a radius of 5 pixels, and the second grayscale distribution matrix within a circular region centered on the matching virtual particle node and with a radius of 5 pixels. Specifically, this includes: For the target virtual particle node determined in step 300b and the searched potential matching virtual particle nodes, the corresponding grayscale distribution matrices are extracted respectively. The specific extraction process is as follows: taking the target virtual particle node... Centered on a point, extract the grayscale values of all virtual particle nodes within a circular region with a radius of 5 pixels. Arrange these grayscale values in order of their spatial location to construct the first grayscale distribution matrix. The matrix has a size of 11×11 (a circular area with a radius of 5 pixels contains 11×11 pixels, i.e., 11×11 virtual particle nodes), and each element in the matrix... The corresponding circular area Line 1 The grayscale values of the virtual particle nodes are listed. The same extraction method is used for each potentially matching virtual particle node. ( To match the virtual particle node index, extract the grayscale values of all virtual particle nodes within a circular region with a radius of 5 pixels, and arrange them in spatial order to construct a second grayscale distribution matrix. The matrix size is also 11×11, and each element in the matrix... The corresponding circular area Line 1 The grayscale values of the virtual particle nodes are listed; during the extraction process, it is ensured that the size and pixel arrangement order of the two circular areas are completely consistent to avoid the problem of grayscale distribution matrices being unable to be compared due to different extraction rules.
[0043] Step 302b: Calculate the texture structure cross-correlation coefficient between the first gray-level distribution matrix and the second gray-level distribution matrix. Compare the texture structure cross-correlation coefficient with a preset critical correlation coefficient. If the texture structure cross-correlation coefficient is greater than or equal to the critical correlation coefficient, set the virtual gravity weight to its maximum value and apply virtual gravity simulating molecular orbital overlap to cause the matching virtual particle node to move towards the spatial position of the target virtual particle node, thus achieving adsorption and locking of texture features. If the texture structure cross-correlation coefficient is less than the critical correlation coefficient, set the virtual repulsion weight to its maximum value and apply virtual repulsion simulating electron cloud repulsion to cause the matching virtual particle node to move away from the spatial position of the target virtual particle node, preventing erroneous fusion of non-corresponding regions. Specifically, this includes: Calculate the first gray-level distribution matrix extracted in step 301b. With the second gray-scale distribution matrix The texture structure cross-correlation coefficient is used to quantify the similarity of texture structures corresponding to two gray-level distribution matrices. The coefficient ranges from -1 to 1; the closer the coefficient is to 1, the more similar the two texture structures are; the closer the coefficient is to -1, the greater the difference between the two texture structures; a coefficient of 0 indicates that the two texture structures are unrelated. The formula for calculating the texture structure cross-correlation coefficient is: ; in This represents the cross-correlation coefficient of the texture structure. The mean gray level of the first gray level distribution matrix is... Let be the mean gray level of the second gray level distribution matrix. The formula for calculating the mean gray level is: 121 represents the total number of elements in an 11×11 matrix.
[0044] The preset critical correlation coefficient is 0.7. This value is preset based on the texture characteristics of the bearing end face and can effectively distinguish between similar and dissimilar textures, avoiding false matching and missed matching. The cross-correlation coefficient of the texture structure is then used. Compared with the critical correlation coefficient of 0.7, if A value of 0.7 indicates that the texture structure of the matched virtual particle node is highly similar to that of the target virtual particle node, thus it is determined to be a valid matching node. At this point, the virtual gravity weight is set to the maximum value of 1.0, applying virtual gravity that simulates the effect of molecular orbital overlap. This virtual gravity is designed based on the principle of molecular orbital overlap, and its value is determined by the formula... Calculation determines (where) For the magnitude of virtual gravity, This is a virtual gravity weight, with a fixed value of 1.0; The cross-correlation coefficient of the texture structure, with a value range of [0.7, 1]; The gravity coefficient is fixed at 1.2 (preset based on the bearing end face texture matching characteristics). The direction of the virtual gravity is from the matching virtual particle node to the target virtual particle node. The magnitude of the gravity is proportional to the cross-correlation coefficient of the texture structure, causing the matching virtual particle node to move towards the spatial position of the target virtual particle node, thus achieving the adsorption and locking of texture features. This indicates a significant difference in texture structure between the matched virtual particle node and the target virtual particle node, classifying it as an invalid match. In this case, the virtual repulsion weight is set to the maximum value of 1.0, and a virtual repulsion force simulating the electron cloud repulsion effect is applied. The magnitude of the virtual repulsion force is determined using the formula... Calculate (where The magnitude of the virtual repulsive force. =1.0 is the repulsive force weight. =1.2 is the repulsion coefficient, which is fixed, to ensure that the magnitude of the repulsion force is quantifiable and controllable; the direction of the virtual repulsion force is set from the target virtual particle node to the matching virtual particle node, which is clear and unique; the virtual repulsion force acts on the matching virtual particle node, causing it to move away from the target virtual particle node. The moving distance is positively correlated with the magnitude of the repulsion force, thereby effectively avoiding erroneous fusion of non-corresponding areas, ensuring registration accuracy, and at the same time, thoroughly clarifying the specific value standard of the virtual repulsion force, eliminating ambiguity, and ensuring that each operation has a clear quantitative basis.
[0045] Step 303b involves iteratively updating the position coordinates of all virtual particle nodes until the total energy of the virtual potential field model converges to its minimum. At this point, the pixel displacement field of the second end face standard image reaches a stable state, generating a finely registered image pair that eliminates nonlinear distortion. Specifically, this includes: Based on the virtual attraction or repulsion applied in step 302b, and combined with the elastic constraints of the virtual elastic connections and the potential energy changes of the virtual coupling links in the virtual potential energy field model, the spatial position coordinates of all virtual particle nodes in the model are iteratively updated. The iterative update follows the formula: ; in, For the first The virtual particle node Spatial coordinates after the next iteration For this node The coordinates after the next iteration The iteration step size (to ensure iteration stability and avoid position oscillation). This refers to the virtual attractive or repulsive force acting on the node. This represents the resultant force of the virtual elastic connection acting on the node. After each iteration, it is calculated using the formula... Calculate the total energy of the virtual potential field, where This is the stiffness coefficient. The distance between the current adjacent nodes. The initial distance between adjacent nodes. This represents the change in potential energy of the coupling link, until the total energy difference between two consecutive iterations is less than [a certain value]. Once the model reaches energy convergence, it indicates that the virtual potential field model has reached a stable state, and the positions of all virtual particle nodes in the second image field no longer change significantly, meaning the pixel displacement field of the second end-face standard image has reached a stable state. After the iteration stops, the second end-face standard image in the stable state is mapped to the first end-face standard image to generate a finely registered image pair that eliminates nonlinear distortion. The texture features and geometric structures of the two end faces in this image pair are completely aligned.
[0046] This embodiment constructs a virtual potential energy field model, mapping image pixels to virtual particle nodes. Virtual elastic connections constrain the internal texture structure of the image, and virtual coupling links connect corresponding nodes across fields. Virtual attraction and repulsion are applied using texture structure cross-correlation coefficients. Iterative convergence achieves pixel-level fine registration, accurately eliminating nonlinear distortions remaining after global coarse registration. This ensures complete alignment of the texture and geometry of the first and second end-face standard images, achieving pixel-level registration accuracy and solving the technical challenge of conventional registration methods in handling nonlinear distortions. Using a unique and stable first microscopic texture anchor point as the target virtual particle node limits the search range for matching nodes. Texture similarity is quantified through texture structure cross-correlation, and precise control of virtual attraction and repulsion effectively avoids erroneous fusion of non-corresponding regions. Simultaneously, virtual elastic connections maintain the integrity of the internal texture structure of the image, preventing texture distortion and misalignment during registration, thus improving the stability and reliability of the registration process. The stiffness coefficient of the virtual elastic connection is determined by the difference in grayscale values. It can adaptively adjust the constraint strength according to the texture density and grayscale differences in different areas of the bearing end face. The application of virtual force is combined with texture structure similarity judgment, which can adapt to bearing end faces of different models and texture features. There is no need to readjust parameters for different bearings. It has strong versatility and reduces the complexity of operation. The generated finely registered image pairs eliminate all macroscopic and microscopic distortions, and the corresponding positions of the two end faces are accurately aligned, which improves the accuracy and efficiency of bearing end face defect detection.
[0047] In a preferred embodiment of the present invention, step 4 includes: Step 400: Perform pixel-by-pixel subtraction on the first end-face standard image and the second end-face standard image in the finely registered image pair to obtain an initial residual image containing grayscale difference information. Specifically, this includes: obtaining the finely registered image pair generated in step 303b after eliminating nonlinear distortion. This image pair includes the first end-face standard image and the second end-face standard image, and the texture features and geometric structures of the two end faces are completely aligned, with pixel coordinates corresponding one-to-one, and without angular offset, linear deformation, or nonlinear distortion. Perform pixel-by-pixel subtraction on the first end-face standard image and the second end-face standard image in the finely registered image pair. The operation rule is to subtract the grayscale value of the corresponding pixel in the first end-face standard image from the grayscale value of the corresponding pixel in the second end-face standard image, retaining the grayscale difference information, and finally obtaining the initial residual image. The specific calculation formula for the pixel-by-pixel subtraction operation is as follows: ; in Coordinates in the initial residual plot The grayscale value of the pixel at that location. Coordinates in the standard drawing of the second end face The grayscale value of the pixel at that location. Coordinates in the standard drawing of the first end face The absolute value of the grayscale value of each pixel is used to avoid negative values and ensure that the grayscale information in the residual image accurately reflects the pixel differences between the two end faces. In the initial residual image, areas with a grayscale value of 0 indicate that there is no difference between corresponding positions on the two end faces, while areas with a grayscale value greater than 0 indicate grayscale anomalies. These anomalies may be actual defects on the bearing end face or periodic discrete noise generated by mechanical vibration, requiring further screening in subsequent steps.
[0048] Step 401: Obtain the mechanical vibration frequency spectrum of the bearing during the flipping process. The mechanical vibration frequency spectrum is obtained by running the flipping mechanism under no-load conditions and collecting vibration signals using an accelerometer, and extracting the main frequency component through Fourier transform. Identify periodic discrete noise points in the initial residual image that conform to the characteristics of the mechanical vibration frequency spectrum, set the gray value of the periodic discrete noise points to zero, retain the static gray-level abnormal areas, and generate a pure defect mask. Specifically, this includes: To obtain the mechanical vibration frequency spectrum of the bearing during the flipping process, the specific process is as follows: The bearing flipping mechanism is started under no-load conditions, and it is operated stably according to the actual flipping speed and cycle in production. Accelerometers are installed at key rotating parts of the flipping mechanism, with the sensor sampling frequency set to 1000Hz and the sampling duration set to 60s. Vibration signals during the operation of the flipping mechanism are collected, and the collected time-domain vibration signals are denoted as […]. (t is the sampling time, in seconds). The acquired time-domain vibration signal is converted into a frequency-domain signal using a Fast Fourier Transform (FFT). The specific operation is as follows: the number of points for the FFT transformation is set to 1024 (to adapt to a 1000Hz sampling frequency and ensure that the frequency resolution meets the detection requirements). The time-domain vibration signal... Zero-padding is performed to make the signal length consistent with the number of FFT points (1024 points), resulting in the padded time-domain signal. And then Perform an FFT transformation; the transformation formula is as follows: ,in =1024 is the number of FFT transform points. For sampling point index, =1 / =0.001s is the sampling period ( =1000Hz is the sampling frequency). Using the imaginary unit, the final result is the frequency domain signal ( The frequency (in Hz) is a complex number, and its magnitude represents the amplitude of the corresponding frequency component. Frequency components with magnitudes greater than an amplitude threshold (set to 10% of the maximum magnitude) are extracted as the dominant frequency components. The frequency range corresponding to the dominant frequency components is the mechanical vibration frequency spectrum, denoted as . ,in The number of main frequency components.
[0049] Periodic analysis is performed on the initial residual map to identify periodic discrete noise points that conform to the characteristics of the mechanical vibration frequency spectrum. Specifically, a two-dimensional fast Fourier transform (2D-FFT) is performed on the initial residual map. The specific operation is as follows: Let the size of the initial residual map be... ( The height is the number of pixels in the image. (where the image width is in pixels), and the grayscale value of each pixel in the residual map. Perform a 2D-FFT transform, setting the number of transform points to match the image size, and obtain the frequency domain features of the residual image after the transform. ( , (Frequency indices in the x and y directions, respectively), frequency domain features. It is also in complex form. The frequency domain features are centered in the frequency domain by moving the origin from the upper left corner of the image to the center, eliminating DC component interference in the frequency domain signal. Then, the magnitude of the frequency domain features is calculated; the larger the magnitude, the stronger the corresponding frequency component. Based on the correspondence between the frequency domain index and the actual frequency, the frequency domain index is... Convert to actual spatial frequency The conversion formula is: (in The image sampling frequency (related to image resolution, set to 1 pixel / unit length) is used to extract all actual spatial frequencies whose magnitudes are greater than the frequency domain amplitude threshold (set to 5% of the maximum frequency domain magnitude). As the frequency component in the frequency domain of the residual map.
[0050] Mechanical vibration frequency spectrum (Time frequency, unit Hz) can be converted to the corresponding spatial frequency range using the following formula: ; in, Set the camera's frame rate (unit: frames / second) to 30 frames / second; The pixel movement speed of the bearing end face in the image (unit: pixels / frame) is obtained through pre-calibration. Specifically, under no-load conditions, the flipping mechanism is operated, multiple frames are continuously acquired, and the average displacement of the bearing end face feature points between adjacent frames is calculated. The calibration result is... =0.5 pixels / frame; calculate each mechanical main frequency component corresponding spatial frequency (Unit: period / pixel). For each spatial frequency component extracted from the residual map. , and all Perform a comparison; if any one exists... This makes the following equation true, i.e. If the value is less than 0.05, the pixel corresponding to the spatial frequency component is determined to be a periodic discrete noise point. After identifying all periodic discrete noise points, the gray values of the pixels corresponding to these noise points are set to zero to eliminate interference from mechanical vibration. Only static gray-level abnormal areas (i.e., areas with gray values greater than 0 and non-periodic) are retained in the initial residual image. These static gray-level abnormal areas are the suspected defect areas. The processed residual image is binarized, and the binarization threshold is set to 20 (preset according to the gray-level characteristics of the bearing end face to ensure accurate differentiation between abnormal areas and background areas). When the pixel gray value is greater than 20, it is set to 255 (indicating a suspected defect area); when the pixel gray value is less than or equal to 20, it is set to 0 (indicating a background area), finally generating a clean defect mask.
[0051] Step 402: Eight-neighbor connected component labeling is performed on the clean defect mask to identify all independent connected components; all boundary pixels of the corresponding connected components are extracted and connected to form closed boundary polygons, and the projected area and perimeter of the boundary polygons are calculated; using the difference between the sum of the interior angles of the boundary polygons and the standard interior angle sum, it is determined whether the corresponding connected component is a concave or convex polygon, specifically including: The clean defect mask generated in step 401 is subjected to eight-neighbor connected component labeling. The criterion for determining eight-neighbor connected components is: if there are other pixels with a gray value of 255 in the eight directions (up, down, left, right, top left, top right, bottom left, bottom right), then these pixels belong to the same connected component. A connected component labeling algorithm (such as the seed filling algorithm) is used to traverse all pixels in the clean defect mask, labeling all independent connected components. Each connected component corresponds to a suspected defect region, and a unique label number is assigned to each connected component. A total of [number missing] labels are generated. Connected domains.
[0052] For each marked connected component, extract all its boundary pixels. The criteria for determining a boundary pixel are: the pixel has a grayscale value of 255, and at least one pixel with a grayscale value of 0 exists in its eight neighboring regions. After extracting all boundary pixels, connect them sequentially according to their spatial position (clockwise or counterclockwise) to form a closed boundary polygon, ensuring that the boundary polygon can completely enclose the suspected defect area of the corresponding connected component.
[0053] Calculate the projected area and perimeter of the boundary polygon; then determine whether the boundary polygon of the corresponding connected region is a concave or convex polygon. The determination method is as follows: traverse each interior angle of the boundary polygon; if any interior angle has a degree measure greater than 180° (i.e., radians greater than 180°), then... If all interior angles are less than or equal to 180°, then the boundary polygon is a concave polygon; if all interior angles are less than or equal to 180°, then the boundary polygon is a convex polygon.
[0054] Step 403: For the identified concave polygons, emit horizontal rays from each concave vertex. Based on the parity of the intersection points of the rays and the remaining edges of the boundary polygons, identify and fill the empty regions inside the corresponding boundary polygons to obtain the same boundary polygons without holes. Specifically, this includes: For the concave polygons identified in step 402, internal void regions are identified and filled to ensure that the boundary polygons completely enclose the defect areas, avoiding deviations in defect feature extraction caused by voids. Specifically, the process involves first identifying all concave vertices of the concave polygon. The criterion for determining a concave vertex is that its interior angle is greater than a certain value. (i.e., greater than 180 degrees), all vertices satisfying this condition are concave vertices. A horizontal ray is emitted from each concave vertex, directed horizontally to the right (i.e., parallel to the positive x-axis), and its length covers the entire boundary polygon region. Based on the parity of the intersection points between the ray and the remaining edges of the boundary polygon, it is determined whether the area traversed by the ray is a hole region. If the number of intersection points is odd, the area traversed by the ray is a hole region inside the polygon; if the number of intersection points is even, the area traversed by the ray is a non-hole region outside or inside the polygon. After identifying all hole regions, a seed filling algorithm is used to fill the hole regions, with the filling grayscale value set to 255, consistent with the grayscale value of the suspected defect region inside the boundary polygon. After filling, a hole-free boundary polygon is obtained, ensuring that the boundary polygon can completely and accurately reflect the actual shape and extent of the suspected defect region.
[0055] Step 404: Solve for the smallest bounding rectangle that completely encloses the corresponding boundary polygon; simultaneously, solve for the largest inscribed rectangle inside the corresponding boundary polygon, and calculate the ratio of the area of the largest inscribed rectangle to the projected area of the boundary polygon; perform ear-cut triangulation on the corresponding boundary polygon to obtain multiple non-overlapping triangles, and record the centroid coordinates and area of each triangle; sequentially shrink and expand each triangle along the corresponding normal direction, and record the rate of change of the area of the sub-polygon after shrinkage and expansion, respectively, specifically including: For the convex polygon obtained in step 402 and the concave polygon without holes obtained in step 403, respectively, we solve for the minimum bounding rectangle and the maximum inscribed rectangle that can completely enclose the corresponding boundary polygon. The method for solving for the minimum bounding rectangle is to traverse all vertices of the boundary polygon and extract the maximum x-coordinate of each vertex. Minimum x-coordinate Maximum y-coordinate Minimum y-coordinate The coordinates of the top left corner of the smallest bounding rectangle are The coordinates of the lower right corner are Its area calculation formula is: The method for finding the maximum inscribed rectangle is as follows: using the boundary of the boundary polygon as a constraint, iterate through all possible rectangle parameters (length, width, position), calculate the area of each candidate rectangle, and select the rectangle with the largest area as the maximum inscribed rectangle. Its area is denoted as... Calculate the ratio of the area of the largest inscribed rectangle to the projected area of the boundary polygon. This ratio is used to quantify the regularity of the defect area. The closer the ratio is to 1, the more regular the defect area is; the smaller the ratio is, the more irregular the shape of the defect area is.
[0056] Perform ear-cutting triangulation on the corresponding boundary polygon. The specific process is as follows: traverse all vertices of the boundary polygon, identify all ear points (ear point is defined as: the triangle formed by the vertex and its two adjacent vertices does not contain other vertices of the polygon), form a triangle with the ear point and its two adjacent vertices, and then delete the ear point from the polygon. Repeat the above process until the entire boundary polygon is divided into multiple non-overlapping triangles. After the triangulation is completed, record the centroid coordinates and area of each triangle.
[0057] Each triangle is sequentially shrunk inward and expanded outward along its corresponding normal direction. The distance of both shrinkage and expansion is set to 1 pixel (preset according to the defect detection accuracy requirements). The area of each triangle after shrinkage and expansion is recorded, along with the rate of change of area after shrinkage. Area change rate after expansion The area change rate is used to reflect the smoothness of the edge of the defect area. The smaller the change rate, the smoother the defect edge; the larger the change rate, the rougher the defect edge.
[0058] Step 405: Compare the shape of the corresponding boundary polygon with the pre-stored standard defect-free bearing end face polygon, calculate the sum of squared distances between corresponding vertices as a similarity metric, and simultaneously check whether the convexity of each vertex of the corresponding boundary polygon is consistent. Mark the vertex positions where the convexity changes as defect edge inflection points. Specifically, this includes: A pre-stored standard defect-free bearing end-face polygon is retrieved. This standard polygon is obtained by acquiring a large number of defect-free bearing end-face images, extracting their feature contours, and averaging them. It is identical in specifications and dimensions to the current boundary polygon and serves as the benchmark for defect shape comparison. The current boundary polygon is then compared with the standard defect-free bearing end-face polygon. The comparison process involves aligning the two polygons (using the first micro-texture anchor point as the origin) to ensure their positions and angles are identical. Corresponding vertices of the two polygons are then extracted, and the sum of squared distances between corresponding vertices is calculated as a shape similarity metric. A smaller similarity metric indicates a more similar shape between the current boundary polygon and the standard polygon, and a closer proximity to a defect-free state to the suspected defect area; a larger metric indicates a greater shape difference and a more obvious defect. Simultaneously, the convexity of each vertex of the current boundary polygon is detected and compared with the convexity of corresponding vertices of the standard defect-free polygon to determine if the convexity is consistent. The criterion for vertex convexity is that if the vertex interior angle < If the vertex is less than 180 degrees, it is a convex vertex; if the interior angle of the vertex is greater than 180 degrees, it is a convex vertex. If the convexity of a vertex of the current boundary polygon is inconsistent with the convexity of the corresponding vertex of the standard polygon (e.g., the standard vertex is a convex vertex and the current vertex is a concave vertex, or vice versa), then the position of the vertex is marked as the defect edge inflection point, and its coordinates are recorded. The defect edge inflection point is used to locate the critical edge position of the defect.
[0059] Step 406: Based on the projected area, perimeter, concavity / convexity, cavity filling, geometric parameters of the smallest and largest inscribed rectangles, area distribution of each triangle, area change rate before and after offset, similarity metric, and coordinates of defect edge inflection points, comprehensively determine the defect type and location coordinates corresponding to the connected region. Specifically, this includes: Collect all defect feature parameters extracted in steps 402 to 405, including the projected area, perimeter, concavity / convexity (convex / concave polygon), hole filling status (whether there are holes), area of the minimum bounding rectangle and area of the maximum inscribed rectangle, area ratio, centroid coordinates and area of each triangle, area change rate after shrinkage and area change rate after expansion, similarity metric value, and coordinates of defect edge inflection points. Defect type judgment rules are established. Combining the characteristics of common defects on bearing end faces (scratches, dents, wear, and notches), the defect type corresponding to the connected region is comprehensively judged. The specific judgment criteria are as follows: If the projected area is less than 50 pixels² (combined with the preset image resolution of the bearing end face to adapt to the accuracy of conventional defect detection), the ratio of perimeter to area is greater than 0.8 (the larger the ratio, the narrower the outline), the shape is irregular (the similarity metric between the boundary polygon and the standard defect-free polygon is greater than 100), the number of edge turning points is greater than 5 (the number of turning points corresponding to every 100 pixels² of projected area is ≥1), and the area change rate after shrinkage and expansion is greater than 15% (the larger the change rate, the rougher the edge), then it is judged as a scratch defect; if the projected area is greater than 200 pixels², is a concave polygon, and has obvious holes (the area of the hole occupies more than the projected area of the boundary polygon), then it is judged as a scratch defect. If the ratio of the area to the projected area is greater than 10% and the ratio of the largest inscribed rectangle to the projected area is less than 0.4 (the smaller the ratio, the more irregular the interior of the defect and the more obvious the depression), it is judged as a depression defect; if the projected area is greater than 300 pixels², the shape is relatively regular (the similarity measure value between the boundary polygon and the standard defect-free polygon is between 50 and 100), the edge flatness is high (the area change rate after shrinkage and expansion is less than 8%), and the similarity measure value is large (greater than 80, indicating that the difference from the standard contour is mainly surface wear rather than local distortion), it is judged as a wear defect; if there are obvious concave vertices (the number of concave vertices is ≥3), the edge turning points are concentrated in a certain area (more than 80% of the turning points are distributed within 1 / 4 of the contour of the boundary polygon), and the shape is significantly different from the standard polygon (the similarity measure value is greater than 200), it is judged as a notch defect. The centroid coordinates of the boundary polygon are used as the center coordinates of the defect. At the same time, the boundary range of the defect is recorded, that is, the minimum x coordinate, maximum x coordinate, minimum y coordinate, and maximum y coordinate of the boundary polygon. This forms the location range information of the defect, and finally completes the comprehensive determination of the defect type and location coordinates corresponding to all connected components.
[0060] like Figure 2 As shown, embodiments of the present invention also provide a defect detection system for image registration and difference comparison of bearing dual end faces, including: The acquisition module is used to acquire the original image data of the first end face and the second end face of the bearing, and to preprocess the original image data to obtain the standard image of the first end face and the standard image of the second end face. The correction module is used to extract the outer circle contour and inner hole edge of the bearing from the first and second end face standard images to construct an annular feature band; determine the first and second micro-texture anchor points on the annular feature band; establish a local rectangular coordinate system with the first micro-texture anchor point as the origin; when a shift in the vector azimuth angle of the second micro-texture anchor point relative to the first micro-texture anchor point is detected, calculate the rotation compensation matrix; use the rotation compensation matrix to perform angle correction on the second end face standard image, and construct a virtual constraint chord by connecting the first and second micro-texture anchor points; calculate the radial scaling coefficient based on the length change rate of the virtual constraint chord, and uniformly scale and correct the second end face standard image to obtain a globally coarsely registered image pair. The calculation module is used to map the corresponding pixels in the global coarse registration image pair to virtual particle nodes in order to construct a virtual potential energy field model; calculate the texture structure cross-correlation coefficient between adjacent virtual particle nodes, and dynamically adjust the interaction force weight between virtual particle nodes according to the cross-correlation coefficient to obtain the fine registration image pair. The judgment module is used to perform pixel-by-pixel difference operations on the finely registered image pairs to obtain the initial residual map and filter out periodic discrete noise to obtain a clean defect mask; the clean defect mask is then subjected to connected component analysis to calculate the projected area of each connected component in order to determine the defect type and location coordinates.
[0061] It should be noted that this system is a system corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.
[0062] Experimental example: This embodiment takes a deep groove ball bearing on an automated inspection line of a bearing manufacturing enterprise as the research object. The bearing model is 6208-2RS, with an outer diameter of 80mm, an inner diameter of 40mm, and a thickness of 18mm. The inspection system includes image inspection station A, a flipping mechanism, and image inspection station B. Dual camera modules are used to acquire end face images of the bearing before and after flipping. Defect detection is achieved through image registration and difference comparison.
[0063] Step 3: Map the corresponding pixels in the global coarse registration image pair to virtual particle nodes to construct a virtual potential energy field model; calculate the texture structure cross-correlation coefficient between adjacent virtual particle nodes, and dynamically adjust the interaction force weight between virtual particle nodes according to the cross-correlation coefficient to obtain the fine registration image pair.
[0064] After completing global coarse registration, a global coarse registration image pair is obtained. This image pair includes a first end-face standard image and a second end-face standard image after angle correction and scaling correction. The first end-face standard image in the global coarse registration image pair is formally defined as the first image field, and the second end-face standard image is formally defined as the second image field. Each pixel in the first and second image fields is used as an independent virtual particle node. Each virtual particle node contains two sets of core parameters: spatial position coordinates and grayscale value. Since global coarse registration has eliminated macroscopic angular offset and linear deformation, the spatial position coordinate deviation of the corresponding virtual particle node is within a small range, not exceeding 2 pixel units.
[0065] Within the first and second image fields, virtual elastic connections are established for each virtual particle node. The connection range of a virtual elastic connection is limited to adjacent virtual particle nodes within its four-neighbor or eight-neighbor domain. The selection of the connection range can be flexibly determined based on the complexity of the bearing end face texture. For denser textures, the criterion is that the number of grayscale value changes per unit area (100×100 pixel area) is ≥80, in which case an eight-neighbor domain is used. For sparser textures, the criterion is that the number of grayscale value changes per unit area (100×100 pixel area) is <80, in which case a four-neighbor domain is used. The core parameter of the virtual elastic connection is the stiffness coefficient, which is determined by the absolute value of the difference in grayscale values between the two connected virtual particle nodes.
[0066] A cross-field virtual coupling link is established between the first and second image fields. The connection rule for the virtual coupling link is that each virtual particle node in the first image field establishes a unique virtual coupling link only with the virtual particle node in the second image field corresponding to its spatial location. The initial potential energy of each virtual coupling link is set to zero, and the change in potential energy of the virtual coupling link is determined by the square of the difference in grayscale values between the two connected virtual particle nodes. In this way, all corresponding pixels in the globally coarsely registered image pair are completely mapped to virtual particle nodes. Each virtual particle node has a clear spatial location coordinate and grayscale value parameter. At the same time, an internal elastic constraint system composed of virtual elastic connections is formed within both the first and second image fields, and a cross-field coupling system composed of virtual coupling links is formed between the two image fields, thus completing the virtual potential energy field model.
[0067] In the virtual potential field model, the virtual particle node corresponding to the first micro-texture anchor point is taken as the target virtual particle node. Potential matching virtual particle nodes are searched within the neighborhood corresponding to the spatial position of the target virtual particle node in the second image field. The search neighborhood is defined as a circular region with a radius of 3 pixels, centered on the second image field coordinates corresponding to the target virtual particle node. For the determined target virtual particle node and the searched potential matching virtual particle nodes, corresponding gray-level distribution matrices are extracted. Centered on the target virtual particle node, the gray-level values of all virtual particle nodes within a circular region with a radius of 5 pixels are extracted. These gray-level values are arranged in spatial order to construct a first gray-level distribution matrix with a size of 11×11. Using the same extraction method, the gray-level values of all virtual particle nodes within a circular region with a radius of 5 pixels are extracted, centered on each potential matching virtual particle node, to construct a second gray-level distribution matrix.
[0068] The texture structure cross-correlation coefficient between the first and second gray-level distribution matrices is calculated. This coefficient quantifies the similarity of the texture structures corresponding to the two gray-level distribution matrices, and its value ranges from -1 to 1. The preset critical correlation coefficient is 0.7, which is based on the texture characteristics of the bearing end face. The texture structure cross-correlation coefficient is compared with the critical correlation coefficient of 0.7. If ρ ≥ 0.7, it indicates that the texture structures of the matched virtual particle node and the target virtual particle node are highly similar, and the node is determined to be a valid match. At this point, the virtual gravity weight is set to the maximum value of 1.0, and virtual gravity simulating molecular orbital overlap is applied. The magnitude of the virtual gravity... ,in This is a virtual gravitational weight, fixed at a value of 1.0. This represents the cross-correlation coefficient of the texture structure. The gravitational constant is fixed at 1.2; if A value less than 0.7 indicates a significant difference in texture structure between the matched virtual particle node and the target virtual particle node, classifying it as an invalid match. In this case, the virtual repulsion weight is set to the maximum value of 1.0, and a virtual repulsion force simulating the electron cloud repulsion effect is applied. The magnitude of the virtual repulsion force... ,in For repulsive force weight, The repulsion coefficient is fixed at 1.2.
[0069] Based on the applied virtual attraction or repulsion, and combined with the elastic constraints of the virtual elastic connections and the potential energy changes of the virtual coupling links in the virtual potential energy field model, the spatial coordinates of all virtual particle nodes within the model are iteratively updated. After each iteration, the total energy of the virtual potential energy field is calculated until the difference between the total energy of two consecutive iterations is less than [a certain value]. Once the model reaches energy convergence, it indicates that the virtual potential field model has reached a stable state, and the positions of all virtual particle nodes in the second image field no longer change significantly, meaning the pixel displacement field of the second end-face standard image has reached a stable state. After the iteration stops, the stable second end-face standard image is mapped to the first end-face standard image to generate a finely registered image pair that eliminates nonlinear distortion.
[0070] like Figure 3 The solid red line with dots represents the change in the total energy of the virtual potential field with the number of iterations. The red dotted line represents the energy convergence threshold. The solid blue line with squares represents the improvement in registration accuracy with the number of iterations.
[0071] Figure 4 The red / orange bars represent the virtual repulsion zone. <0.7), gray bars represent the transition zone (0.5≤ <0.7), cyan / blue bars represent the virtual gravity region ( ≥0.7), the purple dashed line represents the critical correlation coefficient (0.7).
[0072] Step 4: Perform pixel-by-pixel difference operation on the finely registered image pair to obtain the initial residual map, and filter out periodic discrete noise points to obtain a clean defect mask; perform connected component analysis on the clean defect mask, calculate the projected area of each connected component to determine the defect type and location coordinates.
[0073] A finely registered image pair, free from nonlinear distortion, is obtained. This pair includes a first end-face standard image and a second end-face standard image, with perfectly aligned texture features and geometric structures, one-to-one pixel coordinates, and no angular offset, linear deformation, or nonlinear distortion. A pixel-by-pixel subtraction operation is performed on the first and second end-face standard images in the finely registered image pair. The operation rule is to subtract the grayscale value of the corresponding pixel in the first end-face standard image from the grayscale value of the corresponding pixel in the second end-face standard image, preserving the grayscale difference information, and finally obtaining the initial residual image.
[0074] Obtain the mechanical vibration frequency spectrum of the bearing during the flipping process. Start the bearing flipping mechanism under no-load conditions, ensuring stable operation according to the actual flipping speed and cycle in production. Install accelerometers at key rotating parts of the flipping mechanism, setting the sensor sampling frequency to 1000Hz and the sampling duration to 60s to collect vibration signals during operation. Convert the collected time-domain vibration signal to a frequency-domain signal using a Fast Fourier Transform (FFT). Set the FFT transformation to 1024 points, zero-padding the time-domain vibration signal to match the signal length with the number of FFT points, and then perform the FFT again to obtain the final frequency-domain signal. Extract the frequency components with magnitudes greater than the amplitude threshold (set to 10% of the maximum magnitude) as the dominant frequency components. The frequency range corresponding to the dominant frequency components is the mechanical vibration frequency spectrum. Periodic analysis is performed on the initial residual image to identify periodic discrete noise points that conform to the frequency spectrum characteristics of mechanical vibration. The gray values of the pixels corresponding to these noise points are set to zero to eliminate the interference caused by mechanical vibration. Only static gray-level abnormal areas in the initial residual image are retained. The processed residual image is then binarized with a binarization threshold of 20. When the pixel gray value is greater than 20, it is set to 255 (indicating a suspected defect area); when the pixel gray value is less than or equal to 20, it is set to 0 (indicating a background area). Finally, a clean defect mask is generated.
[0075] The generated clean defect mask undergoes eight-neighbor connected component labeling. The criterion for eight-neighbor connected components is: if a pixel (grayscale value of 255) has other pixels with a grayscale value of 255 in its eight directions (up, down, left, right, top left, top right, bottom left, bottom right), then these pixels belong to the same connected component. A connected component labeling algorithm is used to traverse all pixels in the clean defect mask, labeling all independent connected components. Each connected component corresponds to a suspected defect region, and a unique label number is assigned to each connected component. For each labeled connected component, all its boundary pixels are extracted. The criteria for boundary pixels are: the pixel has a grayscale value of 255, and at least one pixel with a grayscale value of 0 exists in its eight neighbors. After extracting all boundary pixels, they are connected sequentially according to their spatial position to form a closed boundary polygon, ensuring that the boundary polygon completely encloses the suspected defect region of the corresponding connected component.
[0076] Calculate the projected area and perimeter of the boundary polygon. Then, determine whether the boundary polygon of the corresponding connected region is concave or convex. Traverse each interior angle of the boundary polygon. If any interior angle has a degree greater than 180°, the boundary polygon is concave; if all interior angles are less than or equal to 180°, the boundary polygon is convex. For the identified concave polygons, identify and fill internal void regions. Draw horizontal rays from each concave vertex. Based on the parity of the intersection points of the rays and the remaining edges of the boundary polygon, identify and fill the void regions inside the corresponding boundary polygon to obtain a void-free boundary polygon. For the obtained convex polygons and void-free concave polygons, respectively solve for the minimum bounding rectangle and the maximum inscribed rectangle that can completely enclose the corresponding boundary polygon. Calculate the ratio of the area of the maximum inscribed rectangle to the projected area of the boundary polygon. This ratio is used to quantify the regularity of the defect region. Perform ear-cutting triangulation on the corresponding boundary polygon to obtain multiple non-overlapping triangles, and record the centroid coordinates and area of each triangle; perform inward shrinkage and outward expansion operations on each triangle along the corresponding normal direction, with the shrinkage and expansion distances both set to 1 pixel unit, and record the area change rate of the sub-polygons after shrinkage and expansion respectively. The area change rate is used to reflect the edge smoothness of the defect area.
[0077] Retrieve pre-stored standard defect-free bearing end face polygons. Compare the current boundary polygon with the standard defect-free bearing end face polygons, calculate the sum of squared distances between corresponding vertices as a shape similarity metric, and simultaneously detect the convexity of each vertex of the current boundary polygon and compare it with the convexity of the corresponding vertices of the standard defect-free polygon to determine if the convexity is consistent. Mark the vertex positions where the convexity changes as defect edge inflection points. Collect all defect feature parameters, including the projected area, perimeter, concavity / convexity, void filling status, area of the minimum bounding rectangle and the maximum inscribed rectangle, area ratio, centroid coordinates and area of each triangle, area change rate after shrinkage and area change rate after expansion, similarity metric, and coordinates of defect edge inflection points. Defect type determination rules are established as follows: if the projected area is less than 50 pixels², the ratio of perimeter to area is greater than 0.8, the shape is irregular (similarity metric value greater than 100), the number of edge turning points is greater than 5, and the area change rate after shrinkage and expansion is greater than 15%, it is determined to be a scratch defect; if the projected area is greater than 200 pixels², it is a concave polygon, has obvious holes, and the ratio of the largest inscribed rectangle to the projected area is less than 0.4, it is determined to be a depression defect; if the projected area is greater than 300 pixels², the shape is relatively regular, the edge flatness is high, and the similarity metric value is large, it is determined to be a wear defect; if there are obvious concave vertices, the edge turning points are concentrated in a certain area, and the shape differs significantly from the standard polygon, it is determined to be a notch defect. The centroid coordinates of the boundary polygon are used as the center position coordinates of the defect, and the boundary range of the defect is recorded simultaneously. Finally, a comprehensive determination of the defect type and position coordinates corresponding to all connected components is completed.
[0078] like Figure 5 Blue bars represent the method of this invention, and gray bars represent traditional affine transformation methods.
[0079] As can be seen from the above embodiments, the defect detection method for image registration and difference comparison of bearing double end faces proposed in this application has achieved significant technical results in the actual application of an automated inspection line in a bearing manufacturing enterprise. This application combines a virtual potential energy field model with dynamic attraction / repulsion adjustment based on texture cross-correlation to achieve precise alignment at two levels: coarse registration and fine registration, maintaining stable registration under industrial conditions such as mechanical vibration, clamping fluctuations, and positioning deviations. Based on pixel-by-pixel differencing of the finely registered image pairs and filtering out periodic discrete noise caused by mechanical vibration, the true defect signal can be extracted, effectively distinguishing defects from mechanical disturbance noise. Through comprehensive judgment using connected component projection area, grayscale contrast ratio, and geometric features, automated and high-precision identification of defect types and location coordinates is achieved. The entire process is based on image algorithm calculations, without complex manual intervention or mechanical adjustments. The single-workpiece inspection process is short, compatible with the loading, flipping, and multi-station inspection processes of fully automated image inspection machines, without reducing production line capacity. The entire process employs non-contact visual imaging and pure image algorithm processing, eliminating the risk of secondary damage such as squeezing, bumping, scratching, and magnetization, thus meeting the non-destructive requirements for high-precision appearance and dimensional inspection of bearings.
[0080] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method of defect detection by bearing two-face image registration and difference comparison, characterized in that, The method includes: Step 1: Obtain the original image data of the first end face and the second end face of the bearing, and preprocess the original image data to obtain the standard image of the first end face and the standard image of the second end face. Step 2: Extract the bearing outer circle contour and inner hole edge from the first and second end face standard images to construct an annular feature band; determine the first and second micro-texture anchor points on the annular feature band; establish a local rectangular coordinate system with the first micro-texture anchor point as the origin; when a vector azimuth angle offset of the second micro-texture anchor point relative to the first micro-texture anchor point is detected, calculate the rotation compensation matrix; use the rotation compensation matrix to perform angle correction on the second end face standard image, and construct a virtual constraint chord by connecting the first and second micro-texture anchor points; calculate the radial scaling coefficient based on the length change rate of the virtual constraint chord, and uniformly scale and correct the second end face standard image to obtain a globally coarsely registered image pair; Step 3: Map the corresponding pixels in the global coarse registration image pair to virtual particle nodes to construct a virtual potential energy field model; calculate the texture structure cross-correlation coefficient between adjacent virtual particle nodes, and dynamically adjust the interaction force weight between virtual particle nodes according to the cross-correlation coefficient to obtain the fine registration image pair. Step 4: Perform pixel-by-pixel difference operation on the finely registered image pair to obtain the initial residual map, and filter out periodic discrete noise points to obtain a clean defect mask; perform connected component analysis on the clean defect mask, calculate the projected area of each connected component to determine the defect type and location coordinates.
2. The bearing dual end face image registration and difference comparison defect detection method of claim 1, wherein, The first end face standard drawing and the second end face standard drawing include: The upper surface of the bearing when it passes through image inspection station A and the upper surface of the bearing when it enters image inspection station B after being flipped by the flipping mechanism; wherein, the first end face standard image is acquired and processed by the first camera module arranged in image inspection station A, and the second end face standard image is acquired and processed by the second camera module arranged in image inspection station B.
3. The defect detection method for image registration and difference comparison of bearing double end faces according to claim 2, characterized in that, Extract the bearing outer circle contour and inner hole edge from the first end face standard drawing and the second end face standard drawing to construct an annular feature band; determine the first and second micro-texture anchor points on the annular feature band, including: Edge detection processing is performed on the first end face standard image and the second end face standard image respectively to extract the outer circle contour pixel set and the inner hole edge pixel set of the bearing; based on the outer circle contour pixel set and the inner hole edge pixel set of the bearing, the geometric center of the bearing end face is determined, and with the geometric center as the center, the inner hole edge radius as the inner boundary and the outer circle contour radius as the outer boundary, the corresponding annular region is extracted from the first end face standard image and the second end face standard image to construct an annular feature band; Within the annular feature band, the curvature change gradient of the chamfer transition zone on the bearing end face is identified, and the position with the largest curvature change gradient is selected as the first micro-texture anchor point; within the annular feature band, the geometric discontinuity structure of the anti-rust oil groove on the bearing end face is identified, and the asymmetric notch with a unique topological shape is selected as the second micro-texture anchor point.
4. The defect detection method for image registration and difference comparison of bearing double end faces according to claim 3, characterized in that, A local Cartesian coordinate system is established with the first micro-texture anchor point as the origin. When a shift in the vector azimuth angle of the second micro-texture anchor point relative to the first micro-texture anchor point is detected, a rotation compensation matrix is calculated, including: In the first end face standard image, the pixel coordinates of the first micro-texture anchor point are used as the origin of the local rectangular coordinate system. The vector line segment pointing from the first micro-texture anchor point to the second micro-texture anchor point is determined, and the first direction angle of the vector line segment relative to the X-axis of the local rectangular coordinate system is calculated as the reference direction angle. In the second end face standard drawing, the same local rectangular coordinate system is established with the same first micro-texture anchor point as the origin. The vector line segment pointing from the first micro-texture anchor point to the second micro-texture anchor point in the second end face standard drawing is determined, and the second direction angle of the vector line segment relative to the X-axis of the local rectangular coordinate system is calculated as the current direction angle. Calculate the difference between the current orientation angle and the reference orientation angle to obtain the rotation angle deviation; construct a two-dimensional rotation matrix based on the rotation angle deviation as the rotation compensation matrix.
5. The defect detection method for image registration and difference comparison of bearing double end faces according to claim 4, characterized in that, Angle correction is performed on the second end face standard image using a rotation compensation matrix, and a virtual constraint chord is constructed by connecting the first and second micro-texture anchor points, including: The second end face standard image is subjected to inverse rotation transformation by rotation compensation matrix so that the vector azimuth angle of the second micro texture anchor point is consistent with the vector azimuth angle of the first micro texture anchor point, and the intermediate image after angle correction is obtained. In the intermediate image after angle correction, the center pixel coordinates of the first micro-texture anchor point and the center pixel coordinates of the second micro-texture anchor point are extracted. In virtual space, the center pixel coordinates of the first micro-texture anchor point and the center pixel coordinates of the second micro-texture anchor point are connected by straight line segments to form a virtual constraint chord. The virtual constraint chord serves as a geometric reference for measuring whether the bearing end face undergoes linear tensile or compressive deformation during the flipping process.
6. The defect detection method for image registration and difference comparison of bearing double end faces according to claim 5, characterized in that, The radial scaling coefficient is calculated based on the length change rate of the virtual constraint chord. The second end face standard image is then uniformly scaled and corrected to obtain a globally coarsely registered image pair, including: Measure the Euclidean distance between the first and second micro-texture anchor points in the first end face standard image, and use it as the reference chord length; measure the Euclidean distance between the first and second micro-texture anchor points in the angle-corrected intermediate image, and use it as the current chord length; calculate the ratio of the current chord length to the reference chord length to obtain the length change rate. The radial scaling factor is derived based on the length change rate. Taking the first micro-texture anchor point as the center, the radial scaling factor is used to uniformly scale the intermediate image after angle correction, so that the position of the second micro-texture anchor point after scaling coincides with the corresponding position in the first end face standard image, eliminating the macroscopic linear deformation caused by mechanical clamping or material stress, and obtaining a global coarse registration image pair.
7. The defect detection method for image registration and difference comparison of bearing double end faces according to claim 6, characterized in that, The corresponding pixels in the globally coarsely registered image are mapped to virtual particle nodes to construct a virtual potential energy field model, including: The first end face standard image and the second end face standard image in the global coarse registration image pair are defined as the first image field and the second image field, respectively. Each pixel in the first image field and the second image field is treated as a virtual particle node. The virtual particle node contains the spatial position coordinates and grayscale value of the corresponding pixel in the first image field and the second image field. Within the first and second image fields, virtual elastic connections are defined between each virtual particle node and its adjacent virtual particle nodes in the four-neighbor or eight-neighbor domains. The stiffness coefficient of the virtual elastic connection is determined by the absolute value of the difference in gray values between the two connected virtual particle nodes. A virtual coupling link is established between the virtual particle node in the first image field and the virtual particle node in the second image field corresponding to the virtual particle node in the second image field. The initial potential energy of each virtual coupling link is set to zero, and the potential energy change of the corresponding virtual coupling link is equal to the square of the difference between the gray values of the two connected virtual particle nodes. Using the above method, all corresponding pixels in the globally coarsely registered image pair are mapped into a virtual particle node system with internal elastic connections and cross-field coupling links, thus completing the construction of the virtual potential energy field model.
8. The defect detection method for image registration and difference comparison of bearing double end faces according to claim 7, characterized in that, Calculate the texture structure cross-correlation coefficient between adjacent virtual particle nodes, and dynamically adjust the interaction force weights between virtual particle nodes based on the cross-correlation coefficient to obtain finely registered image pairs, including: In the virtual potential field model, the first micro-texture anchor point is used as the target virtual particle node, and a matching virtual particle node is searched in the corresponding neighborhood of the second image field. Extract the first grayscale distribution matrix within a circular region centered on the target virtual particle node with a radius of 5 pixels, and the second grayscale distribution matrix within a circular region centered on the matching virtual particle node with a radius of 5 pixels. The texture structure cross-correlation coefficient between the first gray-level distribution matrix and the second gray-level distribution matrix is calculated. The texture structure cross-correlation coefficient is compared with a preset critical correlation coefficient. If the texture structure cross-correlation coefficient is greater than or equal to the critical correlation coefficient, the virtual gravity weight is set to the maximum value, and a virtual gravity simulating the molecular orbital overlap effect is applied to cause the matching virtual particle node to move toward the spatial position of the target virtual particle node, thereby achieving adsorption and locking of texture features. If the texture structure cross-correlation coefficient is less than the critical correlation coefficient, the virtual repulsion weight is set to the maximum value, and a virtual repulsion simulating the electron cloud repulsion effect is applied to cause the matching virtual particle node to move away from the spatial position of the target virtual particle node, thereby preventing erroneous fusion of non-corresponding regions. By iteratively updating the position coordinates of all virtual particle nodes until the total energy of the virtual potential energy field model converges to the minimum value, the pixel displacement field of the second end face standard image reaches a stable state, generating a finely registered image pair that eliminates nonlinear distortion.
9. The defect detection method for image registration and difference comparison of bearing double end faces according to claim 8, characterized in that, Step 4 includes: Perform pixel-by-pixel subtraction between the first end face standard image and the second end face standard image in the finely registered image pair to obtain an initial residual image containing grayscale difference information. The mechanical vibration frequency spectrum of the bearing during the flipping process is obtained by running the flipping mechanism under no-load conditions and collecting vibration signals using an accelerometer, and extracting the main frequency component by Fourier transform; periodic discrete noise points that conform to the characteristics of the mechanical vibration frequency spectrum in the initial residual map are identified, and the gray values of the periodic discrete noise points are set to zero, while static gray-level abnormal areas are retained to generate a pure defect mask. Eight-neighbor connected component labeling is performed on the clean defect mask to identify all independent connected components; all boundary pixels of the corresponding connected components are extracted and connected to form closed boundary polygons, and the projected area and perimeter of the boundary polygons are calculated; the difference between the sum of the interior angles of the boundary polygons and the standard interior angle sum is used to determine whether the corresponding connected component is a concave or convex polygon. For the identified concave polygon, a horizontal ray is emitted from each concave vertex. Based on the parity of the intersection points of the ray and the remaining edges of the boundary polygon, the hollow areas inside the corresponding boundary polygon are identified and filled to obtain the same boundary polygon without hollow areas. Find the smallest bounding rectangle that can completely enclose the corresponding boundary polygon, and at the same time find the largest inscribed rectangle inside the corresponding boundary polygon, and calculate the ratio of the area of the largest inscribed rectangle to the projected area of the boundary polygon; perform ear-cut triangulation on the corresponding boundary polygon to obtain multiple non-overlapping triangles, and record the centroid coordinates and area of each triangle; shrink each triangle inward and expand it outward along the corresponding normal direction, and record the rate of change of the area of the sub-polygon after shrinkage and expansion respectively. The shape of the corresponding boundary polygon is compared with the pre-stored standard defect-free bearing end face polygon. The sum of squared distances between the corresponding vertices is calculated as a similarity measure. At the same time, the convexity of each vertex of the corresponding boundary polygon is checked to see if it is consistent. The vertex positions where the convexity changes are marked as defect edge inflection points. Based on the projected area, perimeter, concavity / convexity, void filling, geometric parameters of the smallest and largest inscribed rectangles, area distribution of each triangle, area change rate before and after offset, similarity metric, and coordinates of defect edge inflection points, the defect type and location coordinates corresponding to the connected region are comprehensively determined.
10. A defect detection system for image registration and difference comparison of bearing double end faces, wherein the system implements the method as described in any one of claims 1 to 9, characterized in that, include: The acquisition module is used to acquire the original image data of the first end face and the second end face of the bearing, and to preprocess the original image data to obtain the standard image of the first end face and the standard image of the second end face. The correction module is used to extract the outer circle contour and inner hole edge of the bearing from the first end face standard image and the second end face standard image, and construct an annular feature band; determine the first and second micro-texture anchor points on the annular feature band; establish a local rectangular coordinate system with the first micro-texture anchor point as the origin; when a vector azimuth angle offset of the second micro-texture anchor point relative to the first micro-texture anchor point is detected, calculate the rotation compensation matrix; use the rotation compensation matrix to perform angle correction on the second end face standard image, and construct a virtual constraint chord by connecting the first and second micro-texture anchor points; The radial scaling coefficient is calculated based on the length change rate of the virtual constraint chord, and the standard image of the second end face is uniformly scaled and corrected to obtain a global coarse registration image pair. The calculation module is used to map the corresponding pixels in the global coarse registration image pair to virtual particle nodes in order to construct a virtual potential energy field model; calculate the texture structure cross-correlation coefficient between adjacent virtual particle nodes, and dynamically adjust the interaction force weight between virtual particle nodes according to the cross-correlation coefficient to obtain the fine registration image pair. The judgment module is used to perform pixel-by-pixel difference operation on the finely registered image pairs to obtain the initial residual map and filter out periodic discrete noise to obtain a clean defect mask. Connectivity analysis is performed on the pure defect mask to calculate the projected area of each connected region in order to determine the defect type and location coordinates.