Rotation detection device, detection method and system thereof and medium
By combining optical shadow imaging and mechanical rotation, a three-dimensional reconstruction model is generated, which solves the problems of difficulty in obtaining depth information and low detection efficiency in existing detection methods, and realizes rapid and accurate detection of workpieces.
Patent Information
- Application Number
- CN202511047106.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2025-10-28
AI Technical Summary
Existing detection methods based on optical imaging or two-dimensional image analysis are difficult to accurately obtain the depth information of parts. The processing of three-dimensional point cloud data is complex and time-consuming, which cannot meet the needs of rapid detection. Furthermore, existing methods that integrate three-dimensional point clouds and two-dimensional images cannot adapt to the comprehensive detection of workpieces, resulting in insufficient detection efficiency and automation.
By combining optical shadow imaging with mechanical rotation, multi-angle scanning of the turntable and point cloud registration and stitching are used to generate a three-dimensional reconstruction model, which is then compared with a standard model to calculate the deviation and achieve rapid and accurate defect detection.
It enables the acquisition of high-precision point cloud data without a 3D laser scanner, making it suitable for rapid full inspection of workpiece shape parameters. It is particularly suitable for surface defect detection and dimensional tolerance analysis, improving the accuracy and efficiency of inspection.
Smart Images

Figure CN120846197A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of workpiece inspection technology, and more specifically, to a rotary inspection device and its inspection method, system, and medium. Background Technology
[0002] The content in this section provides only background information related to this application and may not constitute prior art.
[0003] In the field of machining and inspection of various mechanical parts, the increasing precision requirements of industrial manufacturing pose greater challenges to the accuracy and efficiency of component defect detection technology. Traditional inspection methods have gradually revealed many shortcomings in practical applications.
[0004] On the one hand, existing inspection methods based on optical imaging or two-dimensional image analysis, while achieving a certain degree of automation, rely solely on two-dimensional image information, making it difficult to accurately obtain depth information of components. For defects such as small and shallow cracks, the reliability of the inspection results is poor, easily leading to missed or false detections. For example, in the inspection of aerospace blade forgings, it is difficult to accurately calculate the crack depth using only two-dimensional images, thus failing to comprehensively assess the impact of defects on component performance. On the other hand, while using three-dimensional point cloud data alone can provide rich depth information, it has limitations in edge recognition, is susceptible to noise, leading to inaccurate crack edge extraction and consequently affecting the measurement accuracy of key parameters such as crack width. Furthermore, three-dimensional point cloud data processing is typically complex, computationally intensive, and time-consuming, making it difficult to meet the practical needs of rapid inspection.
[0005] In existing technologies, for example, Chinese patent CN115861274A discloses a crack detection method that integrates 3D point clouds and 2D images. This method involves using a 3D laser scanner to acquire point cloud information of surface cracks on aerospace blade forgings, simultaneously obtaining 2D image features through a camera, and generating a depth image by combining the point cloud model. The 2D image is segmented into crack regions using OpenCV's threshold segmentation algorithm, and edge extraction is performed using Delaunay triangulation and AlphaShape algorithms to calculate the crack width. The depth image is filtered, and the depth difference is calculated to obtain crack depth information. Finally, the 2D image and the 3D point cloud processing results are fused to determine the final defect region and crack width. This method aims to address the problems of low defect detection accuracy, susceptibility to noise, and low detection efficiency in existing detection methods that rely solely on 2D images or 3D point clouds. By fusing multi-source data, it improves the accuracy, reliability, and efficiency of crack detection.
[0006] The drawback of this existing technology is that the combined use of 3D point clouds and 2D images can only perform localized detection, and different judgment conditions need to be set for different defects. It cannot adapt to the comprehensive inspection of workpieces, and has significant limitations in terms of inspection efficiency and automation, making it difficult to meet the actual needs for rapid and accurate defect detection. Summary of the Invention
[0007] To address the aforementioned technical problems, this application aims to provide a rotary inspection device, its inspection method, system, and medium. By generating three-dimensional point cloud data using shadow images, and then performing multi-angle scanning and point cloud registration and stitching on a turntable, three-dimensional reconstruction of the workpiece under test is achieved. The reconstructed inspection model is compared with a standard model point cloud, the deviation is calculated and analyzed, thereby accurately obtaining the defect content. This method enables the acquisition of point cloud data without the use of a three-dimensional laser scanner and allows for rapid detection of the external parameters of the entire workpiece.
[0008] The objective of this application is achieved through the following technical solution:
[0009] In a first aspect, the present invention provides a rotary detection device, comprising: a light source, a fixture stage, a lens, and a light receiving device arranged sequentially; the fixture stage includes a base, a fixture disposed on the base, and a motor; the output shaft of the motor is connected to the fixture; and the light emission outlet of the light source faces the lens; the light source, the light receiving device, and the motor are respectively electrically connected to a controller.
[0010] In a second aspect, the present invention provides a rotation detection method, applied to a rotation detection device as described in the first aspect, the method comprising:
[0011] In response to the start signal, the light source and light receiving device are activated. The light source emits light to illuminate the workpiece to be tested on the fixture, and the light receiving device acquires the shadow image of the workpiece to be tested through the lens.
[0012] The motor is controlled to rotate the workpiece under test, while the shadow images of the workpiece under test at different angles are continuously acquired through the light receiving device; each shadow image and its corresponding rotation angle after the workpiece under test has rotated one revolution are recorded and saved as a set of image angles.
[0013] Edge detection is performed on each shadow image within the image angle set to extract the contour information of each shadow image; the target contours on both sides of the contour information are obtained, and the two-dimensional coordinates of each position point on the target contour are obtained based on the image coordinate system; based on the preset spatial coordinate system, the three-dimensional coordinates of each position point are calculated according to the two-dimensional coordinates and their corresponding rotation angles to obtain the contour point cloud data.
[0014] The contour point cloud data from different perspectives are registered, and the registered contour point cloud data are globally stitched together through voxel grid filtering and bundle adjustment to obtain the detection model.
[0015] Calculate the point-by-point Euclidean distance between the detection model and the preset standard model, and output the regional deviation and root mean square error.
[0016] Furthermore, after the light receiving device acquires the shadow image of the workpiece under test through the lens, it further includes:
[0017] The shadow image is converted to grayscale from a color image; an adaptive thresholding method is used to binarize the image.
[0018] Furthermore, after the binarization operation, the following steps are also included:
[0019] A Gaussian filter is used to smooth the binarized image.
[0020] Furthermore, the step of extracting the contour information of each shadow image specifically includes:
[0021] An improved Canny edge detection algorithm is used to extract edges from each shadow image. Through multi-scale gradient calculation and non-maximum suppression, the boundary pixels of objects in each shadow image are identified and a continuous and closed contour line is formed.
[0022] Furthermore, the step of calculating the three-dimensional coordinates of each position point based on the two-dimensional coordinates and their corresponding rotation angles specifically includes:
[0023] Calculate the mean of all the two-dimensional coordinates, and use the coordinates corresponding to the mean as the centroid of the workpiece to be measured;
[0024] Convert all position points into a preset spatial coordinate system with the center of gravity as the origin, and subtract the coordinate value of the center of gravity from the original coordinate value of each position point to obtain the correction coordinates of each position point;
[0025] Calculate the rotation coordinates and corresponding depth coordinates after rotation based on the rotation angle, correction coordinates, and vertical offset.
[0026] The initial three-dimensional coordinates are obtained by summing the rotation coordinates with the mean and translating them back to the original coordinate system.
[0027] The initial three-dimensional coordinates are normalized to obtain the final three-dimensional coordinates.
[0028] Furthermore, the formula for calculating the three-dimensional coordinates of each location point is as follows:
[0029]
[0030] Where, x 2i Let y be the x-coordinate of a point on a two-dimensional image. 2i y is the ordinate of a point on the 2D image, n is the number of 2D coordinates, i is the index of the coordinate, α is the rotation angle in radians, offset is the image offset, width is the image width, height is the image height, up is the vertical offset, 2f is the target interval width, and -f is the final offset; x 3i y 3i z 3i These are the coordinate values in three directions on a three-dimensional coordinate system.
[0031] Furthermore, the step of registering contour point cloud data from different perspectives specifically includes:
[0032] Extract local geometric features from contour point cloud data, including normal vectors and curvature information; perform feature matching based on fast point feature histogram descriptors or 3D shape context descriptors; screen reliable matching point pairs using random sampling consensus algorithm or four-point coplanar set registration algorithm; generate an initial transformation matrix based on principal component analysis coordinate system transformation;
[0033] Based on the initial transformation matrix, spatial correspondence is established through iterative nearest point search; the Euclidean distance between corresponding points is minimized using the least squares method; normal vector constraints are introduced to minimize the projection distance from the point to the tangent plane; a local surface covariance matrix is established for weighted registration; the contour point cloud data is divided into voxel grids, and a local Gaussian distribution model is fitted to calculate the Euclidean distance and the minimum transformation parameters.
[0034] Thirdly, the present invention provides a rotation detection system applied to a rotation detection device as described in the first aspect, the system comprising:
[0035] The image acquisition module is used to activate the light source and the light receiving device. The light source emits light to illuminate the workpiece to be measured on the fixture, and the light receiving device acquires the shadow image of the workpiece to be measured through the lens.
[0036] The rotating image acquisition module is used to control the motor to rotate the workpiece under test, and at the same time continuously acquire shadow images of the workpiece under test at different angles through the light receiving device; record each shadow image and its corresponding rotation angle after the workpiece under test has rotated one revolution, and save it as an image angle set;
[0037] The coordinate calculation module is used to perform edge detection on each shadow image within the image angle set and extract the contour information of each shadow image; obtain the target contour on both sides of the contour information, and obtain the two-dimensional coordinates of each position point on the target contour based on the image coordinate system; and calculate the three-dimensional coordinates of each position point based on the two-dimensional coordinates and their corresponding rotation angles according to the preset spatial coordinate system to obtain the contour point cloud data.
[0038] The registration module is used to register contour point cloud data from different perspectives. The registered contour point cloud data is then globally stitched together using voxel grid filtering and bundle adjustment to obtain the detection model.
[0039] The output module is used to calculate the point-by-point Euclidean distance between the detection model and the preset standard model, and output the regional deviation and root mean square error.
[0040] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps corresponding to the method in the first aspect.
[0041] In summary, the technical solutions of this application have at least the following advantages and beneficial effects:
[0042] This invention achieves 3D reconstruction through optical shadow imaging combined with mechanical rotation. The device uses a light source to illuminate the workpiece fixed on a motor-driven fixture. The light passes through the workpiece and is focused by a lens onto a light-receiving device, forming a shadow image. Methodologically, the motor first controls the workpiece to rotate, simultaneously acquiring shadow images from various angles and associating them with the rotation angles. Then, edge detection is performed on the image sequence to extract contours, and the 3D point coordinates are calculated using the spatial geometric relationship between 2D coordinates and rotation angles. Next, point cloud registration technology is used to align the multi-view data, followed by voxel grid filtering for noise reduction and bundle adjustment optimization to complete global stitching. Finally, the reconstructed model is compared with a standard model point-by-point deviation analysis. This invention achieves rapid full inspection of workpiece shape parameters by using ordinary optical equipment instead of expensive 3D laser scanners, generating high-precision point cloud data through shadow contour inversion and multi-angle scanning on a turntable. It is particularly suitable for industrial quality inspection scenarios such as surface defect detection and dimensional tolerance analysis. Attached Figure Description
[0043] Figure 1 This is a schematic diagram of the structure of a rotary detection device;
[0044] Figure 2 This is a flowchart of a rotation detection method;
[0045] Figure 3 This is a schematic diagram of a rotary detection system.
[0046] Icons: 1. Light source; 2. Fixture platform; 3. Lens; 4. Receiving device. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0048] like Figure 1 As shown in the embodiment of this application, a rotation detection device is proposed, including: a light source 1, a fixture stage 2, a lens 3, and a light receiving device 4 arranged in sequence. The fixture stage 2 includes a base, a fixture disposed on the base, and a motor. The output shaft of the motor is connected to the fixture. The light emission outlet of the light source 1 faces the lens 3. The light source 1, the light receiving device 4, and the motor are electrically connected to the controller.
[0049] Specifically, the fixture stage 2 adopts a modular design, comprising three core components: a base, a fixture, and a motor. The base serves as a rigid support platform to ensure system stability; the fixture uses adjustable grippers to achieve precise positioning of shaft parts of different specifications; and the motor is a servo motor, which is directly connected to the fixture via its output shaft, enabling precise rotation of the workpiece from 0 to 360°. The light source 1 uses a parallel light emitter, with its light outlet coaxially aligned with the optical axis of the lens 3. This layout eliminates stray light interference and ensures high-quality shadow imaging.
[0050] Its working principle is based on optical projection measurement. When the motor drives the measured shaft to rotate, the parallel beam emitted by the light source 1 forms a continuously changing contour shadow on the surface of the workpiece. The lens 3 transmits the shadow image captured in real time to the light receiving device 4 (such as a CMOS image sensor), and the contour feature extraction and three-dimensional reconstruction are completed by the image processing algorithm integrated by the controller. In particular, the controller synchronously coordinates the flicker of the light source 1, the motor speed and the image acquisition timing through multi-channel electrical connections to realize closed-loop control of the dynamic detection process.
[0051] like Figure 2 As shown, based on the above-mentioned slewing detection device, this application proposes a slewing detection method, including:
[0052] S101, in response to the start signal, the light source 1 and the light receiving device 4 are started. The light source 1 emits light to illuminate the workpiece to be tested on the fixture, and the light receiving device 4 acquires the shadow image of the workpiece to be tested through the lens 3.
[0053] Specifically, upon receiving an external start signal, the controller synchronously activates the light source 1 and the light receiving device 4. The collimated beam generated by the light source 1 (parallel light emitter) vertically illuminates the workpiece (such as a stepped shaft) fixed on the fixture. Due to the occlusion of the workpiece's three-dimensional contour, a projected shadow with a clear boundary is formed at the end of the light receiving device 4. The light receiving device 4 (such as a CMOS image sensor) captures the shadow image in real time through the optical lens 3. Its imaging principle is based on the geometric optical projection law:
[0054]
[0055] In the formula, H is the actual height of the workpiece, h is the image height, D is the distance between the workpiece and light source 1, and d is the distance between light source 1 and sensor. This coaxial optical path design eliminates stray light interference, ensuring sharp and clear contour edges.
[0056] Next, the shadow image is converted to grayscale, transforming it from a color image to a grayscale image; an adaptive thresholding method is then used to binarize the image. Specifically, the original shadow image is in RGB color format and needs to be converted to an 8-bit grayscale image. The conversion formula adopts the International Commission on Illumination (CIE) standard:
[0057] Gray=0.299R+0.587G+0.114B (2)
[0058] In the formula, Gray is the converted 8-bit grayscale value, R is the intensity value of the red channel in the original RGB image, G is the intensity value of the green channel in the original RGB image, and B is the intensity value of the blue channel in the original RGB image.
[0059] This weighting coefficient preserves the brightness features of the contour to the greatest extent, reducing the complexity of subsequent calculations. This eliminates color information interference, highlights the characteristics of light intensity distribution, and lays the foundation for binarization preprocessing. Adaptive threshold binarization is used, that is, image segmentation is performed using a local window adaptive thresholding method. The calculation formula is as follows:
[0060] T(x,y)=μ(x,y)-C·σ(x,y) (3)
[0061] In the formula, μ(x,y) is the mean gray value of all pixels in the local neighborhood window centered at pixel (x,y); σ(x,y) is the standard deviation of the pixel gray values in the neighborhood window; C is the empirical offset; and T(x,y) is the dynamic threshold at pixel (x,y), used to determine whether the point belongs to the foreground (target) or the background.
[0062] Since the binarized image contains quantization noise, a two-dimensional Gaussian kernel function is used for smoothing filtering.
[0063]
[0064] In the formula, G(x,y) is the kernel function value at coordinate (x,y), reflecting the weight of the pixel at that position in the filtering; σ is the standard deviation.
[0065] Specifically, a convolution kernel with σ = 1.5 pixels (such as a 5×5 template) is set, and isolated noise is eliminated through weighted averaging. This operation effectively suppresses salt-and-pepper noise caused by CMOS thermal noise while preserving sub-pixel-level edge accuracy (positioning error controlled within ±0.3 pixels). Its advantage lies in maintaining the first-order differential properties required for Canny edge detection, avoiding the generation of false edges during subsequent contour extraction.
[0066] S102, control the motor to rotate the workpiece to be tested, and at the same time continuously acquire shadow images of the workpiece to be tested at different angles through the light receiving device 4; record each shadow image and its corresponding rotation angle after the workpiece to be tested rotates one revolution, and save it as a set of image angles.
[0067] Specifically, upon receiving a start signal, the controller sends a command to the motor, driving it to rotate. The motor is directly connected to the fixture via its output shaft, enabling 0-360° rotation control of the workpiece under test. Simultaneously, a parallel beam of light emitted from light source 1 continuously illuminates the workpiece surface, forming a contour shadow that changes with the workpiece's rotation. The light receiving device 4 (such as a CMOS image sensor) uses a coaxial optical path design to capture shadow images at different rotation angles in real time, with each image strictly corresponding to the rotation angle recorded by the encoder. After the workpiece completes a full rotation cycle, the system organizes all acquired shadow images and their rotation angles into an image angle set, which is stored in the controller's storage medium. Each shadow image reflects the cross-sectional contour features of the workpiece at that viewpoint using the geometric optics projection law. This synchronous acquisition mechanism achieves microsecond-level synchronization of the light source 1's flicker, the motor speed, and the CMOS image sensor's exposure time through the controller's multi-channel electrical connection, ensuring that high-contrast shadow images without motion blur are acquired at every 0.1° rotation angle interval during dynamic detection, providing sub-pixel-level precision raw data for subsequent 3D point cloud reconstruction.
[0068] The beneficial effects of this step are that it enables automated inspection of the workpiece. Automated rotation and continuous image acquisition reduce manual intervention and increase inspection speed. Simultaneously, precise control of the motor's rotation and synchronous acquisition of shadow images ensure data accuracy and consistency, which is beneficial for improving the accuracy of subsequent 3D reconstruction. Furthermore, during one rotation of the workpiece, shadow images from various angles can be acquired, achieving comprehensive and thorough inspection of the workpiece.
[0069] S103, perform edge detection on each shadow image within the image angle set, extract the contour information of each shadow image; obtain the target contour on both sides of the contour information, obtain the two-dimensional coordinates of each position point on the target contour based on the image coordinate system; calculate the three-dimensional coordinates of each position point based on the two-dimensional coordinates and their corresponding rotation angles according to the preset spatial coordinate system, and obtain the contour point cloud data.
[0070] Specifically, edge detection and contour extraction are performed on each shadow image. An improved Canny edge detection algorithm is employed. This algorithm, through steps such as calculating image gradients, non-maximum suppression, and double threshold detection, can accurately identify the boundary pixels of objects in the image and form continuous and closed contour lines. This step is crucial for extracting contour information, providing the foundation for subsequent 3D coordinate calculations.
[0071] Next, the two-dimensional coordinates of each point on the contour are obtained. These coordinates are based on the image coordinate system; by traversing the contour line, the x-coordinate and y-coordinate of each point are recorded sequentially. These two-dimensional coordinates will be used for subsequent three-dimensional spatial coordinate calculations.
[0072] Then, based on the two-dimensional coordinates of each contour point and its corresponding rotation angle, the coordinates of each point in three-dimensional space are calculated. This step involves the transformation between the image coordinate system and the spatial coordinate system, as well as the consideration of the rotation angle. Using a preset spatial coordinate system, with the centroid as the origin, the two-dimensional coordinates are rotated and transformed in combination with the rotation angle, and the coordinates in the depth direction are calculated considering the vertical offset, finally obtaining the three-dimensional coordinates of each contour point.
[0073] The step of calculating the three-dimensional coordinates of each position point based on its two-dimensional coordinates and corresponding rotation angles specifically includes:
[0074] Assume the point on the shaded image is (x 2i ,y 2i ), where the rotation angle is θ and up is the vertical offset.
[0075] First, calculate the mean of all two-dimensional coordinates. Use the coordinates corresponding to the mean as the center of gravity of the workpiece to be measured, so that subsequent operations can be performed relative to this center. The specific formula for calculating the mean is as follows:
[0076]
[0077] Where, The mean of the x-coordinates. Let y be the mean of the y-coordinates, n be the number of coordinates, and i be the index of the coordinate.
[0078] For ease of calculation, radians are used. The calculation formula is as follows:
[0079] α=θ×π / 180 (7)
[0080] In the formula, α is radians and θ is the rotation angle.
[0081] Secondly, using decentralization, all location points are converted into a preset spatial coordinate system with the centroid as the origin. The original coordinate value of each location point is subtracted from the coordinate value of the centroid to obtain the correction coordinates of each location point; the specific calculation formula is as follows:
[0082]
[0083] Where x ′ The x-coordinate of the move to the origin with the "centroid" as the reference point is y. ′ The ordinate is the vertical coordinate of the object that moves to the origin, which is the "center of gravity".
[0084] Since there are no depth coordinates on the two-dimensional image at this time, we assume z ′ =1, to facilitate subsequent calculations.
[0085] Then, based on the rotation angle, correction coordinates, and vertical offset, the rotated coordinates and corresponding depth coordinates are calculated; specifically, this includes rotating the decentralized data points along the x-axis to obtain the rotated x-coordinates. The corresponding calculation formula is as follows:
[0086] x″=x′cos(α)+z′sin(α) (10)
[0087] In the formula, x″ is the x-coordinate after rotation.
[0088] In this embodiment, the rotation axis is parallel to the y-axis, so only the offset occurs in the y-axis direction. Subtract the vertical offset in the y-axis direction:
[0089] y″=y′-up (11)
[0090] In the formula, y″ is the rotated ordinate, and up is the vertical offset.
[0091] The z-axis coordinate is based on the change caused by the rotation angle, therefore it is calculated based on the rotation angle and the corresponding x-axis value after rotation:
[0092] z″=-x ′ sin(α)+z ′ cos(α) (12)
[0093] In the formula, z″ is the z-axis coordinate after rotation.
[0094] Then, by summing with the mean, the rotated coordinates are translated back to the original coordinate system to obtain the initial three-dimensional coordinates;
[0095]
[0096] z″′=z″ (15)
[0097] In the formula, z″′ is the restored x-coordinate, y″′ is the restored y-coordinate, and z″′ is the restored z-axis coordinate. It should be noted that z″′ and z″ are not added back to the center point coordinates like x and y, because they are already complete 3D rotation results.
[0098] Finally, all initial 3D coordinates are normalized to obtain the final 3D coordinates.
[0099]
[0100] In the formula, (x 3i ,y 3i ,z 3i () represents the final three-dimensional coordinates, i.e., the final output result;
[0101] Combining formulas (5) to (18), the formula corresponding to the three-dimensional coordinates of each location point is:
[0102]
[0103] Where, x 2i Let y be the x-coordinate of a point on a two-dimensional image. 2i y is the ordinate of a point on the 2D image, n is the number of 2D coordinates, i is the index of the coordinate, α is the rotation angle in radians, offset is the image offset, width is the image width, height is the image height, up is the vertical offset, 2f is the target interval width, and -f is the final offset; x 3i y 3i z 3i These are the coordinate values in three directions on a three-dimensional coordinate system.
[0104] S104. The contour point cloud data from different perspectives are registered. The registered contour point cloud data are then globally stitched together using voxel grid filtering and bundle adjustment to obtain the detection model.
[0105] Specifically, the core of step S104 lies in achieving accurate fusion of multi-view contour point cloud data. This involves registering the contour point cloud data extracted from different rotation angles. This process starts with local geometric feature extraction, constructing feature descriptors describing surface geometric properties by calculating the normal vector and curvature information of each point in the point cloud. First, coarse registration is performed using fast point feature histogram descriptors and 3D shape context descriptors for feature matching. These descriptors effectively characterize the shape distribution characteristics of local areas in the point cloud. To improve matching reliability, a random sampling consensus algorithm or a four-point coplanar set registration algorithm is used to select matching point pairs with consistent spatial distribution, eliminating erroneous matches caused by noise or similar geometric features. Based on the selected reliable matching point pairs, principal component analysis is used to establish initial coordinate system transformation relationships, generating initial pose transformation matrices between point clouds.
[0106] Furthermore, accurate registration is achieved through iterative optimization: based on the initial transformation matrix, an iterative nearest-point search algorithm is executed to establish spatial correspondence, and the least squares method is used to minimize the Euclidean distance between corresponding points; simultaneously, a normal vector constraint is introduced to improve surface matching accuracy by minimizing the projection distance from the point to the tangent plane. To handle complex surface features, a local surface covariance matrix is established for weighted registration, giving higher weights to points in areas with significant curvature changes, thereby better preserving the feature structure.
[0107] The registered point cloud data needs to be globally stitched together. First, voxel mesh filtering is used for data normalization: the 3D space is divided into a uniform voxel mesh, each voxel retains a single representative point, and the statistical properties of the point cloud distribution within that mesh are assigned, significantly reducing the data volume while maintaining the original geometric features. Based on this, global optimization is performed using bundle adjustment: a constraint network is established between all point cloud viewpoints, and the pose parameters and 3D point coordinates of all viewpoints are simultaneously optimized with the goal of minimizing reprojection error. This method effectively eliminates global deformation caused by the accumulation of local registration errors, ensuring the geometric consistency of the final 3D model.
[0108] Specific implementation example: Taking the inspection of stepped shaft workpieces as an example, the contour point cloud extracted in the shoulder transition area has high curvature characteristics. The 3D shape context descriptor can accurately match the shoulder contour points from adjacent viewpoints. When the workpiece rotates to a 180° viewpoint, the keyway point cloud at the shaft end and the 0° viewpoint data establish a correspondence through a random sampling consistency algorithm. The initial transformation matrix aligns the keyway centerline. In the global stitching stage, voxel mesh filtering reduces the point cloud density of the 80mm diameter shaft segment from 50 points per square millimeter to 10 points, significantly improving computational efficiency without affecting cylindricity characterization. Bundle adjustment corrects the axial cumulative deviation caused by motor rotation error, keeping the straightness reconstruction error of the 300mm long workpiece within the sub-millimeter level.
[0109] S105 calculates the point-by-point Euclidean distance between the detection model and the preset standard model, and outputs the regional deviation and root mean square error.
[0110] Specifically, calculating the point-to-point Euclidean distance between the inspection model and the preset standard model is a crucial step in evaluating the dimensional accuracy and deviation of the workpiece. This step quantifies the errors in the workpiece during processing by comparing the spatial distance between the inspection model (i.e., the digital representation of the actual workpiece) and the preset standard model (i.e., the theoretical ideal workpiece model).
[0111] First, the basic principle of point-by-point Euclidean distance calculation is to compare each point in the detection model with its corresponding point in a preset standard model, and evaluate the deviation by calculating the straight-line distance (i.e., Euclidean distance) between the two points. This process involves precise alignment of the two models to ensure that each detection point can be accurately compared with its corresponding standard point.
[0112] In practice, the system extracts all contour point cloud data from the detection model and pairs this data with corresponding points in a preset standard model one by one. During the pairing process, the system utilizes the point cloud registration and stitching results calculated in previous steps to ensure correct alignment of the two models in space. Once the point pairs are paired, the system calculates the Euclidean distance between each pair of points. These distance values directly reflect the difference between the actual and ideal dimensions of the workpiece and are a direct indicator for evaluating the workpiece's machining accuracy. After calculating the Euclidean distances for all points, the system performs statistical analysis on these distance values to output the area deviation and root mean square error (RMSE). Area deviation represents the average degree of deviation between different areas of the workpiece and the standard model, helping to identify potential local dimensional problems on the workpiece. The root mean square error provides an overall quantitative indicator of error, reflecting the level of deviation between the overall dimensions of the workpiece and the standard model.
[0113] Based on the same inventive concept, such as Figure 3 As shown in the figure, this application provides a slewing detection system, including:
[0114] Image acquisition module 201 is used to activate the light source 1 and the light receiving device 4. The light source 1 emits light to illuminate the workpiece to be tested on the fixture, and the light receiving device 4 acquires the shadow image of the workpiece to be tested through the lens 3.
[0115] The rotating image acquisition module 202 is used to control the motor to rotate the workpiece to be tested, and at the same time continuously acquire shadow images of the workpiece to be tested at different angles through the light receiving device 4; record each shadow image and its corresponding rotation angle after the workpiece to be tested rotates one revolution, and save it as an image angle set;
[0116] The coordinate calculation module 203 is used to perform edge detection on each shadow image within the image angle set, extract the contour information of each shadow image; obtain the target contour on both sides of the contour information, obtain the two-dimensional coordinates of each position point on the target contour based on the image coordinate system; and calculate the three-dimensional coordinates of each position point based on the two-dimensional coordinates and their corresponding rotation angles according to the preset spatial coordinate system to obtain contour point cloud data.
[0117] The registration module 204 is used to register contour point cloud data from different perspectives, and then globally stitch the registered contour point cloud data through voxel grid filtering and bundle adjustment to obtain the detection model.
[0118] The output module 205 is used to calculate the point-by-point Euclidean distance between the detection model and the preset standard model, and output the regional deviation and root mean square error.
[0119] Based on the same inventive concept, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a rotation detection method.
[0120] The above are merely preferred embodiments of the present application and are not intended to limit the present application. Those skilled in the art will readily appreciate that various modifications and variations are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A rotary detection device, characterized in that, include: A light source, a fixture, a lens, and a light receiving device are arranged sequentially. The fixture includes a base, a clamp mounted on the base, and a motor. The output shaft of the motor is connected to the clamp. The light emission outlet of the light source faces the lens. The light source, the light receiving device, and the motor are all electrically connected to a controller.
2. A method for detecting rotation, characterized in that, Applied to a rotary detection device as described in claim 1, the method includes: In response to a start signal, the light source and the light receiving device are activated. The light source emits light to illuminate the workpiece to be tested on the fixture, and the light receiving device acquires a shadow image of the workpiece to be tested through the lens. The motor is controlled to rotate the workpiece under test, and the shadow images of the workpiece under test at different angles are continuously acquired through the light receiving device; each shadow image and its corresponding rotation angle after the workpiece under test has rotated one revolution are recorded and saved as a set of image angles; Edge detection is performed on each shadow image within the image angle set to extract the contour information of each shadow image; the target contours on both sides of the contour information are obtained, and the two-dimensional coordinates of each position point on the target contour are obtained based on the image coordinate system; the three-dimensional coordinates of each position point are calculated based on the two-dimensional coordinates and their corresponding rotation angles according to the preset spatial coordinate system to obtain contour point cloud data. The contour point cloud data from different perspectives are registered, and the registered contour point cloud data are globally stitched together through voxel grid filtering and bundle adjustment to obtain the detection model. Calculate the point-by-point Euclidean distance between the detection model and the preset standard model, and output the regional deviation and root mean square error.
3. The rotation detection method according to claim 2, characterized in that, After the light receiving device acquires the shadow image of the workpiece under test through the lens, it further includes: The shadow image is converted to grayscale from a color image; an adaptive thresholding method is used to binarize the image.
4. The rotation detection method according to claim 3, characterized in that, Following the binarization operation, the following steps are also included: A Gaussian filter is used to smooth the binarized image.
5. The rotation detection method according to claim 2, characterized in that, The steps for extracting the contour information of each shadow image specifically include: An improved Canny edge detection algorithm is used to extract edges from each shadow image. Through multi-scale gradient calculation and non-maximum suppression, the boundary pixels of objects in each shadow image are identified and a continuous and closed contour line is formed.
6. The rotation detection method according to claim 2, characterized in that, The steps for calculating the three-dimensional coordinates of each position point based on the two-dimensional coordinates and their corresponding rotation angles specifically include: Calculate the mean of all the two-dimensional coordinates, and use the coordinates corresponding to the mean as the centroid of the workpiece to be measured; Convert all position points into a preset spatial coordinate system with the center of gravity as the origin, and subtract the coordinate value of the center of gravity from the original coordinate value of each position point to obtain the correction coordinates of each position point; Calculate the rotation coordinates and corresponding depth coordinates after rotation based on the rotation angle, correction coordinates, and vertical offset. The initial three-dimensional coordinates are obtained by summing the rotation coordinates with the mean and translating them back to the original coordinate system. The initial three-dimensional coordinates are normalized to obtain the final three-dimensional coordinates.
7. The rotation detection method according to claim 6, characterized in that, The formula for calculating the three-dimensional coordinates of each location point is: Among them, c 2i Let y be the x-coordinate of a point on a two-dimensional image. 2i y is the ordinate of a point on the 2D image, n is the number of 2D coordinates, i is the index of the coordinate, α is the rotation angle in radians, offset is the image offset, width is the image width, height is the image height, up is the vertical offset, 2f is the target interval width, and -f is the final offset; x 3i y 3i z 3i These are the coordinate values in three directions on a three-dimensional coordinate system.
8. The rotation detection method according to claim 2, characterized in that, The step of registering contour point cloud data from different perspectives specifically includes: Extract local geometric features from contour point cloud data, including normal vectors and curvature information; perform feature matching based on fast point feature histogram descriptors or 3D shape context descriptors; screen reliable matching point pairs using random sampling consensus algorithm or four-point coplanar set registration algorithm; generate an initial transformation matrix based on principal component analysis coordinate system transformation; Based on the initial transformation matrix, spatial correspondence is established through iterative nearest point search; the Euclidean distance between corresponding points is minimized using the least squares method; normal vector constraints are introduced to minimize the projection distance from the point to the tangent plane; a local surface covariance matrix is established for weighted registration; the contour point cloud data is divided into voxel grids, and a local Gaussian distribution model is fitted to calculate the Euclidean distance and the minimum transformation parameters.
9. A slewing detection system, characterized in that, Applied to a rotary detection device as described in claim 1, the system comprises: The image acquisition module is used to activate the light source and the light receiving device. The light source emits light to illuminate the workpiece to be tested on the fixture, and the light receiving device acquires the shadow image of the workpiece to be tested through the lens. The rotating image acquisition module is used to control the motor to rotate the workpiece under test, and at the same time continuously acquire shadow images of the workpiece under test at different angles through the light receiving device; record each shadow image and its corresponding rotation angle after the workpiece under test has rotated one revolution, and save it as an image angle set; The coordinate calculation module is used to perform edge detection on each shadow image within the image angle set, extract the contour information of each shadow image, obtain the target contour on both sides of the contour information, obtain the two-dimensional coordinates of each position point on the target contour based on the image coordinate system, and calculate the three-dimensional coordinates of each position point based on the two-dimensional coordinates and their corresponding rotation angles according to the preset spatial coordinate system to obtain contour point cloud data. The registration module is used to register contour point cloud data from different perspectives. The registered contour point cloud data is then globally stitched together using voxel grid filtering and bundle adjustment to obtain the detection model. The output module is used to calculate the point-by-point Euclidean distance between the detection model and the preset standard model, and output the regional deviation and root mean square error.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements a rotation detection method as described in any one of claims 2 to 8.
Citation Information
Patent Citations
Crack detection method fusing three-dimensional point cloud and two-dimensional image
CN115861274A
Cited By
Mechanical arm-based cycloid cyclone separation machining workpiece alignment method
CN121104725A
