A multi-modal line-scan alignment object surface measurement method, system, and apparatus
By establishing a pixel position deviation model with height as the independent variable and an interpolation operator, the problem of insufficient multimodal image alignment accuracy in single-chip integrated line scan cameras is solved, achieving high-precision image alignment and three-dimensional topography measurement, reducing hardware costs and calibration complexity, and meeting the real-time requirements of industrial production lines.
Patent Information
- Application Number
- CN202611669369.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-27
- Publication Date
- 2026-11-24
AI Technical Summary
In the existing technology, the multimodal image alignment method of a single-chip integrated line scan camera cannot effectively eliminate highly correlated pixel coordinate deviations, resulting in insufficient accuracy of the three-dimensional topography measurement results.
By establishing a pixel position deviation model with the height of the measured object as the independent variable, the correspondence between pixel coordinate deviation and height value in the Y and X directions is described respectively. Calibration is performed using a correction block, the deviation coefficient is solved by solving a system of equations, and image resampling is performed using an interpolation operator to achieve high-precision alignment between 2D color images and 3D height images.
It improves the accuracy of multimodal image alignment, reduces hardware costs, simplifies system integration and calibration processes, meets the real-time requirements of industrial production lines, and compensates for parameter drift caused by temperature rise and mechanical vibration in real time, ensuring alignment accuracy under long-term continuous operation.
Smart Images

