Three-coordinate structured light rapid measurement system for casting workpieces
Through dynamic calibration and multi-view precise registration of the structured light measurement system, the image quality degradation and environmental factors in the detection of casting workpieces are solved, high-precision three-dimensional digital measurement of casting workpieces is achieved, and the detection efficiency and stability are improved.
Patent Information
- Application Number
- CN202510804143.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-06-17
AI Technical Summary
Existing structured light measurement systems face problems in casting workpiece inspection, such as surface roughness, reflections or shadows that lead to degraded image quality, large feature matching errors when measuring multiple areas, and coordinate system conversion errors caused by environmental factors, making it difficult to achieve high-precision full-surface measurement.
Through dynamic calibration, multi-view precise registration and intelligent error compensation, the system uses Gray code and phase shift composite coding pattern projection, combined with industrial cameras to collect deformed fringe images, generate local point cloud data, and generate a three-dimensional digital model of the casting workpiece through point cloud registration and surface reconstruction technology.
It realizes high-precision digital measurement of the entire surface of the casting workpiece, with measurement accuracy reaching the micron level, adapting to complex curved surface detection, reducing the impact of environmental factors, and improving detection efficiency and stability.
Smart Images

Figure CN120313486B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial automation measurement, in particular to a three-coordinate structured light rapid measurement system for a casting workpiece. Background Art
[0002] In industrial manufacturing, the geometric accuracy of cast workpieces directly impacts the quality of finished products, and 3D inspection is a critical step. Traditional contact measurement, due to its low efficiency, susceptibility to damage, and blind spots in complex curved surface inspections, struggles to meet modern production demands. While structured light measurement offers advantages such as non-contact and high precision, it faces three major challenges when applied to cast workpieces:
[0003] The surface of the casting workpiece is rough, reflective, or has shadows, which leads to a decrease in the quality of the structured light fringe image and an increase in decoding errors;
[0004] Large workpieces require multi-area measurement, and traditional stitching algorithms are prone to global accuracy loss due to feature matching errors or environmental interference;
[0005] Environmental factors such as temperature, humidity, and vibration can cause coordinate system conversion errors and equipment stability fluctuations, affecting measurement consistency.
[0006] Existing structured light measurement systems lack optimized designs for the characteristics of casting workpieces, such as insufficient dynamic environment compensation mechanisms, weak multimodal data fusion capabilities, and limited accuracy in complex surface reconstruction. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to provide a three-coordinate structured light rapid measurement system for casting workpieces, which realizes high-precision digitization of the entire surface of the casting workpiece through dynamic calibration, multi-view precise alignment and intelligent error compensation.
[0008] In order to solve the above technical problems, the technical solutions of the present invention are as follows:
[0009] First, the casting workpiece three-coordinate structured light rapid measurement system includes:
[0010] The calibration parameter module is used to calibrate the standard sphere, establish the initial transformation relationship between the structured light coordinate system and the world coordinate system of the three-dimensional coordinate measuring machine, collect temperature, humidity and vibration data in real time, and dynamically update the transformation relationship to form calibration parameters;
[0011] The measurement path planning module is used to divide the casting workpiece into multiple measurement areas based on calibration parameters, plan the motion path of the three-dimensional coordinate measuring machine, and drive the motion platform to move to each measurement position;
[0012] The local point cloud generation module is used to project the 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 the local point cloud data of the corresponding measurement area by solving the three-dimensional coordinates of each pixel point;
[0013] The compensation module 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 real-time collected clamping vibration data, dynamic error compensation is performed on the converted point cloud to generate an error-compensated point cloud;
[0014] The point cloud registration module is used to extract curvature feature points and plane geometric features in the overlapping areas of adjacent point clouds after error compensation, screen matching point pairs, and calculate coarse registration parameters. It also combines point-to-plane distance constraints to complete the registration of multi-view point clouds and obtain the registered multi-region point cloud data.
[0015] The 3D model analysis module is used to reconstruct the surface of multi-region point cloud data, fuse the overlapping area data to generate a complete 3D digital model of the casting workpiece, and output the dimensional error and surface morphology analysis results of the 3D digital model.
[0016] Furthermore, the standard sphere is calibrated to establish the initial transformation relationship between the structured light coordinate system and the world coordinate system of the three-dimensional coordinate measuring machine. Temperature, humidity and vibration data are collected in real time, and the transformation relationship is dynamically updated to form calibration parameters, including:
[0017] The standard ball is fixed on the worktable of the three-dimensional coordinate measuring machine, and the probe is controlled to move to multiple different positions. The Gray code and phase shift composite coding pattern is sequentially projected onto the surface of the standard ball by the projector, and the industrial camera synchronously captures the deformed fringe image modulated by the surface morphology of the standard ball;
[0018] The wrapped phase image in the deformed fringe image is solved by the phase shift method, and the absolute phase value is generated by combining the Gray code decoding result;
[0019] Based on the absolute phase value and the calibration parameters of the projector and camera, the three-dimensional coordinates of each pixel on the surface of the standard sphere are calculated to generate point cloud data of the standard sphere in the structured light coordinate system.
[0020] The point cloud data of the standard sphere in the structured light coordinate system is fitted with the least squares method. The coordinates of the center of the standard sphere in the structured light coordinate system are measured by the three-dimensional coordinate measuring machine probe to establish the initial rotation matrix and translation vector.
[0021] The temperature and humidity data are collected in real time by the environmental compensation sensor, and the probe vibration data is collected by the six-dimensional force sensor. Combined with the real-time position feedback of the three-dimensional coordinate measuring machine motion platform, the Kalman filter algorithm is used to dynamically correct the initial rotation matrix and translation vector to generate updated calibration parameters.
[0022] Furthermore, based on the calibration parameters, the casting workpiece is divided into multiple measurement areas, and the motion path of the three-dimensional coordinate measuring machine is planned to drive the motion platform to move to each measurement position, including:
[0023] Based on dynamic calibration parameters, the 3D design model of the casting workpiece is converted from the world coordinate system to the structured light coordinate system. The curvature calculation algorithm is used to identify the characteristic areas where the curvature change rate of the workpiece surface exceeds the preset threshold, and the plane geometric feature areas are extracted through the plane fitting algorithm.
[0024] The workpiece surface is divided into multiple measurement areas according to the curvature feature area and the plane feature area, and the overlap rate of adjacent measurement areas is ≥20%;
[0025] Based on the position and size of the measurement area, combined with the structured light incident angle constraints and the camera field of view, blind spots caused by occlusion or reflection are avoided. Based on the mechanical parameters and motion constraints of each motion axis of the three-dimensional coordinate measuring machine, the interpolation algorithm is used to generate the probe's continuous movement path and posture parameters.
[0026] According to the posture parameters, the three-dimensional coordinate measuring machine motion platform is controlled to move to each measurement position.
[0027] Furthermore, based on the dynamic calibration parameters, the three-dimensional design model of the casting workpiece is converted from the world coordinate system to the structured light coordinate system. The curvature calculation algorithm is used to identify the characteristic areas of the workpiece surface where the curvature change rate exceeds the preset threshold, and the plane geometric feature areas are extracted by the plane fitting algorithm, including:
[0028] Based on the dynamic calibration parameters, the three-dimensional design model of the casting workpiece is converted from the world coordinate system to the structured light coordinate system to generate three-dimensional model data in the structured light coordinate system;
[0029] For the 3D model data, the velocity vector and acceleration vector of each position are calculated point by point to obtain the curvature numerator, and the curvature value is calculated in combination with the velocity vector modulus.
[0030] The curvature value is compared with the preset threshold. If the curvature change rate exceeds the threshold, it is marked as a high curvature feature area. For areas not marked as high curvature feature areas, a plane fitting algorithm is used to perform surface fitting and calculate the residual value of each point to the fitting plane.
[0031] 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 the plane geometric feature area.
[0032] Furthermore, a composite coding pattern of Gray code and phase shift is projected onto the workpiece surface, and a deformed fringe image modulated by the workpiece surface topography is collected. By calculating the three-dimensional coordinates of each pixel point, local point cloud data of the corresponding measurement area is generated, including:
[0033] At each measurement position, a composite coding pattern of Gray code and phase shift is projected onto the workpiece surface by a projector, where Gray code is used for absolute phase encoding and phase shift fringes are used for wrapped phase encoding. An industrial camera captures images of the deformed fringes modulated by the workpiece surface topography and stores them as a time-series image sequence.
[0034] For the phase-shifted fringes in the time-series image sequence, a four-step phase-shifting 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 series to generate a continuously distributed absolute phase value.
[0035] Based on the projector calibration matrix and camera intrinsic parameters in the dynamic calibration parameters, the continuously distributed absolute phase values are mapped into three-dimensional coordinates in the structured light coordinate system to generate local point cloud data of the current measurement area.
[0036] Furthermore, the local point cloud data is preprocessed and converted 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 converted point cloud to generate an error-compensated point cloud, including:
[0037] Preprocess the local point cloud data, smooth the surface fluctuations using the moving least squares method, and output the preprocessed point cloud;
[0038] Based on the rotation matrix and translation vector in the dynamic calibration parameters, the pre-processed point cloud is converted from the structured light coordinate system to the coordinate measuring machine world coordinate system to generate a converted point cloud;
[0039] Combined with the probe clamping vibration data collected in real time by the six-dimensional force sensor, the converted point cloud is subjected to vibration noise filtering. The point cloud deformation error caused by thermal expansion is compensated based on the temperature and humidity data of the environmental compensation sensor, and the error-compensated point cloud is output.
[0040] Furthermore, in the overlapping areas of adjacent point clouds after error compensation, curvature feature points and plane geometric features are extracted, matching point pairs are screened, and coarse registration parameters are calculated. Combined with point-to-plane distance constraints, the multi-viewpoint point cloud registration is completed, and the registered multi-region point cloud data is obtained, including:
[0041] For the error-compensated point cloud, the curvature change rate is calculated point by point in the overlapping area of adjacent point clouds using a curvature calculation algorithm. Local areas where the curvature change rate exceeds a preset threshold are selected as curvature feature points. At the same time, a plane fitting is performed on the point cloud to extract continuous plane areas where the normal vector direction consistency meets the preset conditions, and the normal vector and boundary point set are recorded.
[0042] Taking curvature feature points and plane boundary points as input, a bidirectional nearest neighbor search algorithm is used to generate initial matching point pairs. Based on the geometric position relationship and normal vector direction constraints of the initial matching point pairs, a random sampling consistency algorithm is used to iteratively screen matching point pairs that meet the consistency conditions.
[0043] Based on the consistent matching point pairs, the initial rotation matrix and translation vector between adjacent point clouds are calculated through singular value decomposition. The current local point cloud is converted to the coordinate system of the adjacent point cloud based on the rotation matrix and translation vector to generate the roughly registered point cloud data.
[0044] Taking the roughly registered point cloud data as the initial value, the improved iterative closest point algorithm is used to iteratively optimize the overlapping area point cloud, that is, matching each point in the point cloud with the planar area of the adjacent point cloud. The optimization is terminated according to the change in the registration error between two adjacent iterations and the preset iteration number threshold, and finally the registered multi-region point cloud data is output.
[0045] Furthermore, the curvature feature points and plane boundary points are used as input, and the bidirectional nearest neighbor search algorithm is used to generate initial matching point pairs. Based on the geometric position relationship and normal vector direction constraints of the initial matching point pairs, the matching point pairs that meet the consistency conditions are iteratively screened through the random sampling consistency algorithm, including:
[0046] Taking the curvature feature points and plane boundary points as input, forward search and backward search are performed on the feature points in the adjacent point cloud to generate an initial set of matching point pairs;
[0047] 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, remove outlier matching points that exceed the preset distance threshold or angle threshold, and obtain a valid matching point pair set;
[0048] 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.
[0049] Furthermore, the multi-region point cloud data is reconstructed into a surface, and the overlapping region data is fused to generate a complete 3D digital model of the casting workpiece. The dimensional error and surface morphology analysis results of the 3D digital model are output, including:
[0050] For the registered multi-region point cloud data, the moving least squares method is used to fit the local surface piece by piece, with the point cloud of each measurement area as the center. By calculating the weighted least squares plane of the point set in the neighborhood of each point, the weight coefficient is dynamically adjusted to adapt to the local curvature change, generating a smooth and continuous local surface model.
[0051] For the overlapping areas of adjacent local surface models, the curvature similarity of the overlapping point sets is calculated, points with curvature differences less than a preset threshold are screened, and the coordinates of the screened points are fused to generate a complete 3D digital model.
[0052] Taking the complete 3D digital model as input, starting from the initial triangular facets, the system gradually inserts each point in the point cloud data, dynamically adjusts the connection relationship of the triangular facets, and uses the boundary detection algorithm to identify feature edges and lock the topological structure, and outputs the surface triangular mesh model;
[0053] Fit and align the triangular mesh model with the design model, calculate the distance between each point on the triangular mesh surface and the corresponding surface of the design model, and generate dimensional error distribution data;
[0054] The local curvature of the triangular mesh model is calculated point by point, and the difference analysis is performed with the curvature of the design model to generate surface topography deviation data;
[0055] Converting the size error distribution data into error numerical statistical parameters in three-dimensional space, and converting the surface topography deviation data into curvature difference statistical parameters;
[0056] Based on the error numerical statistical parameters and curvature difference statistical parameters, a quantitative analysis report containing the error mean, standard deviation and feature position deviation coordinates is generated.
[0057] In a second aspect, a computer-readable storage medium stores a program, which implements the system when executed by a processor.
[0058] The above solution of the present invention includes at least the following beneficial effects:
[0059] Calibration with a standard sphere establishes coordinate system transformations, and the calibration parameters are dynamically updated by integrating temperature, humidity, and vibration data. This effectively compensates for environmental factors (such as thermal expansion and equipment vibration) and mechanical motion errors, achieving micron-level measurement accuracy and meeting the tolerance requirements of precision castings. Kalman filtering and other technologies are used to fuse multimodal sensor data (structured light, environmental sensors, etc.), suppressing noise and achieving spatiotemporal synchronization, ensuring calibration parameter stability and avoiding measurement deviations caused by environmental fluctuations.
[0060] Based on calibration parameters, the workpiece is divided into overlapping measurement areas (overlap ratio ≥ 20%). Combining the structured light incident angle, camera field of view, and equipment motion constraints (such as high-precision servo motor positioning), an optimal path without blind spots is generated, reducing ineffective movement and shortening measurement time. Using Gray code and phase-shifted fringe composite projection technology, a single measurement can acquire sub-pixel 3D coordinates. Combined with high-speed acquisition from an industrial camera, single-area measurement takes only seconds, improving the inspection efficiency of large and complex workpieces. By extracting curvature feature points and planar geometric features, combined with bidirectional nearest neighbor search, iterative screening using a random sampling consensus algorithm, and point-to-plane distance constraints, mismatched point pairs are eliminated, achieving high-precision alignment of multi-view point clouds.
[0061] Point cloud quality is enhanced through moving least squares point cloud smoothing, statistical filtering for denoising, and real-time compensation for fixture vibration data. Surface reconstruction, curvature-weighted fusion, and triangulated meshing techniques generate smooth, continuous 3D digital models, accurately reproducing workpiece surface details (such as edges and curved surfaces). The entire process, from calibration and measurement to analysis, is fully automated, minimizing manual intervention. Industrial-grade hardware (such as a high-stability projector and anti-interference optical system) and a real-time control system ensure stability over long periods of continuous operation, making it suitable for in-line inspection on production lines. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 Schematic diagram of a three-coordinate structured light rapid measurement system for a casting workpiece provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0063] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0064] like Figure 1 As shown, an embodiment of the present invention provides a three-coordinate structured light rapid measurement system for a casting workpiece, comprising:
[0065] The calibration parameter module is used to calibrate the standard sphere, establish the initial transformation relationship between the structured light coordinate system and the world coordinate system of the three-dimensional coordinate measuring machine, collect temperature, humidity and vibration data in real time, and dynamically update the transformation relationship to form calibration parameters;
[0066] The measurement path planning module is used to divide the casting workpiece into multiple measurement areas based on calibration parameters, plan the motion path of the three-dimensional coordinate measuring machine, and drive the motion platform to move to each measurement position;
[0067] The local point cloud generation module is used to project the 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 the local point cloud data of the corresponding measurement area by solving the three-dimensional coordinates of each pixel point;
[0068] The compensation module 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 real-time collected clamping vibration data, dynamic error compensation is performed on the converted point cloud to generate an error-compensated point cloud;
[0069] The point cloud registration module is used to extract curvature feature points and plane geometric features in the overlapping areas of adjacent point clouds after error compensation, screen matching point pairs, and calculate coarse registration parameters. It also combines point-to-plane distance constraints to complete the registration of multi-view point clouds and obtain the registered multi-region point cloud data.
[0070] The 3D model analysis module is used to reconstruct the surface of multi-region point cloud data, fuse the overlapping area data to generate a complete 3D digital model of the casting workpiece, and output the dimensional error and surface morphology analysis results of the 3D digital model.
[0071] In an embodiment of the present invention, an initial conversion relationship is constructed through calibration with a standard sphere, and parameters are dynamically updated in combination with real-time collected temperature, humidity, and vibration data to improve the long-term matching accuracy between the structured light coordinate system and the three-coordinate world coordinate system and reduce coordinate deviations caused by environmental factors. Environmental compensation sensor data is integrated to achieve real-time perception and calibration of equipment motion errors and environmental fluctuations, thereby ensuring the stability of the measurement system and the accuracy of coordinate conversion. The workpiece is divided into multiple areas based on the calibration parameters, and differentiated planning is performed for feature areas and plane areas with large curvature changes to ensure complete coverage and refined measurement of complex morphologies. The motion trajectory is planned in combination with the structured light incident angle and the camera field of view to avoid measurement blind spots and equipment collisions, and the motion platform is driven to accurately position itself at each measurement position, thereby improving detection efficiency and path rationality.
[0072] A composite coding pattern of Gray code and phase shift is projected, combined with the workpiece surface deformation fringe image to calculate the coordinates of each pixel point. This effectively addresses interference from rough, reflective surfaces in cast parts, generating high-density local point cloud data. Pre-processing of the point cloud data, including denoising and smoothing, improves data quality. Coordinate system transformation and dynamic error compensation, combined with clamping vibration data, eliminate interference and ensure the accuracy of point cloud coordinates. Curvature feature points and plane geometric features are extracted in overlapping areas. Coarse registration parameters are calculated by matching point pairs. Fine registration is achieved by combining point-to-plane distance constraints, achieving high-precision alignment of multi-view point clouds.
[0073] In a preferred embodiment of the present invention, the standard sphere is calibrated to establish an initial transformation relationship between the structured light coordinate system and the world coordinate system of the coordinate measuring machine, and temperature, humidity, and vibration data are collected in real time. The transformation relationship is dynamically updated to form calibration parameters, which may include:
[0074] The standard ball is fixed on the worktable of the three-dimensional coordinate measuring machine, and the probe is controlled to move to multiple different positions. The Gray code and phase shift composite coding pattern is sequentially projected onto the surface of the standard ball by the projector, and the industrial camera synchronously captures the deformed fringe image modulated by the surface morphology of the standard ball;
[0075] The wrapped phase image in the deformed fringe image is solved by the phase shift method, and the absolute phase value is generated by combining the Gray code decoding result;
[0076] Based on the absolute phase value and the calibration parameters of the projector and camera, the three-dimensional coordinates of each pixel on the surface of the standard sphere are calculated to generate point cloud data of the standard sphere in the structured light coordinate system.
[0077] The point cloud data of the standard sphere in the structured light coordinate system is fitted with the least squares method. The coordinates of the center of the standard sphere in the structured light coordinate system are measured by the three-dimensional coordinate measuring machine probe to establish the initial rotation matrix and translation vector.
[0078] The temperature and humidity data are collected in real time by the environmental compensation sensor, and the probe vibration data is collected by the six-dimensional force sensor. Combined with the real-time position feedback of the three-dimensional coordinate measuring machine motion platform, the Kalman filter algorithm is used to dynamically correct the initial rotation matrix and translation vector to generate updated calibration parameters.
[0079] In this embodiment of the present invention, a calibration ball is placed in the center of the CMM worktable and secured with a magnetic clamp or vacuum chuck to ensure zero displacement during measurement. The probe (with an integrated projector and industrial camera) is controlled to move along a CMM guide rail, sequentially reaching 6-8 preset positions (e.g., in the ±X, ±Y, ±Z axes and diagonal directions around the calibration ball). Each position is kept within the effective structured light measurement range (e.g., 300-500 mm) from the calibration ball's surface.
[0080] At each position, the projector first projects an 8-bit Gray code pattern (a total of 8 frames, each corresponding to a 1-bit binary code, and the stripe width is halved in sequence). The industrial camera synchronously captures images at a speed of 20 frames per second and records the Gray code stripe combination of each pixel point; then it projects a 4-step phase-shifted sinusoidal stripe pattern (with phase offsets of 0, ,π, ), the camera collects 4 images again.
[0081] Wrapping phase calculation: For each pixel in the four phase-shifted fringe images, extract its grayscale value in the four images (such as 、 、 、 ). When specifically calculating the wrapped phase value, subtract the grayscale value of the fourth image from the grayscale value of the second image to obtain a value that reflects the change in the sine waveform; subtract the grayscale value of the third image from the grayscale value of the first image to obtain a value that reflects the change in the cosine waveform. Then, based on the positive and negative and size relationship of these two values, the phase angle of the pixel is calculated using the inverse tangent function. This phase angle will be limited to the range of [-π, π]. Since the sinusoidal stripes themselves are periodic, the calculated phase angle will show a "folding" phenomenon, which may cause the phase values of adjacent pixels to suddenly change by more than π. For example, if the phase value of one pixel is 1.5π, the phase value of the adjacent pixel may be -1.5π. This is a "phase jump."
[0082] Gray code decoding: For 8 Gray code images, the 8-bit binary code of each pixel corresponds to a unique number of fringe cycles (such as 0-255 cycles). For example, the fringe width of the first Gray code image is , the second picture is , and so on, the absolute period to which each pixel belongs is determined by the combination of light and dark changes of the stripes.
[0083] The wrapped phase value is combined with the number of periods determined by the Gray code to calculate the absolute phase value (for example, if the wrapped phase is 1.5π and the number of Gray code periods is 5, then the absolute phase is 5×2π+1.5π=11.5π), eliminating the periodic ambiguity and obtaining a continuous phase distribution.
[0084] The projector parameters are calibrated in advance using a three-dimensional target (such as a chessboard array) to determine the geometric relationship between the projector pixel coordinates (up, vp) and the projection light (such as the projection center coordinates, focal length, and distortion coefficient). The Zhang Zhengyou calibration method is used to calculate the camera's intrinsic parameters (focal length f, principal point (u0, v0), radial distortion) by taking 15 chessboard images at different angles. ,in, is the first-order radial distortion coefficient, ranging from -0.1 to 0.1; is the second-order radial distortion coefficient, between -0.01 and 0.01) and external parameters (rotation matrix Rc, translation vector Tc), to ensure the mapping accuracy of pixel coordinates (x, y) and world coordinates. For each pixel's absolute phase value, determine its position in the projector's projected stripes (such as stripe number n= ), combined with the pixel coordinates (x, y) of the point captured by the camera, using the relative position (Rp, Tp) of the projector and the camera, the three-dimensional coordinates of the point in the structured light coordinate system are calculated through geometric triangulation:
[0085] For a structured light stripe projected by a projector, its direction in the projector coordinate system is known (e.g., along the positive X-axis). This direction can be converted into a direction vector in the structured light coordinate system using Rp and Tp. For example, a 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. A ray emitted by a projector can be considered a ray extending from its optical center (determined by Tp) along a specific direction (determined by the stripe position and Rp). For example, if a pixel corresponds to the nth stripe of a projector, the ray in the structured light coordinate system extends diagonally upward from the projector's optical center. A pixel captured by an industrial camera corresponds to a ray starting from the camera's optical center (the camera's Tp parameter) and passing through that pixel. For example, if the camera's optical center is at (100, 100, 100) in the structured light coordinate system and a pixel is located in the upper right corner of the image, then the camera ray extends from the optical center to the upper right. The two rays (the projected ray and the camera ray) should intersect at point P on the surface of the standard sphere. In actual calculations, the closest intersection point is found by adjusting the extension distance of the two rays:
[0086] First, estimate the approximate distance from the projector to the calibration sphere (for example, 300 mm). This serves as the initial value for the projection ray extension parameter g. At this point, the coordinates of a point on the projection ray are: starting from the projector's optical center, the point reached by advancing 300 mm in the ray direction. Similarly, estimate the approximate distance from the camera to the calibration sphere (for example, 300 mm). This serves as the initial value for the camera ray extension parameter s. The coordinates of a point on the camera ray are: starting from the camera's optical center, the point reached by advancing 300 mm in the ray direction. At this point, the points on the two rays may not intersect exactly, and there may be discrepancies in their spatial coordinates (for example, 5 mm in the X direction, 3 mm in the Y direction, and 4 mm in the Z direction).
[0087] Iteratively adjust parameters:
[0088] The first step of adjustment:
[0089] First, fix the value of g and gradually increase or decrease the value of s (for example, by 1 mm at a time) to observe the change in the coordinate difference between the points on the two rays. For example, when s is increased to 305 mm, the difference in the X direction decreases to 2 mm, the difference in the Y direction decreases to 1 mm, and the difference in the Z direction decreases to 3 mm, indicating that the adjustment direction is correct.
[0090] Second step adjustment:
[0091] Fix the current s=305 mm and gradually adjust the g value (for example, 1 mm at a 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.
[0092] Reduce the adjustment step size (for example, 0.1 mm at a 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, which is considered to meet the accuracy requirements.
[0093] When the coordinate differences in the X, Y, and Z directions are small enough (for example, all less than 0.01 mm), the average coordinates of the points on the projection light and the camera light are taken as the final coordinates of the intersection point P.
[0094] 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 by the above-mentioned geometric intersection method, thereby forming a dense point set covering the surface of the standard sphere. The distance from each point to the center of the standard sphere is calculated. For example, if the radius of the standard sphere is 50mm, if a point is 50.2mm or 49.8mm away from the center of the sphere, and the deviation exceeds the preset threshold (such as 0.1mm), then the point is considered to be an abnormal point caused by noise or reflection, and it is removed from the point cloud. By adjusting the resolution of the projector (such as 1920×1080 pixels) and the measurement distance (such as 300mm), the density of the final point cloud on the surface of the standard sphere reaches about 100 points / mm. 2 For example, at 1mm 2 The spherical area contains about 100 three-dimensional coordinate points, ensuring that the subtle undulations of the spherical surface can be accurately captured.
[0095] Spherical fitting: For the point cloud data in the structured light coordinate system, assume that the spherical equation is (Xs Xsc) 2 +(Ys Ysc) 2 +(Zs Zsc) 2 =R 2 , the coordinates (Xsc, Ysc, Zsc) of the sphere center obtained by spherical fitting in the structured light coordinate system and the radius R of the standard sphere obtained by spherical fitting are iteratively adjusted by the least squares method to minimize the sum of the squares of the distances from all points to the sphere (iterative termination condition: the change in the coordinates of the sphere center between two adjacent times is less than 0.001mm); where (Xs, Ys, Zs) is the three-dimensional coordinate of any point on the surface of the standard sphere in the structured light coordinate system.
[0096] Three-dimensional coordinate measurement of the sphere center: Switch to the contact probe of the three-dimensional coordinate measuring machine (such as a ruby stylus) and manually touch 3-5 points at different positions on the surface of the standard sphere. After the touch measurement is completed, select the "Fit sphere center" function in the measurement software. The software will automatically calculate the sphere center position using the collected touch point coordinates. The specific process is as follows:
[0097] The software calculates the final sphere center position based on the coordinates of all touch points, ensuring that each touch point is the same distance from the center (that is, minimizing the difference in distance from each point to the center). Once the calculation is complete, the software displays the coordinates of the sphere center in the three-dimensional world coordinate system (Xwc, Ywc, Zwc).
[0098] Initial conversion parameters:
[0099] 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.
[0100] Rotation matrix R: The principal axis alignment relationship between the structured light coordinate system and the world coordinate system is calculated 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 sphere (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°).
[0101] Temperature and humidity sensor: This sensor collects ambient temperature and humidity in real time to calculate the thermal expansion and deformation of the three-dimensional coordinate guide rail and the probe (for example, the thermal expansion coefficient of a steel guide rail: when the temperature changes by 5°C, the length of a 1m guide rail changes by approximately 55μm).
[0102] Six-axis force sensor: Installed at the probe connection, collects X / Y / Z axis acceleration at 100Hz (resolution 0.01m / s 2 ) and angular velocity (resolution 0.001° / s), monitoring vibration disturbances (such as vibration amplitude greater than 0.05mm / s when the equipment is running) 2 compensation is triggered when
[0103] 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 motion or stationary state (the error is large during motion and filtering needs to be strengthened).
[0104] Kalman filter processing:
[0105] The state vector of the Kalman filter is used to describe the coordinate system conversion parameters and contains 6 key parameters:
[0106] The Euler angles (α, β, γ) of the rotation matrix R: α (rotation angle around the X-axis), β (rotation angle around the Y-axis), and γ (rotation angle around the Z-axis) are used to represent the posture of the structured light coordinate system relative to the world coordinate system. For example, α = 0.5° means that the structured light coordinate system is rotated 0.5 degrees around the X-axis, resulting in a tilted projection light direction.
[0107] The three components of the translation vector T (Tx, Ty, Tz): Tx, Ty, and Tz represent the offset of the origin of the structured light coordinate system in the X, Y, and Z axes of the world coordinate system (unit: mm). For example, Tz = 3 mm means that the structured light coordinate system is 3 mm higher than the world coordinate system in the Z axis direction.
[0108] State prediction process:
[0109] Assume that the state vector at the previous moment is , combined with the speed information of the coordinate measuring machine motion platform, predict the current state:
[0110] If the probe is stationary: the velocity is 0, and the predicted state is the same as the previous moment, that is, .
[0111] If the probe moves: Based on the speed of the motion platform in the X / Y / Z axis (e.g. Vx=5mm / s), calculate the change of the translation vector by integration (e.g. Vx×Δt, Δt is the time interval), and predict the new translation component ( ), the rotation component does not change temporarily (assuming the posture does not change during movement).
[0112] Temperature change ΔT will cause the CMM guide rail and probe to expand thermally. For example, the thermal expansion coefficient of a steel guide rail is b=11× / ℃, when the guide rail length L = 1000mm, a temperature change of 2℃ will cause a length change of ΔL = b × L × ΔT = 0.022mm, which in turn causes the Z-axis component of the translation vector T to change ΔTz = ΔL (assuming the guide rail is along the Z-axis direction).
[0113] The vibration acceleration collected by the six-dimensional force sensor (such as the acceleration in the Z-axis direction is 0.1m / s 2 ), calculate the vibration displacement by integration ΔZ=0.5×Z-axis acceleration×(Δt) 2 The disturbance value calculated by the sensor is used as the “measured value” and compared with the predicted state vector to obtain the difference (e.g., if the Z-axis component of the predicted translation vector T is Tz = 100 mm, the measured value shows that Tz should be corrected to 100.0215 mm, resulting in a difference of ΔTz = 0.0215 mm).
[0114] The final correction is calculated based on the Kalman gain, and the state vector is updated. For example, if the original prediction Tz = 100mm and the correction ΔTz = 0.021mm, the updated Tz = 100.021mm. The Euler angles α, β, and γ are similarly corrected based on the posture offset caused by vibration (e.g., 0.01°). Kalman filter calibration is automatically initiated after every 10 workpiece measurements, ensuring regular parameter updates regardless of environmental changes. Calibration is triggered immediately when the ambient temperature changes by more than 2°C (e.g., temperature fluctuations caused by air conditioning in the workshop). For example, if the initial temperature is 20°C and the current temperature is 22.1°C, and ΔT = 2.1°C is greater than 2°C, calibration is triggered. Calibration can also be triggered when the humidity changes by more than 10%RH (optional trigger condition). 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 three-coordinate system is always less than ±0.05mm.
[0115] By measuring a standard sphere in multiple poses, the system covers the entire surface, avoiding blind spots associated with single-view measurement and ensuring the global accuracy of coordinate system transformation. Gray code is combined with phase-shift encoding to eliminate periodic errors in phase resolution and adapt to the complex fringe deformations of the standard sphere's curved surface. Real-time collection of environmental data such as temperature, humidity, and vibration is used. Kalman filtering dynamically corrects coordinate system transformation parameters to offset the impact of workshop environmental fluctuations (such as temperature changes and equipment vibration) on measurement accuracy, ensuring long-term measurement stability. An initial transformation relationship is established based on the standard sphere's geometric properties (spherical fitting), using precise contact measurement results as a benchmark to ensure accurate alignment between the structured light and three-coordinate coordinate systems. Automatic sensor data collection and real-time algorithm processing reduce manual intervention, improve calibration efficiency, and avoid errors introduced by human operators.
[0116] In a preferred embodiment of the present invention, based on calibration parameters, the casting workpiece is divided into multiple measurement areas, and the motion path of the three-dimensional coordinate measuring machine is planned, and the motion platform is driven to move to each measurement position, which may include:
[0117] Based on dynamic calibration parameters, the 3D design model of the casting workpiece is converted from the world coordinate system to the structured light coordinate system. The curvature calculation algorithm is used to identify the characteristic areas where the curvature change rate of the workpiece surface exceeds the preset threshold, and the plane geometric feature areas are extracted through the plane fitting algorithm. Specifically, the following steps are performed:
[0118] Based on the dynamic calibration parameters, the three-dimensional design model of the casting workpiece is converted from the world coordinate system to the structured light coordinate system to generate three-dimensional model data in the structured light coordinate system;
[0119] For the 3D model data, the velocity vector and acceleration vector of each position are calculated point by point to obtain the curvature numerator, and the curvature value is calculated in combination with the velocity vector modulus.
[0120] The curvature value is compared with the preset threshold. If the curvature change rate exceeds the threshold, it is marked as a high curvature feature area. For areas not marked as high curvature feature areas, a plane fitting algorithm is used to perform surface fitting and calculate the residual value of each point to the fitting plane.
[0121] 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 the plane geometric feature area;
[0122] The workpiece surface is divided into multiple measurement areas according to the curvature feature area and the plane feature area, and the overlap rate of adjacent measurement areas is ≥20%;
[0123] Based on the position and size of the measurement area, combined with the structured light incident angle constraints and the camera field of view, blind spots caused by occlusion or reflection are avoided. Based on the mechanical parameters and motion constraints of each motion axis of the three-dimensional coordinate measuring machine, the interpolation algorithm is used to generate the probe's continuous movement path and posture parameters.
[0124] According to the posture parameters, the three-dimensional coordinate measuring machine motion platform is controlled to move to each measurement position.
[0125] In the embodiment of the present invention, for each vertex in the 3D design model, its X coordinate in the world coordinate system is added with the X component of the translation vector, its Y coordinate is added with the Y component of the translation vector, and its Z coordinate is added with the Z component of the translation vector. For example, the original vertex coordinates are (10, 20, 30), and the translation vector is (5, 3, 2), the coordinates after translation become (10+5, 20 3, 30 + 2). Rotate the translated vertex coordinates around the X, Y, and Z axes in sequence. For example, when rotating around the X axis, keep the X coordinate unchanged, and adjust the Y and Z coordinates based on the rotation angle (a positive rotation angle decreases the Y coordinate and increases the Z coordinate; a negative rotation angle does the opposite). Similarly, rotate the Y and Z axes, each rotation based on the coordinate values from the previous rotation.
[0126] Curvature calculation:
[0127] For a point on the model surface, analyze its positional relationship with its neighboring points. For example, if the point is offset further to the right than its neighboring points in the X direction, the velocity vector's X-axis component is larger; if it is offset upward in the Y direction, the Y-axis component is positive. The velocity magnitude is calculated by dividing the distance between the point and its neighboring points by the sampling interval (assuming the interval is fixed). Compare the changes in the velocity vector at that point at different times. For example, if the velocity vector's X-axis component increases at the current moment compared to the previous moment, the acceleration vector's X-axis component is positive. The acceleration magnitude is calculated by dividing the velocity change by the interval. The degree of difference in direction between the acceleration vector and the velocity vector is used as the numerator of the curvature. For example, if the acceleration direction is perpendicular to the velocity direction, the numerator is larger; if the directions are the same, the numerator is zero. The velocity vector modulus is the velocity magnitude; dividing the numerator by the velocity modulus gives the curvature value.
[0128] Determine a curvature change threshold based on the workpiece design requirements. For example, for workpieces with relatively smooth surfaces, the threshold can be set to 0.05; for workpieces with complex surfaces, the threshold can be appropriately increased to 0.1.
[0129] For each point on the model surface, the curvature difference between it and its adjacent points is calculated and divided by the distance between the two points. If the rate of change of the curvature of the points within a region exceeds a preset threshold, the region is marked as a high curvature feature. For example, if the threshold is 0.01 / mm, and the curvature change rate of most points in a region is above 0.03 / mm, the region is marked.
[0130] Plane geometric feature region extraction:
[0131] For areas that are not marked as high curvature features, a plane fitting algorithm is used to process them. First, assume a plane equation, which is generally in the form of Ax+By+Cz+D=0, where (A, B, C) represents the normal vector of the plane, (x, y, z) is the coordinate of the point on the plane, and D is a constant. For each point Q(x0, y0, z0) in the area, its coordinates are substituted into the plane equation and the result is calculated by The residual value from point Q to the hypothetical plane is obtained. This value represents the perpendicular distance from point Q to the plane. If the residuals of all points in a region are less than a preset tolerance (e.g., 0.1 mm), the region is determined to be a plane geometric feature region. At the same time, the direction of its normal vector is determined by fitting the plane equation. Since (A, B, C) in the plane equation Ax+By+Cz+D=0 is the plane's normal vector, the normal vector direction can be directly derived.
[0132] For high-curvature feature areas, a measurement area is formed by extending a certain distance (e.g., 5mm) beyond its boundary. For example, if the boundary of the original high-curvature area is a circle with a radius of 10mm, the boundary of the expanded measurement area is a circle with a radius of 15mm. Large plane areas are divided into multiple small areas, and the size of each small area is determined by the camera's field of view. For example, if the camera's field of view is 20mm×20mm, the plane is divided into square areas with a side length of 15mm to ensure that adjacent areas overlap. The boundaries of adjacent measurement areas overlap, and the width of the overlapping part is at least 20% of the area width. For example, if a region is 10mm wide, the overlap with the adjacent region is at least 2mm.
[0133] Calculate the angle at which structured light is projected onto each measurement area, ensuring that the light is perpendicular to the surface and unobstructed. For example, for vertical walls, the light should be projected horizontally; for inclined surfaces, the light direction should be adjusted to a specific angle (e.g., 30°) with respect to the surface normal. For areas that exceed the camera's single field of view, divide them into multiple subareas and plan the camera position and angle to fully capture each subarea. For example, for a long, rectangular area, the camera should be moved multiple times along its length to capture the image. Consider surface features such as bumps and grooves on the workpiece and plan the probe's movement path to avoid obstacles. For example, if there is a 10mm bump, the probe should be raised 15mm before moving to the area and then moved horizontally over the bump. Optimize velocity changes along the path based on the maximum speed and acceleration of each axis of the CMM. For example, use maximum speed for long, straight-line moves and decelerate appropriately around turns to ensure smooth motion and within the equipment's capabilities.
[0134] The planned pose parameters (e.g., X=50mm, Y=30mm, Z=20mm, tilt angle = 45°) are converted into commands that the control system can understand. For example, coordinate values are converted into motor pulse counts, and angle values are converted into the step size of the rotary stage. Each axis motor is driven sequentially according to the parsed commands. For example, the X-axis motor is first controlled to move the probe to the 50mm position, the Y-axis motor is then controlled to move to the 30mm position, and finally the Z-axis height and probe angle are adjusted. After the probe reaches each measurement position, the measurement system is triggered to collect data. For example, for a contact probe, the coordinate values at the moment of contact are recorded; for a laser scanning probe, the angle and intensity of the reflected light are recorded.
[0135] Translation vector calculation:
[0136] The position difference between the origin of the world coordinate system and the structured light coordinate system is obtained by measuring the 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).
[0137] Rotation matrix calculation:
[0138] By repeatedly measuring the coordinates of the standard sphere in different postures, the rotation relationship between the two coordinate systems can be calculated. For example, by measuring the change in the coordinates of the standard sphere after rotating it 90° around the X-axis, the rotation angle around the X-axis can be determined. Similarly, the rotation angles of the Y and Z axes can be calculated.
[0139] Intermediate points are inserted between adjacent measurement points to ensure a smooth path. For example, given a starting point (0, 0, 0) and an end point (10, 10, 10), nine intermediate points are inserted so that the X, Y, and Z coordinates increase evenly from 0 to 10, respectively.
[0140] By calculating curvature and fitting planes, the system identifies distinct feature areas, focusing measurements on high-curvature areas and streamlining measurements on flat surfaces, improving measurement efficiency and resource utilization. Adjacent measurement areas must overlap by 20% or more to effectively avoid blind spots, ensuring every detail of the workpiece surface is captured, and enhancing the comprehensiveness and accuracy of measurement results. Path planning, combining the characteristics of structured light, cameras, and coordinate measuring machines, avoids occlusion and reflections while meeting equipment motion constraints, minimizing wasted movement, shortening measurement time, and improving overall measurement efficiency.
[0141] In a preferred embodiment of the present invention, a Gray code and phase shift composite coding pattern is projected onto the workpiece surface, and a deformed fringe image modulated by the workpiece surface topography is collected. By calculating the three-dimensional coordinates of each pixel point, local point cloud data corresponding to the measurement area is generated, which may include:
[0142] At each measurement position, a composite coding pattern of Gray code and phase shift is projected onto the workpiece surface by a projector, where Gray code is used for absolute phase encoding and phase shift fringes are used for wrapped phase encoding. An industrial camera captures images of the deformed fringes modulated by the workpiece surface topography and stores them as a time-series image sequence.
[0143] For the phase-shifted fringes in the time-series image sequence, a four-step phase-shifting 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 series to generate a continuously distributed absolute phase value.
[0144] Based on the projector calibration matrix and camera intrinsic parameters in the dynamic calibration parameters, the continuously distributed absolute phase values are mapped into three-dimensional coordinates in the structured light coordinate system to generate local point cloud data of the current measurement area.
[0145] In an embodiment of the present invention, the Gray code pattern projects:
[0146] Gray code is a binary code where only one bit differs between adjacent values. When projecting, project from the lowest bit to the highest bit, for example:
[0147] Bit 1: Projects a completely black (0) or completely white (1) image;
[0148] Second bit: Split the image into two halves, with the left half black and the right half white (or vice versa);
[0149] Bit 3: Divide the image into four equal parts, alternating black and white (e.g. black-white-black-white);
[0150] Similarly, N images are required to project an N-bit Gray code. In this way, the Gray code value of each pixel uniquely corresponds to its position on the projection plane.
[0151] Phase-shifted fringe pattern projection:
[0152] Phase-shifted stripes are a set of alternating light and dark sinusoidal stripes that encode phase information through four phase shifts (0°, 90°, 180°, and 270°). An image is projected after each phase shift, for a total of four images. For example:
[0153] Picture 1: The brightness of the stripes is distributed according to a sine wave, with an initial phase of 0°;
[0154] Picture 2: The stripes shift to the right as a whole Period (90° phase shift);
[0155] Picture 3: Stripes shifted to the right Period (180° phase shift);
[0156] Picture 4: Stripes shift to the right period (270° phase shift).
[0157] An industrial camera synchronously captures images of deformed fringes modulated by the workpiece surface. Due to the varying heights of the workpiece surface, the fringes are distorted. For example, in raised areas, the fringes appear compressed, while in recessed areas, they appear stretched. The captured images are stored as a time-series sequence (Gray code image first, then phase-shifted image) in the order in which they were projected.
[0158] Four-step phase shift method to solve the wrapping phase:
[0159] For each pixel in the four phase-shifted images, calculate its wrapped phase value. The specific steps are as follows:
[0160] Extract pixel values: Extract the brightness value of the same pixel from four images 、 、 、 ;
[0161] Calculate the inverse tangent value: Wrap phase value = arctan( ).
[0162] The phase value is limited to the range of [-π, π], forming a "wrapping" phenomenon (similar to a clock hand returning to 1 o'clock after exceeding 12 o'clock).
[0163] Gray code decoding determines integer periods:
[0164] For each pixel in the Gray code image sequence, convert the binary Gray code to a decimal value G. For example:
[0165] If the values of a pixel in the three Gray code images are 1, 0, and 1 (Gray code 101), converted to decimal, it is 5. This value G corresponds to the integer number of periods of the phase shift fringe, W = G. Combining the wrapped phase value with the integer period W, we get the absolute phase value of the pixel = 2πW + wrapped phase value.
[0166] 3D coordinate mapping and point cloud generation:
[0167] The projector calibration matrix contains parameters such as projection center coordinates, focal length, distortion coefficient, etc. Through this matrix, the absolute phase value is mapped to the two-dimensional coordinates (up, vp) in the projector coordinate system. For example:
[0168] Horizontal coordinate up: linearly related to the absolute phase value (e.g. up = absolute phase value × ).
[0169] Vertical coordinate vp: determined by the phase change rate of adjacent pixels.
[0170] Camera internal parameter application:
[0171] The camera intrinsic parameters (focal length, principal point, distortion coefficient) are used to convert the image pixel coordinates (uk, vk) collected by the camera into a direction vector in the camera coordinate system.
[0172] Triangulation calculates 3D coordinates:
[0173] 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 principle of triangulation. For example:
[0174] Construct the ray equation: The ray cast by the projector and the ray observed by the camera intersect in space.
[0175] Solve the intersection point: Determine the coordinates of the intersection point in space by minimizing the distance between two rays.
[0176] This process is repeated for all pixels to generate local point cloud data of the current measurement area.
[0177] Gray code provides globally unique encoding, resolving ambiguity in phase unwrapping and preventing "cycle skipping" errors. The four-step phase shift method averages noise through multiple phase shifts, improving phase measurement accuracy (down to sub-pixel levels). Composite encoding requires only N+4 images (N is the number of Gray code bits), reducing the number of images compared to pure phase shifting methods and increasing measurement speed. Gray code is highly robust to partial occlusion and reflections. Even if image quality in some areas is poor, it can still be decoded from adjacent areas. Dynamic calibration parameters compensate for environmental changes (such as temperature and vibration) to ensure long-term measurement stability.
[0178] In a preferred embodiment of the present invention, local point cloud data is preprocessed and converted from a structured light coordinate system to a world coordinate system; dynamic error compensation is performed on the converted point cloud in combination with real-time acquired clamping vibration data to generate an error-compensated point cloud, which may include:
[0179] Preprocess the local point cloud data, smooth the surface fluctuations using the moving least squares method, and output the preprocessed point cloud;
[0180] Based on the rotation matrix and translation vector in the dynamic calibration parameters, the pre-processed point cloud is converted from the structured light coordinate system to the coordinate measuring machine world coordinate system to generate a converted point cloud;
[0181] Combined with the probe clamping vibration data collected in real time by the six-dimensional force sensor, the converted point cloud is subjected to vibration noise filtering. The point cloud deformation error caused by thermal expansion is compensated based on the temperature and humidity data of the environmental compensation sensor, and the error-compensated point cloud is output.
[0182] In an embodiment of the present invention, for each point in the local point cloud, the average distance between it and the neighboring points is calculated. For example, all points within a radius of 5 mm with the current point as the center are regarded as the neighborhood. If the average distance of a point exceeds 3 times the global average distance, it is determined to be 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 squares of the distances from the neighboring points to the plane is minimized. For example: the center of mass of the neighboring points is calculated as the center of the plane; the plane normal vector (i.e., the eigenvector corresponding to the minimum eigenvalue) is determined by principal component analysis; point P is projected onto the plane to obtain a smoothed new position P', and this process is repeated to update the entire point cloud point by point.
[0183] Coordinate system conversion (structured light → world coordinate system):
[0184] For each pre-processed point P (x, y, z), add the translation vector (Tx, Ty, Tz) in the dynamic calibration parameters to its coordinates. For example: if Tx = 5mm, Ty = 3mm, Tz=2mm, then the coordinate after translation is P'(x+5, y 3, z+2); rotate the translated point P' around the X, Y, and Z axes of the world coordinate system in sequence. For example: rotate around the X axis Degrees: Adjust the Y and Z coordinates (Y'=Y×cos Z×sin , Z'=Y×sin +Z×cos ); Rotate around the Y axis Degrees: Adjust the X and Z coordinates (X'=X×cos +Z×sin , Z'= X×sin +Z×cos ); Rotate around the Z axis Degrees: Adjust the X and Y coordinates (X'=X×cos Y×sin , Y'=X×sin +Y×cos );Rotation angle 、 、 Determined by the rotation matrix in the dynamic calibration parameters.
[0185] Dynamic error compensation:
[0186] Acquire vibration data (acceleration, displacement) synchronized with the point cloud acquisition time from the six-dimensional force sensor, convert the vibration signal to the frequency domain through Fourier transform, and identify the main vibration frequency (such as 50Hz, 100Hz, and other equipment characteristic frequencies). For each point P, predict the displacement deviation caused by vibration (such as ±0.1mm in the X direction) based on its acquisition time and vibration data, and then compensate for the deviation in reverse. Determine the thermal expansion coefficient of the workpiece material, and construct a workpiece surface temperature distribution model based on the temperature and humidity sensor data (such as calculating the temperature of each point by interpolation). For each point P, calculate the guide rail length change ΔL= caused by temperature. × thermal expansion coefficient of workpiece material × (temperature at each point Reference temperature), where is the original length of the guide rail at the reference temperature; point P is moved a distance ΔL along its normal vector to complete thermal expansion compensation.
[0187] Preprocessing removes outliers and smoothes surfaces, reducing measurement noise and improving the accuracy of surface details. Vibration filtering eliminates artifacts caused by equipment vibration, making the point cloud more accurate to the actual workpiece topography. Dynamic calibration parameters are updated in real time to accommodate minor equipment movement during measurement. Thermal expansion compensation eliminates dimensional errors caused by ambient temperature fluctuations (for example, a 1°C temperature difference can cause a 1m long steel workpiece to change by approximately 0.01mm). Vibration compensation reduces dynamic errors caused by equipment motion or external interference. The compensated point cloud more accurately reflects the designed workpiece dimensions, reducing misjudgment rates.
[0188] In a preferred embodiment of the present invention, in the overlapping area of adjacent point clouds after error compensation, curvature feature points and plane geometric features are extracted, matching point pairs are screened, and coarse registration parameters are calculated. In combination with point-to-plane distance constraints, multi-view point cloud registration is completed to obtain registered multi-region point cloud data, which may include:
[0189] For the error-compensated point cloud, the curvature change rate is calculated point by point in the overlapping area of adjacent point clouds using a curvature calculation algorithm. Local areas where the curvature change rate exceeds a preset threshold are selected as curvature feature points. At the same time, a plane fitting is performed on the point cloud to extract continuous plane areas where the normal vector direction consistency meets the preset conditions, and the normal vector and boundary point set are recorded.
[0190] Taking curvature feature points and plane boundary points as input, a bidirectional nearest neighbor search algorithm is used to generate initial matching point pairs. Based on the geometric position relationship and normal vector direction constraints of the initial matching point pairs, a random sampling consistency algorithm is used to iteratively screen matching point pairs that meet the consistency conditions. Specifically, the algorithm includes:
[0191] Taking the curvature feature points and plane boundary points as input, forward search and backward search are performed on the feature points in the adjacent point cloud to generate an initial set of matching point pairs;
[0192] 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, remove outlier matching points that exceed the preset distance threshold or angle threshold, and obtain a valid matching point pair set;
[0193] 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;
[0194] Based on the consistent matching point pairs, the initial rotation matrix and translation vector between adjacent point clouds are calculated through singular value decomposition. The current local point cloud is converted to the coordinate system of the adjacent point cloud based on the rotation matrix and translation vector to generate the roughly registered point cloud data.
[0195] Taking the roughly registered point cloud data as the initial value, the improved iterative closest point algorithm is used to iteratively optimize the overlapping area point cloud, that is, matching each point in the point cloud with the planar area of the adjacent point cloud. The optimization is terminated according to the change in the registration error between two adjacent iterations and the preset iteration number threshold, and finally the registered multi-region point cloud data is output.
[0196] In this embodiment of the present invention, in the overlapping area of adjacent point clouds, a spherical range with a radius of 2mm is taken for each point, and the points within the range are regarded as neighborhood points. The curvature is evaluated by comparing the height difference between the point and the neighboring points. The greater the height difference, the higher the curvature. 0.05 is set as the maximum height change rate threshold allowed per unit length. If the curvature change rate of a point exceeds this threshold, it is marked as a curvature feature point, such as a point on a workpiece edge, a boss vertex, etc.
[0197] Plane region extraction:
[0198] The point cloud data in the overlapping area is divided into groups of 50 points. If the point cloud density is high, the number of points in each group can be reduced (for example, to 30 points) to avoid computational redundancy. If the point cloud density is low, the number of points in each group can be increased appropriately (for example, to 80 points) to ensure that each group effectively reflects the local geometric characteristics. During grouping, there will be a certain amount of overlap between adjacent groups to ensure continuity of analysis. For each group of points, the average X, Y, and Z coordinates of all points in the group are first calculated to obtain the centroid of the group, which represents the average position of the points in the group in space. Next, by analyzing the spatial distribution of the points within the group, a direction is found that makes the distribution of the points in this direction the flattest. The vector corresponding to this direction is the normal vector of the fitted plane. For example, if the direction found is parallel to the Z axis, the normal vector may be (0, 0, 1), indicating that the fitted plane is perpendicular to the Z axis. After completing the plane fitting and obtaining the normal vector for each group of points, the normal vectors of adjacent groups are compared. Calculate the angle between two adjacent groups of normal vectors. If the angle is less than 10°, the two groups are considered to belong to the same continuous plane region. If the angle is greater than or equal to 10°, they are considered to belong to different plane regions. In this way, all adjacent groups are checked in sequence, and the groups that belong to the same continuous plane region are merged.
[0199] After determining each continuous planar region, the plane's normal vector is recorded, which defines the plane's orientation. At the same time, a set of boundary points is identified and recorded. Specifically, for each point in the region, its neighboring points (e.g., points within a 1mm radius centered on the point) are checked. If any of the neighboring points does not belong to the current planar region, the point is marked as a boundary point. Together, these boundary points form the edge contour of the planar region.
[0200] Bidirectional nearest neighbor search:
[0201] For each point PF among the curvature feature points of point cloud F, the Euclidean distance calculation is used to find the point PG closest to it among the curvature feature points and plane boundary points of point cloud G, forming a candidate matching pair (PF, PG). For each candidate matching pair, check whether the nearest neighbor of PG in point cloud G is PF. If not, the pair is eliminated to ensure bidirectional consistency of the matching. After bidirectional screening, all point pairs that meet the bidirectional nearest neighbor condition are retained to form the initial matching set, for example, a set containing 100 matching points is obtained.
[0202] For the initial matching point pairs, two deviations are calculated: one is the Euclidean distance deviation. Ideally, the theoretical distance of the matching point pairs is 0. The difference between the actual spatial distance and the theoretical distance is calculated. If it exceeds the preset threshold of 0.3mm, the point pair is removed. The other is the normal vector angle deviation. If the matching point pair belongs to a planar area, the normal vector angle of the plane is calculated. If it exceeds the preset threshold of 15°, the point pair is removed.
[0203] Randomly select three pairs of valid matching points from the set. Use these three pairs to calculate a temporary rotation matrix and translation vector to transform the points of point cloud A to the coordinate system of point cloud B. Transform all matching points using the temporary parameters, and count the number of point pairs (inliers) whose distance after transformation is less than 0.2 mm. Repeat the random sampling, parameter calculation, and counting process 100 times. Select the matching point pair with the set of parameters that has the largest number of inliers as the final consistent matching point pair.
[0204] Singular Value Decomposition (SVD):
[0205] After obtaining the final consistent matching point pairs, they are classified and organized into two independent point sets, point set E and point set Y, based on the different point clouds to which they belong. This ensures that the points in the two point sets correspond to feature points on the surface of the same object from different perspectives. For point set E, the X coordinates of all points in it are added together and then divided by the number of points in point set E to obtain the average coordinate in the X direction. The average coordinates in the Y and Z directions are calculated in the same way. These three averages together determine the center of mass of point set E. The center of mass of point set Y is calculated in the same way. The center of mass represents the average position of the point set in space.
[0206] The centroid coordinates of point set E and point set Y, as well as the specific coordinate information of all matching point pairs, are input into the singular value decomposition algorithm together, and two key parameters are finally output: the rotation matrix R and the translation vector T. The rotation matrix R contains the angle information required to rotate point set E to be consistent with the direction of point set Y. 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 as the centroid coordinates of point set Y minus the centroid coordinates of point set E, which clarifies the distance that point set E needs to be translated in the X, Y, and Z directions, so that point set E can be accurately moved to the position corresponding to point set Y in space.
[0207] For each point in the current local point cloud, the rotation matrix R is first used to change the direction, and then the translation vector T is added to transform the point cloud into the coordinate system of the adjacent point cloud to achieve coarse registration, so that the point clouds in the overlapping area are initially aligned. For each point P in the coarsely registered point cloud A, the nearest plane area is found in point cloud B based on the plane normal vector and plane equation. The vertical distance from point P to the plane area is calculated as the registration error, and point P is projected onto the plane to obtain the new position P'. The sum of the registration errors of two consecutive iterations is calculated. If the preset number of iterations reaches 50, the iteration is stopped and the fully aligned multi-region point cloud data is output.
[0208] 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 edges and planes), reducing the probability of mismatching. The RANSAC algorithm effectively eliminates outliers through random sampling and consistency verification. The bidirectional nearest neighbor search quickly narrows the matching range and avoids traversing the entire point cloud. Vector constraints and plane matching take into account the local geometric structure of the point cloud (such as plane direction) and have better adaptability to noise and incomplete surface areas (such as holes). The improved point-plane matching mode of the ICP algorithm is more suitable for the planar features of the casting workpiece (such as parting surfaces and flange planes) than traditional point-point matching, and the registration accuracy can reach the micron level. Forced alignment of overlapping areas (overlap rate ≥ 20%) ensures that there are no stitching gaps in the point cloud.
[0209] In a preferred embodiment of the present invention, surface reconstruction is performed on multi-region point cloud data, overlapping region data 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, which may include:
[0210] For the registered multi-region point cloud data, the moving least squares method is used to fit the local surface piece by piece, with the point cloud of each measurement area as the center. By calculating the weighted least squares plane of the point set in the neighborhood of each point, the weight coefficient is dynamically adjusted to adapt to the local curvature change, generating a smooth and continuous local surface model.
[0211] For the overlapping areas of adjacent local surface models, the curvature similarity of the overlapping point sets is calculated, points with curvature differences less than a preset threshold are screened, and the coordinates of the screened points are fused to generate a complete 3D digital model.
[0212] Taking the complete 3D digital model as input, starting from the initial triangular facets, the system gradually inserts each point in the point cloud data, dynamically adjusts the connection relationship of the triangular facets, and uses the boundary detection algorithm to identify feature edges and lock the topological structure, and outputs the surface triangular mesh model;
[0213] Fit and align the triangular mesh model with the design model, calculate the distance between each point on the triangular mesh surface and the corresponding surface of the design model, and generate dimensional error distribution data;
[0214] The local curvature of the triangular mesh model is calculated point by point, and the difference analysis is performed with the curvature of the design model to generate surface topography deviation data;
[0215] Converting the size error distribution data into error numerical statistical parameters in three-dimensional space, and converting the surface topography deviation data into curvature difference statistical parameters;
[0216] Based on the error numerical statistical parameters and curvature difference statistical parameters, a quantitative analysis report containing the error mean, standard deviation and feature position deviation coordinates is generated.
[0217] In this embodiment of the present invention, after registering multi-region point cloud data, the point cloud of each measurement region is used as a processing unit. Taking the point cloud of a specific measurement region as an example, a neighborhood is first defined for each point within that region. Typically, a spherical region with a radius of 2-5 mm centered on the point is used as the neighborhood (2 mm is used for small precision workpieces, and 5 mm is used for larger workpieces, ensuring that the neighborhood contains sufficient feature points). When calculating the weighted least squares plane, the weight coefficients are determined according to two core principles: distance weighting and curvature weighting.
[0218] Distance weight: This is set using an inverse proportional relationship. Let di be the distance from a point Pi in the neighborhood to the center point P0. The distance weight wdi ranges from 0.1 to 1. When di approaches 0 (i.e., point Pi coincides with the center point), wdi takes its 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.
[0219] Curvature weight: This is set based on the local curvature variation of a point. First, the curvature of each point in its neighborhood is calculated (evaluated by comparing the height differences of neighboring points). Let the curvature of a point Pi be Ci, and the curvature of the center point P0 be C0. The curvature weight wci ranges from 0.2 to 1. If |Ci−C0| approaches 0 (i.e., the local curvature variation is small and the surface is flat), wci is set to a small value of 0.2. If |Ci−C0| is large (i.e., the surface varies significantly), wci can be increased to 1.
[0220] The final comprehensive weight wi is the product of the distance weight and the curvature weight, that is, wi = wdi × wci, and its value range is between 0.02 and 1. In this way, a plane that adapts to the local characteristics of each point is fitted, thereby generating a smooth and continuous local surface model.
[0221] For the overlapping areas of adjacent local surface models, the point set of the overlapping part is first extracted. For each point in the point set, its curvature is calculated using the same method as before (evaluated by comparing the height differences of neighboring 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. Points with curvature differences less than the preset threshold are filtered out, and these points are considered to be similar in curvature characteristics. When the filtered points are coordinate-fused, weights are assigned according to the distance from the point to the boundaries of the two adjacent surface models. Suppose the distance from a point P to the boundary of surface model A is dA, and the distance to the boundary of surface model B is dB, then the fusion weight wA= ,wB= The weight values range from 0 to 1. The coordinates of the corresponding points of the two surface models are weighted averaged according to the weights to obtain the fused coordinates and generate a complete 3D digital model.
[0222] Generate a triangular mesh model of the surface:
[0223] Based on the complete 3D digital model, the initial triangular facet is constructed from three randomly selected adjacent points. When the points in the point cloud data are inserted into the model one by one, the positional relationship between the points and the existing triangular facets is determined:
[0224] If the point is inside a triangle, connect the three vertices of the triangle to the insertion point respectively and split it into three new triangles.
[0225] If the point is on the edge of a triangle, the vertices of the two triangles adjacent to the edge will be reconnected to form a new triangle combination.
[0226] The boundary detection algorithm identifies characteristic edges by examining the edges of triangles. If an edge is used by only one triangle, it is marked as a boundary edge. An edge used by two triangles, and the angle between the two triangle normals exceeds a certain threshold (e.g., 120°, adjustable based on model complexity), is also considered a boundary edge. The topology of these boundary edges is locked to ensure edge integrity, ultimately outputting a triangular mesh of the surface.
[0227] The generated triangular mesh model is aligned with the design model. By finding corresponding points for matching (e.g., based on curvature or planar feature points), the position and posture of the triangular mesh model are adjusted to ensure that it coincides as closely as possible with the design model. After alignment, for each point on the triangular mesh surface, a corresponding surface on the design model is found based on its spatial position. To calculate the perpendicular distance from that point to the corresponding surface, a perpendicular line is drawn from the point to the corresponding surface and the distance from the point to the foot of the perpendicular is measured. The distance value for each point is recorded to generate dimensional error distribution data, reflecting the deviation of each model location from the design dimensions.
[0228] Calculation of surface topography deviation:
[0229] For each point P in the triangular mesh model, we first determine its neighborhood point set. These neighborhood points are selected by searching for the vertices of triangles directly connected to P in the triangular mesh, as well as their neighbors, to form a local region of 10–20 points (this can be adjusted based on the mesh density).
[0230] In this local area, the curvature is evaluated by comparing the height difference between the neighboring points and P. The specific operation is as follows:
[0231] Calculate the spatial distance between point P and each neighboring point, finding the 3-5 closest points (called "neighbors"). Fit a local plane using these 3-5 neighboring points and calculate the perpendicular distance (i.e., the "height difference") from point P to this plane. A large height difference indicates that the surface in the area where point P is located is highly curved, resulting in a high curvature value; a small height difference indicates a low curvature value. In this way, each point P is assigned a curvature value that reflects the degree of curvature of its local surface. Find the point P′ in the design model (e.g., CAD model) that corresponds to the position of point P in the triangular mesh model. The specific method is:
[0232] According to the three-dimensional coordinates (X, Y, Z) of point P, search for the nearest point P′ in the three-dimensional space of the design model (the error range is usually set to 0.1−0.5mm).
[0233] The curvature calculation of the design model is divided into two cases:
[0234] Parametric model: If the design model is defined by a mathematical expression (such as a surface equation), the curvature value at P' is calculated directly by taking the derivative (for example, taking the derivative of the cylindrical surface equation gives the curvature ).
[0235] Discrete 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 using a method similar to neighborhood fitting when the model is constructed).
[0236] Compare the curvature value of the triangular mesh model point P with the curvature value of the corresponding point P' of the design model:
[0237] Directly calculate the difference between the two = the curvature value of the triangular mesh model point P − the curvature value of the corresponding point P′ of the design model;
[0238] If the difference is > 0, it means that the actual workpiece surface is more curved than the design model at that point (such as a local convexity);
[0239] If the difference is <0, it means that the actual surface is flatter than the design model (e.g., local depression);
[0240] If the difference = 0, it means that the surface morphology at that point is consistent with the design.
[0241] Traverse all points of the triangular mesh model, record the difference of each point, and form surface morphology deviation data.
[0242] For dimensional error distribution data, the mean error is calculated by summing the error values for all points and dividing by the total number of points. To calculate the standard deviation, the square of the difference between the error value and the mean for each point is first calculated. These squared values are then added and divided by the total number of points, and the square root of the result is taken. For surface topography deviation data, the mean and standard deviation of curvature differences are calculated similarly to those used for dimensional error statistics. First, the sum of the curvature differences for all points is calculated and divided by the total number of points to obtain the mean. The sum of the squares of the difference between the curvature differences for each point and the mean is then calculated, and the square root of the average is taken to obtain the standard deviation. A detailed quantitative analysis report is compiled based on the calculated mean and standard deviation, as well as the coordinates of feature position deviations determined through analysis (such as the coordinates of the point with the largest absolute error value and the coordinates of areas where deviations exceed a certain threshold). This report, using a combination of charts and text, clearly presents the differences between the dimensions and surface topography of the 3D digital model of the casting workpiece and the design requirements.
[0243] By fitting local surfaces using the moving least squares method and dynamically adjusting weights to adapt curvature, the system accurately captures workpiece surface details and generates high-quality 3D digital models. In overlapping areas, data is fused based on curvature similarity to avoid splicing artifacts, ensuring model integrity and continuity, and faithfully recreating the workpiece's topography.
[0244] In addition to calculating dimensional errors, it also deeply analyzes surface topography deviations, assessing workpiece quality from multiple dimensions and providing more comprehensive inspection results. It generates a quantitative analysis report containing statistical parameters and feature position deviations, presenting issues with intuitive data to facilitate the development of corrective measures, improving production efficiency and product quality.
[0245] In specific applications, a high-precision standard ball with a known diameter (such as a tolerance of ±0.002mm) is placed on the workbench of a three-dimensional coordinate measuring machine. The structured light probe is moved by a motion platform to project a structured light pattern from at least three different angles. The camera collects the deformed fringe image on the surface of the standard ball and calculates the point cloud data (about 1,000 points) of the standard ball in the structured light coordinate system.
[0246] Coordinate matching: Use the contact probe of a three-dimensional coordinate measuring machine (accuracy ±0.002mm) to measure the coordinates of the center of the standard sphere (in the world coordinate system), recorded as (Xw, Yw, Zw). Simultaneously, the least squares method is used to fit the structured light point cloud data to obtain the coordinates of the center of the sphere in the structured light coordinate system (Xs, Ys, Zs).
[0247] Establishing the transformation relationship: Through coordinate translation (T = Xw − Xs, etc.) and rotation (based on the normal direction of the spherical point cloud), an initial transformation matrix is established to ensure that the centers of the spheres in the two coordinate systems coincide with an error of ≤0.05mm.
[0248] Dynamic update: After completing 50 measurements or changing the workpiece, repeat the above steps and combine the real-time temperature and humidity (accuracy ±0.5℃, ±5%RH) and vibration data (acceleration resolution 0.01m / s 2 ), correct the conversion matrix and compensate for the slight displacement caused by the environment (for example, for every 1°C change in temperature, the structured light sensor expands by about 0.001mm).
[0249] Camera calibration: A checkerboard calibration plate (20 mm × 20 mm squares) was placed on a workbench. The camera was controlled to capture images of the plate from 15 different angles (covering a ±45° field of view). Corner coordinates were extracted using a sub-pixel corner detection algorithm (with 0.1 pixel accuracy). The camera's intrinsic parameters (e.g., focal length f = 16 mm, principal point (u0, v0) = (512, 384)) and distortion coefficients (radial distortion k1 = −0.01, tangential distortion p1 = 0) were calculated using the least squares method. The reprojection error was ensured to be ≤ 0.5 pixels (i.e., the pixel distance between the actual corners and the model-predicted corners was < 0.5).
[0250] Projector Modeling: The projector projects a 12-bit Gray code (256 fringe levels) and a three-step phase shift pattern (0°, 120°, and 240°). The camera simultaneously captures an image of a calibration plate. By decoding the fringe levels, the absolute phase of each pixel is determined. Combined with the 3D coordinates of the calibration plate, a mapping relationship is established between the projector pixel coordinates (up, vp) and the world coordinates (X, Y, Z) (e.g., up = 1000X + 500), with an error of ≤0.5 fringe periods.
[0251] Joint Calibration: Using a 3D target with 24 spherical feature points (the spacing between sphere centers is calibrated with a laser tracker to an accuracy of ±0.005mm), camera images and projected patterns are simultaneously captured at six different poses (e.g., 200mm movement on each of the X, Y, and Z axes). Feature matching (e.g., locating the centroid of the spherical points in the image) establishes a "projector code - camera corner - world coordinate" correspondence. Bundle adjustment is then used to optimize the relative position of the camera and projector (e.g., translation error ≤ 0.1mm, rotation error ≤ 0.1°).
[0252] Workpiece pretreatment and clamping:
[0253] Surface treatment: Wipe the surface of the casting with alcohol to remove oil and dust; evenly spray white developer (about 5μm thick) on the reflective aluminum alloy surface to ensure clear imaging of the structured light fringes.
[0254] Clamping and positioning: Place the workpiece on a high-precision workbench (flatness ≤ 0.01mm / m), use a vacuum suction cup (diameter 50mm, adsorption force 150N) to fix the bottom surface, and use a magnetic fixture (residual magnetism 0.3mT) to clamp the side surface to ensure that the workpiece displacement during measurement is ≤ 0.02mm.
[0255] Measurement area division and path planning:
[0256] Region Division: For a rectangular workpiece measuring 500mm × 300mm × 200mm, the field of view is divided into four measurement regions (with a 25% overlap) covering the top, two side surfaces, and the front surface of the workpiece. Each region is labeled A (upper left), B (upper right), C (lower left), and D (lower right), with an overlap width of 50mm.
[0257] Path Optimization: Using the PPO reinforcement learning algorithm, we prioritized feature-rich areas (such as top surface bosses and side edges) to prevent the motion platform from colliding with the workpiece. The path sequence was A→B→C→D, with movement speeds set at 200 mm / s for coarse positioning and 20 mm / s for fine positioning, resulting in a total movement time of approximately 3 minutes.
[0258] Coarse positioning: The Delta parallel mechanism moves the probe above area A at a speed of 200 mm / s, and the seven-axis robotic arm fine-tunes the posture so that the structured light axis is perpendicular to the workpiece surface (angle deviation ≤ 1°).
[0259] Pattern projection and acquisition: The projector projects 8 8-bit Gray code images and 4 4-step phase-shift patterns at 20 frames per second. The camera (20 fps, 1920 × 1200 resolution) simultaneously acquires 12 images in 0.6 seconds.
[0260] 3D solution: For each image, the absolute phase level is determined by Gray code decoding, and the wrapped phase is solved by combining the phase shift image to obtain the 3D coordinates (Xs, Ys, Zs) of each pixel, generating a local point cloud of about 2.3 million points (density of about 40 points / mm 2 Repeat this process to complete data collection for 4 areas, which takes about 5 minutes in total.
[0261] For the point cloud in area A, a neighborhood radius of 1.5mm was set. The average distance between each point and its neighbors was calculated, and points with distances exceeding three times the global mean were deleted (approximately 1% of noise points were eliminated). Using the moving least squares method, a local plane was fitted to each point's 50 neighbors. The point was then projected onto the plane to smooth surface fluctuations (e.g., height error was reduced from ±0.1mm to ±0.03mm). Using the calibrated rotation matrix R and translation vector T, the point cloud in area A was transformed from the structured light coordinate system to the world coordinate system. For example, the coordinates of a point were transformed from (100, 200, 300) to (100+Tx, 200+Ty, 300+Tz), with an error of ≤0.05mm.
[0262] Vibration compensation: Six-axis force sensor collects clamping vibration data in real time (such as X-axis vibration acceleration 0.1m / s 2 ), identify the main vibration frequency (such as 50Hz) through Fourier transform, add reverse displacement compensation to the coordinates of each point (such as X-axis compensation 0.01mm).
[0263] 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× / ℃), calculate thermal expansion = 500mm×11.7× ×(22 20), move the point cloud along the surface normal vector direction by 500mm×11.7× ×(22 20).
[0264] Curvature feature point extraction: In the overlapping area of area A and B, the height variance of each point in its neighborhood (30 points within a radius of 2mm) is calculated, and the variance is >0.02mm 2 The points are marked as curvature feature points (such as edge points and boss vertices), and a total of about 500 feature points are extracted.
[0265] Plane feature extraction: Divide the overlapping area point cloud into groups of 50 points. Fit each group of planes. Merge adjacent groups with normal vector angles less than 10° into the same plane area. Extract plane normal vectors (such as the top surface normal vector (0, 0, 1)) and boundary points (about 200).
[0266] Bidirectional matching: For the curvature feature point PA in area A, find the closest point PB (threshold 0.5mm) in Euclidean distance among the curvature feature points and plane boundary points in area B, then check whether the nearest neighbor of PB is PA, and retain bidirectional matching pairs (about 300 pairs).
[0267] RANSAC screening: Three pairs of matching points were randomly selected, and the temporary rotation matrix R' and translation vector T' were calculated. The number of inliers with a distance < 0.2 mm after transformation was counted. After 100 iterations, the parameter with the most inliers (inlier rate 85%) was selected to obtain the coarse registration parameters (rotation error ≤ 0.5°, translation error ≤ 0.3 mm).
[0268] ICP precision registration: Use the point cloud of area A as the target and the point cloud of area B as the source. Calculate the closest plane distance from each point to the target point cloud (such as the distance from point P to the top surface). After 50 iterations, the error change is <0.01mm, and the final registration error is ≤0.03mm.
[0269] For the overlapping points of areas A and B, calculate the points with a curvature difference of <0.03, assign weights according to the distance from the plane boundary (for example, the point 1 mm away from the boundary of A has a weight of 0.6, and the point 1 mm away from the boundary of B has a weight of 0.4), take the weighted average coordinates, and generate a fused point cloud.
[0270] Triangulation: Using the Delaunay triangulation algorithm, the fused point cloud (approximately 8 million points) is converted into a triangulated mesh model with an average mesh side length of 0.5 mm. At the same time, the octree algorithm is used to reduce the number of points to 800,000, preserving edge and surface details.
[0271] Align the mesh model with the design CAD model and calculate the vertical distance from each triangle vertex to the corresponding CAD surface. For example, if a point on the top surface is +0.12mm away from the design surface (positive deviation indicates convexity), record the maximum deviation of +0.15mm, the minimum deviation of -0.08mm, and the average deviation of +0.03mm. For the center area of the top surface, calculate the curvature of the mesh model to be 0.005 , the design curvature is 0.003 , difference +0.002 , indicating that the actual surface is more curved than designed.
[0272] In the 3D display software, the deviation is mapped by color (red is greater than 0.1mm, blue is less than -0.1mm), the center area of the top surface is displayed in red, and the edge is displayed in blue. The Excel table is output, which includes the error mean (+0.03mm), standard deviation (0.05mm), and feature position deviation (such as the X-axis deviation of edge point A is +0.08mm, and the Y-axis deviation is -0.02mm).
[0273] The embodiment of the present invention further provides a computer-readable storage medium storing instructions, which, when executed on a computer, causes the computer to execute the above-described method. All implementations in the above-described method embodiment are applicable to this embodiment and can achieve the same technical effects.
[0274] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. Casting workpiece three-coordinate structured light rapid measurement system, characterized by: include: The calibration parameter module is used to fix the standard sphere to the worktable of the three-dimensional coordinate measuring machine, control the movement of the probe to multiple different positions, and sequentially project a Gray code and phase shift composite coding pattern onto the surface of the standard sphere through a projector. The industrial camera simultaneously captures the deformed fringe image modulated by the surface topography of the standard sphere. The wrapped phase image in the deformed fringe image is solved by the phase shift method, and the absolute phase value is generated by combining the Gray code decoding result. Based on the absolute phase value, the three-dimensional coordinates of each pixel point on the surface of the standard sphere are solved in combination with the calibration parameters of the projector and camera, and the point cloud data of the standard sphere in the structured light coordinate system is generated. The least squares method is used to fit the coordinates of the center of the standard sphere in the structured light coordinate system using the point cloud data of the standard sphere in the structured light coordinate system. The coordinates of the center of the standard sphere in the world coordinate system are measured using the three-dimensional coordinate measuring machine probe to establish the initial rotation matrix and translation vector. The environmental compensation sensor collects real-time temperature and humidity data and the six-dimensional force sensor collects probe clamping vibration data. Combined with the real-time position feedback of the three-dimensional coordinate measuring machine motion platform, the Kalman filter algorithm is used to dynamically correct the initial rotation matrix and translation vector to generate updated calibration parameters. A measurement path planning module is used to convert the three-dimensional design model of the casting workpiece from the world coordinate system to the structured light coordinate system based on dynamic calibration parameters, and generate three-dimensional model data in the structured light coordinate system; For the 3D model data, the velocity vector and acceleration vector of each position are calculated point by point to obtain the curvature numerator, and the curvature value is calculated in combination with the velocity vector modulus. Compare the curvature value with the preset threshold. If the curvature change rate exceeds the threshold, it is marked as a high curvature feature area. For areas not marked as high curvature feature areas, surface fitting is performed using a plane fitting algorithm, and the residual value from each point to the fitting plane is calculated; 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 the plane geometric feature area; The workpiece surface is divided into multiple measurement areas based on curvature feature areas and plane feature areas, with an overlap rate of ≥20% between adjacent measurement areas. Based on the position and size of the measurement areas, combined with the constraints of the structured light incident angle and the camera field of view, measurement blind spots caused by occlusion or reflection are avoided. Based on the mechanical parameters and motion constraints of each motion axis of the coordinate measuring machine, an interpolation algorithm is used to generate the probe's continuous motion path and pose parameters. Based on the pose parameters, the coordinate measuring machine's motion platform is controlled to move to each measurement position. The local point cloud generation module is used to project the 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 the local point cloud data of the corresponding measurement area by solving the three-dimensional coordinates of each pixel point; The compensation module is used to pre-process the local point cloud data, smooth the surface fluctuations using the moving least squares method, and output the pre-processed point cloud; Based on the rotation matrix and translation vector in the dynamic calibration parameters, the pre-processed point cloud is converted from the structured light coordinate system to the coordinate measuring machine world coordinate system to generate a converted point cloud; Combined with the probe clamping vibration data collected in real time by the six-dimensional force sensor, the converted point cloud is subjected to vibration noise filtering. The point cloud deformation error caused by thermal expansion is compensated based on the temperature and humidity data of the environmental compensation sensor, and the error-compensated point cloud is output. The point cloud registration module is used to extract curvature feature points and plane geometric features in the overlapping areas of adjacent point clouds after error compensation, screen matching point pairs, and calculate coarse registration parameters. It also combines point-to-plane distance constraints to complete the registration of multi-view point clouds and obtain the registered multi-region point cloud data. The 3D model analysis module is used to reconstruct the surface of multi-region point cloud data, fuse the overlapping area data to generate a complete 3D digital model of the casting workpiece, and output the dimensional error and surface morphology analysis results of the 3D digital model.
2. The casting workpiece three-coordinate structured light rapid measurement system according to claim 1, characterized in that: The Gray code and phase shift composite coding pattern is projected onto the workpiece surface, and the deformed fringe image modulated by the workpiece surface topography is collected. By solving the 3D coordinates of each pixel point, the local point cloud data of the corresponding measurement area is generated, including: At each measurement position, a composite coding pattern of Gray code and phase shift is projected onto the workpiece surface by a projector, where Gray code is used for absolute phase encoding and phase shift fringes are used for wrapped phase encoding. An industrial camera captures images of the deformed fringes modulated by the workpiece surface topography and stores them as a time-series image sequence. For the phase-shifted fringes in the time-series image sequence, a four-step phase-shifting 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 series to generate a continuously distributed absolute phase value. Based on the projector calibration matrix and camera intrinsic parameters in the dynamic calibration parameters, the continuously distributed absolute phase values are mapped into three-dimensional coordinates in the structured light coordinate system to generate local point cloud data of the current measurement area.
3. The casting workpiece three-coordinate structured light rapid measurement system according to claim 2, characterized in that: In the overlapping area of adjacent point clouds after error compensation, curvature feature points and plane geometric features are extracted, matching point pairs are screened, and coarse registration parameters are calculated; Combined with the point-to-plane distance constraint, the multi-view point cloud registration is completed, and the registered multi-region point cloud data is obtained, including: For the error-compensated point cloud, the curvature change rate is calculated point by point in the overlapping area of adjacent point clouds using a curvature calculation algorithm. Local areas where the curvature change rate exceeds a preset threshold are selected as curvature feature points. At the same time, a plane fitting is performed on the point cloud to extract continuous plane areas where the normal vector direction consistency meets the preset conditions, and the normal vector and boundary point set are recorded. Taking curvature feature points and plane boundary points as input, a bidirectional nearest neighbor search algorithm is used to generate initial matching point pairs. Based on the geometric position relationship and normal vector direction constraints of the initial matching point pairs, a random sampling consistency algorithm is used to iteratively screen matching point pairs that meet the consistency conditions. Based on the consistent matching point pairs, the initial rotation matrix and translation vector between adjacent point clouds are calculated through singular value decomposition. The current local point cloud is converted to the coordinate system of the adjacent point cloud based on the rotation matrix and translation vector to generate the roughly registered point cloud data. Taking the roughly registered point cloud data as the initial value, the improved iterative closest point algorithm is used to iteratively optimize the overlapping area point cloud, that is, matching each point in the point cloud with the planar area of the adjacent point cloud. The optimization is terminated according to the change in the registration error between two adjacent iterations and the preset iteration number threshold, and finally the registered multi-region point cloud data is output.
4. The casting workpiece three-coordinate structured light rapid measurement system according to claim 3, characterized in that: Taking curvature feature points and plane boundary points as input, a bidirectional nearest neighbor search algorithm is used to generate initial matching point pairs. Based on the geometric position relationship and normal vector direction constraints of the initial matching point pairs, a random sampling consistency algorithm is used to iteratively screen matching point pairs that meet the consistency conditions, including: Taking the curvature feature points and plane boundary points as input, forward search and backward search are performed on the feature points in the adjacent point cloud to generate an initial set of matching point pairs; 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, remove outlier matching points that exceed the preset distance threshold or angle threshold, and obtain a valid matching point pair set; 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.
5. The casting workpiece three-coordinate structured light rapid measurement system according to claim 4, characterized in that: Reconstruct the surface of multi-region point cloud data, fuse the overlapping area data to generate a complete 3D digital model of the casting workpiece, and output the dimensional error and surface morphology analysis results of the 3D digital model, including: For the registered multi-region point cloud data, the moving least squares method is used to fit the local surface piece by piece, with the point cloud of each measurement area as the center. By calculating the weighted least squares plane of the point set in the neighborhood of each point, the weight coefficient is dynamically adjusted to adapt to the local curvature change, generating a smooth and continuous local surface model. For the overlapping areas of adjacent local surface models, the curvature similarity of the overlapping point sets is calculated, points with curvature differences less than a preset threshold are screened, and the coordinates of the screened points are fused to generate a complete 3D digital model. Taking the complete 3D digital model as input, starting from the initial triangular facets, the system gradually inserts each point in the point cloud data, dynamically adjusts the connection relationship of the triangular facets, and uses the boundary detection algorithm to identify feature edges and lock the topological structure, and outputs the surface triangular mesh model; Fit and align the triangular mesh model with the design model, calculate the distance between each point on the triangular mesh surface and the corresponding surface of the design model, and generate dimensional error distribution data; The local curvature of the triangular mesh model is calculated point by point, and the difference analysis is performed with the curvature of the design model to generate surface topography deviation data; Converting the size error distribution data into error numerical statistical parameters in three-dimensional space, and converting the surface topography deviation data into curvature difference statistical parameters; Based on the error numerical statistical parameters and curvature difference statistical parameters, a quantitative analysis report containing the error mean, standard deviation and feature position deviation coordinates is generated.
6. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a program, which, when executed by a processor, implements the system according to any one of claims 1 to 5.
Citation Information
Patent Citations
High-precision point cloud registration method for three-dimensional laser scanning
CN110473239A
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
Contact type three-coordinate measuring machine and measuring method
CN119714163A