Height measurement method, marking method and system, storage medium and program product
By projecting a light spot into existing standard marking equipment and measuring the pixel coordinates of the center point of the light spot using a monocular camera, combined with the height information of standard scale points, the problem of high hardware cost in existing technologies is solved, and low-cost, high-precision surface reconstruction is achieved.
Patent Information
- Application Number
- CN202511175254.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-12-19
AI Technical Summary
Existing industrial surface measurement technologies require additional hardware, resulting in high hardware costs and low measurement efficiency, making it difficult to achieve low-cost, high-precision surface reconstruction.
The laser device of the existing standard marking equipment projects a light spot on the surface of the object to be measured. The image of the light spot is acquired by a monocular camera and the pixel coordinates of the center point of the light spot are extracted. Combined with the height information of the standard scale point, the distance between the light spot and the scale point is calculated to realize the height measurement of the object to be measured.
High-precision surface reconstruction was achieved without adding hardware, reducing hardware costs and improving measurement efficiency.
Smart Images

Figure CN121163386A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of laser marking technology, and in particular to height measurement methods, marking methods, height measurement systems, storage media, and program products. Background Technology
[0002] In existing industrial surface measurement, especially for laser surface marking, precise acquisition of 3D data of the object's surface is required to achieve distortion-free projection marking. Current mainstream height measurement technologies mainly rely on: binocular vision systems, which calculate the height of the object being measured through the parallax of binocular lenses (this requires complex binocular lens calibration and high-precision image acquisition equipment); line-scan laser ranging, which relies on a laser line scanner and a precision displacement platform to obtain the height of the object being measured (this has low measurement efficiency and high complexity); and structured light ranging, which requires dedicated grating projection equipment to photograph the object being measured (this is sensitive to ambient light and has high hardware costs).
[0003] While the aforementioned mainstream height measurement technologies can achieve height measurement, they all require additional dedicated hardware (such as dual-camera modules, laser emitters, or grating projectors). This means manufacturers need to upgrade existing standard visual marking equipment with binocular or structured light modules, increasing hardware costs and requiring redesign of optical paths and mechanical structures. Therefore, a low-cost height measurement technology is urgently needed to achieve high-precision surface reconstruction.
[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main purpose of this application is to provide a height measurement method, marking method, height measurement system, storage medium and program product, which aims to solve the technical problem that existing height measurement technologies require additional hardware and have high costs.
[0006] To achieve the above objectives, this application proposes a height measurement method, the method comprising:
[0007] A first laser is emitted by a laser, and a first number of first light spots of a predetermined number are projected onto the surface of the object being tested.
[0008] The first light spot is photographed using a monocular camera, and the first pixel coordinates of the center of the first light spot in the camera coordinate system are obtained.
[0009] A second number of standard scale points and the height of each standard scale point are predetermined on the target laser optical path, and the standard scale points are projected onto the camera coordinate system to obtain the second pixel coordinates of the standard scale points in the camera coordinate system, wherein the target laser optical path is the optical path of the first laser.
[0010] Calculate the distance between the first pixel coordinates and the second pixel coordinates, determine the target standard scale point with the smallest distance, and take the height of the target standard scale point as the height of the measured object.
[0011] In one embodiment, before the step of photographing the first light spot with a monocular camera, the following steps are included:
[0012] Lens intrinsic parameters are calibrated using a calibration board to obtain the intrinsic parameter matrix and distortion coefficients of the monocular camera;
[0013] The lens extrinsic parameters are calibrated using a calibration board to obtain the extrinsic parameter matrix of the monocular camera;
[0014] The monocular camera is calibrated based on the intrinsic parameter matrix, the distortion coefficients, and the extrinsic parameter matrix.
[0015] In one embodiment, the step of projecting the standard scale point onto the camera coordinate system to obtain the second pixel coordinate of the standard scale point in the camera coordinate system includes:
[0016] Based on the extrinsic parameter matrix, the world coordinates of the standard scale points are converted into camera coordinates in the camera coordinate system;
[0017] Perform a projection transformation on the camera coordinates to obtain the corresponding planar coordinates;
[0018] The distortion coefficients are used to correct the distortion of the planar coordinates to obtain the distorted planar coordinates.
[0019] The distortion-corrected planar coordinates are mapped to the camera coordinate system using the intrinsic parameter matrix to obtain the second pixel coordinates of each standard scale point.
[0020] In one embodiment, before the step of converting the world coordinates of the standard scale point to camera coordinates in the camera coordinate system based on the extrinsic parameter matrix, the method includes:
[0021] Determine whether the height value of the standard scale point is greater than zero, where the positive or negative value of the height represents the direction;
[0022] If the height value is less than or equal to zero, the standard scale point is deemed invalid.
[0023] If the height value is greater than zero, then the step of converting the world coordinates of the standard scale point into camera coordinates in the camera coordinate system based on the extrinsic parameter matrix of the monocular camera is executed.
[0024] In one embodiment, the step of capturing the first light spot with a monocular camera and obtaining the first pixel coordinates of the center of the first light spot in the camera coordinate system includes:
[0025] The red channel of the first acquired light spot image is separated to extract the red light component image;
[0026] The red light component image is segmented based on a color intensity threshold to generate multiple binary images;
[0027] The light spot regions in each binary image are filtered and selected according to a preset geometric feature threshold, and the adjacent filtered light spot regions are merged to obtain the effective light spot regions.
[0028] The center coordinates of the effective light spot area are used as the first pixel coordinates of the center of the first light spot in the camera coordinate system.
[0029] In one embodiment, the step of calculating the distance between the first pixel coordinates and the second pixel coordinates, and determining the target standard scale point with the minimum distance, includes:
[0030] Calculate the Euclidean distance between the second pixel coordinates of each standard scale point and the first pixel coordinates of the center of the first light spot;
[0031] Standard scale points whose Euclidean distance is less than a preset distance threshold are selected as target standard scale points.
[0032] Furthermore, this application also proposes a marking method, which, when executed, employs the steps of the height measurement method described above, including:
[0033] Based on the height of the target standard scale points corresponding to all the first light spots, generate the three-dimensional point cloud data of the measured object;
[0034] Based on the three-dimensional point cloud data, a continuous surface model of the surface of the object under test is constructed by surface fitting.
[0035] The standard planar marking pattern is projected and transformed according to the continuous curved surface model to generate a curved marking path on the surface of the object being tested, and the marking operation is performed on the surface of the object being tested along the curved marking path.
[0036] Furthermore, to achieve the above objectives, this application also proposes a height measurement system, the system comprising:
[0037] A laser device for projecting a light spot onto the surface of an object under test, a camera for capturing the actual light spot on the surface of the object under test, and the object under test, wherein the laser device includes a laser that emits a laser, a galvanometer and a field lens for controlling the direction of the laser.
[0038] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the steps of the height measurement method and / or the marking method described above.
[0039] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the height measurement method and / or the marking method described above.
[0040] One or more technical solutions proposed in this application have at least the following technical effects:
[0041] In existing curved surface height measurement solutions, the binocular vision system requires a physical dual-lens group and a high-precision synchronous acquisition device, the line-scan laser ranging relies on an external displacement platform, and the structured light ranging requires an independent grating projection module, which necessitates the addition of dedicated hardware, resulting in high hardware costs.
[0042] This application utilizes the laser equipment in existing standard marking equipment to project a light spot onto the surface of the object being measured as a height measurement reference point. It only uses a monocular camera to acquire images of the light spot on the object's surface and extracts the first pixel coordinates of the spot's center point in the image coordinate system. Simultaneously, a certain number of standard scale points are selected along the laser path to obtain their heights. The standard scale points are then projected onto the camera coordinate system to generate the second pixel coordinates of each standard scale point. The distance between the first and second pixel coordinates is calculated, and the height of the target standard scale point with the smallest distance is directly taken as the height value of the object being measured. This application replaces additional hardware with algorithm reconstruction, using the laser equipment and monocular camera of existing standard marking equipment for height measurement. It achieves height measurement of the object being measured with zero additional hardware, minimizing hardware costs. Attached Figure Description
[0043] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0044] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 This is a flowchart illustrating an embodiment of the height measurement method of this application;
[0046] Figure 2This is a schematic diagram of the height measurement process provided in one embodiment of the height measurement method of this application;
[0047] Figure 3 A simplified flowchart illustrating an embodiment of the height measurement method of this application;
[0048] Figure 4 This is an overall schematic diagram of the height measurement method used in this application;
[0049] Figure 5 This is a schematic diagram of the structure involved in the height measurement method of this application.
[0050] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0051] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of this application and are not intended to limit this application.
[0052] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0053] Laser marking is typically performed on a flat plane. Marking on an uneven, curved surface requires measuring the height of the object being measured using height measurement techniques. Then, based on the object's 3D data, a curved surface is generated. Finally, a projection is made between the marking plane and the height-measuring surface, and marking is performed after the projection. This ensures that the marking pattern is accurately reproduced on the curved surface, avoiding distorted patterns. This application provides a height measurement method and a marking method.
[0054] Existing height measurement technologies all employ line-scan laser ranging, binocular lenses, and structured light ranging, requiring additional hardware such as laser scanning, binocular lenses, or structured light emission. In contrast, the laser equipment and monocular camera required in this application are standard equipment for existing visual marking. This application, based on the hardware of planar visual marking, achieves 3D curved surface marking without requiring additional hardware, thus reducing costs.
[0055] It should be noted that the executing entity in this embodiment can be a height measurement system, or a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or processor capable of performing the above functions. The following description uses a height measurement system as an example to illustrate this embodiment and the subsequent embodiments.
[0056] Based on this, the embodiments of this application provide a height measurement method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the height measurement method of this application.
[0057] In this embodiment, the height measurement method includes steps S10 to S40:
[0058] Step S10: A first laser is emitted by a laser to project a preset first number of first light spots onto the surface of the object being tested;
[0059] It should be noted that a first laser beam of a specific wavelength is emitted by a laser (for example, red light can be used to simulate a laser). The laser is guided and projected onto the surface of the curved object to be measured, with the aim of forming a set of discrete first light spots at predetermined positions on the surface of the object. It is understood that the predetermined first number here refers to the size of the light spot matrix pre-set according to the measurement accuracy requirements. One light spot can be used for height measurement; multiple light spots can also be used for height measurement. When multiple light spots are used, the height measurements corresponding to the multiple light spots can be used to generate three-dimensional point cloud data of the surface of the object being measured.
[0060] For example, in one embodiment, the first number of light spots can be a 9x9 matrix, that is, 81 light spots are projected onto the surface of the object being measured. These light spots constitute the basic sampling points for subsequent height measurement.
[0061] Step S20: Take a picture of the first light spot with a monocular camera to obtain the first pixel coordinates of the center of the first light spot in the camera coordinate system;
[0062] It should be noted that the monocular camera is used to capture images of the first light spot on the surface of the object being measured. Exemplarily, this can be done by capturing images one by one or in a single image. In a specific implementation, the monocular camera needs to capture an image of each light spot. Subsequently, the position of the center of each light spot on the camera's imaging plane, i.e., the camera coordinate system, is identified and calculated to obtain the first pixel coordinates (x1, y1). This step converts the physical location of the light spot into its position in the image coordinate system.
[0063] In one feasible implementation, step S20 includes steps S21 to S24:
[0064] Step S21: Separate the red channel of the acquired first spot image and extract the red light component image;
[0065] It should be noted that, in the specific implementation, after the monocular camera completes the acquisition of the first light spot image on the surface of the object being measured, information related to the simulated laser red light is separated from the acquired first light spot image. For example, the original image, i.e., the acquired first light spot image, contains multiple color information. Since the first laser is set to red light, the first light spot mainly appears as red pixels in the image, thus requiring the extraction of the red channel component. Therefore, by performing a red channel separation operation on the original image, a red light component image containing only or highlighting the red component information can be generated. This step effectively filters background noise and other color interference, laying the foundation for subsequent accurate light spot identification.
[0066] Step S22: Perform segmentation processing on the red light component image based on the color intensity threshold to generate multiple binary images;
[0067] It should be noted that after obtaining the red light component image, it is necessary to further distinguish the actual light spot region from the background. In one embodiment, this can be achieved through segmentation processing based on a color intensity threshold. Specifically, a single color intensity threshold can be used, or a multi-scale binarization strategy can be employed. It is understood that the brightness of the first light spot may vary due to factors such as lighting conditions and the reflective properties of the object being measured. Therefore, within a preset minimum and maximum color intensity threshold range, a series of different binary images are generated at a specified step size. Pixels in the original image with red intensity higher than the maximum color intensity threshold are considered foreground (e.g., set to white), while pixels with red intensity lower than the minimum color intensity threshold are considered background (e.g., set to black). This generates multiple candidate binary images, each corresponding to a potential light spot segmentation effect.
[0068] Step S23: Filter the spot regions in each binary image according to the preset geometric feature threshold, and merge the adjacent filtered spot regions to obtain the effective spot regions.
[0069] It should be noted that in multiple binary images, the foreground region (white area) contains real light spots, but also contains noise, reflection artifacts, or other invalid regions. In order to filter out the truly valid light spots, in a specific implementation, geometric feature analysis is performed on the foreground region (also called a connected region, which can be understood as an independent region composed of interconnected white pixels) in each binary image.
[0070] For example, the area, roundness (measures how close it is to a circle), concavity / convexity (complexity of the contour), and average brightness of each connected region are calculated. Then, the values of the area, roundness, and other parameters are compared with preset geometric feature thresholds to filter out regions that do not meet the conditions (e.g., false spots with too small an area, too irregular shape, or abnormal brightness).
[0071] In addition, for multiple connected regions in the original image that are adjacent in location and belong to the same actual spot but are temporarily separated due to segmentation, a merging operation will be performed to aggregate them into a complete and effective spot region, ensuring that the spot region ultimately retained is both real and effective, and can completely represent an independent spot.
[0072] Step S24: Use the center coordinates of the effective light spot area as the first pixel coordinates of the center of the first light spot in the camera coordinate system.
[0073] It should be noted that after successfully identifying and confirming the effective light spot areas, it is necessary to obtain the position of the center of each light spot in the camera coordinate system. In one embodiment, this can be achieved by calculating the center coordinates of the effective light spot areas. It is understood that these center coordinates represent the two-dimensional position of the light spot in the camera coordinate system.
[0074] In a specific implementation, the center coordinates can be calculated using a weighted average method. For example, the weights can be based on the brightness of pixels within the effective light spot area (pixels with higher brightness contribute more) or on the pixel positions within the effective light spot area (morphological features of connected components). The final calculated two-dimensional coordinate point (x1, y1) is the first pixel coordinate of the center of the first light spot in the camera coordinate system.
[0075] Step S30: Determine the second number of standard scale points and the height of each standard scale point on the target laser optical path, and project the standard scale points onto the camera coordinate system to obtain the second pixel coordinates of the standard scale points in the camera coordinate system, wherein the target laser optical path is the optical path of the first laser.
[0076] It should be noted that the target laser optical path can be the optical path followed by the laser beam used to project the first spot; exemplarily, it can also be the optical path of a second laser other than the optical path of the first laser. In one embodiment, the target laser optical path has been calibrated during laser device (such as a field lens or galvanometer) calibration. At this time, a series of equally spaced standard scale points are virtually or physically set along this known laser optical path. It can be understood that the standard scale points can be regarded as preset scale marks on the target laser optical path, and their respective world coordinates (Xw, Yw, Zw) in the real physical world space are known (because after the laser device is calibrated, there is a coordinate system, and the world coordinates of the standard scale points can be obtained using this known coordinate system).
[0077] Next, using the pre-calibrated parameters of the monocular camera (such as extrinsic and intrinsic parameters, distortion coefficients, etc.), a forward projection calculation is performed on each standard scale point. The forward projection calculation maps the 3D physical point onto the camera coordinate system, ultimately outputting the second pixel coordinates (x2, y2) of each standard scale point in the camera coordinate system. This step establishes the correspondence between each standard scale point on a laser line of known physical height and its projected position in the image.
[0078] Step S40: Calculate the distance between the first pixel coordinates and the second pixel coordinates, determine the target standard scale point with the minimum distance, and take the height of the target standard scale point as the height of the measured object.
[0079] It should be noted that the Euclidean distance (i.e., the two-dimensional distance on the image plane) between the first pixel coordinates (x1, y1) of the first spot center and the second pixel coordinates (x2, y2) of all standard scale points along the target laser path is calculated. In one embodiment, the distances between all coordinates are compared sequentially, and the standard scale point with the smallest distance to the first pixel coordinate of the current first spot center is found. This standard scale point with the smallest distance is taken as the target standard scale point. The core idea of this process is that the real physical position corresponding to the standard scale point closest to the actual captured first spot center position is considered the target standard scale point closest to the actual position of the spot on the surface of the object being measured. The height value (i.e., Zw) of the target standard scale point in the real physical world is then used as the measured height value of the surface of the object being measured at that location.
[0080] In one feasible implementation, step S40 includes:
[0081] Calculate the Euclidean distance between the second pixel coordinates of each standard scale point and the first pixel coordinates of the center of the first light spot;
[0082] Standard scale points whose Euclidean distance is less than a preset distance threshold are selected as target standard scale points.
[0083] It should be noted that, in the specific implementation, the center point of each first light spot on the surface of the object being measured has known coordinates in the camera coordinate system, namely, the first pixel coordinates. Furthermore, a series of standard scale points preset along the target laser path are also calculated through forward projection, each having known coordinates in the camera coordinate system, namely, the second pixel coordinates.
[0084] At this point, it is necessary to measure the proximity of the projected position of each standard scale point to the actual captured center position of the light spot on the image plane. For example, this can be achieved by calculating the "Euclidean distance" between them. It is understood that Euclidean distance is the most direct way to measure the straight-line distance between two points in image space. For example, in a two-dimensional pixel coordinate system, for the first pixel coordinate (x1, y1) of a light spot and the second pixel coordinate (x2, y2) of a standard scale point, the Euclidean distance can be expressed as: distance = sqrt((x1-x2)² + (y1-y2)²). The Euclidean distance between the first pixel coordinate in the camera coordinate system and the projected coordinates (i.e., the second pixel coordinates) of all preset standard scale points on the target laser path is calculated for each first light spot.
[0085] After calculating the Euclidean distances of all standard scale points relative to the first light spot, it is necessary to identify the standard scale point that best matches the actual light spot position, i.e., the target standard scale point. In one embodiment, a preset distance threshold can be used to assist in the selection; this preset distance threshold sets a maximum acceptable range of positional deviation in the image space. It is understood that setting the preset distance threshold too small may result in no matching point being found; setting it too large may introduce incorrect matching points.
[0086] In a specific implementation, the preset distance threshold can be determined comprehensively based on the camera calibration accuracy, image resolution, the error range of the spot localization algorithm, and the requirements of the actual application scenario. All calculated Euclidean distances are scanned, and standard scale points with distance values less than the preset distance threshold are selected. In one feasible implementation, the unique standard scale point with the smallest distance is found and designated as the target standard scale point. However, considering the influence of actual image noise or complex surface reflections, multiple candidate points may sometimes exist. In this case, the preset distance threshold can help filter out obviously unreasonable candidate standard scale points (such as points with excessively large distances), ensuring that among the valid candidate standard scale points, the standard scale point with the smallest distance is the most matching target standard scale point. Finally, the real physical world height value (Zw) corresponding to the selected target standard scale point is recognized as the height measurement result of the measured object surface at that location.
[0087] This embodiment provides a height measurement method. Using the laser device in existing standard marking equipment, a light spot is projected onto the surface of the object being measured as a height measurement reference point. Only a monocular camera is used to acquire the image of the light spot on the object's surface and extract the first pixel coordinates of the center point of the light spot in the image coordinate system. Simultaneously, a certain number of standard scale points are selected along the laser path, and the height of these standard scale points is obtained. The standard scale points are then projected onto the camera coordinate system to generate the second pixel coordinates of each standard scale point. The distance between the first and second pixel coordinates is calculated, and the height of the target standard scale point with the smallest distance is directly taken as the height value of the object being measured. This application replaces additional hardware with algorithm reconstruction, using the laser device and monocular camera of existing standard marking equipment for height measurement. This achieves height measurement of the object being measured with zero additional hardware, minimizing hardware costs.
[0088] For example, such as Figure 2 , Figure 2 This is a schematic diagram of a height measurement process. Specifically: a laser projects a first light spot onto the surface of the object being measured, and then a monocular camera acquires an image of the first light spot, obtaining the first pixel coordinates of the center of the first light spot in the camera coordinate system; a standard scale point and its height are determined on the target laser path; then, a forward projection is performed to project the world coordinates of the standard scale point onto the camera coordinate system, obtaining the second pixel coordinates of the standard scale point; the distance between the first and second pixel coordinates is calculated, and based on the orbital angle (ranging from 0° to 360°) around the second pixel coordinate corresponding to the first pixel coordinate, combined with a calibration matrix, the height value of the target scale point with the minimum distance is obtained, where the calibration matrix is determined during forward projection; and this height value is taken as the height of the object being measured.
[0089] Based on the above embodiments of this application, in another embodiment of this application, the same or similar content as the above embodiments can be referred to the above description, and will not be repeated hereafter. Before step S20, the following is included:
[0090] Lens intrinsic parameters are calibrated using a calibration board to obtain the intrinsic parameter matrix and distortion coefficients of the monocular camera;
[0091] The lens extrinsic parameters are calibrated using a calibration board to obtain the extrinsic parameter matrix of the monocular camera;
[0092] The monocular camera is calibrated based on the intrinsic parameter matrix, distortion coefficients, and extrinsic parameter matrix.
[0093] It should be noted that, in specific implementations, in order to accurately establish the mathematical model of monocular camera imaging, it is necessary to calibrate the lens's internal parameters. This can be achieved using a physical calibration board with a known geometric pattern (exemplarily, a black and white checkerboard or a regularly arranged array of dots). It is understood that intrinsic parameter calibration can determine the camera's inherent optical characteristics. During implementation, the calibration board needs to be placed in multiple different positions and orientations within the camera's field of view (including various angles and distances, ensuring it remains within the camera's field of view), and a series of images (e.g., 15 to 20) need to be captured. Subsequently, a specific image processing algorithm (such as the Zhang Zhengyou calibration method) is used to identify feature points on the calibration board (such as the corners of the checkerboard or the centers of the dots), and the correspondence between the projected positions of these feature points in the images and their known true physical positions is analyzed. Finally, the camera's intrinsic parameter matrix and distortion coefficients are calculated. The intrinsic parameter matrix mainly includes parameters such as the camera's focal length (Fx and Fy in pixels) and optical center (principal point coordinates Cx, Cy), which characterize the projection relationship under the ideal pinhole camera model. The distortion coefficients (usually including radial distortion coefficients k1, k2, k3, etc. and tangential distortion coefficients p1, p2, etc.) are used to quantify the degree of image distortion introduced by the lens itself (e.g., barrel distortion or pincushion distortion) for subsequent correction.
[0094] After completing the intrinsic parameter calibration, the next step is to determine the spatial transformation relationship between the camera coordinate system and a predefined real-world coordinate system, i.e., to perform extrinsic parameter calibration. In one implementation, this also requires the use of a calibration board.
[0095] First, a physical world reference origin needs to be established. This origin can be understood as a point where the laser beam coincides with the camera's optical axis (e.g., the position where the red and blue light spots completely overlap by adjusting the laser field lens focal length). In practice, the origin of the calibration board (e.g., a specific corner point of a checkerboard) must be strictly aligned with the established physical world origin. Then, an image of the calibration board in this specific pose is captured using a camera that has undergone intrinsic parameter calibration. By analyzing the image coordinates of the feature points of the calibration board in this image, combined with its known physical world coordinates and the obtained intrinsic parameter information, the extrinsic parameter matrix can be calculated. This extrinsic parameter matrix is a rigid body transformation matrix. For example, the extrinsic parameter matrix can consist of a 3x3 rotation matrix R and a 3x3 translation vector T, describing how to transform the three-dimensional point coordinates in the physical world coordinate system to the camera's own three-dimensional coordinate system.
[0096] Combining the results of the first two steps yields complete calibration parameters for the monocular camera. In specific implementations, this process is called camera calibration. Calibration involves using known calibration board information to calculate and solve for the camera's intrinsic parameters (describing its internal imaging characteristics) and extrinsic parameters (describing its external spatial attitude). The intrinsic parameter matrix and distortion coefficients together define the camera's internal imaging characteristics, used to correct lens distortion and map image pixel coordinates to a normalized camera coordinate system. The extrinsic parameter matrix establishes the mapping relationship between the camera coordinate system and the physical world coordinate system.
[0097] For example, in applications such as 3D reconstruction or surface elevation measurement, when it is necessary to backproject a pixel in an image back into the real 3D space, it is necessary to calculate calibration parameters (intrinsic parameter matrix, distortion coefficients, and extrinsic parameter matrix). Therefore, by using a calibration board to complete the calibration of the monocular camera's intrinsic and extrinsic parameters and obtaining the intrinsic parameter matrix, distortion coefficients, and extrinsic parameter matrix, the monocular camera has been calibrated.
[0098] In one feasible implementation, the step of projecting the standard scale point onto the camera coordinate system to obtain the second pixel coordinate of the standard scale point in the camera coordinate system includes:
[0099] Based on the extrinsic parameter matrix, the world coordinates of the standard scale points are converted into camera coordinates in the camera coordinate system;
[0100] Perform a projection transformation on the camera coordinates to obtain the corresponding planar coordinates;
[0101] The distortion correction of the plane coordinates is performed by using the distortion coefficients to obtain the distortion-corrected plane coordinates;
[0102] By mapping the distortion-corrected planar coordinates to the camera coordinate system using the intrinsic parameter matrix, the second pixel coordinates of each standard scale point are obtained.
[0103] It should be noted that, in the specific implementation, the projection process assumes the standard scale point has a known three-dimensional position in real physical space, i.e., the world coordinates of the standard scale point. It can be understood that the world coordinates of the standard scale point are defined within a pre-defined world coordinate system.
[0104] To correlate the world coordinates of a standard calibration point with the bokeh image captured by the camera, the world coordinates of the standard calibration point need to be transformed to the camera coordinate system. This transformation relies on the extrinsic parameter matrix obtained during the camera calibration phase, which characterizes the spatial relationship between the world coordinate system and the camera coordinate system. In one implementation, after applying the extrinsic parameter matrix to perform a rotation and translation on the world coordinates of the standard calibration point, the output is the position of the standard calibration point in the camera's three-dimensional space, called the camera coordinates. This step establishes the geometric connection between the physical point and the camera's observation viewpoint.
[0105] After obtaining the coordinates of the standard scale point in the camera's three-dimensional space, the camera's imaging process is simulated by projecting the camera coordinates onto the camera's imaging plane. In a specific implementation, this can be achieved through projection transformation, which simulates the process of light passing through the camera's optical center (pinhole) to form an image on the camera's imaging plane. For example, for a three-dimensional point in the camera coordinate system, its two-dimensional coordinates on the camera's normalized plane can be obtained by dividing its X and Y coordinates by its Z coordinate (depth value). This normalized plane is located one unit distance (Z = 1) from the optical center in front of the camera, and the resulting coordinates are the point's normalized coordinates (u, v), which characterize the point's position on the imaging plane.
[0106] Since actual camera lenses are not ideal optical systems, various geometric distortions are introduced during imaging, causing a shift in the position of points on the normalized plane. In specific implementations, to obtain a more accurate projection position, distortion coefficients obtained during the camera intrinsic parameter calibration stage are used to correct the distortion of the projection points. It is understood that distortion coefficients describe the type and degree of distortion introduced by the lens, commonly including radial distortion (such as barrel distortion and pincushion distortion) that bends straight lines and tangential distortion that tangentially shears the image. In one implementation, these distortion coefficients (e.g., k1, k2, k3, p1, p2, etc.) are used to inversely calculate the normalized coordinates (u, v) to compensate for the effects of lens distortion, thereby obtaining corrected normalized coordinates (u', v') that are closer to the ideal pinhole camera model—that is, the distortion-corrected planar coordinates. This step compensates for optical defects and ensures the accuracy of coordinate mapping.
[0107] The final step is to transform the distortion-corrected, two-dimensional point coordinates (u', v') on the normalized plane to the camera's coordinate system, i.e., the specific pixel position in the camera coordinate system. In a specific implementation, this is achieved using the camera's intrinsic parameter matrix, which contains the camera's optical characteristic parameters, mainly including the focal length and the position of the optical center. In one implementation, this process converts the normalized, unitless coordinate values into pixel row and column numbers. The final output two-dimensional coordinate point (x2, y2) is the estimated projection position of the standard scale point on the camera's imaging plane, which is the second pixel coordinate. This step completes the transformation from three-dimensional point coordinates in physical space to two-dimensional pixel coordinates in image space, providing a basis for subsequent matching and comparison with the first pixel coordinates.
[0108] In one feasible implementation, prior to the step of converting the world coordinates of the standard scale points to camera coordinates in the camera coordinate system based on the extrinsic parameter matrix, the following steps are included:
[0109] Determine whether the height value of the standard scale point is greater than zero; the positive or negative value of the height indicates the direction.
[0110] If the height value is less than or equal to zero, the standard scale point is considered invalid.
[0111] If the height value is greater than zero, then the step of converting the world coordinates of the standard scale point into camera coordinates in the camera coordinate system based on the extrinsic parameter matrix of the monocular camera is executed.
[0112] It should be noted that, in specific implementations, before transforming the world coordinates of the standard scale point to the camera coordinate system, the height value of the standard scale point in a specific direction is checked. It is understood that in a 3D measurement scenario, the height value typically refers to the coordinate component of the standard scale point in a direction perpendicular to a reference plane (e.g., the working plane of laser marking), or the coordinate value of the standard scale point in the depth direction (usually corresponding to the Z-axis). In one implementation, the sign of the height value represents the relative direction of the point in space. For example, a positive value indicates that the standard scale point is above the reference plane or in front of the camera's field of view (i.e., a position that can be observed by the camera), while a negative value indicates that the standard scale point is below the reference plane or behind the camera's field of view (i.e., a position that theoretically cannot be imaged by the camera).
[0113] At this point, the system first checks if the height value of the standard scale point is greater than zero. If the height value is less than or equal to zero (i.e., non-positive), the standard scale point is determined to be in an invalid position (e.g., behind the camera or below the reference plane), and projection calculation cannot be performed. Therefore, the standard scale point is marked as invalid and its subsequent processing is terminated. Only when the height value of the standard scale point is confirmed to be greater than zero will the process of converting the world coordinates of the standard scale point to camera coordinates continue.
[0114] In this embodiment, the determination of whether the height value is zero ensures that the standard scale point is located in the space in front of the camera's observable field of view, thus enabling the formation of an effective image projection. Therefore, for standard scale points that satisfy the condition of a height value greater than zero, the extrinsic parameter matrix of the monocular camera obtained during the calibration phase is used to accurately convert the world coordinates of the standard scale point in the world coordinate system into coordinates in the camera's own three-dimensional coordinate system (i.e., camera coordinates). This determination ensures that only standard scale points with reasonable spatial positions and theoretically image-capable properties are included in subsequent calculation processes, improving the efficiency of the entire altimeter system.
[0115] For example, please refer to Figure 3 , Figure 3This is a flowchart illustrating the height value determination process in this embodiment. Specifically, it first determines whether the height value of the standard scale point is greater than zero. If it is greater than zero, it means that the point is located above the reference plane or in front of the camera's field of view, allowing for coordinate system transformation and forward projection to obtain the second pixel coordinates. If it is less than or equal to zero, it means that the point is located below the reference plane or behind the camera's field of view, making it an invalid point, and therefore no further steps are performed.
[0116] For example, to help understand the implementation process of the height measurement method obtained by combining the above embodiments, please refer to... Figure 4 , Figure 4 A simplified flowchart of an altitude measurement method is provided, specifically: Figure 4 The object under test is located on the marking plane, where a is the field of view of the monocular camera, 400 is the beam center of the monocular camera, and 200 is the imaging ray path from the optical center of the monocular camera to the light spot on the surface of the object under test. Figure 4 The laser device emits a laser 100 onto the surface of the object being measured, forming a first light spot at position 300. A monocular camera then captures an image of the first light spot and obtains the first pixel coordinates of the center of the first light spot in the camera coordinate system. A standard scale point is established along the optical path of the laser 100, and its world coordinates are known. The second pixel coordinates are obtained based on the world coordinates of the standard scale point. The distance between the first and second pixel coordinates is calculated, and the height value of the target standard scale point (i.e., the Z-axis component in world coordinates) with the smallest distance is taken as the height value of the object being measured.
[0117] Based on the above embodiments of this application, in another embodiment of this application, the same or similar content as the above embodiments can be referred to the above description, and will not be repeated hereafter. The marking method adopts the height measurement method as described above, including steps D10 to D30:
[0118] Step D10: Generate three-dimensional point cloud data of the object under test based on the height of the target standard scale points corresponding to all the first light spots;
[0119] It should be noted that, in a specific implementation, after measuring the height of the center points of all the first light spots, the height value (Zw) of the target standard scale point corresponding to each light spot in real physical space is obtained. It can be understood that these height values represent the actual unevenness of the surface of the object being measured at each sampling point along the laser path. In one feasible implementation, three-dimensional point cloud data is generated based on the data at each sampling point. The three-dimensional point cloud data records the (X, Y, Z) coordinates of specific locations on the object's surface.
[0120] Step D20: Perform surface fitting based on 3D point cloud data to construct a continuous surface model of the object under test.
[0121] It should be noted that the continuous geometric shape of the measured object's surface is recovered based on 3D point cloud data. In specific implementations, this can be achieved through surface fitting. It is understood that point cloud data consists of discrete, finite sampling points, while surface fitting aims to find a mathematically continuous surface function that best approximates or passes through these discrete points, thereby simulating the smooth shape of the object's surface. For example, spline interpolation algorithms (such as B-splines) are commonly used for fitting. In one implementation, the spatial distribution and topological relationships of the point cloud data are analyzed to calculate one or more smooth mathematical surface patches. These surface patches are seamlessly connected to form a continuous surface model.
[0122] Step D30: Project the standard planar marking pattern onto the continuous curved surface model to generate a curved marking path on the surface of the object being measured, and perform marking operations on the surface of the object being measured along the curved marking path.
[0123] It should be noted that after obtaining the continuous surface model of the object's surface shape, the marking pattern originally designed on a standard plane (referred to as the standard plane marking pattern) needs to be adapted to this surface. In a specific implementation, this can be achieved through projection transformation. This transformation calculates how each point on the standard plane pattern needs to be mapped to fit the actual object surface based on the spatial geometric characteristics of the constructed continuous surface model. For example, this involves spatial coordinate mapping calculations, ensuring that the marking pattern, after projection, can follow the contours of the surface, thereby avoiding distortions such as stretching, compression, or twisting during marking.
[0124] After performing the projection transformation, the final output is a sequence of spatial coordinate points, i.e., the surface marking path. This surface marking path indicates how the laser marking head (usually controlled by a galvanometer system) needs to move the laser focus in three-dimensional space to mark along the object's surface contour. Finally, the laser beam is driven to move along the calculated surface marking path on the surface of the object being measured and perform the marking operation, ultimately achieving precise and distortion-free marking of the preset pattern or text on complex curved surfaces. This step transforms the previous height measurement and surface modeling results into a practically executable processing operation.
[0125] In this embodiment, three-dimensional point cloud data is generated to accurately capture the spatial undulation features of the surface of the object being measured. A high-fidelity continuous surface model is constructed by combining surface fitting algorithms, which effectively overcomes the problems of pattern stretching, compression, or distortion caused by traditional planar marking on curved surfaces. Furthermore, standard planar patterns are accurately adapted to the actual curved surface shape through projection transformation to generate a laser marking path that fits the natural contour of the object. Finally, a marking system that uses the application marking method without additional hardware upgrades can complete distortion-free marking on complex curved surfaces, significantly reducing equipment costs and improving the accuracy and adaptability of curved surface marking.
[0126] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the height measurement method and / or marking method of this application. Any simple variations based on this technical concept, such as the interaction and combination of various embodiments, are all within the protection scope of this application.
[0127] This application provides a height measurement system, which includes: a laser device for projecting a light spot onto the surface of an object being measured, a camera for capturing the actual light spot on the surface of the object being measured, and the object being measured. The laser device includes a laser that emits a laser, a galvanometer and a field lens for controlling the direction of the laser.
[0128] The following is for reference. Figure 5 The diagram illustrates a structural schematic suitable for implementing the height measurement system of the embodiments of this application. Specifically, the height measurement system includes a laser device, a monocular camera, and an object to be measured. The laser device includes a laser capable of emitting infrared laser light, galvanometers X and Y for controlling the direction of the infrared laser light, and a field lens for focusing the laser beam.
[0129] The height measurement system provided in this application, employing the height measurement method described in the above embodiments, can solve the technical problem that existing height measurement technologies require additional hardware, resulting in high costs. Compared with the prior art, the beneficial effects of the height measurement system provided in this application are the same as those of the height measurement method provided in the above embodiments, and other technical features of this height measurement system are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0130] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0131] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0132] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to perform the height measurement method and / or the marking method in the above embodiments.
[0133] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0134] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0135] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0136] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0137] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., computer programs) for executing the above-described height measurement method and / or marking method. This solves the technical problem that existing height measurement technologies require additional hardware, resulting in high costs. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the height measurement method and / or marking method provided in the above embodiments, and will not be repeated here.
[0138] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the height measurement method and / or the marking method described above.
[0139] The computer program product provided in this application can solve the technical problem that existing height measurement technologies require additional hardware, resulting in high costs. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the height measurement method and / or marking method provided in the above embodiments, and will not be repeated here.
[0140] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.
Claims
1. A method for measuring altitude, characterized in that, The height measurement method includes: A first laser is emitted by a laser, and a first number of first light spots of a predetermined number are projected onto the surface of the object being tested. The first light spot is photographed using a monocular camera, and the first pixel coordinates of the center of the first light spot in the camera coordinate system are obtained. A second number of standard scale points and the height of each standard scale point are predetermined on the target laser optical path, and the standard scale points are projected onto the camera coordinate system to obtain the second pixel coordinates of the standard scale points in the camera coordinate system, wherein the target laser optical path is the optical path of the first laser. Calculate the distance between the first pixel coordinates and the second pixel coordinates, determine the target standard scale point with the smallest distance, and take the height of the target standard scale point as the height of the measured object.
2. The method as described in claim 1, characterized in that, Before the step of photographing the first light spot with a monocular camera, the following steps are included: Lens intrinsic parameters are calibrated using a calibration board to obtain the intrinsic parameter matrix and distortion coefficients of the monocular camera; The lens extrinsic parameters are calibrated using a calibration board to obtain the extrinsic parameter matrix of the monocular camera; The monocular camera is calibrated based on the intrinsic parameter matrix, the distortion coefficients, and the extrinsic parameter matrix.
3. The method as described in claim 2, characterized in that, The step of projecting the standard scale point onto the camera coordinate system to obtain the second pixel coordinate of the standard scale point in the camera coordinate system includes: Based on the extrinsic parameter matrix, the world coordinates of the standard scale points are converted into camera coordinates in the camera coordinate system; Perform a projection transformation on the camera coordinates to obtain the corresponding planar coordinates; The distortion coefficients are used to correct the distortion of the planar coordinates to obtain the distorted planar coordinates. The distortion-corrected planar coordinates are mapped to the camera coordinate system using the intrinsic parameter matrix to obtain the second pixel coordinates of each standard scale point.
4. The method as described in claim 3, characterized in that, Before the step of converting the world coordinates of the standard scale point to camera coordinates in the camera coordinate system based on the extrinsic parameter matrix, the following steps are included: Determine whether the height value of the standard scale point is greater than zero, where the positive or negative value of the height represents the direction; If the height value is less than or equal to zero, the standard scale point is deemed invalid. If the height value is greater than zero, then the step of converting the world coordinates of the standard scale point into camera coordinates in the camera coordinate system based on the extrinsic parameter matrix of the monocular camera is executed.
5. The method as described in claim 1, characterized in that, The step of capturing the first light spot with a monocular camera and obtaining the first pixel coordinates of the center of the first light spot in the camera coordinate system includes: The red channel of the first acquired light spot image is separated to extract the red light component image; The red light component image is segmented based on a color intensity threshold to generate multiple binary images; The light spot regions in each binary image are filtered and selected according to a preset geometric feature threshold, and the adjacent filtered light spot regions are merged to obtain the effective light spot regions. The center coordinates of the effective light spot area are used as the first pixel coordinates of the center of the first light spot in the camera coordinate system.
6. The method as described in claim 1, characterized in that, The step of calculating the distance between the first pixel coordinates and the second pixel coordinates, and determining the target standard scale point with the smallest distance, includes: Calculate the Euclidean distance between the second pixel coordinates of each standard scale point and the first pixel coordinates of the center of the first light spot; Standard scale points whose Euclidean distance is less than a preset distance threshold are selected as target standard scale points.
7. A marking method, characterized in that, The marking method employs the height measurement method as described in claim 1, including: Based on the height of the target standard scale points corresponding to all the first light spots, generate the three-dimensional point cloud data of the measured object; Based on the three-dimensional point cloud data, a continuous surface model of the surface of the object under test is constructed by surface fitting. The standard planar marking pattern is projected and transformed according to the continuous curved surface model to generate a curved marking path on the surface of the object being tested, and the marking operation is performed on the surface of the object being tested along the curved marking path.
8. A height measurement system, characterized in that, The system includes: a laser device for projecting a light spot onto the surface of the object being measured, a camera for capturing the actual light spot on the surface of the object being measured, and the object being measured. The laser device includes a laser that emits a laser, a galvanometer and a field lens for controlling the direction of the laser.
9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the height measurement method as described in any one of claims 1 to 6, and / or the marking method as described in claim 7.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the height measurement method as described in any one of claims 1 to 6, and / or the marking method as described in claim 7.
Citation Information
Patent Citations
Laser projection plane calibration method, device and system and storage medium
CN115690227A
Monocular vision real-time distance measurement method and system based on embedded platform
CN115705621A
Monocular camera and laser range finder three-dimensional fusion measurement and target center extraction method
CN120031963A
Three-dimensional reconstruction method based on lidar and vision multi-information fusion
WO2025086950A1
Cited By
Laser marking method, device and equipment based on monocular camera and medium
CN122322698A
Laser marking methods, devices, equipment, and media based on monocular cameras
CN122322698B