Figure CN123160636A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing and measurement technology, and in particular to a method, system and device for measuring the surface of an object using multimodal line scan alignment. Background Technology
[0002] In industrial production, the measurement of three-dimensional surface topography is widely used in scenarios such as dimensional inspection, surface defect identification, and contour measurement. Line scan cameras, due to their high resolution and high scanning speed, are widely used in these online measurement scenarios.
[0003] With the development of integrated imaging technology, a single-chip integrated architecture has emerged that integrates a 2D (two-dimensional) color imaging system and a 3D (three-dimensional) structured light imaging system within the same line scan camera body. In this architecture, the 2D color imaging system consists of an LED white light source and a color photosensitive pixel array, while the 3D structured light imaging system consists of a line laser source and a grayscale photosensitive pixel array. The two imaging systems share the same camera lens, but their respective imaging optical axes have tilt angles. Furthermore, under actual production line installation conditions, it is impossible to guarantee that the chip planes of the two systems are strictly perpendicular to the working plane. Compared with traditional dual-camera solutions, the above-mentioned single-chip integrated architecture has advantages such as small size, low cost, and good data synchronization. However, it also introduces a technical problem that has been overlooked by existing technologies: because the two imaging optical paths share a lens and have different optical axis tilt angles, changes in the height of the measured object will cause different pixel coordinate deviations in the 2D and 3D images, and these deviations vary with the height of the measured object. The deviation patterns of the two systems are also different, requiring independent modeling.
[0004] Existing alignment methods based on fixed pose transformation matrices cannot eliminate this highly correlated deviation, resulting in insufficient alignment accuracy of multimodal images, which in turn affects the accuracy of the three-dimensional topography measurement results of the object surface. Summary of the Invention
[0005] Therefore, it is necessary to provide a multimodal line scan alignment method, system, and device for measuring object surfaces to address the aforementioned technical problems.
[0006] Firstly, this application provides a method for measuring the surface of an object using multimodal line scan alignment. The method includes: A line-scan imaging device using a shared optical system simultaneously acquires 2D color images and 3D height images; A pixel position deviation model is established with the height of the measured object as the independent variable. The pixel position deviation model describes the correspondence between pixel coordinate deviation in the Y direction and height value, and the correspondence between pixel coordinate deviation in the X direction and height value, respectively. Scan a correction block having at least two known height levels and feature aperture arrays distributed on each height level, extract the center coordinates of the feature apertures on each height level, use the theoretical center coordinates as the true value and the measured center coordinates as the observed value, and solve the deviation coefficient of the pixel position deviation model by solving a system of equations. For each of the 2D color image and the 3D height image, traverse the pixel coordinates in the image, read the height value of the corresponding position from the 3D height image, substitute the height value into the pixel position deviation model to calculate the correction coordinates, and use an interpolation operator to resample the image at the correction coordinates to generate the corrected image of the image, thus obtaining the corrected 2D color image and the corrected 3D height image. Based on a pre-calibrated 3D coordinate system, a fixed number of rows offset is calculated between the first scan position of the imaging system of the corrected 2D color image and the corrected 3D height image. The 3D height image is then translated along the Y direction by the fixed number of rows offset to obtain the translated 3D height data. The corrected 2D color image and the translated 3D height data are then output in a unified coordinate system. Based on the aligned 3D height data, the height values of each measurement point on the surface of the object under test are extracted; the surface appearance information corresponding to each measurement point is obtained by combining the aligned 2D color image; the height values and the surface appearance information are fused to generate the three-dimensional shape measurement result of the surface of the object under test.
[0007] The core innovation of this application lies in establishing a pixel position deviation model with the height of the measured object as the independent variable, breaking the technical bias of "height does not affect pixel coordinates" in the traditional line scan camera theory. In view of the actual constraints that neither of the two optical paths in the single-chip integrated architecture can guarantee strict vertical installation, a complete modeling-calibration-correction-alignment pipeline is provided to achieve high-precision multimodal image alignment under single-camera conditions.
[0008] In one embodiment, establishing a pixel position deviation model with the height of the measured object as the independent variable includes: Y-direction deviation model and X-direction deviation model; The Y-direction deviation model is as follows: Y1 = Y + (k0 × H + b0), Where Y1 is the corrected Y coordinate value, Y is the Y coordinate value on the image, H is the height value, and k0 and b0 are the Y direction deviation coefficients; The X-direction deviation model is as follows: X1=X×(k1×H+b1)+(k2×H+b2), Where X1 is the corrected X coordinate value, X is the X coordinate value on the image, and k1, b1, k2 and b2 are the X direction deviation coefficients.
[0009] The Y-direction linear deviation model physically describes the systematic offset of the row coordinates caused by the optical axis tilt angle, while the X-direction affine-linear composite model describes the height-related scaling and translation deviations. Together, the two models cover all pixel coordinate deviation components caused by height changes.
[0010] In one embodiment, the simultaneous equations used to solve for the deviation coefficients of the pixel position deviation model include: The measured Y-coordinates of the centers of each feature hole at the first height level of the correction block are used as the first set of observation data, and the measured Y-coordinates of the centers of each feature hole at the second height level are used as the second set of observation data. The theoretical center Y-coordinates of each feature hole are used as the true values, and the difference between the true values and the observed data is calculated as the deviation. The height values corresponding to each feature hole are substituted into the Y-direction deviation model to construct an overdetermined linear equation system in the Y-direction. The deviation coefficients k0 and b0 are solved by the least squares method. The first set of observation data uses the measured X-coordinates of the center of each feature hole at the first height level, and the second set uses the measured X-coordinates of the center of each feature hole at the second height level. The theoretical center X-coordinates of each feature hole are taken as the true values. The difference between the true values and the observed data is calculated as the deviation. The height values corresponding to each feature hole are substituted into the X-direction deviation model to construct an overdetermined linear equation system in the X-direction. The deviation coefficients k1, b1, k2, and b2 are solved using the least squares method. The solutions for the deviation coefficients in the Y and X directions all use the theoretical center coordinates calculated based on the geometric design parameters of the straightening block as the true values. The true values are not affected by the machining errors of the straightening block, thus improving the accuracy and robustness of the deviation coefficient solution.
[0011] In one embodiment, the interpolation operator is a bilinear interpolation operator; the steps of traversing the pixel coordinates in the image, calculating the correction coordinates, and resampling are executed in parallel by the graphics processor, and the deviation coefficients are stored as constants in the constant storage space of the graphics processor. The massively parallel computing capability of the graphics processor reduces the pixel correction processing time by one to two orders of magnitude compared to the serial processing of the central processing unit, meeting the real-time image processing requirements of industrial production lines.
[0012] In one embodiment, after solving for the deviation coefficient, the root mean square of the residual of the pixel position deviation model on the calibration data is calculated; When the root mean square of the residual exceeds a preset threshold, the pixel position deviation model is replaced with a high-order polynomial deviation model or a piecewise linear deviation model, and the coefficients of the replaced model are refitted using the calibration data.
[0013] The adaptive model selection strategy retains the linear model in scenarios with a small height range to reduce computational complexity, and automatically upgrades the model order in scenarios with a large height range or nonlinear deviation, thus achieving an adaptive balance between model complexity and correction accuracy.
[0014] In one embodiment, during the scanning process, the scanning of a preset calibration area is periodically triggered at fixed line intervals, the current coordinates of feature points in the calibration area are extracted, the current coordinates are compared with the reference coordinates of the feature points, the drift of the deviation coefficient is calculated, and the deviation coefficient is dynamically updated according to the drift. The current temperature value output by the temperature sensor of the line scanning imaging device is obtained, the temperature correction amount is calculated based on the difference between the current temperature value and the reference temperature value, and the deviation coefficient is updated after the temperature correction amount is added to the drift amount.
[0015] The online dynamic correction mechanism, combined with temperature compensation, compensates in real time for optical path thermal drift caused by temperature rise and parameter drift caused by mechanical vibration during long-term camera operation, ensuring the continuous stability of alignment accuracy under long-term continuous operation of the production line.
[0016] In one embodiment, the correction block has three or more known height levels, and the step of solving the deviation coefficients using the simultaneous equations includes: Extract the center coordinates of the feature holes at each height level, establish the correspondence between the deviation and the height value, and generate a multi-level deviation lookup table; For any height value, the deviation at that height value is estimated by weighted interpolation of the deviations at adjacent height levels in the multi-level deviation lookup table, and the estimated deviation is used for pixel coordinate correction.
[0017] In one embodiment, the pixel position deviation model is implemented by a convolutional neural network, including: Training samples are constructed using the calibration data collected by the correction block. The training samples include local patches of the 3D height image and the 2D color image and the corresponding pixel-level deviation vectors. The convolutional neural network is trained using the training samples, so that the convolutional neural network outputs a pixel-level deviation vector field after inputting local patches of the 3D height image and the 2D color image; In the image correction stage, the 2D color image and the 3D height image are respectively segmented into local patches, which are then fed into the trained convolutional neural network for inference to obtain the pixel-level deviation vector field, and the pixel-level deviation vector field is applied to pixel coordinate correction.
[0018] Secondly, this application also provides a multimodal line scan aligned object surface measurement system, comprising: The image acquisition module is used to control the line scanning imaging device of the shared optical system to simultaneously acquire 2D color images and 3D height images, and output the 2D color images and the 3D height images; The deviation modeling module is used to establish a pixel position deviation model with the height of the measured object as the independent variable. The pixel position deviation model describes the correspondence between pixel coordinate deviation in the Y direction and height value, and the correspondence between pixel coordinate deviation in the X direction and height value, respectively. The calibration module is used to scan a correction block with at least two known height levels and feature aperture arrays distributed on each height level, extract the center coordinates of the feature apertures on each height level, use the theoretical center coordinates as the true value and the measured center coordinates as the observed value, solve the deviation coefficient of the pixel position deviation model by solving a system of equations, and output the deviation coefficient to the deviation modeling module. The pixel correction module is used to: for each image in the 2D color image and the 3D height image, traverse the pixel coordinates in the image, read the height value of the corresponding position from the 3D height image, substitute the height value into the pixel position deviation model to calculate the correction coordinates, use an interpolation operator to resample the image at the correction coordinates, generate the corrected image of the image, and obtain the corrected 2D color image and the corrected 3D height image; The alignment module is used to calculate a fixed number of line offsets between the first scan position of the imaging system of the corrected 2D color image and the corrected 3D height image based on a pre-calibrated 3D coordinate system, translate the 3D height image along the Y direction by the fixed number of line offsets to obtain the translated 3D height data, and output the corrected 2D color image and the translated 3D height data aligned in a unified coordinate system. The measurement output module is used to extract the height values of each measurement point on the surface of the object under test based on the aligned 3D height data; obtain the surface appearance information corresponding to each measurement point by combining the aligned 2D color image; and fuse the height values with the surface appearance information to generate a three-dimensional shape measurement result of the surface of the object under test.
[0019] In the aforementioned multimodal line scan aligned object surface measurement system, the image acquisition module, deviation modeling module, calibration module, pixel correction module, alignment module, and measurement output module work in sequence and collaboratively, corresponding one-to-one with each step of the method. After the calibration module solves for the deviation coefficients, it outputs the result to the deviation modeling module. The pixel correction module performs geometric correction on the image based on the pixel position deviation model containing the deviation coefficients maintained by the deviation modeling module. The alignment module, based on the correction results, achieves coordinate system unification by shifting the first row offset, thus enabling alignment output of 2D color images and 3D height data with an accuracy within 2 pixels under the condition of a single line scan imaging device. The measurement output module fuses the alignment output results to generate a three-dimensional topography measurement result, reducing hardware costs and simplifying system integration and calibration processes.
[0020] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps: A line-scan imaging device using a shared optical system simultaneously acquires 2D color images and 3D height images; A pixel position deviation model is established with the height of the measured object as the independent variable. The pixel position deviation model describes the correspondence between pixel coordinate deviation in the Y direction and height value, and the correspondence between pixel coordinate deviation in the X direction and height value, respectively. Scan a correction block with at least two known height levels and feature aperture arrays distributed on each height level, extract the center coordinates of the feature apertures on each height level, use the theoretical center coordinates as the true value and the measured center coordinates as the observed value, and solve the deviation coefficient of the pixel position deviation model by solving a system of equations. For each of the 2D color image and the 3D height image, traverse the pixel coordinates in the image, read the height value of the corresponding position from the 3D height image, substitute the height value into the pixel position deviation model to calculate the correction coordinates, and use an interpolation operator to resample the image at the correction coordinates to generate the corrected image of the image, thus obtaining the corrected 2D color image and the corrected 3D height image. Based on a pre-calibrated 3D coordinate system, a fixed number of rows offset is calculated between the first scan position of the imaging system of the corrected 2D color image and the corrected 3D height image. The 3D height image is then translated along the Y direction by the fixed number of rows offset to obtain the translated 3D height data. The corrected 2D color image and the translated 3D height data are then output in a unified coordinate system. Based on the aligned 3D height data, the height values of each measurement point on the surface of the object under test are extracted; the surface appearance information corresponding to each measurement point is obtained by combining the aligned 2D color image; the height values and the surface appearance information are fused to generate the three-dimensional shape measurement result of the surface of the object under test.
[0021] Compared with the prior art, this application has the following beneficial effects: 1. By establishing a pixel position deviation model with the height of the measured object as the independent variable, the height-related pixel position deviation caused by the optical path tilt angle in the single-chip integrated line scan imaging device is identified and eliminated from a physical perspective. This breaks the technical bias in the traditional line scan camera theory that "height does not affect pixel coordinates". The alignment accuracy is significantly improved after correction, and the alignment error is greatly reduced compared with the existing fixed pose transformation scheme. This fundamentally solves the defect that the existing technology cannot eliminate height-related deviation.
[0022] 2. By integrating the 2D color imaging system and the 3D structured light imaging system into a single camera body and sharing the lens, the hardware investment of one camera is reduced compared to the traditional dual-camera solution. This reduces the system hardware cost and simplifies the system calibration process. It outputs three-dimensional topography measurement results with surface appearance information, directly supporting applications such as size inspection, surface defect identification and contour measurement in industrial vision inspection.
[0023] 3. By using a bilinear interpolation operator to resample at the correction coordinates, the quality degradation problem of jagged edges and holes in the image after pixel geometric correction is effectively avoided. Furthermore, by using a graphics processor to accelerate the pixel traversal-interpolation process in parallel, the pixel correction processing time is reduced by 1 to 2 orders of magnitude compared to the serial processing of the central processing unit, meeting the strict requirements of industrial production lines for real-time image processing.
[0024] 4. By periodically updating the deviation coefficient through an online dynamic correction mechanism and combining it with temperature compensation, the optical path thermal drift caused by temperature rise and parameter drift caused by mechanical vibration during long-term operation of the camera are compensated in real time. This extends the traditional offline one-time calibration to continuous adaptive parameter maintenance, which helps to maintain the continuous stability of multimodal image alignment accuracy under long-term continuous operation of industrial production lines and overcomes the defect of accuracy decay in offline calibration schemes during long-term operation. Attached Figure Description
[0025] Figure 1 This is an application environment diagram of a multimodal line scan aligned object surface measurement method in one embodiment; Figure 2 This is a flowchart illustrating a multimodal line scan aligned object surface measurement method in one embodiment; Figure 3This is a block diagram of a multimodal line scan aligned object surface measurement system in one embodiment; Figure 4 This is a schematic diagram of the structure of the correction block in one embodiment; Figure 5 This is a schematic diagram of the correction block motion scanning process in one embodiment; Figure 6 This is a schematic diagram of the deviation of the center coordinates of the feature hole in the scanned image in one embodiment; Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0027] The application environment of the multimodal line scan aligned object surface measurement method provided in the embodiments of this application will be briefly described below. For example... Figure 1 As shown, the object surface measurement system includes a line scan imaging device 102, a computer device 104, and an industrial vision inspection system 106.
[0028] The line scan imaging device 102 integrates a 2D (two-dimensional) color imaging system and a 3D (three-dimensional) structured light imaging system into the same camera body, with both imaging systems sharing the same camera lens. The computer device 104 communicates with the line scan imaging device 102 via a communication network, receives the 2D color image and 3D height image synchronously output by the line scan imaging device 102, performs pixel position deviation modeling, correction block calibration, pixel correction, data alignment, and 3D topography measurement processing, and outputs the 3D topography measurement results to the industrial vision inspection system 106. The industrial vision inspection system 106 receives the 3D topography measurement results output by the computer device 104 for quality inspection judgment, data storage, or result display.
[0029] In one implementation, such as Figure 2 As shown, a multimodal line scan aligned object surface measurement method is provided. Taking the application of this method to the above-mentioned object surface measurement system as an example, the method includes the following steps: Step S202: Simultaneously acquire 2D color images and 3D height images using a line scan imaging device with a shared optical system.
[0030] During the scanning phase, the 2D color imaging system and the 3D structured light imaging system of the line scan imaging device are triggered simultaneously, scanning the moving object line by line. The 2D color imaging system outputs color image frames, while the 3D structured light imaging system outputs height image frames using the triangulation principle. The two data streams are synchronously correlated in time. Because the two imaging systems share the same lens but have different optical axis tilt angles, the pixel coordinates of the same physical point on the surface of the object differ between the 2D and 3D images, and this difference varies with the height of the object.
[0031] Step S204: Establish a pixel position deviation model with the height of the measured object as the independent variable. The pixel position deviation model describes the correspondence between pixel coordinate deviation in the Y direction and height value, and the correspondence between pixel coordinate deviation in the X direction and height value.
[0032] In single-chip integrated line scanning imaging devices, since neither the 2D nor 3D imaging optical paths can guarantee that the chip plane is strictly perpendicular to the working plane, changes in the height of the object being measured will cause systematic pixel coordinate deviations in both the Y and X directions. The Y-direction deviation manifests as a systematic translation of the pixel row coordinates as the height changes, while the X-direction deviation includes both height-related scaling and translation components. Because the deviation patterns of the two imaging systems differ, independent deviation models must be established for each system. After calibrating their respective deviation coefficients using correction blocks, geometric correction can be performed on the two image data streams separately.
[0033] Step S206: Scan the correction block with at least two known height levels and feature aperture arrays distributed on each height level, extract the center coordinates of the feature apertures on each height level, use the theoretical center coordinates as the true value and the measured center coordinates as the observed value, and solve the deviation coefficient of the pixel position deviation model by solving the system of equations.
[0034] like Figure 4 and Figure 5 As shown, the correction block has two height levels: a first height level and a second height level, and the height difference between the two height levels is known. In the top-view direction of the correction block, circular feature holes are uniformly distributed on the surface of each height level. These feature holes satisfy symmetry requirements in both the X and Y directions, allowing the theoretical coordinates of the center of each feature hole to be accurately calculated based on the geometric design parameters of the correction block. During scanning, the correction block is placed flat within the field of view of the line scanning imaging device and moves at a constant speed with the transport mechanism. The line scanning imaging device scans the correction block line by line, obtaining a 2D color scan image and a 3D height scan image containing the feature hole images of both height levels.
[0035] When solving for the Y-direction deviation coefficient, the height values corresponding to the positions of each feature hole are read from the 3D height image, using the original 3D data before calibration. The measured Y-coordinates of the center of each feature hole at the first height level are used as the first set of observation data, and the measured Y-coordinates of the center of each feature hole at the second height level are used as the second set of observation data. The theoretical Y-coordinates of the center of each feature hole are calculated based on the geometric design parameters of the correction block and used as the true values. Equations are constructed for multiple feature holes on the correction block using the differences between the true values and the observed data, forming an overdetermined linear equation system in the Y direction. The least squares method is used to solve for the Y-direction deviation coefficient. The theoretical Y-coordinates calculated using the geometric design parameters are used as the true values, which are unaffected by the machining error of the correction block. The observation data from the two height levels ensure the solvability of the equation system and the stability of the solution results.
[0036] When solving for the X-direction deviation coefficient, the measured X-coordinates of the centers of each feature hole at the first height level are used as the first set of observation data, and the measured X-coordinates of the centers of each feature hole at the second height level are used as the second set of observation data. The theoretical X-coordinates of each feature hole center are calculated based on the geometric design parameters of the correction block and used as the true values. The measurement data of multiple feature holes at the two height levels are substituted into the X-direction deviation model to form an overdetermined linear equation system in the X direction. The least squares method is used to solve for the X-direction deviation coefficient. Since the X-direction deviation model also includes scale terms and translation terms, there are four coefficients to be solved. Multiple feature hole coordinates need to be collected at at least two different height levels to ensure the solvability of the equation system and the uniqueness and stability of the solution results.
[0037] Step S208: For each image in the 2D color image and the 3D height image, traverse the pixel coordinates in the image, read the height value of the corresponding position from the 3D height image, substitute the height value into the pixel position deviation model to calculate the correction coordinates, use the interpolation operator to resample the image at the correction coordinates, generate the corrected image of the image, and obtain the corrected 2D color image and the corrected 3D height image.
[0038] The computer equipment performs pixel-level traversal correction on both the 2D color image and the 3D height image. For each pixel coordinate in the image, the height value is read from the corresponding position in the 3D height image. This height value is then substituted into the Y-direction deviation model to calculate the corrected Y-coordinate, and into the X-direction deviation model to calculate the corrected X-coordinate, yielding the corrected coordinates of that pixel in the image. Since the corrected coordinates are usually non-integer coordinates, an interpolation operator is used to resample at the corrected coordinates in the image. The resampling result is then used as the pixel value at the current pixel coordinates in the output image. The selection of the interpolation operator must balance image quality with computational efficiency to meet the requirement of pixel-by-pixel traversal processing of the entire image.
[0039] Step S210: Based on the pre-calibrated 3D coordinate system, calculate the fixed number of line offsets between the first scan position of the imaging system of the corrected 2D color image and the corrected 3D height image, translate the 3D height image along the Y direction by the fixed number of line offsets, obtain the translated 3D height data, and output the corrected 2D color image and the translated 3D height data aligned in a unified coordinate system.
[0040] Specifically, the calibration of 3D height data is accomplished using a sloped dot matrix: a sloped dot matrix plate with a known geometric design is placed within the field of view of a line-scan imaging device for scanning. Due to the slope, each feature point on the dot matrix plate is at a different known height. The measured coordinates of each feature point are extracted from the 3D height data and paired with the theoretical 3D coordinates calculated based on the geometric design parameters of the sloped dot matrix plate. The calibration mapping coefficients of the 3D height data are then solved by fitting these point pairs, converting the 3D height data into physical coordinates in a 3D coordinate system. Since 2D color images do not contain 3D coordinate information, they are not calibrated separately. Instead, they are calibrated using 3D height data as a reference: first, the pixel coordinate deviation caused by the height difference is corrected using a pixel position deviation model; then, the 3D height data is translated a specified number of rows along the Y direction using the first-row alignment method described below. This constructs 3D height data aligned with the 2D color image, achieving alignment between the 2D color image and the 3D height data in the 3D coordinate system, thus realizing the calibration of the 3D coordinate system. In another embodiment, the scanning data of the correction block can also be reused to complete the above calibration: For the Z-axis, the original height readings of the regions where the feature holes are located at each height level are read from the 3D height image, and the original height readings corresponding to different height levels are matched one by one with the known design height of the correction block. The linear mapping coefficient between the height readings and the physical height values is solved by linear fitting. For the X and Y axes, the measured coordinates of the center of each feature hole are extracted with sub-pixel precision, and the measured coordinates are matched with the theoretical physical coordinates calculated according to the geometric design parameters of the correction block. The scaling factor between the image pixel coordinates and the X and Y physical coordinates is solved. Both of the above 3D coordinate system calibrations are mature techniques in this field.
[0041] After the above calibration, both the 2D color image and the 3D height data are mapped to the 3D coordinate system. The physical coordinates of each feature point on the inclined dot matrix plate in the 3D coordinate system are obtained according to the design parameters of the inclined dot matrix plate. The subsequent calculation of the fixed row offset and the three-dimensional shape measurement are all performed in the calibrated 3D coordinate system.
[0042] Because the 2D color imaging system and the 3D structured light imaging system have different physical positions on the camera body, the starting positions of the photosensitive pixels in the scanning direction differ between the two systems. That is, the first line of the scan corresponds to different physical positions on the object being measured. This difference in the first line position is determined by the camera's optical path geometry and is a fixed value. To determine this fixed line offset, a sloping dot matrix plate needs to be scanned. The sloping dot matrix plate is placed within the common viewing area that both the 2D and 3D imaging systems can image from. The coordinates of feature points on the sloping dot matrix plate are extracted from the bias-corrected 2D color image and the calibrated 3D height data, respectively. By comparing the difference in the Y-direction coordinates of the same feature point in the two data streams, the fixed line offset is calculated. Since this offset is determined by the fixed geometry of the camera's optical path, it is a constant when the camera's installation state remains unchanged and does not need to be recalculated for each scan. After obtaining a fixed number of row offsets, the entire 3D height data after deviation correction is translated along the Y direction by this offset, so that the first row of the 3D height data and the first row of the 2D color image correspond to the same physical position on the object being measured, thereby achieving precise alignment of the 2D color image and 3D height data in a unified coordinate system, and outputting the aligned multimodal image data.
[0043] Step S212: Based on the aligned 3D height data, extract the height values of each measurement point on the surface of the object under test; combine the aligned 2D color image to obtain the surface appearance information corresponding to each measurement point; fuse the height values and surface appearance information to generate the three-dimensional morphology measurement results of the surface of the object under test.
[0044] After the initial offset translation is completed, the 2D color image and 3D height data are now in a unified coordinate system. The computer uses the pixel coordinates of each valid measurement point in the aligned 3D height data as an index to directly find the pixel value at the same coordinate position in the aligned 2D color image. The surface appearance information of that pixel is used as the appearance attribute of the measurement point, combined with its 3D spatial coordinates (X, Y, Z) to form a 3D measurement point with appearance attributes. The computer processes all valid measurement points sequentially according to the line scan order. Utilizing the hardware characteristics of the line scan imaging device for line-by-line acquisition, the coordinate indexing and appearance attribute assignment are executed sequentially in a pipeline manner. For pixel positions in the 3D height data that have missing or invalid height values (such as points where structured light measurement fails due to highly reflective or transparent materials), the computer skips these points and does not participate in the fusion, ensuring the validity of the data at each point in the 3D topography measurement result. After all valid measurement points have been processed, the set of 3D measurement points with appearance attributes is used as the 3D topography measurement result of the measured object surface and output to the downstream detection system or storage system.
[0045] Since the 2D color image and 3D height data have undergone pixel-level geometric correction and coordinate system alignment in steps S208 and S210, the spatial deviation of the pixels corresponding to each 3D measurement point is within 2 pixels, ensuring the spatial consistency of surface appearance information and height information. This allows the 3D topography measurement results to accurately reflect the true geometric shape and surface appearance distribution of the measured object. Compared to the traditional dual-camera scheme, this scheme can simultaneously acquire high-precision aligned surface appearance information and 3D height data using a single line scan imaging device. It eliminates the need for extrinsic parameter calibration and coordinate system transformation between two independent cameras, directly outputting the 3D topography measurement results, thus reducing system cost and calibration complexity.
[0046] In some implementations, the pixel position deviation model described above is specifically implemented in a linear form. The Y-direction deviation model is Y1 = Y + (k0 × H + b0), where Y1 is the corrected Y-coordinate value, Y is the Y-coordinate value on the image, H is the height of the measured object at the pixel position, k0 is the Y-direction height-deviation linear coefficient, and b0 is the Y-direction zero height intercept. For the X-direction deviation, height changes cause not only translational deviation in the X-direction but also scaling deviation in the X-direction. Therefore, the X-direction deviation model is X1 = X × (k1 × H + b1) + (k2 × H + b2), where X1 is the corrected X-coordinate value, X is the X-coordinate value on the image, k1 × H + b1 is the height-related scaling coefficient, k2 × H + b2 is the height-related translation coefficient, and k1, b1, k2, and b2 are four linear deviation coefficients. The above two deviation models contain a total of six deviation coefficients k0, b0, k1, b1, k2, and b2, which are solved through calibration of the correction block.
[0047] When solving for the deviation coefficients k0 and b0, the measured Y-coordinates of the center of each feature hole at the first height level of the correction block are used as the first set of observation data, and the measured Y-coordinates of the center of each feature hole at the second height level are used as the second set of observation data. The theoretical center Y-coordinates of each feature hole are used as the true values, and the difference between the true values and the observed data is calculated as the deviation. The height values corresponding to each feature hole are substituted into the Y-direction deviation model Y1=Y+(k0×H+b0) to construct an overdetermined linear equation system in the Y-direction. The deviation coefficients k0 and b0 are solved by the least squares method. When solving for the deviation coefficients k1, b1, k2, and b2, the measured X-coordinates of the centers of each feature hole at the first height level are used as the first set of observation data, and the measured X-coordinates of the centers of each feature hole at the second height level are used as the second set of observation data. The theoretical center X-coordinates of each feature hole are used as the true values, and the difference between the true values and the observed data is calculated as the deviation. The height values corresponding to each feature hole are substituted into the X-direction deviation model X1 = X × (k1 × H + b1) + (k2 × H + b2) to construct an overdetermined linear equation system in the X-direction. The deviation coefficients k1, b1, k2, and b2 are solved using the least squares method. Figure 6 As shown, the coordinates of the feature hole center in the scanned image exhibit significant X and Y direction offsets in the second height level region. The aforementioned linear deviation model can physically characterize this offset pattern. After calibration and solving the six deviation coefficients, the coordinate deviation of each pixel in the image can be accurately compensated to within 2 pixels.
[0048] In some implementations, the interpolation operator in step S208 is a bilinear interpolation operator, and the steps of traversing the coordinates of each pixel in the image, calculating the correction coordinates, and resampling are executed in parallel by the graphics processor. Specifically, the computer device transmits 2D color image data and 3D height image data in batches to the video memory of the graphics processor. The graphics processor uses each pixel in the image as an independent calculation thread, and each thread performs the following operations in parallel: reads the coordinates of the corresponding pixel from the video memory, reads the height value of the corresponding position from the 3D height image video memory, reads the deviation coefficient from the constant storage space of the graphics processor, calculates the correction coordinates, performs bilinear interpolation, and writes the resampling result to the corresponding position in the output image video memory.
[0049] The specific execution process of bilinear interpolation is as follows: Based on the decimal part of the correction coordinates, determine the four integer coordinate pixels adjacent to the correction coordinates. Calculate the weighting coefficients of each adjacent pixel for the output pixel value based on the distance between the correction coordinates and each adjacent integer coordinate. Sum the pixel values of the four adjacent pixels using weighted summation, and use the sum as the output value of the current pixel. Bilinear interpolation effectively avoids jagged edges and holes in the image after geometric correction, ensuring the visual quality of the corrected image. After calibration, the deviation coefficients are stored as constants in the constant storage space of the graphics processor. Each calculation thread can efficiently read them via broadcast, avoiding the overhead of repeated loading. After the traversal and interpolation calculation of all pixels is completed, the computer device transfers the processing results from the graphics processor's video memory back to main memory. The massively parallel computing capability of the graphics processor reduces the pixel correction processing time by one to two orders of magnitude compared to the serial processing of the central processing unit, meeting the real-time image processing requirements of industrial production lines.
[0050] In some implementations, after solving the deviation coefficients in step S206, the method further includes a goodness-of-fit test of the deviation model and an adaptive model selection step. The computer device substitutes the calibration data into the solved Y-direction and X-direction deviation models, calculates the residuals between the predicted and measured values of the deviation models at each calibration point, and then calculates the root mean square of the residuals. When the root mean square of the residuals in the Y-direction or X-direction does not exceed a preset threshold, the current deviation model is retained for subsequent pixel correction to ensure computational efficiency. When the root mean square of the residuals exceeds the preset threshold, it is determined that the current model's fitting accuracy to the actual deviation pattern is insufficient. The deviation model in the corresponding direction is automatically replaced with a higher-order polynomial deviation model or a piecewise linear deviation model, and the coefficients of the replaced model are refitted using the calibration data. The higher-order polynomial deviation model is a quadratic or cubic polynomial, and the coefficients are solved by least-squares fitting from the calibration data.
[0051] When replacing with a piecewise linear deviation model, the range of height values is divided into multiple segmented intervals according to preset segment boundaries. An independent linear deviation model is established within each segmented interval, and the coefficients of the linear model within each interval are independently solved using calibration data within that interval. At the boundaries of adjacent segmented intervals, a linear transition processing is applied to the deviation between two adjacent linear models at the boundary height, ensuring continuous variation of the deviation at the boundary and avoiding abrupt changes in the deviation at the segment boundaries. During the pixel correction stage, the computer determines the segmented interval to which each pixel belongs based on its corresponding height value and selects the model coefficients for the corresponding segmented interval to calculate the correction coordinates. By introducing a goodness-of-fit test during the calibration stage, adaptive selection of the deviation model is achieved: when the height range of the measured object is small and the deviation exhibits linear characteristics, the linear model is retained to reduce computational complexity; when the height range is large and the deviation exhibits non-linear characteristics, the model is automatically upgraded to adapt to the accuracy requirements of complex scenarios.
[0052] In some embodiments, the above method further includes an online dynamic correction step. During the scanning process, the computer device periodically triggers scanning of a preset calibration area at fixed line intervals. The preset calibration area is a calibration target embedded on the production line conveyor belt, on which feature points with known coordinates are provided. It periodically enters the field of view of the line scanning imaging device as the conveyor belt moves. Each time the calibration area enters the field of view, the computer device extracts the current coordinates of the feature points of the calibration area from the currently acquired image data, compares the current coordinates with the reference coordinates recorded for the feature point during the initial calibration, calculates the drift of the deviation coefficients in each direction relative to the reference value, and dynamically updates the currently used deviation coefficients based on the drift, so that the deviation model continuously tracks the actual state of the camera parameters.
[0053] Building upon this foundation, temperature compensation can be further introduced. The computer acquires the current temperature value output by the built-in temperature sensor of the line-scan imaging device, calculates the difference between the current temperature value and the reference temperature value recorded during initial calibration, calculates the correction amount for each deviation coefficient caused by temperature changes based on this temperature difference, and adds each deviation coefficient correction amount to the drift amount of the corresponding deviation coefficient to obtain a comprehensive update amount. The deviation coefficients are then updated based on this comprehensive update amount. This online dynamic correction mechanism, combined with temperature compensation, can compensate in real time for deviation coefficient drift caused by mechanical vibration, thermal expansion, and other factors during long-term camera operation. This ensures the continuous stability of alignment accuracy under long-term continuous operation of the production line, overcoming the accuracy decay defect of offline one-time calibration schemes during long-term operation.
[0054] In some implementations, the correction block has three or more known height levels, and a multi-height-level calibration and fusion strategy is used to solve for the deviation coefficients. The computer extracts the center coordinates of the feature holes at each height level, establishes a correspondence between the corresponding height value and the deviation at that height level, and summarizes the deviation-height value correspondences for all height levels to generate a multi-level deviation lookup table. The multi-level deviation lookup table uses the height value of each calibration height level as an index and the corresponding X and Y direction deviations as table entry values. During the pixel correction stage, for any pixel's height value, the computer searches the multi-level deviation lookup table for the nearest adjacent height level. By weighted interpolation of the deviations of adjacent height levels, the deviation at that height value is estimated, and the estimated deviation is used for the pixel's coordinate correction. Compared to a linear model using only two height levels, the multi-height-level calibration scheme significantly improves the accuracy of deviation estimation across the entire height range through dense sampling, making it particularly suitable for applications with a large scanning height range or where the deviation changes non-linearly with height.
[0055] In some implementations, the pixel position deviation model is implemented by a convolutional neural network, replacing the analytical deviation model described above to complete pixel coordinate correction. During the training phase, a training sample set is constructed using calibration data collected from the correction block under various height conditions. Each training sample includes a local patch cropped from a 3D height image and a 2D color image, along with the pixel-level deviation vector for each pixel within the corresponding local patch. The deviation vector is calculated from the difference between the measured coordinates and theoretical coordinates in the calibration data. The convolutional neural network is trained using the training sample set. The network employs an encoder-decoder structure. The encoder receives the concatenated input of local patches from the 3D height image and the 2D color image, extracts joint features, and the decoder decodes the joint features into a pixel-level deviation vector field of the same size as the input patch. The output value at each position in the vector field is the deviation amount of that pixel in the X and Y directions. After network training, in the image correction phase, the computer divides the 2D color image and the 3D height image into several overlapping local patches. These patches are then fed into the trained convolutional neural network for inference, obtaining pixel-level deviation vector fields for each patch. The deviation vector fields of each patch are then combined into a full-image deviation vector field. Finally, the deviation vectors of each pixel in the full-image deviation vector field are superimposed onto the corresponding pixel coordinates to obtain the corrected coordinates. Bilinear interpolation is then used to complete the resampling. The network inference process is accelerated using a graphics processing unit (GPU) to meet real-time processing requirements. This deep learning-based deviation prediction scheme can learn complex nonlinear deviation patterns from calibration data that are difficult to accurately describe using analytical models. It is particularly suitable for scenarios where the object surface has special optical properties such as high reflectivity or transparency, making analytical modeling difficult.
[0056] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0057] In one embodiment, such as Figure 3 As shown, a multimodal line scan alignment object surface measurement system is provided, including an image acquisition module, a deviation modeling module, a calibration module, a pixel correction module, an alignment module, and a measurement output module, wherein: The image acquisition module controls the line-scan imaging device of the shared optical system to simultaneously acquire 2D color images and 3D height images. The 2D color imaging system located at the top and the 3D structured light imaging system located at the bottom of the line-scan imaging device are integrated into the same camera body. The 2D color imaging system consists of a light-emitting diode (LED) white light source and a color photosensitive pixel array, with four rows of 5120 pixels per row. The 3D structured light imaging system consists of a line laser source and a grayscale photosensitive pixel array, with 832 rows of 2560 pixels per row. Both imaging systems share the same camera lens, but their respective imaging optical axes are tilted. The image acquisition module receives the synchronization trigger signal from the line-scan imaging device, ensuring that the 2D color image frames and 3D height image frames correspond in time. During the calibration phase, the 2D color scan image and 3D height scan image of the correction block are output to the calibration module; during the measurement phase, the 2D color image and 3D height image of the object being measured are output to the pixel correction module.
[0058] The deviation modeling module is used to establish a pixel position deviation model with the height of the measured object as the independent variable. The pixel position deviation model describes the correspondence between pixel coordinate deviation in the Y direction and the height value, as well as the correspondence between pixel coordinate deviation in the X direction and the height value. Specifically, it includes a linear deviation model in the Y direction and an affine-linear composite deviation model in the X direction. The deviation modeling module receives the deviation coefficients output by the calibration module, writes the deviation coefficients into the pixel position deviation model, and provides the complete deviation model containing the deviation coefficients to the pixel correction module. When the deviation coefficients are updated through the online dynamic correction step, the deviation modeling module synchronously refreshes the model parameters to ensure that the pixel correction module always uses the latest deviation coefficients to perform correction calculations.
[0059] The calibration module processes the image data obtained from scanning the correction block, output by the image acquisition module, and solves for the deviation coefficients of the pixel position deviation model. The calibration module includes a feature hole center extraction submodule and an equation solving submodule. The feature hole center extraction submodule detects feature holes at each height level in the scanned image of the correction block. It uses a subpixel-precision circle center fitting algorithm to fit ellipses or circles to the image regions of each detected feature hole, extracting the subpixel-precision center coordinates of each feature hole, and outputs the extraction results to the equation solving submodule. The equation solving submodule uses the theoretical center coordinates of each feature hole as the true value and the center coordinates output by the subpixel-precision circle center fitting algorithm as the observed value to construct overdetermined linear equations in the Y and X directions. It uses the least squares method to solve for the deviation coefficients in the Y and X directions respectively, and outputs all deviation coefficients to the deviation modeling module. The subpixel-precision circle center fitting algorithm improves the extraction accuracy of the feature hole center coordinates to the subpixel level, thus ensuring high accuracy in solving the deviation coefficients, and ultimately ensuring that the final alignment result achieves an accuracy within 2 pixels.
[0060] The pixel correction module iterates through the coordinates of each pixel in the image, reads the height value of the corresponding position from the 3D height image, substitutes the height value into the pixel position deviation model provided by the deviation modeling module to calculate the correction coordinates, and uses a bilinear interpolation operator to resample the image at the correction coordinates to generate the corrected image. The corrected 2D color image and the corrected 3D height image are then output to the alignment module. The pixel correction module supports parallel acceleration of the pixel traversal and interpolation process by calling the graphics processor. The deviation coefficients are stored as constants in the constant storage space of the graphics processor. The deviation model calculation and bilinear interpolation of each pixel are executed in parallel as independent threads. Compared with the serial processing of the central processing unit, the processing time can be reduced by one to two orders of magnitude, meeting the real-time processing requirements of industrial production lines.
[0061] The alignment module calculates a fixed-row offset between the first scan position of the 2D color image and the 3D height image in a pre-calibrated 3D coordinate system. It then translates the corrected 3D height image along the Y-direction by this fixed-row offset, outputting the aligned corrected 2D color image and the translated 3D height data in a unified coordinate system. During the calibration phase, the alignment module solves for the calibration mapping coefficients of the 3D height data based on the scan data from the inclined dot matrix, establishing the 3D coordinate system. The fixed-row offset is determined by scanning the inclined dot matrix within the common viewing area. After the inclined dot matrix scan image is corrected by the pixel correction module, the alignment module extracts the coordinates of feature points from it. The alignment module extracts the coordinates of feature points on the inclined dot matrix from the deviation-corrected 2D color image and the calibrated 3D height data, respectively. It calculates the fixed-row offset by comparing the difference in the Y-direction coordinates of the same feature point in the two data streams. This offset is constant under unchanged camera mounting conditions and does not need to be recalculated for each scan.
[0062] The measurement output module receives the aligned 2D color image and 3D height data output by the alignment module. Using the pixel coordinates of each valid measurement point in the aligned 3D height data as an index, the module directly searches for the pixel value at the same coordinate position in the aligned 2D color image to obtain the surface appearance information corresponding to that measurement point. This surface appearance information is then combined with the 3D spatial coordinates (X, Y, Z) of the measurement point to form a 3D measurement point with appearance attributes. The measurement output module processes all valid measurement points sequentially according to the line scan order. Utilizing the hardware characteristics of the line scan imaging device's line-by-line acquisition, it sequentially performs coordinate indexing and appearance attribute assignment in a pipeline manner. For pixel positions in the 3D height data that have missing or invalid height values (such as points where structured light measurement fails due to highly reflective or transparent materials), the measurement output module skips these points and does not participate in the fusion, ensuring the validity of the data at each point in the 3D topography measurement result. After processing all valid measurement points, the measurement output module outputs the set of 3D measurement points with appearance attributes as the 3D topography measurement result of the measured object's surface to the downstream detection system or storage system. Since the 2D color image and 3D height data have already undergone pixel-level geometric correction and coordinate system alignment in the pixel correction module and alignment module, the coordinates can be directly indexed without additional registration steps, ensuring the spatial consistency between surface appearance information and height information.
[0063] In a complete alignment task, the six modules mentioned above work collaboratively in the following data flow order: The image acquisition module synchronously acquires 2D color images and 3D height images and outputs them to the deviation modeling module and the pixel correction module; the calibration module processes the scanning data of the correction block, solves for the deviation coefficients, and outputs them to the deviation modeling module; the deviation modeling module writes the deviation coefficients into the pixel position deviation model and provides them to the pixel correction module; the pixel correction module performs pixel-level geometric correction on the 2D color images and 3D height images respectively according to the pixel position deviation model, generates the corrected 2D color images and corrected 3D height images, and outputs them to the alignment module; the alignment module calculates the first-line offset, performs Y-direction translation on the corrected 3D height image, and finally outputs the corrected 2D color image and the translated 3D height data aligned in a unified coordinate system; the measurement output module receives the aligned data output by the alignment module, fuses the surface appearance information with the three-dimensional spatial coordinates point by point using a direct coordinate indexing method, and generates the three-dimensional morphology measurement results of the measured object surface in a pipeline manner according to the row scanning sequence, completing the end-to-end processing from the original image acquisition to the final three-dimensional morphology measurement output.
[0064] Each module in the aforementioned multimodal line scan aligned object surface measurement system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware within or independently of the processor in a computer device, or stored in software within the computer device's memory, allowing the processor to invoke and execute the corresponding operations of each module.
[0065] In one implementation, such as Figure 7As shown, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps: synchronously acquiring 2D color images and 3D height images using a line-scanning imaging device with a shared optical system; establishing a pixel position deviation model with the height of the measured object as the independent variable, wherein the pixel position deviation model describes the correspondence between pixel coordinate deviation in the Y direction and the height value, and the correspondence between pixel coordinate deviation in the X direction and the height value; scanning a correction block having at least two known height levels and feature aperture arrays distributed on each height level, extracting the center coordinates of the feature apertures on each height level, and solving for the deviation coefficients by using the theoretical center coordinates as the true value and the measured center coordinates as the observed value, and solving for the deviation coefficients by solving a system of equations; for each image in the 2D color image and the 3D height image, traversing each pixel coordinate in the image, and reading the corresponding pixel coordinates from the 3D height image. The height value of the location is used to calculate the correction coordinates in the pixel position deviation model. An interpolation operator is then used to resample the image at the correction coordinates to generate the corrected image, resulting in a corrected 2D color image and a corrected 3D height image. Based on a pre-calibrated 3D coordinate system, a fixed number of line offsets between the first scan position of the imaging system for the corrected 2D color image and the corrected 3D height image are calculated. The 3D height image is then translated along the Y direction by a fixed number of line offsets to obtain the translated 3D height data. The corrected 2D color image and the translated 3D height data, aligned in a unified coordinate system, are output. Based on the aligned 3D height data, the height values of each measurement point on the surface of the object are extracted. The surface appearance information corresponding to each measurement point is obtained by combining the aligned 2D color image. The height values and surface appearance information are fused to generate the three-dimensional morphology measurement results of the surface of the object.
[0066] In one implementation, when the processor executes the computer program, it further performs the following steps: the pixel position deviation model includes a Y-direction deviation model Y1=Y+(k0×H+b0) and an X-direction deviation model X1=X×(k1×H+b1)+(k2×H+b2); using the measured Y-coordinates of the center of each feature hole at the first height level of the correction block as the first set of observation data, and the measured Y-coordinates of the center of each feature hole at the second height level as the second set of observation data, using the theoretical center Y-coordinates of each feature hole as the true value, calculating the difference between the true value and the observed data as the deviation, and assigning the corresponding feature hole... Substituting the height values into the Y-direction deviation model, an overdetermined linear equation system in the Y-direction is constructed, and the deviation coefficients k0 and b0 are solved using the least squares method. The measured X-coordinates of the centers of each feature hole at the first height level are used as the first set of observation data, and the measured X-coordinates of the centers of each feature hole at the second height level are used as the second set of observation data. The theoretical center X-coordinates of each feature hole are used as the true values, and the difference between the true values and the observed data is calculated as the deviation. Substituting the height values corresponding to each feature hole into the X-direction deviation model, an overdetermined linear equation system in the X-direction is constructed, and the deviation coefficients k1, b1, k2, and b2 are solved using the least squares method.
[0067] In one implementation, the processor, when executing the computer program, further performs the following steps: after solving for the deviation coefficients, calculates the root mean square of the residuals of the pixel position deviation model on the calibration data; when the root mean square of the residuals exceeds a preset threshold, replaces the pixel position deviation model with a high-order polynomial deviation model or a piecewise linear deviation model, and refits the coefficients of the replaced model using the calibration data.
[0068] In one embodiment, when the processor executes the computer program, it further performs the following steps: during the scanning process, periodically triggers scanning of a preset calibration area at fixed line intervals, extracts the current coordinates of feature points in the calibration area, compares the current coordinates with the reference coordinates of the feature points, calculates the drift amount of the deviation coefficient, and dynamically updates the deviation coefficient based on the drift amount; obtains the current temperature value output by the temperature sensor of the line scanning imaging device, calculates the temperature correction amount based on the difference between the current temperature value and the reference temperature value, and updates the deviation coefficient after superimposing the temperature correction amount onto the drift amount.
[0069] In one embodiment, a measurement system is provided, including a first light projection device, a second light projection device, a first photosensitive element, a second photosensitive element, and the computer equipment described in any of the above embodiments.
[0070] The first light projection device is a white light source using LEDs, used to project uniform white light onto the object under test, providing illumination for 2D color imaging of the first photosensitive element. The second light projection device is a line laser source, used to project line laser stripes onto the object under test, providing laser light for 3D structured light imaging of the second photosensitive element. The first light projection device and the first photosensitive element together constitute a 2D color imaging system, and the second light projection device and the second photosensitive element together constitute a 3D structured light imaging system. The two imaging systems share the same camera lens, but their respective imaging optical axes have tilt angles. Under actual installation conditions, it is impossible to ensure that the chip plane is strictly perpendicular to the working plane, which causes different pixel coordinate deviations in the two images due to changes in the height of the object under test.
[0071] The first photosensitive element is a color photosensitive pixel array with 4 rows and 5120 pixels per row. It acquires a 2D color image of the object's surface line by line as the object moves with the conveyor mechanism, and outputs the 2D color image to a computer. The second photosensitive element is a grayscale photosensitive pixel array with 832 rows and 2560 pixels per row. It acquires a 3D height image of the object's surface line by line using the triangulation principle, and outputs the 3D height image to a computer.
[0072] The computer equipment is electrically connected to the first photosensitive element and the second photosensitive element respectively, and synchronously receives the 2D color image output by the first photosensitive element and the 3D height image output by the second photosensitive element. It sequentially performs pixel position deviation modeling, correction block calibration, pixel correction, data alignment and three-dimensional shape measurement processing to generate the three-dimensional shape measurement result of the surface of the object under test and output it to the downstream industrial vision inspection system.
[0073] This embodiment integrates two imaging systems into a single camera body, and the shared lens reduces hardware costs. By executing the alignment and measurement method of this application through computer equipment, multimodal image alignment with an accuracy of less than 2 pixels is achieved, and three-dimensional topography measurement results with surface appearance information are output.
[0074] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program performs the following steps: simultaneously acquiring 2D color images and 3D height images using a line-scanning imaging device with a shared optical system; establishing a pixel position deviation model with the height of the object being measured as the independent variable, wherein the pixel position deviation model describes the correspondence between pixel coordinate deviation in the Y direction and the height value, and the correspondence between pixel coordinate deviation in the X direction and the height value; scanning a correction block having at least two known height levels, each height level having a feature aperture array distributed thereon, extracting the center coordinates of the feature apertures at each height level, and solving for the deviation coefficients by using the theoretical center coordinates as the true values and the measured center coordinates as the observed values, and solving for the deviation coefficients by simultaneously solving a system of equations; for each image in the 2D color image and the 3D height image, traversing each pixel coordinate in the image, and reading the corresponding position from the 3D height image. The height value is used to calculate the correction coordinates in the pixel position deviation model. An interpolation operator is used to resample the image at the correction coordinates to generate the corrected image, resulting in a corrected 2D color image and a corrected 3D height image. Based on a pre-calibrated 3D coordinate system, a fixed number of line offsets between the first scan position of the imaging system for the corrected 2D color image and the corrected 3D height image are calculated. The 3D height image is then translated along the Y direction by a fixed number of line offsets to obtain the translated 3D height data. The corrected 2D color image and the translated 3D height data, aligned in a unified coordinate system, are output. Based on the aligned 3D height data, the height values of each measurement point on the surface of the object are extracted. The surface appearance information corresponding to each measurement point is obtained by combining the aligned 2D color image. The height values and surface appearance information are fused to generate the three-dimensional morphology measurement results of the surface of the object.
[0075] In one implementation, when the computer program is executed by the processor, it further performs the following steps: when the correction block has three or more known height levels, extract the center coordinates of the feature holes at each height level, establish the correspondence between the deviation and the height value, and generate a multi-level deviation lookup table; for any height value, estimate the deviation at that height value by performing weighted interpolation on the deviations of adjacent height levels in the multi-level deviation lookup table, and use the estimated deviation for pixel coordinate correction.
[0076] In one implementation, when the computer program is executed by the processor, it further performs the following steps: constructing training samples using calibration data collected from the correction block, the training samples including local patches of the 3D height image and the 2D color image and the corresponding pixel-level deviation vectors; training a convolutional neural network with the training samples, so that the convolutional neural network outputs a pixel-level deviation vector field after inputting local patches of the 3D height image and the 2D color image; in the image correction stage, the 2D color image and the 3D height image are respectively segmented into local patches, fed into the trained convolutional neural network for inference, to obtain the pixel-level deviation vector field, and the pixel-level deviation vector field is applied to pixel coordinate correction.
[0077] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0078] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0079] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for measuring the surface of an object using multimodal line scan alignment, characterized in that, The method includes: A line-scan imaging device using a shared optical system simultaneously acquires 2D color images and 3D height images; A pixel position deviation model is established with the height of the measured object as the independent variable. The pixel position deviation model describes the correspondence between pixel coordinate deviation in the Y direction and height value, and the correspondence between pixel coordinate deviation in the X direction and height value, respectively. Scan a correction block having at least two known height levels and feature aperture arrays distributed on each height level, extract the center coordinates of the feature apertures on each height level, use the theoretical center coordinates as the true value and the measured center coordinates as the observed value, and solve the deviation coefficient of the pixel position deviation model by solving a system of equations. For each of the 2D color image and the 3D height image, traverse the pixel coordinates in the image, read the height value of the corresponding position from the 3D height image, substitute the height value into the pixel position deviation model to calculate the correction coordinates, and use an interpolation operator to resample the image at the correction coordinates to generate the corrected image of the image, thus obtaining the corrected 2D color image and the corrected 3D height image. Based on a pre-calibrated 3D coordinate system, a fixed number of rows offset is calculated between the first scan position of the imaging system of the corrected 2D color image and the corrected 3D height image. The 3D height image is then translated along the Y direction by the fixed number of rows offset to obtain the translated 3D height data. The corrected 2D color image and the translated 3D height data are then output in a unified coordinate system. Based on the aligned 3D height data, the height values of each measurement point on the surface of the object under test are extracted; the surface appearance information corresponding to each measurement point is obtained by combining the aligned 2D color image; the height values and the surface appearance information are fused to generate the three-dimensional shape measurement result of the surface of the object under test.
2. The method according to claim 1, characterized in that, The establishment of a pixel position deviation model with the height of the measured object as the independent variable includes: Y-direction deviation model and X-direction deviation model; The Y-direction deviation model is as follows: Y1 = Y + (k0 × H + b0), Where Y1 is the corrected Y coordinate value, Y is the Y coordinate value on the image, H is the height value, and k0 and b0 are the Y direction deviation coefficients; The X-direction deviation model is as follows: X1=X×(k1×H+b1)+(k2×H+b2), Where X1 is the corrected X coordinate value, X is the X coordinate value on the image, and k1, b1, k2 and b2 are the X direction deviation coefficients.
3. The method according to claim 2, characterized in that, The deviation coefficients obtained by solving the simultaneous equations for the pixel position deviation model include: The measured Y-coordinates of the centers of each feature hole at the first height level of the correction block are used as the first set of observation data, and the measured Y-coordinates of the centers of each feature hole at the second height level are used as the second set of observation data. The theoretical center Y-coordinates of each feature hole are used as the true values, and the difference between the true values and the observed data is calculated as the deviation. The height values corresponding to each feature hole are substituted into the Y-direction deviation model to construct an overdetermined linear equation system in the Y-direction. The deviation coefficients k0 and b0 are solved by the least squares method. The measured X-coordinates of the centers of each feature hole at the first height level are used as the first set of observation data, and the measured X-coordinates of the centers of each feature hole at the second height level are used as the second set of observation data. The theoretical center X-coordinates of each feature hole are used as the true values, and the difference between the true values and the observed data is calculated as the deviation. The height values corresponding to each feature hole are substituted into the X-direction deviation model to construct an overdetermined linear equation system in the X-direction. The deviation coefficients k1, b1, k2 and b2 are solved by the least squares method.
4. The method according to claim 1, characterized in that, The interpolation operator is a bilinear interpolation operator; the steps of traversing the coordinates of each pixel in the image, calculating the correction coordinates, and resampling are executed in parallel by the graphics processor, and the deviation coefficients are stored in constant form in the constant storage space of the graphics processor.
5. The method according to claim 1, characterized in that, The method further includes: After solving for the deviation coefficient, the root mean square residual of the pixel position deviation model on the calibration data is calculated. When the root mean square of the residual exceeds a preset threshold, the pixel position deviation model is replaced with a high-order polynomial deviation model or a piecewise linear deviation model, and the coefficients of the replaced model are refitted using the calibration data.
6. The method according to claim 1, characterized in that, The method further includes: During the scanning process, the scanning of the preset calibration area is periodically triggered at fixed line intervals. The current coordinates of the feature points in the calibration area are extracted, the current coordinates are compared with the reference coordinates of the feature points, the drift of the deviation coefficient is calculated, and the deviation coefficient is dynamically updated according to the drift. The current temperature value output by the temperature sensor of the line scanning imaging device is obtained, the temperature correction amount is calculated based on the difference between the current temperature value and the reference temperature value, and the deviation coefficient is updated after the temperature correction amount is added to the drift amount.
7. The method according to claim 1, characterized in that, The correction block has three or more known height levels, and the steps for solving the deviation coefficients using the simultaneous equations include: Extract the center coordinates of the feature holes at each height level, establish the correspondence between the deviation and the height value, and generate a multi-level deviation lookup table; For any height value, the deviation at that height value is estimated by weighted interpolation of the deviations at adjacent height levels in the multi-level deviation lookup table, and the estimated deviation is used for pixel coordinate correction.
8. The method according to claim 1, characterized in that, The pixel position deviation model is implemented by a convolutional neural network, including: Training samples are constructed using the calibration data collected by the correction block. The training samples include local patches of the 3D height image and the 2D color image and the corresponding pixel-level deviation vectors. The convolutional neural network is trained using the training samples, so that the convolutional neural network outputs a pixel-level deviation vector field after inputting local patches of the 3D height image and the 2D color image; In the image correction stage, the 2D color image and the 3D height image are respectively segmented into local patches, which are then fed into the trained convolutional neural network for inference to obtain the pixel-level deviation vector field, and the pixel-level deviation vector field is applied to pixel coordinate correction.
9. A multimodal line scan aligned object surface measurement system, characterized in that, include: The image acquisition module is used to control the line scanning imaging device of the shared optical system to simultaneously acquire 2D color images and 3D height images, and output the 2D color images and the 3D height images; The deviation modeling module is used to establish a pixel position deviation model with the height of the measured object as the independent variable. The pixel position deviation model describes the correspondence between pixel coordinate deviation in the Y direction and height value, and the correspondence between pixel coordinate deviation in the X direction and height value, respectively. The calibration module is used to scan a correction block with at least two known height levels and feature aperture arrays distributed on each height level, extract the center coordinates of the feature apertures on each height level, use the theoretical center coordinates as the true value and the measured center coordinates as the observed value, solve the deviation coefficient of the pixel position deviation model by solving a system of equations, and output the deviation coefficient to the deviation modeling module. The pixel correction module is used to: for each image in the 2D color image and the 3D height image, traverse the pixel coordinates in the image, read the height value of the corresponding position from the 3D height image, substitute the height value into the pixel position deviation model to calculate the correction coordinates, use an interpolation operator to resample the image at the correction coordinates, generate the corrected image of the image, and obtain the corrected 2D color image and the corrected 3D height image; The alignment module is used to calculate a fixed number of line offsets between the first scan position of the imaging system of the corrected 2D color image and the corrected 3D height image based on a pre-calibrated 3D coordinate system, translate the 3D height image along the Y direction by the fixed number of line offsets to obtain the translated 3D height data, and output the corrected 2D color image and the translated 3D height data aligned in a unified coordinate system. The measurement output module is used to extract the height values of each measurement point on the surface of the object under test based on the aligned 3D height data; and to obtain the surface appearance information corresponding to each measurement point by combining the aligned 2D color image. The height value is fused with the surface appearance information to generate a three-dimensional shape measurement result of the surface of the object being measured.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.
