Casting workpiece three-coordinate structured light rapid measurement system
The dynamic calibration and multi-angle point cloud registration with intelligent error compensation in structure light measurement systems address the challenges of environmental interference and surface complexity, achieving high-precision three-dimensional modeling of cast parts.
Patent Information
- Application Number
- CN202510804143.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2045-06-17
AI Technical Summary
In the detection of cast workpieces, existing structural light measurement systems have problems such as surface roughness, reflection or shadowing, image quality reduction, large feature matching errors during multi-region measurements, and environmental factors affect measurement consistency, and lack of optimized design for the characteristics of cast workpieces.
Through dynamic calibration, multi-view accurate registration and intelligent error compensation, the Gray code and phase shift composite code pattern are used, combined with environmental sensor data, and high-precision three-dimensional digital measurement of cast workpieces is realized.
It realizes high-precision digital measurement of the entire surface of cast workpieces, with measurement accuracy reaching micron level, adapting to complex environments, improving detection efficiency and stability, and generating a smooth and continuous three-dimensional digital model.
Smart Images

Figure CN120313486A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial automation measurement technology, and particularly to a three-coordinate structured light rapid measurement system for cast workpiece. Background Art
[0002] In industrial manufacturing, the geometric accuracy of cast workpieces directly affects the quality of finished products, and their three-dimensional inspection is a key link. Traditional contact measurement is difficult to meet the requirements of modern production due to low efficiency, easy damage to workpieces, and blind spots in the detection of complex curved surfaces. Although structured light measurement has advantages such as non-contact and high precision, it faces three major challenges when used for cast workpieces: The surface of the cast workpiece is rough, reflective or has shadows, resulting in a decrease in the quality of the structured light stripe image and an increase in decoding errors; Large workpieces require multi-region measurement, and traditional stitching algorithms are prone to global accuracy loss due to feature matching errors or environmental interference; Environmental factors such as temperature, humidity, and vibration will cause coordinate system conversion errors and equipment stability fluctuations, affecting measurement consistency.
[0003] Existing structured light measurement systems lack optimized designs for the characteristics of cast workpieces, such as insufficient dynamic environment compensation mechanisms, weak multi-modal data fusion capabilities, and limited complex curved surface reconstruction accuracy. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a three-coordinate structured light rapid measurement system for cast workpieces, which realizes high-precision digitization of the entire surface of the cast workpiece through dynamic calibration, multi-view precise registration, and intelligent error compensation.
[0005] To solve the above technical problem, the technical solution of the present invention is as follows: In the first aspect, a three-coordinate structured light rapid measurement system for cast workpieces includes: A calibration parameter module for calibrating a standard ball, establishing an initial conversion relationship between the structured light coordinate system and the world coordinate system of the three-coordinate measuring machine, and collecting temperature, humidity, and vibration data in real time to dynamically update the conversion relationship to form calibration parameters; A measurement path planning module for dividing the cast workpiece into multiple measurement regions based on the calibration parameters, planning the movement path of the three-coordinate measuring machine, and driving the moving platform to move to each measurement position; A local point cloud generation module for projecting a Gray code and phase-shift composite coding pattern onto the surface of the workpiece, collecting the deformed stripe image modulated by the surface topography of the workpiece, and generating local point cloud data for the corresponding measurement region by calculating the three-dimensional coordinates of each pixel point; A compensation module is used to preprocess the local point cloud data and convert the preprocessed local point cloud data from the structured light coordinate system to the world coordinate system; combining the clamping vibration data collected in real time, dynamically compensate the converted point cloud for errors to generate the point cloud after error compensation. A point cloud registration module is used to extract curvature feature points and planar geometric features in the overlapping area of adjacent point clouds after error compensation, screen matching point pairs and calculate the rough registration parameters; combining the point-to-plane distance constraint, complete the registration of multi-view point clouds to obtain the registered multi-region point cloud data. A three-dimensional model analysis module is used to reconstruct the surface of the multi-region point cloud data, fuse the data in the overlapping area to generate a complete three-dimensional digital model of the cast workpiece, and output the size error and surface topography analysis results of the three-dimensional digital model.
[0006] Furthermore, calibrate the standard sphere, establish the initial conversion relationship between the structured light coordinate system and the world coordinate system of the coordinate measuring machine, and collect temperature, humidity and vibration data in real time, and dynamically update the conversion relationship to form calibration parameters, including: Fix the standard sphere on the workbench of the coordinate measuring machine, control the probe to move to multiple different poses, project the Gray code and phase-shift composite coding patterns onto the surface of the standard sphere in turn through the projector, and the industrial camera synchronously collects the deformed fringe images modulated by the surface topography of the standard sphere. Solve the wrapped phase diagram in the deformed fringe image by the phase-shift method, and generate the absolute phase value in combination with the Gray code decoding result. Based on the absolute phase value, combined with the calibration parameters of the projector and the camera, solve the three-dimensional coordinates of each pixel point on the surface of the standard sphere, and generate the point cloud data of the standard sphere in the structured light coordinate system. For the point cloud data of the standard sphere in the structured light coordinate system, use the least squares method to fit the coordinates of the center of the sphere in the structured light coordinate system, and measure the coordinates of the center of the standard sphere in the world coordinate system by the probe of the coordinate measuring machine to establish the initial rotation matrix and translation vector. Collect the temperature and humidity data in real time through the environmental compensation sensor and the probe vibration data collected by the six-axis force sensor, combine the real-time position feedback of the motion platform of the coordinate measuring machine, and use the Kalman filter algorithm to dynamically correct the initial rotation matrix and translation vector to generate the updated calibration parameters.
[0007] Furthermore, based on the calibration parameters, divide the cast workpiece into multiple measurement areas and plan the motion path of the coordinate measuring machine to drive the motion platform to move to each measurement position, including: Based on the dynamic calibration parameters, convert the three-dimensional design model of the cast workpiece from the world coordinate system to the structured light coordinate system, identify the feature areas where the surface curvature change rate of the workpiece exceeds the preset threshold through the curvature calculation algorithm, and extract the planar geometric feature areas through the plane fitting algorithm. According to the curvature feature regions and planar feature regions, the surface of the workpiece is divided into multiple measurement regions, and the overlap rate of adjacent measurement regions is ≥ 20%; Based on the position and size of the measurement regions, combined with the structural light incident angle constraint and the camera field of view range, avoid the measurement blind spots caused by occlusion or reflection, and based on the mechanical parameters and motion constraints of each moving axis of the coordinate measuring machine, generate the continuous moving path and pose parameters of the probe through an interpolation algorithm; According to the pose parameters, control the moving platform of the coordinate measuring machine to move to each measurement position.
[0008] Furthermore, based on the dynamic calibration parameters, convert the three-dimensional design model of the casting workpiece from the world coordinate system to the structural light coordinate system, identify the feature regions where the curvature change rate of the workpiece surface exceeds the preset threshold through a curvature calculation algorithm, and extract the planar geometric feature regions through a plane fitting algorithm, including: Based on the dynamic calibration parameters, convert the three-dimensional design model of the casting workpiece from the world coordinate system to the structural light coordinate system, and generate the three-dimensional model data in the structural light coordinate system; For the three-dimensional model data, calculate the velocity vector and acceleration vector at each position point by point to obtain the curvature numerator term, and calculate the curvature value in combination with the modulus of the velocity vector; Compare the curvature value with the preset threshold. If the curvature change rate exceeds the threshold, mark it as a high-curvature feature region; for the regions not marked as high-curvature feature regions, perform surface fitting through a plane fitting algorithm and calculate the residual value of each point to the fitting plane; Calculate the normal vector direction and planar geometric parameters of the region where the residual value of each point to the fitting plane is less than the preset tolerance, and mark the region where the residual value is less than the preset tolerance as the planar geometric feature region.
[0009] Furthermore, project the Gray code and phase-shift composite coding pattern onto the surface of the workpiece, collect the deformed fringe images modulated by the surface topography of the workpiece, and generate the local point cloud data of the corresponding measurement region by solving the three-dimensional coordinates of each pixel point, including: For each measurement position, project the Gray code and phase-shift composite coding pattern onto the surface of the workpiece through a projector, where the Gray code is used for absolute phase coding and the phase-shift fringes are used for wrapped phase coding; collect the deformed fringe images modulated by the surface topography of the workpiece through an industrial camera and store them as a time-sequence image sequence; For the phase-shift fringes in the time-sequence image sequence, use the four-step phase-shift method to solve the wrapped phase map, and determine the integer period part of the absolute phase value based on the Gray code fringe order to generate a continuously distributed absolute phase value; Based on the projector calibration matrix and camera internal parameters in the dynamic calibration parameters, map the continuously distributed absolute phase value to the three-dimensional coordinates in the structural light coordinate system to generate the local point cloud data of the current measurement region.
[0010] Furthermore, preprocess the local point cloud data and transform the preprocessed local point cloud data from the structured light coordinate system to the world coordinate system; combine the clamping vibration data collected in real time to perform dynamic error compensation on the transformed point cloud and generate the point cloud after error compensation, including: Preprocess the local point cloud data and use the moving least squares method to smooth the surface fluctuations, and output the preprocessed point cloud; Based on the rotation matrix and translation vector in the dynamic calibration parameters, transform the preprocessed point cloud from the structured light coordinate system to the world coordinate system of the coordinate measuring machine to generate the transformed point cloud; Combine the probe clamping vibration data collected by the six-axis force sensor in real time to filter the vibration noise of the transformed point cloud, and compensate the point cloud deformation error caused by thermal expansion based on the temperature and humidity data of the environmental compensation sensor, and output the point cloud after error compensation.
[0011] Furthermore, in the overlapping area of adjacent point clouds after error compensation, extract the curvature feature points and plane geometric features, screen the matching point pairs and calculate the rough registration parameters; combine the point-to-plane distance constraint to complete the registration of multi-viewpoint clouds and obtain the registered multi-region point cloud data, including: For the point cloud after error compensation, in the overlapping area of adjacent point clouds, calculate the curvature change rate point by point through the curvature calculation algorithm, and screen the local area where the curvature change rate exceeds the preset threshold as the curvature feature points; at the same time, perform plane fitting on the point cloud, extract the continuous plane area where the normal vector direction consistency meets the preset conditions, and record the normal vector and the boundary point set; Use the curvature feature points and plane boundary points as inputs, adopt the bidirectional nearest neighbor search algorithm to generate the initial matching point pairs, and based on the geometric position relationship and normal vector direction constraint of the initial matching point pairs, iteratively screen the matching point pairs that meet the consistency conditions through the random sample consensus algorithm; Based on the consistent matching point pairs, calculate the initial rotation matrix and translation vector between adjacent point clouds through singular value decomposition, and transform the current local point cloud to the coordinate system of the adjacent point cloud based on the rotation matrix and translation vector to generate the point cloud data after rough registration; Take the point cloud data after rough registration as the initial value, and use the improved iterative closest point algorithm to iteratively optimize the overlapping area point cloud, that is, match each point in the point cloud with the plane area of the adjacent point cloud, and terminate the optimization according to the change amount of the registration error between two adjacent iterations and the preset iteration number threshold, and finally output the registered multi-region point cloud data.
[0012] Further, taking the curvature feature points and the plane boundary points as inputs, a bidirectional nearest neighbor search algorithm is used to generate initial matching point pairs, and based on the geometric position relationship and normal vector direction constraint of the initial matching point pairs, a random sample consensus algorithm is used to iteratively screen the matching point pairs that meet the consistency conditions, including: Taking the curvature feature points and the plane boundary points as inputs, forward search and backward search are respectively performed on the feature points in adjacent point clouds to generate an initial set of matching point pairs; For each pair of matching points in the initial set of matching point pairs, the Euclidean distance deviation and the normal vector angle deviation of the plane region where they are located are calculated, and the outlier matching points that exceed the preset distance threshold or angle threshold are removed to obtain a set of valid matching point pairs; Based on the set of valid matching point pairs, multiple pairs of matching points are randomly selected, the corresponding rotation matrix and translation vector are calculated, the number of matching points that meet the geometric constraints is counted, and the final consistent matching point pairs are output.
[0013] Further, the multi-region point cloud data is subjected to surface reconstruction, and the data in the overlapping regions is fused to generate a complete three-dimensional digital model of the casting workpiece, and the dimensional error and surface topography analysis results of the three-dimensional digital model are output, including: For the registered multi-region point cloud data, with the point cloud of each measurement region as the center, the moving least squares method is used to fit the local surface piece by piece; by calculating the weighted least squares plane of the point set within the neighborhood of each point, the weight coefficient is dynamically adjusted to adapt to the local curvature change, and a smooth and continuous local surface model is generated; For the overlapping regions of adjacent local surface models, by calculating the curvature similarity of the overlapping point sets, the points with a curvature difference less than the preset threshold are screened, and the coordinates of the screened points are fused to generate a complete three-dimensional digital model; Taking the complete three-dimensional digital model as the input, starting from the initial triangular patches, each point in the point cloud data is gradually inserted, the connection relationship of the triangular patches is dynamically adjusted, and the feature edges are identified and the topological structure is locked through the boundary detection algorithm, and a surface triangular mesh model is output; The triangular mesh model is fitted and aligned with the design model, the distance from each point on the surface of the triangular mesh to the corresponding surface of the design model is calculated, and the dimensional error distribution data is generated; By calculating the local curvature of the triangular mesh model point by point and performing a difference analysis with the curvature of the design model, the surface topography deviation data is generated; The dimensional error distribution data is converted into error numerical statistical parameters in three-dimensional space, and the surface topography deviation data is converted into curvature difference statistical parameters; Based on the error numerical statistical parameters and the curvature difference statistical parameters, a quantitative analysis report including the error mean, standard deviation and the deviation coordinates of the feature positions is generated.
[0014] Second aspect: A computer-readable storage medium stores a program which, when executed by a processor, implements the described system.
[0015] The above solution of the present invention has at least the following beneficial effects: By calibrating with a standard sphere to establish a coordinate system conversion relationship, and dynamically updating calibration parameters by integrating temperature, humidity, and vibration data, environmental factors (such as thermal expansion and equipment vibration) and mechanical motion errors are effectively compensated. The measurement accuracy can reach the micron level, meeting the tolerance detection requirements of precision castings. Using technologies such as Kalman filtering to integrate multi-modal sensor data (structured light, environmental sensors, etc.), noise is suppressed and spatio-temporal synchronization is achieved, ensuring the stability of calibration parameters and avoiding measurement deviations caused by environmental fluctuations.
[0016] Based on the calibration parameters, the workpiece is divided into overlapping measurement areas (overlap rate ≥ 20%). Combining the incident angle of structured light, the camera field of view, and equipment motion constraints (such as high-precision positioning of servo motors), an optimal path without blind spots is generated, reducing ineffective movement and shortening the measurement time. Using the composite projection technology of Gray code and phase-shifted fringes, sub-pixel three-dimensional coordinates can be obtained in a single measurement. With the high-speed acquisition of industrial cameras, the measurement time for a single area only takes seconds, improving the detection efficiency of large and complex workpieces. By extracting curvature feature points and plane geometric features, and combining bidirectional nearest neighbor search, iterative screening of the random sample consensus algorithm, and point-to-plane distance constraints, mismatched point pairs are eliminated, achieving high-precision alignment of multi-view point clouds.
[0017] The point cloud is smoothed by moving least squares method and denoised by statistical filtering. Combining with real-time compensation of clamping vibration data, the quality of the point cloud is improved. Using surface reconstruction, curvature weighted fusion, and triangular mesh triangulation technologies, a smooth and continuous three-dimensional digital model is generated, accurately restoring the surface details of the workpiece (such as edges and surfaces). The whole process from calibration, measurement to analysis runs automatically, reducing manual intervention. Using industrial-grade hardware (such as high-stability projectors and anti-interference optical systems) and real-time control systems, the stability of long-term continuous operation is ensured, which is suitable for on-line detection in production lines. Description of the Drawings
[0018] Figure 1 It is a schematic diagram of a three-coordinate structured light rapid measurement system for a casting workpiece provided by an embodiment of the present invention. Detailed Embodiments
[0019] Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be completely conveyed to those skilled in the art.
[0020] As shown Figure 1 in the figure, an embodiment of the present invention proposes a three - coordinate structured - light rapid measurement system for a casting workpiece, including: A calibration parameter module, which is used to calibrate a standard sphere, establish an initial conversion relationship between the structured - light coordinate system and the world coordinate system of the coordinate measuring machine, and collect temperature, humidity and vibration data in real time, and dynamically update the conversion relationship to form calibration parameters; A measurement path planning module, which is used to divide the casting workpiece into multiple measurement areas based on the calibration parameters, plan the movement path of the coordinate measuring machine, and drive the moving platform to move to each measurement position; A local point cloud generation module, which is used to project a Gray - code and phase - shift composite coding pattern onto the workpiece surface, collect the deformed fringe images modulated by the workpiece surface topography, and generate local point cloud data for the corresponding measurement area by calculating the three - dimensional coordinates of each pixel point; A compensation module, which is used to pre - process the local point cloud data, and convert the pre - processed local point cloud data from the structured - light coordinate system to the world coordinate system; combined with the clamping vibration data collected in real time, dynamically compensate the errors of the converted point cloud to generate the error - compensated point cloud; A point cloud registration module, which is used to extract curvature feature points and plane geometric features in the overlapping area of adjacent error - compensated point clouds, screen matching point pairs and calculate the rough registration parameters; combined with the point - to - plane distance constraint, complete the registration of multi - view point clouds to obtain the registered multi - area point cloud data; A three - dimensional model analysis module, which is used to reconstruct the surface of the multi - area point cloud data, fuse the data in the overlapping area to generate a complete three - dimensional digital model of the casting workpiece, and output the size error and surface topography analysis results of the three - dimensional digital model.
[0021] In the embodiment of the present invention, an initial conversion relationship is constructed through the calibration of the standard sphere, and the parameters are dynamically updated by combining the temperature, humidity and vibration data collected in real time, so as to improve the long - term matching accuracy between the structured - light coordinate system and the three - coordinate world coordinate system, and reduce the coordinate deviation caused by environmental factors. Integrate the environmental compensation sensor data to realize the real - time perception and calibration of the equipment movement error and environmental fluctuation, and ensure the stability of the measurement system and the accuracy of coordinate conversion. Divide the workpiece into multiple regions based on the calibration parameters, and make differential planning for the feature regions and plane regions with large curvature changes to ensure the complete coverage and refined measurement of complex topographies. Combine the structured - light incident angle and the camera field - of - view range to plan the movement trajectory, avoid measurement blind spots and equipment collisions, drive the moving platform to accurately position to each measurement position, and improve the detection efficiency and path rationality.
[0022] Project the Gray code and phase-shift composite coding pattern, combine with the deformed fringe image of the workpiece surface to calculate the coordinates of each pixel point, effectively cope with the interference such as roughness and reflection on the surface of the casting workpiece, and generate high-density local point cloud data. Perform preprocessing such as denoising and smoothing on the point cloud data to improve the data quality; through coordinate system transformation and dynamic error compensation, combine the clamping vibration data to eliminate interference and ensure the accuracy of the point cloud coordinates. Extract curvature feature points and plane geometric features in the overlapping area, calculate the rough registration parameters through the matching point pairs, and complete the fine registration by combining the point-to-plane distance constraint to achieve high-precision alignment of multi-view point clouds.
[0023] In a preferred embodiment of the present invention, calibrate the standard ball, establish the initial conversion relationship between the structured light coordinate system and the world coordinate system of the coordinate measuring machine, and collect temperature, humidity and vibration data in real time, and dynamically update the conversion relationship to form calibration parameters, which may include: Fix the standard ball on the workbench of the coordinate measuring machine, control the probe to move to multiple different poses, project the Gray code and phase-shift composite coding pattern onto the surface of the standard ball in turn through the projector, and the industrial camera synchronously collects the deformed fringe image modulated by the surface topography of the standard ball; Solve the wrapped phase diagram in the deformed fringe image by the phase-shift method, and generate the absolute phase value in combination with the Gray code decoding result; Based on the absolute phase value, combine the calibration parameters of the projector and the camera to calculate the three-dimensional coordinates of each pixel point on the surface of the standard ball, and generate the point cloud data of the standard ball in the structured light coordinate system; For the point cloud data of the standard ball in the structured light coordinate system, use the least squares method to fit the coordinates of the center of the ball in the structured light coordinate system, and measure the coordinates of the center of the standard ball in the world coordinate system by the probe of the coordinate measuring machine to establish the initial rotation matrix and translation vector; Collect the temperature and humidity data in real time through the environmental compensation sensor and the probe vibration data collected by the six-axis force sensor, combine the real-time position feedback of the motion platform of the coordinate measuring machine, and use the Kalman filter algorithm to dynamically correct the initial rotation matrix and translation vector to generate the updated calibration parameters.
[0024] In the embodiment of the present invention, place the standard ball in the center of the workbench of the coordinate measuring machine, fix it with a magnetic fixture or a vacuum chuck to ensure no displacement during the measurement process. Control the probe (integrated projector and industrial camera) to move along the coordinate guide rail of the coordinate measuring machine, and reach 6-8 preset different poses in turn (such as the directions of ±X, ±Y, ±Z axes and the diagonal direction around the standard ball), and the distance between each pose and the surface of the standard ball is kept within the effective measurement range of the structured light (such as 300-500mm).
[0025] At each pose, the projector first projects an 8-bit Gray code pattern (a total of 8 images, each corresponding to 1-bit binary encoding, with the stripe width halved in turn). The industrial camera synchronously captures images at a speed of 20 frames per second, recording the Gray code stripe combination of each pixel point; subsequently, it projects a 4-step phase-shifted sine stripe pattern (phase offsets are 0, , π, ), and the camera captures 4 images again.
[0026] Wrapped phase calculation: For each pixel point in the 4 phase-shifted stripe images, extract its gray values in the 4 images (such as , , , ). When specifically calculating the wrapped phase value, subtract the gray value of the second image from the gray value of the fourth image to obtain a value that can reflect the sine waveform change; subtract the gray value of the first image from the gray value of the third image to obtain a value that can reflect the cosine waveform change. Then, based on the positive and negative and magnitude relationships of these two values, calculate the phase angle of this pixel point through the arctangent function, and this phase angle will be limited within the range of [-π, π]. Due to the periodicity of the sine stripe itself, the calculated phase angle will exhibit a "folding" phenomenon, resulting in a sudden change in the phase value of adjacent pixel points that may exceed π. For example, the phase value of a pixel point is 1.5π, and the phase value of an adjacent pixel point may be -1.5π. This is the "phase jump".
[0027] Gray code decoding: For the 8 Gray code images, the 8-bit binary encoding of each pixel point corresponds to a unique number of stripe periods (such as 0 - 255 periods). For example, the stripe width of the first Gray code image is of the entire field of view, the second is , and so on. Determine the absolute period to which each pixel belongs through the combination of stripe brightness changes.
[0028] Combine the wrapped phase value with the number of periods determined by the Gray code to calculate the absolute phase value (such as the wrapped phase is 1.5π and the Gray code period number is 5, then the absolute phase is 5×2π + 1.5π = 11.5π), eliminate the periodic ambiguity, and obtain a continuous phase distribution.
[0029] Calibrate the projector parameters in advance through a three-dimensional target (such as a checkerboard array) to determine the geometric relationship between the projector pixel coordinates (up, vp) and the projection light rays (such as the projection center coordinates, focal length, distortion coefficients). Using the Zhang Zhengyou calibration method, solve the internal parameters of the camera (focal length f, principal point (u0, v0), radial distortion , where is the first-order radial distortion coefficient, between -0.1 and 0.1; is the second-order radial distortion coefficient, which is between -0.01 and 0.01), and the external parameters (rotation matrix Rc, translation vector Tc), to ensure the mapping accuracy between pixel coordinates (x, y) and world coordinates. For the absolute phase value of each pixel point, determine its position in the fringes projected by the projector (e.g., fringe number n = ), combined with the pixel coordinates (x, y) of this point captured by the camera, using the relative pose (Rp, Tp) of the projector and the camera, calculate the three-dimensional coordinates of this point in the structured light coordinate system through geometric triangulation: For a certain structured light fringe projected by the projector, its direction in the projector coordinate system is known (e.g., along the positive X-axis direction), and this direction can be converted into a direction vector in the structured light coordinate system through Rp and Tp. For example, the light ray along the X-axis in the projector coordinate system, after rotation and translation, appears as an inclined ray in the structured light coordinate system. The light ray emitted by the projector can be regarded as a ray starting from its optical center (determined by Tp) and extending along a specific direction (determined by the fringe position and Rp). For example, if a pixel point corresponds to the nth fringe of the projector, this light ray starts from the projector optical center in the structured light coordinate system and extends obliquely upward. The pixel point captured by the industrial camera corresponds to a ray starting from the camera optical center (the Tp parameter of the camera) and passing through this pixel point. For example, if the camera optical center is located at the position (100, 100, 100) in the structured light coordinate system and a pixel point is located in the upper right corner of the image, then the camera light ray extends obliquely upward from this optical center. The two rays (the projection light ray and the camera light ray) should intersect at a point P on the surface of the standard sphere. In actual calculation, by adjusting the extension distances of the two rays, find the point closest to the intersection: First, estimate the approximate distance from the projector to the standard sphere (e.g., 300 mm) as the initial value of the projection light ray extension parameter g. At this time, the coordinates of the point on the projection light ray are: the position reached by advancing 300 mm along the light ray direction from the projector optical center; similarly, estimate the approximate distance from the camera to the standard sphere (e.g., 300 mm) as the initial value of the camera light ray extension parameter s. The coordinates of the point on the camera light ray are: the position reached by advancing 300 mm along the light ray direction from the camera optical center. At this time, the points on the two light rays may not intersect precisely, and there are spatial coordinate differences (e.g., 5 mm difference in the X direction, 3 mm difference in the Y direction, 4 mm difference in the Z direction).
[0030] Iteratively adjust the parameters: The first step of adjustment: First, fix the value of g, and gradually increase or decrease the value of s (e.g., adjust 1 mm each time), and observe the change in the coordinate differences of the points on the two light rays. For example, when s increases to 305 mm, the difference in the X direction shrinks to 2 mm, the difference in the Y direction shrinks to 1 mm, and the difference in the Z direction shrinks to 3 mm, indicating that the adjustment direction is correct.
[0031] The second step of adjustment: Fix the current s = 305 mm and then gradually adjust the value of g (for example, adjust by 1 mm each time). When g is reduced to 298 mm, the difference in the X direction is further reduced to 0.5 mm, the difference in the Y direction is 0.3 mm, and the difference in the Z direction is 1 mm.
[0032] Reduce the adjustment step size (for example, adjust by 0.1 mm each time) and continue to alternately adjust t and s. When g = 297.5 mm and s = 305.8 mm, the differences in the X / Y / Z directions are all less than 0.05 mm, and it is considered that the accuracy requirement is met.
[0033] When the coordinate differences in the X, Y, and Z directions are small enough (for example, all less than 0.01 mm), take the average value of the point coordinates on the projection light ray and the camera light ray at this time as the final coordinates of the intersection point P.
[0034] For each pair of corresponding pixel points of the projector and the camera (such as (up, vp) of the projector and (x, y) of the camera), a three-dimensional coordinate point is calculated through the above geometric intersection method, thereby forming a dense point set covering the surface of the standard sphere. Calculate the distance from each point to the center of the standard sphere. For example, the radius of the standard sphere is 50 mm. If the distance of a certain point from the center of the sphere is 50.2 mm or 49.8 mm and the deviation exceeds the preset threshold (such as 0.1 mm), then this point is considered an abnormal point caused by noise or reflection and is removed from the point cloud. By adjusting the resolution of the projector (such as 1920×1080 pixels) and the measurement distance (such as 300 mm), the density of the finally generated point cloud on the surface of the standard sphere reaches about 100 points / mm 2 For example, within a spherical area of 1 mm 2 there are about 100 three-dimensional coordinate points, ensuring that the fine undulations of the spherical surface can be accurately captured.
[0035] Spherical surface fitting: For the point cloud data in the structured light coordinate system, assume the spherical surface equation is (Xs Xsc) 2 +(Ys Ysc) 2 +(Zs Zsc) 2 =R 2 , and through the least squares method, iteratively adjust the coordinates (Xsc, Ysc, Zsc) of the center of the sphere obtained by spherical surface fitting in the structured light coordinate system and the standard sphere radius R obtained by spherical surface fitting to minimize the sum of the squares of the distances from all points to the spherical surface (iteration termination condition: the change amount of the center of the sphere coordinates between two adjacent times is less than 0.001 mm); where, (Xs, Ys, Zs) are the three-dimensional coordinates of any point on the surface of the standard sphere in the structured light coordinate system.
[0036] Three - coordinate measurement of the ball center: Switch to the contact probe of the coordinate measuring machine (such as a ruby probe), manually touch - measure points at 3 - 5 different positions on the surface of the standard ball. After the touch - measurement is completed, select the "Fit Ball Center" function in the measurement software, and the software will automatically calculate the ball - center position using the coordinates of the touched points that have been collected. The specific process is as follows: Based on the coordinate values of all touched points, the software finds the final ball - center position such that the distance from each touched point to the ball center is equal (i.e., minimizes the distance difference from each point to the ball center). After the calculation is completed, the software will display the coordinate values (Xwc, Ywc, Zwc) of the ball center in the three - coordinate world coordinate system.
[0037] Initial transformation parameters: Translation vector T: T = [Xwc - Xsc, Ywc - Ysc, Zwc - Zsc], which represents the offset of the origin of the structured - light coordinate system in the world coordinate system.
[0038] Rotation matrix R: Calculate the alignment relationship of the main axes between the structured - light coordinate system and the world coordinate system through singular - value decomposition (SVD), so that the distribution of the point cloud in the world coordinate system is aligned with the center of the standard ball (for example, the angle between the Z - axis of the structured - light coordinate system and the Z - axis of the world coordinate system is less than 0.1°).
[0039] Temperature and humidity sensor: Collect the ambient temperature and humidity in real - time, which is used to calculate the thermal expansion deformation of the three - coordinate guide rail and the probe (such as the thermal expansion coefficient of a steel - material guide rail, when the temperature changes by 5°C, the length change of a 1 - m guide rail is about 55μm).
[0040] Six - axis force sensor: Installed at the probe connection, it collects the accelerations of the X / Y / Z axes (resolution 0.01m / s 2 ) and the rotational angular velocity (resolution 0.001° / s) at a frequency of 100Hz, and monitors vibration interference (such as triggering compensation when the vibration amplitude during equipment operation is greater than 0.05mm / s 2 ).
[0041] The grating ruler of the three - coordinate guide rail provides real - time feedback of the current position, which is used to determine whether the probe is in a moving or stationary state (the error is larger during movement, and stronger filtering is required).
[0042] Kalman filter processing: The state vector of the Kalman filter is used to describe the coordinate - system transformation parameters, which includes 6 key parameters: Euler angles (α, β, γ) of the rotation matrix R: α (rotation angle around the X - axis), β (rotation angle around the Y - axis), γ (rotation angle around the Z - axis), which are used to represent the attitude of the structured - light coordinate system relative to the world coordinate system. For example: α = 0.5° means that the structured - light coordinate system rotates 0.5 degrees around the X - axis, resulting in the inclination of the projection light direction.
[0043] The three components of the translation vector T (Tx, Ty, Tz): Tx, Ty, and Tz respectively represent the offsets of the origin of the structured light coordinate system in the X, Y, and Z axis directions of the world coordinate system (unit: mm); for example: Tz = 3mm means that the structured light coordinate system is 3 millimeters higher than the world coordinate system in the Z axis direction.
[0044] State prediction process: Assume that the state vector at the previous moment is , and combine with the speed information of the moving platform of the coordinate measuring machine to predict the state at the current moment: If the probe is stationary: the speed is 0, and the predicted state is the same as the previous moment, that is .
[0045] If the probe is moving: According to the speed of the moving platform in the X / Y / Z axes (such as Vx = 5mm / s), calculate the change of the translation vector through integration (such as Vx×Δt, Δt is the time interval), and predict the new translation component ( ), and the rotation component remains unchanged temporarily (assuming the attitude remains unchanged during movement).
[0046] The temperature change ΔT will cause thermal expansion of the guide rail and probe of the coordinate measuring machine. For example, the thermal expansion coefficient b of the steel guide rail is 11× / ℃. When the length of the guide rail L = 1000mm and the temperature changes by 2℃, the length change ΔL = b×L×ΔT = 0.022mm, which will cause a change in the Z-axis component of the translation vector ΔTz = ΔL (assuming the guide rail is along the Z-axis direction).
[0047] The vibration acceleration collected by the six-axis force sensor (such as the acceleration in the Z-axis direction is 0.1m / s 2 ), calculate the vibration displacement ΔZ = 0.5×acceleration in the Z-axis direction×(Δt) 2 . Take the interference amount calculated by the sensor as the "measurement value", compare it with the predicted state vector, and obtain the difference (such as the Z-axis component Tz of the predicted translation vector T = 100mm, and the measurement value shows that Tz should be corrected to 100.0215mm, and the difference ΔTz = 0.0215mm).
[0048] Calculate the final correction amount according to the Kalman gain and update the state vector. For example: the original predicted Tz = 100 mm, the correction amount ΔTz = 0.021 mm, and after update, Tz = 100.021 mm; the Euler angles α, β, and γ are corrected similarly according to the attitude offset caused by vibration (such as 0.01°). After every 10 workpiece measurements, the Kalman filter calibration is automatically started to ensure regular parameter update regardless of whether the environment changes. When the environmental temperature change exceeds 2°C (such as the temperature fluctuation caused by the start and stop of the workshop air conditioner), the calibration is immediately triggered. For example: the initial temperature is 20°C, the current temperature is 22.1°C, and ΔT = 2.1°C is greater than 2°C, triggering the calibration; when the humidity change exceeds 10%RH (optional trigger condition), the calibration can also be triggered. After each calibration, the coordinate system transformation parameters (rotation matrix R and translation vector T) are updated in real time to ensure that the deviation between the structured light measurement data and the coordinate measuring machine system is always less than ±0.05 mm.
[0049] Through the measurement of the standard sphere at multiple poses, the full surface data is covered, the blind area of single-view measurement is avoided, and the global accuracy of the coordinate system transformation is ensured. The combination of Gray code and phase-shift coding eliminates the periodic error of phase resolution and adapts to the complex fringe deformation of the standard sphere surface. The environmental data such as temperature, humidity, and vibration are collected in real time, and the coordinate system transformation parameters are dynamically corrected through the Kalman filter to offset the influence of workshop environmental fluctuations (such as temperature changes and equipment vibrations) on the measurement accuracy and ensure long-term measurement stability. Based on the geometric characteristics of the standard sphere (spherical fitting), the initial transformation relationship is established, and the accurate contact measurement results are used as the benchmark to ensure the coordinate alignment accuracy between the structured light and the coordinate measuring machine system. Through the automatic acquisition of sensor data and the real-time processing of algorithms, the manual intervention is reduced, the calibration efficiency is improved, and at the same time, the errors introduced by human operations are avoided.
[0050] In a preferred embodiment of the present invention, based on the calibration parameters, the cast workpiece is divided into multiple measurement areas, and the movement path of the coordinate measuring machine is planned to drive the moving platform to move to each measurement position, which may include: Based on the dynamic calibration parameters, the three-dimensional design model of the cast workpiece is transformed from the world coordinate system to the structured light coordinate system. The characteristic areas where the surface curvature change rate of the workpiece exceeds the preset threshold are identified through the curvature calculation algorithm, and the planar geometric feature areas are extracted through the plane fitting algorithm, specifically including: Based on the dynamic calibration parameters, the three-dimensional design model of the cast workpiece is transformed from the world coordinate system to the structured light coordinate system to generate the three-dimensional model data in the structured light coordinate system; For the three-dimensional model data, the velocity vector and acceleration vector at each position are calculated point by point to obtain the curvature numerator term, and the curvature value is calculated in combination with the modulus of the velocity vector; Compare the curvature value with a preset threshold. If the curvature change rate exceeds the threshold, mark it as a high-curvature feature area; for areas not marked as high-curvature feature areas, perform surface fitting through a plane fitting algorithm and calculate the residual values of each point to the fitting plane. Calculate the normal vector direction and plane geometric parameters of the area where the residual value of each point to the fitting plane is less than the preset tolerance, and mark the area where the residual value is less than the preset tolerance as a plane geometric feature area. According to the curvature feature area and the plane feature area, divide the workpiece surface into multiple measurement areas, and the overlap rate of adjacent measurement areas is ≥ 20%. According to the position and size of the measurement area, combined with the structural light incident angle constraint and the camera field of view range, avoid measurement blind spots caused by occlusion or reflection, and based on the mechanical parameters and motion constraints of each moving axis of the coordinate measuring machine, generate the continuous moving path and pose parameters of the probe through an interpolation algorithm. According to the pose parameters, control the moving platform of the coordinate measuring machine to move to each measurement position.
[0051] In the embodiment of the present invention, for each vertex in the 3D design model, add the X component of the translation vector to the X coordinate in the world coordinate system, add the Y component of the translation vector to the Y coordinate, and add the Z component of the translation vector to the Z coordinate. For example, the original vertex coordinate is (10, 20, 30), and the translation vector is (5, 3, 2), then the translated coordinate becomes (10 + 5, 20 3, 30 + 2). Rotate the translated vertex coordinates around the X-axis, Y-axis, and Z-axis in sequence. For example, when rotating around the X-axis, keep the X coordinate unchanged and adjust the Y and Z coordinates according to the rotation angle (if the rotation angle is positive, the Y coordinate decreases and the Z coordinate increases; if it is negative, it is the opposite). Similarly, rotate around the Y-axis and Z-axis, and each rotation is based on the coordinate values after the previous rotation.
[0052] Curvature calculation: For a certain point on the model surface, analyze its positional relationship with adjacent points. For example, if this point offsets more to the right than adjacent points in the X direction, the component of the velocity vector on the X-axis is larger; if it offsets upward in the Y direction, the component on the Y-axis is positive. The velocity magnitude is obtained by dividing the distance between the point and the adjacent point by the sampling time interval (assuming the time interval is fixed). Compare the change of the velocity vector of this point at different times. For example, if the component of the velocity vector on the X-axis at the current moment increases compared to the previous moment, the component of the acceleration vector on the X-axis is positive. The acceleration magnitude is obtained by dividing the velocity change amount by the time interval. Take the degree of direction difference between the acceleration vector and the velocity vector as the numerator term of the curvature. For example, if the acceleration direction is perpendicular to the velocity direction, the numerator term is larger; if the directions are the same, the numerator term is zero. The magnitude of the velocity vector is the velocity magnitude, and divide the numerator term by the velocity magnitude to obtain the curvature value.
[0053] Determine a critical value of curvature change according to the design requirements of the workpiece. For example, for a workpiece with a relatively smooth surface, the threshold can be set to 0.05; for a workpiece with complex curved surfaces, the threshold can be appropriately increased to 0.1.
[0054] For each point on the model surface, calculate the curvature difference between it and its adjacent points, and divide by the distance between the two points. If the curvature change rate of the points in a certain area exceeds the preset threshold, then mark this area as a high-curvature feature area. For example, if the threshold is 0.01 / mm and the curvature change rate of most points in a certain area is above 0.03 / mm, then this area is marked.
[0055] Extraction of planar geometric feature areas: For the areas not marked as high-curvature features, use the plane fitting algorithm to process. First, assume a plane equation, generally in the form of Ax + By + Cz + D = 0, where (A, B, C) represents the normal vector of the plane, (x, y, z) are the coordinates of the points on the plane, and D is a constant. For each point Q(x0, y0, z0) in this area, substitute its coordinates into the plane equation and calculate to obtain the residual value of point Q to the assumed plane, which represents the perpendicular distance from point Q to the plane. If the residuals of all points in a certain area are less than the preset tolerance (such as 0.1mm), then this area is determined to be a planar geometric feature area. At the same time, determine the direction of its normal vector through the equation of the fitted plane. Since (A, B, C) in the plane equation Ax + By + Cz + D = 0 is the normal vector of the plane, the direction of the normal vector can be directly obtained.
[0056] For the high-curvature feature areas, expand a certain distance (such as 5mm) outside their boundaries to form a measurement area. For example, if the boundary of the original high-curvature area is a circle with a radius of 10mm, then the boundary of the expanded measurement area is a circle with a radius of 15mm. Divide the large-area planar region into multiple small regions, and the size of each small region is determined according to the camera field of view. For example, if the camera field of view is 20mm×20mm, then divide the plane into square regions with a side length of 15mm to ensure that adjacent regions overlap. The boundaries of adjacent measurement areas overlap with each other, and the width of the overlapping part is at least 20% of the width of the region. For example, if the width of a region is 10mm, then the overlapping part with the adjacent region is at least 2mm.
[0057] Calculate the angle at which the structured light is projected onto each measurement area to ensure that the light is perpendicular to the surface of the area and unobstructed. For example, for a vertical wall surface, the light should be projected horizontally; for an inclined surface, the direction of the light needs to be adjusted to a specific angle (such as 30°) with the surface normal vector. For areas that exceed the single field of view of the camera, divide them into multiple sub-areas and plan the position and angle of the camera so that each sub-area can be completely photographed. For example, for a long strip area, the camera needs to move along its length multiple times for shooting. Consider features such as protrusions and grooves on the workpiece surface and avoid obstacles when planning the movement path of the probe. For example, if there is a protrusion with a height of 10 mm, the probe needs to be raised by 15 mm before moving to this area and then move horizontally over the protrusion. Optimize the speed changes in the path according to the maximum speed and acceleration of each axis of the coordinate measuring machine. For example, use the maximum speed during long-distance linear movement and appropriately decelerate at turns to ensure smooth movement and not exceed the equipment capabilities.
[0058] Convert the planned pose parameters (such as X = 50 mm, Y = 30 mm, Z = 20 mm, tilt angle = 45°) into instructions that the control system can recognize. For example, convert the coordinate values into the number of motor pulses and convert the angle values into the step amounts of the rotary table. Drive the motors of each axis in sequence according to the parsed instructions. For example, first control the X-axis motor to move the probe to the 50 mm position, then control the Y-axis motor to move to the 30 mm position, and finally adjust the Z-axis height and the probe angle. After the probe reaches each measurement position, trigger the measurement system to collect data. For example, for a contact probe, record the coordinate values at the moment of contact; for a laser scanning probe, record the angle and intensity information of the reflected light.
[0059] Translation vector calculation: Obtain the position difference between the origin of the world coordinate system and the structured light coordinate system through the measurement of a standard sphere. For example, the center coordinates of the standard sphere in the world coordinate system are (100, 100, 100), and the coordinates in the structured light coordinate system are (105, 97, 102), then the translation vector is (105 100, 97 100, 102 100).
[0060] Rotation matrix calculation: Calculate the rotation relationship between the two coordinate systems by measuring the coordinates of the standard sphere in different postures multiple times. For example, determine the rotation angle around the X-axis by measuring the coordinate changes of the standard sphere after rotating 90° around the X-axis, and similarly calculate the rotation angles of the Y-axis and Z-axis.
[0061] Insert intermediate points between adjacent measurement points to ensure a smooth path. For example, given the starting point (0, 0, 0) and the ending point (10, 10, 10), insert 9 intermediate points so that the X, Y, and Z coordinates increase uniformly from 0 to 10.
[0062] Identify different feature regions through curvature calculation and plane fitting, focus on measuring high-curvature regions, simplify the measurement of plane regions, improve measurement efficiency and resource utilization. It is required that the overlap rate of adjacent measurement regions is ≥ 20%, effectively avoiding measurement blind spots, ensuring that every detail on the surface of the workpiece can be covered, and enhancing the comprehensiveness and accuracy of the measurement results. Plan the path by combining the characteristics of structured light, cameras, and coordinate measuring machines, which can not only avoid occlusion and reflection problems but also meet the motion limitations of the equipment, reduce ineffective movement, shorten the measurement time, and improve the overall measurement efficiency.
[0063] In a preferred embodiment of the present invention, a composite Gray code and phase-shift encoded pattern is projected onto the surface of the workpiece, and a deformed fringe image modulated by the surface topography of the workpiece is collected. By calculating the three-dimensional coordinates of each pixel point, local point cloud data corresponding to the measurement region can be generated, including: For each measurement position, project a composite Gray code and phase-shift encoded pattern onto the surface of the workpiece through a projector, where the Gray code is used for absolute phase encoding and the phase-shifted fringes are used for wrapped phase encoding; collect the deformed fringe image modulated by the surface topography of the workpiece through an industrial camera and store it as a time-sequence image sequence; For the phase-shifted fringes in the time-sequence image sequence, use the four-step phase-shift method to calculate the wrapped phase map, and determine the integer cycle part of the absolute phase value based on the Gray code fringe order to generate a continuously distributed absolute phase value; Based on the projector calibration matrix and camera internal parameters in the dynamic calibration parameters, map the continuously distributed absolute phase value to three-dimensional coordinates in the structured light coordinate system to generate local point cloud data for the current measurement region.
[0064] In the embodiment of the present invention, Gray code pattern projection: The Gray code is a binary code, and only one bit is different between adjacent numerical values. When projecting, project from the lowest bit to the highest bit. For example: The 1st bit: project an all-black (0) or all-white (1) image; The 2nd bit: divide the image into two halves, with the left half black and the right half white (or vice versa); The 3rd bit: divide the image into four equal parts, alternating black and white (such as black - white - black - white); And so on. Projecting an N-bit Gray code requires N images. In this way, the Gray code value of each pixel uniquely corresponds to its position on the projection plane.
[0065] Phase-shifted fringe pattern projection: The phase-shifted fringes are a set of sinusoidal fringes with alternating light and dark, and the phase information is encoded through four phase shifts (0°, 90°, 180°, 270°). Project one image after each phase shift, for a total of four images. For example: The 1st image: The stripe brightness is distributed in a sine wave with an initial phase of 0°; The 2nd image: The whole stripe shifts to the right Period (90° phase shift); The 3rd image: The stripe shifts to the right Period (180° phase shift); The 4th image: The stripe shifts to the right Period (270° phase shift).
[0066] The industrial camera synchronously collects the deformed stripe images modulated by the workpiece surface. Due to the height change of the workpiece surface, the stripes will be distorted. For example, in the convex area, the stripes will be compressed; in the concave area, the stripes will be stretched. The collected images are stored as a time sequence in the projection order (first the Gray code image, then the phase shift image).
[0067] Solving the wrapped phase by the four-step phase shift method: For each pixel in the four phase shift images, calculate its wrapped phase value. The specific steps are as follows: Extract the pixel value: Extract the brightness values of the same pixel from the four images respectively 、 、 、 ; Calculate the arctangent value: Wrapped phase value = arctan( ).
[0068] This phase value is restricted within the range of [-π, π], forming a "wrapping" phenomenon (similar to the clock hand returning to 1 o'clock after exceeding 12 o'clock).
[0069] Gray code decoding to determine the integer period: For each pixel in the Gray code image sequence, convert the binary Gray code to a decimal value G. For example: If the values of a certain pixel in the three Gray code images are 1, 0, 1 (Gray code 101) respectively, the converted decimal value is 5, and the value G corresponds to the integer period number W of the phase shift stripe = G. Combine the wrapped phase value with the integer period W to obtain the absolute phase value of this pixel = 2πW + wrapped phase value.
[0070] Three-dimensional coordinate mapping and point cloud generation: The projector calibration matrix contains parameters such as the projection center coordinates, focal length, and distortion coefficients. Through this matrix, map the absolute phase value to the two-dimensional coordinates (up, vp) in the projector coordinate system. For example: Horizontal coordinate up: It has a linear relationship with the absolute phase value (such as up = absolute phase value × ).
[0071] Vertical coordinate vp: It is determined by the phase change rate of adjacent pixels.
[0072] Application of camera internal parameters: The camera internal parameters (focal length, principal point, distortion coefficient) are used to convert the image pixel coordinates (uk, vk) collected by the camera into the direction vector in the camera coordinate system.
[0073] Triangulation to calculate three-dimensional coordinates: Combined with the geometric relationship between the projector and the camera (determined by dynamic calibration), the three-dimensional coordinates (X, Y, Z) of each pixel are calculated using the triangulation principle. For example: Construct the light ray equation: The light ray projected by the projector intersects with the light ray observed by the camera in space.
[0074] Solve for the intersection point: By minimizing the distance between the two light rays, the coordinates of the intersection point in space are determined.
[0075] Repeat this process for all pixels to generate the local point cloud data of the current measurement area.
[0076] The Gray code provides a globally unique encoding, solves the ambiguity problem in phase unwrapping, and avoids the "cycle skipping" error. The four-step phase-shifting method averages the noise through multiple phase shifts, improving the phase measurement accuracy (up to the sub-pixel level). The composite coding only needs to project N + 4 images (N is the number of bits of the Gray code), reducing the number of images compared to the pure phase-shifting method and improving the measurement speed. The Gray code has strong robustness to local occlusion and reflection. Even if the image quality of some areas is poor, it can still be decoded through adjacent areas. The dynamic calibration parameters compensate for environmental changes (such as temperature, vibration), ensuring long-term measurement stability.
[0077] In a preferred embodiment of the present invention, the local point cloud data is preprocessed, and the preprocessed local point cloud data is converted from the structured light coordinate system to the world coordinate system; combined with the clamping vibration data collected in real time, dynamic error compensation is performed on the converted point cloud to generate the error-compensated point cloud, which may include: Preprocess the local point cloud data and use the moving least squares method to smooth the surface fluctuations, and output the preprocessed point cloud; Based on the rotation matrix and translation vector in the dynamic calibration parameters, convert the preprocessed point cloud from the structured light coordinate system to the world coordinate system of the coordinate measuring machine to generate the converted point cloud; Combined with the probe clamping vibration data collected in real time by the six-axis force sensor, perform vibration noise filtering on the converted point cloud, and compensate for the point cloud deformation error caused by thermal expansion based on the temperature and humidity data of the environmental compensation sensor, and output the error-compensated point cloud.
[0078] In an embodiment of the present invention, for each point in the local point cloud, the average distance between it and its neighboring points is calculated. For example, with the current point as the center, all points within a radius of 5 mm are used as the neighborhood. If the average distance of a certain point exceeds 3 times the global average distance, it is determined as an outlier and deleted. For each point P, a local plane is fitted within its neighborhood (such as points within a radius of 3 mm). By adjusting the plane parameters, the sum of the squared distances from the neighborhood points to the plane is minimized. For example: the centroid of the neighborhood points is calculated as the center of the plane; the plane normal vector is determined through principal component analysis (i.e., the eigenvector corresponding to the minimum eigenvalue); the point P is projected onto the plane to obtain the smoothed new position P', and this process is repeated to update the entire point cloud point by point.
[0079] Coordinate system transformation (structured light → world coordinate system): For each preprocessed point P(x, y, z), its coordinates are respectively added with the translation vector (Tx, Ty, Tz) in the dynamic calibration parameters. For example: if Tx = 5 mm, Ty = 3 mm, Tz = 2 mm, then the translated coordinates are P'(x + 5, y 3, z + 2); the translated point P' is rotated successively around the X, Y, and Z axes of the world coordinate system. For example: rotate around the X axis by degrees: adjust the Y and Z coordinates (Y' = Y × cos Z × sin , Z' = Y × sin + Z × cos ); rotate around the Y axis by degrees: adjust the X and Z coordinates (X' = X × cos + Z × sin , Z' = X × sin + Z × cos ); rotate around the Z axis by degrees: adjust the X and Y coordinates (X' = X × cos Y × sin , Y' = X × sin + Y × cos ); the rotation angles , , are determined by the rotation matrix in the dynamic calibration parameters.
[0080] Dynamic error compensation: Obtain vibration data (acceleration, displacement) synchronized with the point cloud acquisition moment from a six-axis force sensor, convert the vibration signal to the frequency domain through Fourier transform, and identify the main vibration frequencies (such as device characteristic frequencies like 50Hz, 100Hz, etc.). For each point P, based on its acquisition time and vibration data, predict the displacement deviation caused by vibration (such as ±0.1mm in the X direction), and then reverse-compensate for this deviation. Determine the thermal expansion coefficient of the workpiece material, and based on the temperature and humidity sensor data, construct a surface temperature distribution model of the workpiece (such as calculating the temperature of each point through interpolation). For each point P, calculate the change in the guide rail length dimension ΔL caused by temperature = × Thermal expansion coefficient of the workpiece material × (Temperature of each point - Reference temperature), where is the original length of the guide rail at the reference temperature; move the point P by a distance of ΔL along its normal vector direction to complete thermal expansion compensation.
[0081] Preprocessing removes outliers and smooths the surface, reduces measurement noise, and improves the accuracy of surface details. Vibration filtering eliminates artifacts caused by device vibration, making the point cloud closer to the true workpiece morphology. The dynamic calibration parameters are updated in real time to adapt to the small displacements of the device during the measurement process. Thermal expansion compensation eliminates dimensional errors caused by environmental temperature changes (such as a 1℃ temperature difference can cause a change of about 0.01mm in a 1m long steel workpiece), and vibration compensation reduces dynamic errors caused by device movement or external interference; the compensated point cloud more truly reflects the designed dimensions of the workpiece and reduces the misjudgment rate.
[0082] In a preferred embodiment of the present invention, in the overlapping region of adjacent point clouds after error compensation, extract curvature feature points and plane geometric features, screen matching point pairs and calculate the rough registration parameters; combine the point-to-plane distance constraint to complete the registration of multi-viewpoint clouds, and obtain the registered multi-region point cloud data, which may include: For the point cloud after error compensation, in the overlapping region of adjacent point clouds, calculate the curvature change rate point by point through the curvature calculation algorithm, and screen the local regions where the curvature change rate exceeds the preset threshold as curvature feature points; at the same time, perform plane fitting on the point cloud, extract the continuous plane regions where the normal vector direction consistency meets the preset conditions, and record the normal vector and the boundary point set; Using the curvature feature points and plane boundary points as inputs, adopt the bidirectional nearest neighbor search algorithm to generate initial matching point pairs, and based on the geometric position relationship and normal vector direction constraint of the initial matching point pairs, use the random sample consensus algorithm to iteratively screen the matching point pairs that meet the consistency conditions, specifically including: Using the curvature feature points and plane boundary points as inputs, perform forward search and backward search on the feature points in adjacent point clouds respectively to generate an initial set of matching point pairs; For each pair of matching points in the initial set of matching point pairs, calculate the Euclidean distance deviation and the normal vector angle deviation of the plane region where they are located, and remove the outlier matching points that exceed the preset distance threshold or angle threshold to obtain a set of valid matching point pairs; Based on the set of valid matching point pairs, randomly select multiple pairs of matching points, calculate the corresponding rotation matrix and translation vector, count the number of matching points that satisfy the geometric constraints, and output the final consistent matching point pairs; Based on the consistent matching point pairs, calculate the initial rotation matrix and translation vector between adjacent point clouds through singular value decomposition, transform the current local point cloud to the coordinate system of the adjacent point cloud based on the rotation matrix and translation vector, and generate the point cloud data after rough registration; Taking the point cloud data after rough registration as the initial value, use the improved iterative closest point algorithm to iteratively optimize the point cloud in the overlapping area, that is, match each point in the point cloud with the plane region of the adjacent point cloud, and terminate the optimization according to the change amount of the registration error between two adjacent iterations and the preset iteration number threshold, and finally output the registered multi-region point cloud data.
[0083] In the embodiment of the present invention, in the overlapping area of adjacent point clouds, a spherical range with a radius of 2 mm is taken with each point as the center, and the points within the range are used as neighborhood points. The curvature is evaluated by comparing the height difference between the point and the neighborhood points. The greater the height difference, the higher the curvature. Set 0.05 as the maximum height change rate threshold allowed per unit length. If the curvature change rate of a certain point exceeds this threshold, it is marked as a curvature feature point, such as the points at the edges of workpieces and the vertices of bosses.
[0084] Plane region extraction: For the point cloud data in the overlapping area, divide it into groups of 50 points. If the point cloud density is high, the number of points in each group can be reduced (such as 30 points per group) to avoid redundant calculations; if the point cloud density is low, the number of points in each group can be appropriately increased (such as 80 points per group) to ensure that each group of points can effectively reflect the local geometric features. When grouping, there will be a certain number of overlapping points between adjacent groups to ensure the continuity of the analysis. For each group of points, first calculate the average values of the X, Y, and Z coordinates of all points in the group to obtain the centroid of this group of points, which represents the average position of this group of points in space. Then, by analyzing the distribution of points in the group in space, find a direction such that the distribution of these points in this direction is the most "flat", and the vector corresponding to this direction is the normal vector of the fitted plane. For example, if the found direction is parallel to the Z-axis, then the normal vector may be (0, 0, 1), indicating that the fitted plane is perpendicular to the Z-axis. After completing the plane fitting for each group of points and obtaining the normal vector, start comparing the normal vectors of adjacent groups. Calculate the angle between the normal vectors of two adjacent groups. If the angle is less than 10°, it is considered that these two groups of points belong to the same continuous plane region; if the angle is greater than or equal to 10°, it is determined to be different plane regions. In this way, check all adjacent groups in turn and merge the groups that belong to the same continuous plane region.
[0085] After determining each continuous plane region, record the normal vector of this plane, which clarifies the direction of the plane. At the same time, identify and record the set of boundary points. The specific operation is to check the neighborhood points of each point in the region (such as points within a radius of 1 mm centered on this point). If there are points in the neighborhood points that do not belong to the current plane region, mark this point as a boundary point, and these boundary points together form the edge contour of the plane region.
[0086] Bidirectional nearest neighbor search: Among the curvature feature points of point cloud F, for each point PF, in the curvature feature points and plane boundary points of point cloud G, use the Euclidean distance calculation to find the point PG closest to it, forming a candidate matching pair (PF, PG). For each candidate matching pair, check whether the nearest neighbor point of PG in point cloud G is PF. If not, then eliminate this pair to ensure the bidirectional consistency of the matching. After bidirectional screening, retain all point pairs that meet the bidirectional nearest neighbor condition to form an initial matching set. For example, a set containing 100 pairs of matching points is obtained.
[0087] For the initial matching point pairs, calculate two deviations: one is the Euclidean distance deviation. Ideally, the theoretical distance of the matching point pair is 0. Calculate the difference between the actual spatial distance and the theoretical distance. If it exceeds the preset threshold of 0.3 mm, then eliminate it; the other is the normal vector angle deviation. If the matching point pair belongs to a plane region, calculate the angle between the normal vectors of the planes where they are located. If it exceeds the preset threshold of 15°, then eliminate it.
[0088] Randomly extract 3 pairs from the valid matching point pairs, and use these 3 pairs of matching points to calculate the temporary rotation matrix and translation vector, and transform the points of point cloud A into the coordinate system of point cloud B. Transform all matching points with the temporary parameters, and count the number of point pairs (inliers) with a distance less than 0.2 mm after transformation. Repeat the above random sampling, parameter calculation and statistical process 100 times, and select the matching point pairs corresponding to the set of parameters with the largest number of inliers as the final consistent matching point pairs.
[0089] Singular Value Decomposition (SVD): After obtaining the final consistent matching point pairs, according to the different point clouds to which these point pairs belong, classify and organize them into two independent point sets, namely point set E and point set Y. This operation ensures that the points in the two point sets respectively correspond to the surface feature points of the same object under different perspectives. For point set E, add up the X coordinates of all points in it, and then divide by the number of points in point set E to obtain the average coordinate in the X direction; in the same way, calculate the average coordinates in the Y direction and Z direction, and these three average values together determine the centroid position of point set E. Calculate the centroid of point set Y in the same way. The centroid represents the average position of the point set in space.
[0090] Input the centroid coordinates of point set E and point set Y, as well as the specific coordinate information of all matching point pairs, into the singular value decomposition algorithm, and finally output two key parameters: rotation matrix R and translation vector T. Among them, the rotation matrix R contains the angle information required for point set E to rotate to the same direction as point set Y, and it can describe the specific angle combination of point set E rotating around the X-axis, Y-axis, and Z-axis in three-dimensional space; the translation vector T is calculated by subtracting the centroid coordinate of point set E from the centroid coordinate of point set Y, which clarifies the distances that point set E needs to translate in the X, Y, and Z directions, so that point set E can be accurately moved to the corresponding position of point set Y in space.
[0091] For each point in the current local point cloud, first change the direction using the rotation matrix R, and then add the translation vector T to transform the point cloud into the coordinate system of the adjacent point cloud to achieve rough registration and preliminarily align the point clouds in the overlapping area. For each point P in point cloud A after rough registration, find the nearest plane area in point cloud B according to the plane normal vector and plane equation, calculate the perpendicular distance from point P to this plane area as the registration error, and project point P onto the plane to get the new position P'. Calculate the total registration error of two adjacent iterations. If the preset number of 50 iterations is reached, stop the iteration and output the fully aligned multi-region point cloud data.
[0092] The combination of curvature feature points and plane boundary points ensures that the selected matching point pairs have strong geometric uniqueness (such as the intersection of an edge and a plane), reducing the probability of false matching. The RANSAC algorithm effectively eliminates outliers through random sampling and consistency checking. The bidirectional nearest neighbor search quickly narrows the matching range, avoiding a full point cloud traversal. The vector constraint and plane matching consider the local geometric structure of the point cloud (such as the plane direction) and have better adaptability to noise and surface incomplete regions (such as holes). The point-plane matching mode of the improved ICP algorithm is more suitable for the plane features of the casting workpiece (such as the parting surface and flange plane) than the traditional point-point matching, and the registration accuracy can reach the micron level. The forced alignment of the overlapping regions (overlap rate ≥ 20%) ensures that there are no stitching gaps in the point cloud.
[0093] In a preferred embodiment of the present invention, the multi-region point cloud data is subjected to surface reconstruction, and the data of the overlapping regions is fused to generate a complete three-dimensional digital model of the casting workpiece, and the size error and surface topography analysis results of the three-dimensional digital model are output, which may include: For the registered multi-region point cloud data, with the point cloud of each measurement region as the center, the moving least squares method is used to fit the local surface piece by piece; by calculating the weighted least squares plane of the point set within the neighborhood of each point, the weight coefficient is dynamically adjusted to adapt to the local curvature change, and a smooth and continuous local surface model is generated; For the overlapping regions of adjacent local surface models, by calculating the curvature similarity of the overlapping point sets, the points with a curvature difference less than a preset threshold are screened, and the coordinates of the screened points are fused to generate a complete three-dimensional digital model; Taking the complete three-dimensional digital model as the input, starting from the initial triangular facets, each point in the point cloud data is gradually inserted, the connection relationship of the triangular facets is dynamically adjusted, and the feature edges are identified and the topological structure is locked through the boundary detection algorithm, and a surface triangular mesh model is output; The triangular mesh model is fitted and aligned with the design model, and the distance from each point on the surface of the triangular mesh to the corresponding surface of the design model is calculated to generate size error distribution data; By calculating the local curvature of the triangular mesh model point by point and performing a difference analysis with the curvature of the design model, surface topography deviation data is generated; The size error distribution data is converted into error numerical statistical parameters in three-dimensional space, and the surface topography deviation data is converted into curvature difference statistical parameters; Based on the error numerical statistical parameters and the curvature difference statistical parameters, a quantitative analysis report including the error mean, standard deviation, and characteristic position deviation coordinates is generated.
[0094] In the embodiments of the present invention, for the registered multi-region point cloud data, the point cloud of each measurement region is used as a processing unit. Taking the point cloud of a certain measurement region as an example, a neighborhood range is first delimited for each point in this region. Generally, a spherical region centered on this point with a radius of 2 - 5 mm is selected as the neighborhood (2 mm can be selected for small-sized precision workpieces, and 5 mm for larger workpieces to ensure that there are enough feature points in the neighborhood). When calculating the weighted least squares plane, the determination of the weight coefficient follows two core principles: distance weight and curvature weight.
[0095] Distance weight: It is set using an inverse proportion relationship. Let the distance from a point Pi in the neighborhood to the center point P0 be di, and the value range of the distance weight wdi is between 0.1 and 1. When di approaches 0 (i.e., the point Pi coincides with the center point), wdi takes the maximum value of 1; as di increases, the weight gradually decreases. For example, when di reaches the neighborhood radius, wdi may drop to 0.1.
[0096] Curvature weight: It is set according to the local curvature change of the point. First, calculate the curvature of each point in the neighborhood (evaluated by comparing the height differences of the neighborhood points). Let the curvature of a point Pi be Ci, and the curvature of the center point P0 be C0. The value range of the curvature weight wci is between 0.2 and 1. If ∣Ci−C0∣ approaches 0 (i.e., the local curvature change is small and the surface is flat), wci takes the smaller value of 0.2; if ∣Ci−C0∣ is large (the surface changes violently), wci can increase to 1.
[0097] The final comprehensive weight wi is the product of the distance weight and the curvature weight, that is, wi = wdi×wci, and the value range is between 0.02 and 1. In this way, a plane adapted to its local features is fitted for each point, and then a smooth and continuous local surface model is generated.
[0098] For the overlapping region of adjacent local surface models, first extract the point set of the overlapping part. For each point in this point set, calculate its curvature in the same way as before (evaluated by comparing the height differences of the neighborhood points). The preset curvature difference threshold is set according to the workpiece accuracy requirements. For general industrial castings, the threshold can be set to 0.05; for precision parts, the threshold may be reduced to 0.01. Select the points with a curvature difference less than the preset threshold. These points are considered to be similar in curvature characteristics. When performing coordinate fusion on the selected points, weights are assigned according to the distances from the points to the boundaries of the two adjacent surface models. Let the distance from a point P to the boundary of surface model A be dA, and the distance to the boundary of surface model B be dB, then the fusion weight wA = ,wB = ,and the value range of the weights is between 0 and 1. The coordinates of the corresponding points of the two surface models are weighted and averaged according to the weights to obtain the fused coordinates and generate a complete three-dimensional digital model.
[0099] Generate a surface triangular mesh model: Based on the complete 3D digital model, an initial triangular patch is formed from three arbitrarily selected adjacent points. When inserting points in the point cloud data into the model one by one, the position relationship between the point and the existing triangular patches is judged: If the point is inside the triangular patch, connect the three vertices of the triangular patch to the inserted point respectively, and divide it into three new triangular patches.
[0100] If the point is on the edge of the triangular patch, reconnect the vertices of the two triangular patches adjacent to this edge to form a new combination of triangular patches.
[0101] The boundary detection algorithm identifies the feature edges by checking the edges of the triangular patches. If an edge is used by only one triangular patch, it is marked as a boundary edge; if an edge is used by two triangular patches and the included angle between the normal vectors of the two triangular patches exceeds a certain threshold (such as 120°, which can be adjusted according to the complexity of the model), it is also regarded as a boundary edge. Lock the topological structure of these boundary edges to ensure the integrity of the model edge, and finally output the surface triangular mesh model.
[0102] Fit and align the generated triangular mesh model with the design model. Match by finding corresponding points (such as based on curvature feature points, plane feature points, etc.), and adjust the position and orientation of the triangular mesh model to make it coincide with the design model as much as possible. After alignment, for each point on the triangular mesh surface, find the corresponding face on the design model according to its spatial position. When calculating the vertical distance from the point to the corresponding face, draw a perpendicular line from the point to the corresponding face and measure the distance from the point to the foot of the perpendicular. Record the distance value of each point to generate size error distribution data, which reflects the deviation of each position of the model from the design size.
[0103] Calculation of surface topography deviation: For each point P in the triangular mesh model, first determine its neighborhood point set. The selection method of neighborhood points is: centered on P, search for the vertices of the triangles directly connected to it in the triangular mesh, as well as the adjacent vertices of these vertices, to form a local area containing 10 - 20 points (which can be adjusted according to the mesh density).
[0104] Within this local area, evaluate the curvature by comparing the height differences between neighborhood points and P. The specific operation is as follows: Calculate the spatial distance between point P and each neighborhood point, and find the 3-5 points with the closest distances (referred to as "neighboring points"). Fit a local plane with these 3-5 neighboring points, and calculate the perpendicular distance from point P to this plane (i.e., "height difference"). If the height difference is large, it indicates that the surface curvature of the region where P is located is large and the curvature value is high; if the height difference is small, the curvature value is low. In this way, a curvature value reflecting the local surface curvature is assigned to each point P. Find the point P' corresponding to the position of point P in the triangular mesh model in the design model (such as a CAD model). The specific method is as follows: According to the three-dimensional coordinates (X, Y, Z) of point P, search for the closest point P' in the three-dimensional space of the design model (the error range is usually set to 0.1 - 0.5 mm).
[0105] The curvature calculation of the design model is divided into two cases: Parametric model: If the design model is defined by a mathematical expression (such as a surface equation), directly calculate the curvature value at P' by taking the derivative (for example, taking the derivative of the cylindrical surface equation to obtain the curvature as )
[0106] Discretized model: If the design model has been pre-stored as discrete point cloud or mesh data, directly extract the curvature value at P' (this value is pre-calculated and stored by a method similar to neighborhood fitting during model construction).
[0107] Compare the curvature value of point P in the triangular mesh model with the curvature value of the corresponding point P' in the design model: Directly calculate the difference between the two = the curvature value of point P in the triangular mesh model - the curvature value of the corresponding point P' in the design model; If the difference > 0, it means that the actual workpiece surface is more curved at this point than the design model (such as a local protrusion); If the difference < 0, it means that the actual surface is flatter than the design model (such as a local depression); If the difference = 0, it means that the surface topography at this point is consistent with the design.
[0108] Traverse all points of the triangular mesh model, record the difference of each point, and form surface topography deviation data.
[0109] For the dimensional error distribution data, when calculating the mean error, add up the error values of all points and then divide by the total number of points. When calculating the standard deviation, first calculate the square of the difference between the error value of each point and the mean, add up these squared values, divide by the total number of points, and then take the square root of the result. For the surface topography deviation data, the methods for calculating the mean and standard deviation of the curvature difference are similar to those for dimensional error statistics. First, calculate the sum of the curvature differences of all points and divide by the total number of points to obtain the mean; then calculate the sum of the squares of the differences between the curvature difference of each point and the mean, take the square root after averaging to obtain the standard deviation. Based on the calculated mean error, standard deviation, and the deviation coordinate of the characteristic position determined through analysis (such as the coordinate of the point with the largest absolute error, the coordinate of the area where the deviation exceeds a certain threshold), organize them into a detailed quantitative analysis report. In the report, in the form of a combination of charts and text, clearly present the differences between the three-dimensional digital model of the casting workpiece and the design requirements in terms of dimensions and surface topography.
[0110] By fitting the local surface using the moving least squares method and dynamically adjusting the weights to adapt to the curvature, it is possible to accurately capture the surface details of the workpiece and generate a high-quality three-dimensional digital model. In the overlapping area, fuse the data based on the curvature similarity to avoid splicing marks and ensure the integrity and continuity of the model, and truly restore the workpiece topography.
[0111] Not only calculate the dimensional error, but also deeply analyze the surface topography deviation, evaluate the workpiece quality from multiple dimensions, and provide more comprehensive inspection results. Generate a quantitative analysis report containing statistical parameters and characteristic position deviations, present the problems with intuitive data, facilitate the formulation of improvement measures, and improve production efficiency and product quality.
[0112] When specifically applied, place a high-precision standard ball with a known diameter (such as a tolerance of ±0.002 mm) on the workbench of the coordinate measuring machine. Move the structured light probe through the motion platform and project the structured light pattern from at least 3 different angles. The camera captures the deformed fringe images on the surface of the standard ball, and calculates the point cloud data (about 1000 points) of the standard ball in the structured light coordinate system.
[0113] Coordinate matching: Use the contact probe (accuracy ±0.002 mm) of the coordinate measuring machine to measure the center coordinates of the standard ball (in the world coordinate system), denoted as (Xw, Yw, Zw). At the same time, fit the structured light point cloud data by the least squares method to obtain the center coordinates (Xs, Ys, Zs) in the structured light coordinate system.
[0114] Establishment of conversion relationship: Through coordinate translation (T = Xw - Xs, etc.) and rotation (based on the normal direction of the spherical point cloud), establish the initial conversion matrix to ensure that the center of the ball coincides under the two coordinate systems, with an error ≤ 0.05 mm.
[0115] Dynamic update: After every 50 measurements or after replacing the workpiece, repeat the above steps, incorporating real-time temperature and humidity (accuracy ±0.5°C, ±5%RH) and vibration data (acceleration resolution 0.01 m / s 2 ), correct the transformation matrix, and compensate for the small displacements caused by the environment (e.g., for every 1°C change in temperature, the thermal expansion of the structured light probe is approximately 0.001 mm).
[0116] Camera calibration: Place the checkerboard calibration plate (square size 20 mm × 20 mm) on the workbench, and control the camera to capture calibration plate images from 15 different angles (covering a ±45° field of view). Use the sub-pixel corner detection algorithm (accuracy 0.1 pixel) to extract the corner coordinates, and calculate the camera internal parameters (such as focal length f = 16 mm, principal point (u0, v0) = (512, 384)) and distortion coefficients (radial distortion k1 = -0.01, tangential distortion p1 = 0) by the least squares method, ensuring that the reprojection error ≤ 0.5 pixel (i.e., the pixel distance between the actual corner and the model-predicted corner < 0.5).
[0117] Projector modeling: The projector projects a 12-bit Gray code (256-level stripes) and a 3-step phase-shift pattern (0°, 120°, 240°), and the camera synchronously captures calibration plate images. Determine the absolute phase of each pixel by decoding the stripe levels, and combine the three-dimensional coordinates of the calibration plate to establish the mapping relationship between the projector pixel coordinates (up, vp) and the world coordinates (X, Y, Z) (such as up = 1000X + 500), with an error ≤ 0.5 stripe periods.
[0118] Joint calibration: Use a three-dimensional target with 24 spherical feature points (the center distances of the spheres are calibrated by a laser tracker, accuracy ±0.005 mm), and synchronously capture camera images and projection patterns in 6 different poses (such as moving 200 mm along each of the X / Y / Z axes). Establish the correspondence of "projector code - camera corner - world coordinates" through feature matching (such as centroid positioning of the spherical points in the image), and use bundle adjustment to optimize the relative positions of the camera and the projector (such as translation error ≤ 0.1 mm, rotation error ≤ 0.1°).
[0119] Workpiece preprocessing and clamping: Surface treatment: Wipe the surface of the cast workpiece with alcohol to remove oil and dust; for the reflective aluminum alloy surface, evenly spray a white developer (thickness approximately 5 μm) to ensure clear imaging of the structured light stripes.
[0120] Clamping and positioning: Place the workpiece on a high-precision workbench (flatness ≤ 0.01 mm / m), fix the bottom surface using a vacuum chuck (diameter 50 mm, adsorption force 150 N), and clamp the side surface with a magnetic fixture (residual magnetism 0.3 mT) to ensure that the displacement of the workpiece during measurement ≤ 0.02 mm.
[0121] Measurement Area Division and Path Planning: Area Division: For a cuboid workpiece with dimensions of 500mm×300mm×200mm, it is divided into 4 measurement areas (with an overlap rate of 25%) according to a field of view of 200mm×200mm, covering the top surface, two side surfaces, and the front surface of the workpiece. Each area is marked as A (upper left), B (upper right), C (lower left), D (lower right), and the width of the overlapping area is 50mm.
[0122] Path Optimization: The PPO reinforcement learning algorithm is adopted to preferentially plan areas with rich features (such as bosses on the top surface and edges on the side surfaces) to avoid the motion platform colliding with the workpiece. The path sequence is A→B→C→D, and the motion speed is set to 200mm / s for rough positioning and 20mm / s for fine positioning, with a total moving time of about 3 minutes.
[0123] Rough Positioning: The Delta parallel mechanism moves the probe to above area A at a speed of 200mm / s, and the seven-axis robotic arm fine-tunes the posture to make the optical axis of the structured light perpendicular to the workpiece surface (angle deviation ≤1°).
[0124] Pattern Projection and Acquisition: The projector projects 8-bit Gray codes (8 images) and 4-step phase-shift patterns (4 images) at a speed of 20 images per second, and the camera (frame rate 20fps, resolution 1920×1200) synchronously acquires 12 images, which takes 0.6 seconds.
[0125] 3D Solution: For each image, the absolute phase level is determined by Gray code decoding, and the wrapped phase is solved in combination with the phase-shifted images to obtain the 3D coordinates (Xs, Ys, Zs) of each pixel, generating a local point cloud of about 2.3 million points (density about 40 points / mm 2 ) Repeat this process to complete the data acquisition of 4 areas, with a total time consumption of about 5 minutes.
[0126] For the point cloud of area A, set the neighborhood radius to 1.5mm, calculate the average distance between each point and its neighborhood points, and delete the points whose distance exceeds 3 times the global mean (about 1% of the noise points are removed). Use the moving least squares method to fit a local plane for 50 neighborhood points of each point, project the point onto the plane, and smooth the surface fluctuations (such as reducing the height error from ±0.1mm to ±0.03mm). Through the rotation matrix R and translation vector T obtained by calibration, the point cloud of area A is transformed from the structured light coordinate system to the world coordinate system. For example, the coordinate of a certain point is transformed from (100, 200, 300) to (100+Tx, 200+Ty, 300+Tz), with an error ≤0.05mm.
[0127] Vibration Compensation: The six-axis force sensor continuously collects clamping vibration data (such as the X-axis vibration acceleration is 0.1m / s 2), identify the main vibration frequency (e.g., 50 Hz) through Fourier transform, and add reverse displacement compensation to the coordinates of each point (e.g., X-axis compensation 0.01 mm).
[0128] Thermal compensation: The temperature and humidity sensor detects that the ambient temperature is 22 °C (reference temperature 20 °C), and the workpiece material is steel (α = 11.7 × / °C), calculate the thermal expansion = 500 mm × 11.7 × × (22 20), and move the point cloud along the surface normal vector direction by 500 mm × 11.7 × × (22 20).
[0129] Curvature feature point extraction: In the overlapping area of regions A and B, calculate the height variance of the neighborhood (30 points within a radius of 2 mm) for each point. Points with a variance > 0.02 mm 2 are marked as curvature feature points (such as edge points and boss vertices), and approximately 500 feature points are extracted in total.
[0130] Plane feature extraction: Divide the point cloud in the overlapping area into groups of 50 points, fit each group of planes, and merge groups with the included angle of the normal vectors between adjacent groups < 10° into the same plane area. Extract the plane normal vector (such as the top surface normal vector (0, 0, 1)) and boundary points (approximately 200).
[0131] Bidirectional matching: For the curvature feature points PA in region A, find the point PB with the closest Euclidean distance (threshold 0.5 mm) among the curvature feature points and plane boundary points in region B, and then check whether the nearest neighbor of PB is PA. Retain the bidirectional matching pairs (approximately 300 pairs).
[0132] RANSAC filtering: Randomly select 3 pairs of matching points, calculate the temporary rotation matrix R' and translation vector T', count the number of inliers with a distance < 0.2 mm after transformation, and select the parameters with the most inliers (inlier rate 85%) after 100 iterations to obtain the rough registration parameters (rotation error ≤ 0.5°, translation error ≤ 0.3 mm).
[0133] ICP fine registration: Take the point cloud in region A as the target and the point cloud in region B as the source, calculate the distance from each point to the nearest plane of the target point cloud (such as the distance from point P to the top surface), and the error change < 0.01 mm after 50 iterations, and the final registration error ≤ 0.03 mm.
[0134] For the overlapping points of regions A and B, calculate the points with a curvature difference < 0.03, assign weights according to the distance from the plane boundary (such as the weight of a point 1 mm away from the boundary of A is 0.6, and the weight of a point 1 mm away from the boundary of B is 0.4), and calculate the weighted average coordinates to generate the fused point cloud.
[0135] Triangular meshing: Using the Delaunay triangulation algorithm, the fused point cloud (about 8 million points) is converted into a triangular mesh model with an average mesh edge length of 0.5 mm. At the same time, it is thinned to 800,000 points through the octree algorithm, retaining the edge and surface details.
[0136] Align the mesh model with the designed CAD model and calculate the vertical distance from each vertex of the triangular patch to the corresponding surface of the CAD. For example, a certain point on the top surface is 0.12 mm away from the designed surface (+ indicates a protrusion). Record the maximum deviation of +0.15 mm, the minimum deviation of -0.08 mm, and the average deviation of +0.03 mm. For the central area of the top surface, calculate the curvature of the mesh model to be 0.005 and the designed curvature to be 0.003 with a difference of +0.002 indicating that the actual surface is more curved than the design.
[0137] In the 3D display software, map the deviation with colors (red for values greater than 0.1 mm and blue for values less than -0.1 mm). The central area of the top surface is shown in red and the edge is shown in blue. Output an Excel table containing the mean error (+0.03 mm), standard deviation (0.05 mm), and deviation of feature positions (such as the X-axis deviation of point A on edge A being +0.08 mm and the Y-axis deviation being -0.02 mm).
[0138] An embodiment of the present invention also provides a computer-readable storage medium storing instructions that, when run on a computer, cause the computer to execute the method described above. All implementation manners in the above method embodiments are applicable to this embodiment and can also achieve the same technical effects.
[0139] The above is the preferred embodiment of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. Three-coordinate structured light rapid measurement system for casting workpieces, characterized in that, Including: A calibration parameter module, which is used to calibrate a standard sphere, establish an initial conversion relationship between the structured light coordinate system and the world coordinate system of the coordinate measuring machine, and collect temperature, humidity and vibration data in real time, and dynamically update the conversion relationship to form calibration parameters; A measurement path planning module, which is used to divide the cast workpiece into multiple measurement areas based on the calibration parameters, plan the movement path of the coordinate measuring machine, and drive the moving platform to move to each measurement position; A local point cloud generation module, which is used to project a Gray code and phase shift composite coding pattern onto the workpiece surface, collect the deformed fringe image modulated by the workpiece surface topography, and generate local point cloud data for the corresponding measurement area by calculating the three-dimensional coordinates of each pixel point; A compensation module, which is used to preprocess the local point cloud data, and convert the preprocessed local point cloud data from the structured light coordinate system to the world coordinate system; combined with the clamping vibration data collected in real time, dynamically compensate the converted point cloud to generate the point cloud after error compensation; A point cloud registration module, which is used to extract curvature feature points and plane geometric features in the overlapping area of adjacent point clouds after error compensation, screen matching point pairs and calculate the rough registration parameters; combined with the point-to-plane distance constraint, complete the registration of multi-viewpoint clouds to obtain the registered multi-region point cloud data; A three-dimensional model analysis module, which is used to perform surface reconstruction on the multi-region point cloud data, fuse the data in the overlapping area to generate a complete three-dimensional digital model of the cast workpiece, and output the dimensional error and surface topography analysis results of the three-dimensional digital model.
2. The three - coordinate structured - light rapid measurement system for a casting workpiece according to claim 1, wherein, Calibrate the standard sphere, establish an initial conversion relationship between the structured light coordinate system and the world coordinate system of the coordinate measuring machine, and collect temperature, humidity and vibration data in real time, and dynamically update the conversion relationship to form calibration parameters, including: Fix the standard sphere on the workbench of the coordinate measuring machine, control the probe to move to multiple different poses, project the Gray code and phase shift composite coding pattern onto the surface of the standard sphere in turn through the projector, and the industrial camera synchronously collects the deformed fringe image modulated by the surface topography of the standard sphere; Solve the wrapped phase diagram in the deformed fringe image by the phase shift method, and generate the absolute phase value in combination with the Gray code decoding result; Based on the absolute phase value, combined with the calibration parameters of the projector and the camera, calculate the three-dimensional coordinates of each pixel point on the surface of the standard sphere, and generate the point cloud data of the standard sphere in the structured light coordinate system; For the point cloud data of the standard sphere in the structured light coordinate system, use the least square method to fit the coordinates of the center of the sphere in the structured light coordinate system, and measure the coordinates of the center of the standard sphere in the world coordinate system by the probe of the coordinate measuring machine to establish the initial rotation matrix and translation vector; Collect the temperature and humidity data in real time through the environmental compensation sensor and the probe vibration data collected by the six-axis force sensor, combined with the real-time position feedback of the moving platform of the coordinate measuring machine, and use the Kalman filter algorithm to dynamically correct the initial rotation matrix and translation vector to generate the updated calibration parameters.
3. The three - coordinate structured - light rapid measurement system for casting workpieces according to claim 2, characterized in that, Based on the calibration parameters, divide the cast workpiece into multiple measurement areas, plan the movement path of the coordinate measuring machine, and drive the moving platform to move to each measurement position, including: Based on the dynamic calibration parameters, the three-dimensional design model of the casting workpiece is transformed from the world coordinate system to the structured light coordinate system. The characteristic regions where the surface curvature change rate of the workpiece exceeds the preset threshold are identified through the curvature calculation algorithm, and the planar geometric feature regions are extracted through the plane fitting algorithm; According to the curvature characteristic regions and the planar feature regions, the workpiece surface is divided into multiple measurement regions, and the overlap rate of adjacent measurement regions is ≥20%; According to the positions and sizes of the measurement regions, combined with the structured light incident angle constraint and the camera field of view range, the measurement blind areas caused by occlusion or reflection are avoided, and based on the mechanical parameters and motion constraints of each moving axis of the coordinate measuring machine, the continuous moving path and pose parameters of the probe are generated through the interpolation algorithm; According to the pose parameters, the motion platform of the coordinate measuring machine is controlled to move to each measurement position.
4. The three-coordinate structured light rapid measurement system for a casting workpiece according to claim 3, characterized in that, Based on the dynamic calibration parameters, the three-dimensional design model of the casting workpiece is transformed from the world coordinate system to the structured light coordinate system. The characteristic regions where the surface curvature change rate of the workpiece exceeds the preset threshold are identified through the curvature calculation algorithm, and the planar geometric feature regions are extracted through the plane fitting algorithm, including: Based on the dynamic calibration parameters, the three-dimensional design model of the casting workpiece is transformed from the world coordinate system to the structured light coordinate system to generate the three-dimensional model data in the structured light coordinate system; For the three-dimensional model data, the velocity vector and acceleration vector at each position are calculated point by point to obtain the curvature numerator term, and the curvature value is calculated in combination with the modulus of the velocity vector; The curvature value is compared with the preset threshold. If the curvature change rate exceeds the threshold, it is marked as a high-curvature characteristic region; for the regions not marked as high-curvature characteristic regions, surface fitting is performed through the plane fitting algorithm, and the residual value of each point to the fitting plane is calculated; The normal vector direction and planar geometric parameters of the regions where the residual value of each point to the fitting plane is less than the preset tolerance are calculated, and the regions where the residual value is less than the preset tolerance are marked as planar geometric feature regions.
5. The three-coordinate structured light rapid measurement system for a casting workpiece according to claim 4, wherein The Gray code and phase-shift composite coding pattern are projected onto the workpiece surface, and the deformed fringe images modulated by the workpiece surface topography are collected. By solving the three-dimensional coordinates of each pixel point, the local point cloud data corresponding to the measurement region is generated, including: For each measurement position, the Gray code and phase-shift composite coding pattern are projected onto the workpiece surface through the projector, where the Gray code is used for absolute phase coding and the phase-shift fringes are used for wrapped phase coding; the deformed fringe images modulated by the workpiece surface topography are collected through the industrial camera and stored as a time-sequence image sequence; For the phase-shift fringes in the time-sequence image sequence, the four-step phase-shift method is used to solve the wrapped phase map, and the integer period part of the absolute phase value is determined based on the Gray code fringe order to generate a continuously distributed absolute phase value; Based on the projector calibration matrix and the camera internal parameters in the dynamic calibration parameters, the continuously distributed absolute phase value is mapped to the three-dimensional coordinates in the structured light coordinate system to generate the local point cloud data of the current measurement region.
6. The three-coordinate structured light rapid measurement system for the cast workpiece according to claim 5, wherein The local point cloud data is preprocessed, and the preprocessed local point cloud data is transformed from the structured light coordinate system to the world coordinate system; Combined with the real-time collected clamping vibration data, dynamic error compensation is performed on the transformed point cloud to generate the point cloud after error compensation, including: Preprocess the local point cloud data, and use the moving least squares method to smooth the surface fluctuations, and output the preprocessed point cloud; Based on the rotation matrix and translation vector in the dynamic calibration parameters, convert the preprocessed point cloud from the structured light coordinate system to the coordinate measuring machine world coordinate system, and generate the transformed point cloud; Combined with the probe clamping vibration data collected by the six-axis force sensor in real time, filter the vibration noise of the transformed point cloud, and compensate the point cloud deformation error caused by thermal expansion based on the temperature and humidity data of the environmental compensation sensor, and output the point cloud after error compensation.
7. The three-coordinate structured light rapid measurement system for casting workpieces according to claim 6, characterized in that, In the overlapping area of adjacent point clouds after error compensation, extract the curvature feature points and plane geometric features, screen the matching point pairs and calculate the rough registration parameters; Combined with the point-to-plane distance constraint, complete the registration of multi-view point clouds, and obtain the registered multi-region point cloud data, including: For the point cloud after error compensation, in the overlapping area of adjacent point clouds, calculate the curvature change rate point by point through the curvature calculation algorithm, and screen the local area where the curvature change rate exceeds the preset threshold as the curvature feature point; at the same time, perform plane fitting on the point cloud, extract the continuous plane area where the normal vector direction consistency meets the preset conditions, and record the normal vector and the boundary point set; Use the curvature feature points and plane boundary points as inputs, adopt the bidirectional nearest neighbor search algorithm to generate the initial matching point pairs, and based on the geometric position relationship and normal vector direction constraint of the initial matching point pairs, use the random sample consensus algorithm to iteratively screen the matching point pairs that meet the consistency conditions; Based on the consistent matching point pairs, calculate the initial rotation matrix and translation vector between adjacent point clouds through singular value decomposition, and transform the current local point cloud to the coordinate system of the adjacent point cloud based on the rotation matrix and translation vector, and generate the roughly registered point cloud data; Taking the roughly registered point cloud data as the initial value, use the improved iterative closest point algorithm to iteratively optimize the overlapping area point cloud, that is, match each point in the point cloud with the plane area of the adjacent point cloud, and terminate the optimization according to the registration error change amount between adjacent two iterations and the preset iteration number threshold, and finally output the registered multi-region point cloud data.
8. The three-coordinate structured light rapid measurement system for casting workpieces according to claim 7, characterized in that, Use the curvature feature points and plane boundary points as inputs, adopt the bidirectional nearest neighbor search algorithm to generate the initial matching point pairs, and based on the geometric position relationship and normal vector direction constraint of the initial matching point pairs, use the random sample consensus algorithm to iteratively screen the matching point pairs that meet the consistency conditions, including: Use the curvature feature points and plane boundary points as inputs, and perform forward search and backward search on the feature points in the adjacent point clouds respectively to generate the initial matching point pair set; For each pair of matching points in the initial matching point pair set, calculate the Euclidean distance deviation and the normal vector angle deviation of the plane area where they are located, and remove the outlier matching points that exceed the preset distance threshold or angle threshold to obtain the effective matching point pair set; Based on the effective matching point pair set, randomly extract multiple pairs of matching points, calculate the corresponding rotation matrix and translation vector, count the number of matching points that meet the geometric constraints, and output the final consistent matching point pairs.
9. The three-coordinate structured light rapid measurement system for a casting workpiece according to claim 8, wherein, Perform surface reconstruction on multi-region point cloud data, fuse the data in the overlapping regions to generate a complete three-dimensional digital model of the casting workpiece, and output the dimensional error and surface topography analysis results of the three-dimensional digital model, including: For the registered multi-region point cloud data, with the point cloud of each measurement region as the center, use the moving least squares method to fit the local surface piece by piece; by calculating the weighted least squares plane of the point set within the neighborhood of each point, dynamically adjust the weight coefficient to adapt to the local curvature change, and generate a smooth and continuous local surface model; For the overlapping regions of adjacent local surface models, calculate the curvature similarity of the overlapping point sets, filter out the points with curvature differences less than the preset threshold, and fuse the coordinates of the filtered points to generate a complete three-dimensional digital model; Using the complete three-dimensional digital model as the input, starting from the initial triangular mesh, gradually insert each point in the point cloud data, dynamically adjust the connection relationship of the triangular meshes, and identify the feature edges and lock the topological structure through the boundary detection algorithm, and output the surface triangular mesh model; Align the triangular mesh model with the design model, calculate the distance from each point on the triangular mesh surface to the corresponding surface of the design model, and generate the dimensional error distribution data; Generate the surface topography deviation data by calculating the local curvature of the triangular mesh model point by point and performing a difference analysis with the curvature of the design model; Convert the dimensional error distribution data into error numerical statistical parameters in three-dimensional space, and convert the surface topography deviation data into curvature difference statistical parameters; Based on the error numerical statistical parameters and the curvature difference statistical parameters, generate a quantitative analysis report including the error mean, standard deviation, and deviation coordinate of the feature position.
10. A computer-readable storage medium, characterized in that, The program stored in the computer-readable storage medium, when executed by the processor, implements the system according to any one of claims 1 to 9.
Citation Information
Patent Citations
Three-dimensional panorama measurement method for precision parts based on linear laser
CN108981604A
High-precision point cloud registration method for three-dimensional laser scanning
CN110473239A
Structured light three-dimensional reconstruction correction method and device
CN112581605A
Contour precision compensation method and system for precision hot press forming die
CN118864790A
Three-dimensional reconstruction method based on linear structure light spot set monomer kinematics calibration
CN119313812A
Cited By
Splicing method and system of structured light under three coordinates
CN120510028A
Structured light splicing method and system under three-coordinates
CN120510028B
Tire full life cycle management system and method based on AI identity authentication
CN120580180A
A tire full life cycle management system and method based on AI identity authentication
CN120580180B
Method for precisely measuring angle of workpiece based on laser displacement sensor
CN120627965A