Laser ray extraction method and device, equipment, storage medium and program product
By extracting the gradient and feature parameters of the laser line using a one-dimensional Gaussian template and filtering out the sub-pixel coordinates of the laser line, the problem of high resource consumption in existing technologies is solved, and efficient three-dimensional coordinate extraction of laser line scanning is achieved.
Patent Information
- Application Number
- CN202511078450.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-12-12
AI Technical Summary
In existing technologies, methods for extracting the center of the light stripe with high precision when scanning three-dimensional coordinates using laser lines, such as the Steger algorithm, have low computational efficiency and result in excessive resource consumption.
Gradient parameters and feature parameters in grayscale images are extracted using a one-dimensional Gaussian template. The target pixel with the largest feature parameters in the neighborhood is selected, and the sub-pixel coordinates of the laser line are calculated to avoid two-dimensional convolution.
It reduces the consumption of on-chip storage and processing resources while maintaining high precision, making it suitable for low-power embedded applications.
Smart Images

Figure CN121120759A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of laser scanning technology, and in particular to a laser line extraction method, apparatus, device, storage medium, and program product. Background Technology
[0002] Laser line scanning technology is a non-contact measurement technique that involves projecting a strip of laser light emitted by a line laser onto the surface of the object being measured for scanning. The laser stripe image on the object's surface is then captured by a camera, and the three-dimensional coordinates of the laser line are calculated using image processing technology.
[0003] In related technologies, since laser lines have a certain pixel width, accurately extracting the center of the laser line's light stripe is necessary to determine its three-dimensional coordinates for high-precision measurement. Currently, the center of the laser line's light stripe can be extracted using the Steger algorithm. However, the Steger algorithm requires a large number of two-dimensional convolutions, which, while resulting in high accuracy, leads to low computational efficiency and significant resource consumption. Summary of the Invention
[0004] Therefore, it is necessary to provide a laser line extraction method, apparatus, equipment, storage medium, and program product that can reduce resource consumption in response to the above-mentioned technical problems.
[0005] In a first aspect, this application provides a laser line extraction method applied to an FPGA chip, comprising:
[0006] To acquire multiple pixels in a grayscale image of a target object obtained by laser line scanning;
[0007] Using a preset one-dimensional Gaussian template, the gradient parameters and feature parameters of each pixel in the grayscale image in the first direction of the image coordinate system are determined. The gradient parameters are used to characterize the grayscale change rate of the light stripe formed by the laser line on the grayscale image in the corresponding pixel, and the feature parameters are used to characterize the curvature change rate of the light stripe in the corresponding pixel.
[0008] Based on the gradient parameter and the feature parameter, a target pixel is selected from each pixel in the grayscale image. The target pixel is the pixel with the largest feature parameter in the neighborhood in the first direction.
[0009] Based on the integer coordinates corresponding to the target pixel, determine the sub-pixel coordinates of the laser line corresponding to the target pixel;
[0010] The laser line is extracted based on the sub-pixel coordinates of the laser line corresponding to the target pixel.
[0011] In one embodiment, the step of selecting target pixels from each pixel in the grayscale image based on the gradient parameters and the feature parameters includes:
[0012] Based on the gradient parameters and the feature parameters, determine the sub-pixel offset of each pixel in the grayscale image;
[0013] Based on the sub-pixel offset, the effective pixels in each pixel of the grayscale image are filtered out;
[0014] The target pixel is selected from the valid pixels among the individual pixels.
[0015] In one embodiment, filtering out the valid pixels from each pixel in the grayscale image based on the sub-pixel offset includes:
[0016] Invalid pixels are filtered out from each pixel in the grayscale image to obtain the valid pixels. The invalid pixels are pixels whose absolute value of subpixel offset is greater than or equal to 1.
[0017] In one embodiment, determining the sub-pixel coordinates of the laser line corresponding to the target pixel based on the integer coordinates corresponding to the target pixel includes:
[0018] The sub-pixel coordinates of the laser line corresponding to the target pixel are obtained by fitting the integer coordinates corresponding to the target pixel and the sub-pixel offset corresponding to the target pixel.
[0019] In one embodiment, multiple one-dimensional Gaussian templates process multiple pixels in a grayscale image in parallel; after determining the gradient parameters and feature parameters of each pixel in the grayscale image in a first direction in the image coordinate system using a preset one-dimensional Gaussian template, the method further includes:
[0020] Based on the number of the one-dimensional Gaussian template for parallel processing, the integer coordinates corresponding to the determined gradient parameters and feature parameters are offset and adjusted in the first direction.
[0021] In one embodiment, acquiring multiple pixels in a grayscale image of the target object obtained by laser line scanning includes:
[0022] Data of the grayscale image is acquired frame by frame;
[0023] The data of two adjacent grayscale images are decomposed and recombined to obtain the target number of pixels, wherein the target number of pixels is equal to the number of one-dimensional Gaussian templates in the parallel processing.
[0024] Secondly, this application also provides a laser line extraction device for use in FPGA chips, comprising:
[0025] The acquisition module is used to acquire multiple pixels in a grayscale image of a target object obtained by laser line scanning;
[0026] The determination module is used to determine the gradient parameters and feature parameters of each pixel in the grayscale image in the first direction of the image coordinate system using a preset one-dimensional Gaussian template. The gradient parameters are used to characterize the grayscale change rate of the light stripe formed by the laser line on the grayscale image at the corresponding pixel, and the feature parameters are used to characterize the curvature change rate of the light stripe at the corresponding pixel.
[0027] A filtering module is used to filter out target pixels from each pixel in the grayscale image according to the gradient parameters and the feature parameters, wherein the target pixel is the pixel with the largest feature parameters in the neighborhood in the first direction.
[0028] The positioning module is used to determine the sub-pixel coordinates of the laser line corresponding to the target pixel based on the integer coordinates corresponding to the target pixel.
[0029] The extraction module is used to extract the laser line based on the sub-pixel coordinates of the laser line corresponding to the target pixel.
[0030] In one embodiment, the filtering module is further configured to determine the sub-pixel offset of each pixel in the grayscale image based on the gradient parameter and the feature parameter; filter out the effective pixels in each pixel in the grayscale image based on the sub-pixel offset; and filter out the target pixel from the effective pixels in each pixel.
[0031] In one embodiment, the filtering module is further configured to filter out invalid pixels from each pixel in the grayscale image to obtain the valid pixels, wherein the invalid pixels are pixels whose absolute value of sub-pixel offset is greater than or equal to 1.
[0032] In one embodiment, the filtering module is further configured to fit the integer coordinates corresponding to the target pixel and the sub-pixel offset corresponding to the target pixel to obtain the laser line sub-pixel coordinates corresponding to the target pixel.
[0033] In one embodiment, multiple one-dimensional Gaussian templates process multiple pixels in a grayscale image in parallel; the determining module is further configured to offset and adjust the integer coordinates corresponding to the determined gradient parameters and feature parameters in the first direction according to the number of the one-dimensional Gaussian templates processed in parallel.
[0034] In one embodiment, the acquisition module is further configured to acquire the data of the grayscale image frame by frame; decompose and reassemble the data of two adjacent grayscale images to obtain a target number of pixels, wherein the target number of pixels is equal to the number of one-dimensional Gaussian templates processed in parallel.
[0035] 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 implement the laser line extraction method of the first aspect described above.
[0036] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the laser line extraction method of the first aspect described above.
[0037] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the laser line extraction method of the first aspect described above.
[0038] The aforementioned laser line extraction method, apparatus, device, storage medium, and program product acquire multiple pixels in a grayscale image obtained by scanning a target object with a laser line; using a preset one-dimensional Gaussian template, determine the gradient parameters and feature parameters of each pixel in the grayscale image in a first direction in the image coordinate system, wherein the gradient parameters characterize the grayscale change rate of the light stripe formed by the laser line on the grayscale image at the corresponding pixel, and the feature parameters characterize the curvature change rate of the light stripe at the corresponding pixel; based on the gradient parameters and the feature parameters, select a target pixel from among the pixels in the grayscale image, wherein the target pixel is the pixel with the largest feature parameter in its neighborhood in the first direction; determine the sub-pixel coordinates of the laser line corresponding to the target pixel based on the integer coordinates corresponding to the target pixel; and extract the laser line based on the sub-pixel coordinates of the laser line corresponding to the target pixel. Since there is no need to perform two-dimensional convolution, but instead a one-dimensional Gaussian template is used to extract the gradient parameters and feature parameters of each pixel in the first direction, and then the sub-pixel coordinates of the laser line are determined based on the gradient parameters and feature parameters, the target pixel with the largest feature parameters in the neighborhood is selected to calculate the corresponding sub-pixel coordinates of the laser line for laser line extraction, thereby greatly reducing the consumption of on-chip storage resources and processing resources. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This application provides an illustration of an application scenario for a laser line extraction method.
[0041] Figure 2 A schematic flowchart of a laser line extraction method provided in an embodiment of this application;
[0042] Figure 3 A schematic diagram illustrating data disassembly and reassembly as provided in an embodiment of this application;
[0043] Figure 4 A schematic diagram of a one-dimensional Gaussian template provided in an embodiment of this application;
[0044] Figure 5 A schematic diagram of another laser line extraction method provided in an embodiment of this application;
[0045] Figure 6 A structural block diagram of a laser line extraction device provided in an embodiment of this application;
[0046] Figure 7 This is an internal structural diagram of a computer device provided in an embodiment of this application. Detailed Implementation
[0047] 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.
[0048] The relevant technologies will be explained below.
[0049] Laser line scanning technology is a non-contact measurement technique that involves projecting a strip of laser light emitted by a line laser onto the surface of the object being measured for scanning. The laser stripe image on the object's surface is then captured by a camera, and the three-dimensional coordinates of the laser line are calculated using image processing technology.
[0050] In related technologies, since laser lines have a certain pixel width, accurately extracting the center of the laser stripe is necessary to determine its three-dimensional coordinates for high-precision measurement. Currently, the center of the laser stripe can be extracted using the Steger algorithm. However, while the Steger algorithm offers high accuracy, its computational efficiency is low, resulting in significant resource consumption.
[0051] In addition, related technologies can also extract the center of the laser stripe using methods such as the gray-scale centroid method, skeleton thinning method, and centerline method based on normal guidance. The gray-scale centroid method uses the centroid of the gray-scale value distribution of the stripe cross-section as the center of the stripe. Each row (column) of the image is scanned, and the centroid of the stripe is calculated based on its position and pixel gray-scale value. The skeleton thinning method repeatedly peels away the boundary pixels of the binary image, maintaining the connectivity of the target during the peeling process until the skeleton of the image is obtained. The centerline method based on normal guidance uses the geometric center method to quickly locate the pixel-level centerline, performs edge detection using the Canny algorithm, and calculates the center point by the median value of the edge positions on both sides of the structured light. Then, Principal Component Analysis (PCA) is used to determine the normal direction.
[0052] However, the methods mentioned above for extracting the center of a laser line all suffer from problems such as noise sensitivity, poor accuracy, high algorithm complexity, slow processing speed, and high power consumption.
[0053] To address the aforementioned technical problems, embodiments of this application provide a laser line extraction method, apparatus, device, storage medium, and program product. Instead of performing two-dimensional convolution, it uses a one-dimensional Gaussian template to extract the gradient parameters and feature parameters of each pixel in the first direction. Based on these gradient and feature parameters, the sub-pixel coordinates of the laser line are determined. The target pixel with the largest feature parameter in its neighborhood is then selected to calculate the corresponding sub-pixel coordinates of the laser line for extraction. This significantly reduces the consumption of on-chip storage and processing resources.
[0054] The application scenarios of the laser line extraction method provided in the embodiments of this application will be described below.
[0055] The laser line extraction method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with host computer 104 via a network.
[0056] Terminal 102 acquires multiple pixels from a grayscale image of the target object obtained by laser line scanning. Using a preset one-dimensional Gaussian template, it determines the gradient parameters and feature parameters of each pixel in the grayscale image along a first direction in the image coordinate system. The gradient parameters characterize the rate of grayscale change of the light stripe formed by the laser line on the grayscale image at the corresponding pixel, and the feature parameters characterize the rate of curvature change of the light stripe at the corresponding pixel. Next, based on the gradient parameters and feature parameters, terminal 102 selects the target pixel from the pixels in the grayscale image. The target pixel is the pixel with the largest feature parameter in its neighborhood along the first direction. Then, based on the integer coordinates of the target pixel, terminal 102 determines the sub-pixel coordinates of the laser line corresponding to the target pixel. Finally, terminal 102 extracts the laser line based on the sub-pixel coordinates of the laser line corresponding to the target pixel. After extracting the laser line, terminal 102 sends the extracted laser line to host computer 104, which performs limit correction and matching to reconstruct a three-dimensional point cloud.
[0057] The terminal 102 may be, but is not limited to, a 3D scanning device, and the host computer 104 may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0058] It should be understood that the laser line extraction method provided in this application embodiment can be applied to a laser line extraction device, which can be the aforementioned terminal 102 or the chip of terminal 102. The chip of terminal 102 can be, for example, a field-programmable gate array (FPGA) chip.
[0059] It should be noted that the laser line extraction method provided in this application embodiment can be applied to scenarios such as belt detection, three-dimensional image reconstruction of object surface, and high-precision measurement of object size and shape features.
[0060] In one exemplary embodiment, such as Figure 2 As shown, a laser line extraction method is provided, which is applied to... Figure 1 The following explanation will be based on the terminal in the example, including S201 to S205:
[0061] S201. Obtain multiple pixels from the grayscale image of the target object obtained by laser line scanning.
[0062] In some embodiments, when performing laser scanning on a target object, a laser component on the terminal can be used to emit a laser beam and project it onto the surface of the object to be measured for scanning. Then, a camera component on the terminal can be used to capture the laser stripe image on the surface of the object, thereby obtaining a grayscale image.
[0063] The aforementioned terminal can be a laser scanning device.
[0064] For example, the camera can directly capture grayscale images; correspondingly, the laser stripe image of the object surface described above is a grayscale image obtained through laser line scanning. For example, the camera can also capture color images and then convert the color images into grayscale images obtained through laser line scanning.
[0065] It should be understood that the embodiments of this application do not limit the target objects described above. In some embodiments, they may include industrial parts, industrial molds, works of art, cultural relics, buildings, interior components, etc.
[0066] It should be understood that the embodiments of this application do not limit how multiple pixels in a grayscale image are obtained. In some embodiments, the terminal can acquire grayscale image data frame by frame. Subsequently, the terminal decomposes and reassembles the data of two adjacent grayscale images to obtain the target number of pixels.
[0067] For example, grayscale image data can be transmitted frame by frame, and each frame of grayscale image data can contain data of multiple pixels. By decomposing and recombining the data of two adjacent grayscale images, multiple groups of pixels are obtained.
[0068] For example, the subsequent confirmation of gradient parameters and feature parameters for each pixel can be performed in parallel using multiple one-dimensional Gaussian templates. Correspondingly, the number of groups obtained from decomposition and recombination is equal to the number of one-dimensional Gaussian templates processed in parallel. For example, if there is a one-dimensional Gaussian template that can be processed in parallel, then decomposition and recombination will yield four groups of pixels.
[0069] It should be understood that the embodiments of this application do not limit the number of pixels in each group, and can be set according to the actual situation. For example, a group can have 5 pixels.
[0070] For example, when the terminal receives the data of the Nth grayscale image, if there is no currently stored grayscale image data, it can store the Nth grayscale image data. Subsequently, the terminal receives the data of the (N+1)th grayscale image and detects that grayscale image data is currently stored; accordingly, the terminal can store the Nth grayscale image data. Then, the data of the Nth and (N+1)th grayscale images are decomposed and recombined to obtain four groups of pixels, each group containing five pixels. N is an integer greater than or equal to 1.
[0071] It should be understood that, in some embodiments of this application, regarding how to decompose and reassemble the data of two adjacent grayscale images, a portion of the data can be extracted from the data of two adjacent grayscale images as the data of a pixel according to the extraction position indicated by the preset extraction rules, and the extraction position of each pixel in each group of pixels is different.
[0072] For example, Figure 3 This is a schematic diagram illustrating data disassembly and reassembly as provided in an embodiment of this application, such as... Figure 3 As shown, the data for two adjacent grayscale images can be D0 and D1, both of which are 32 bits, i.e., [31:0]. Subsequently, according to the extraction positions indicated by the extraction rules, each pixel corresponding to group 1, group 2, group 3, and group 4 extracts data from D0 or D1 respectively, which serves as the pixel data.
[0073] For example, in group 1, the first pixel extracts [31:24] octet data from D0; the second pixel extracts [23:16] octet data from D0; the third pixel extracts [15:8] octet data from D0; the fourth pixel extracts [7:0] octet data from D0; and the fifth pixel extracts [31:24] octet data from D1. Similarly, in group 2, the first pixel extracts [23:16] octet data from D0; the second pixel extracts [15:8] octet data from D0; the third pixel extracts [7:0] octet data from D0; the fourth pixel extracts [31:24] octet data from D1; and the fifth pixel extracts [23:16] octet data from D1. Bit data; the first pixel in group 3 extracts [15:8] eight-bit data from D0, the second pixel in group 3 extracts [7:0] eight-bit data from D0, the third pixel in group 3 extracts [31:24] eight-bit data from D1, the fourth pixel in group 3 extracts [23:16] eight-bit data from D1, and the fifth pixel in group 3 extracts [15:8] eight-bit data from D1; the first pixel in group 4 extracts [7:0] eight-bit data from D0, the second pixel in group 4 extracts [31:24] eight-bit data from D1, the third pixel in group 4 extracts [23:16] eight-bit data from D1, the fourth pixel in group 4 extracts [15:8] eight-bit data from D1, and the fifth pixel in group 4 extracts [7:0] eight-bit data from D1.
[0074] S202. Using a preset one-dimensional Gaussian template, determine the gradient parameters and feature parameters of each pixel in the grayscale image in the first direction of the image coordinate system.
[0075] In this step, after the terminal acquires multiple pixels in the grayscale image of the target object obtained by laser line scanning, it can determine the gradient parameters and feature parameters of each pixel in the grayscale image in the first direction of the image coordinate system by using a preset one-dimensional Gaussian template.
[0076] Among them, the gradient parameter is used to characterize the rate of grayscale change of the light stripe formed by the laser line on the grayscale image at the corresponding pixel, and the feature parameter is used to characterize the rate of curvature change of the light stripe at the corresponding pixel.
[0077] Among them, the one-dimensional Gaussian template is a set of numerical sequences obtained by discretization based on the one-dimensional Gaussian function. Its core is to suppress high-frequency noise while preserving the main trend of the data through the weighted averaging property of the Gaussian function.
[0078] For example, a one-dimensional Gaussian template can be pre-set, and the width of the laser stripe can be finely adjusted to fit the one-dimensional Gaussian template. Then, the parameters corresponding to the one-dimensional Gaussian template can be pre-stored in the FPGA register of the terminal to reduce FPGA resource consumption.
[0079] For example, Figure 4 A schematic diagram of a one-dimensional Gaussian template provided in an embodiment of this application is shown below. Figure 4 As shown, the gradient parameter and feature parameters correspond to different one-dimensional Gaussian templates. The one-dimensional Gaussian template Gx corresponding to the gradient parameter is [-523, -7792, 0, 7792, 523], and the one-dimensional Gaussian template Gxx corresponding to the feature parameters is [1777, 8116, -20000, 8116, 1777]. The gradient parameter Dx can be obtained by taking the first derivative of the data of each pixel in the first direction using the one-dimensional Gaussian template Gx corresponding to the gradient parameter. The feature parameter Dxx can be obtained by taking the second derivative of the data of each pixel in the first direction using the one-dimensional Gaussian template Gxx corresponding to the feature parameters.
[0080] The aforementioned image coordinate system can be a rectangular plane coordinate system, and the aforementioned first direction can be the x-axis direction in the rectangular plane coordinate system.
[0081] In some embodiments, multiple one-dimensional Gaussian templates process multiple pixels in a grayscale image in parallel. Accordingly, the integer coordinates corresponding to the determined gradient parameters and feature parameters can be offset in a first direction to correspond to their true coordinates.
[0082] For example, after determining the gradient parameters and feature parameters, the terminal can adjust the integer coordinates corresponding to the determined gradient parameters and feature parameters in the first direction according to the number of the one-dimensional Gaussian template processed in parallel.
[0083] For example, when multiple pixels in a grayscale image are processed in parallel using four one-dimensional Gaussian templates, in quad-parallel mode, the integer coordinates corresponding to each gradient parameter and feature parameter remain unchanged in the second direction (y-axis), while they are adjusted according to their number in the first direction (x-axis). The first one-dimensional Gaussian template (number 0) can adjust the integer coordinates... Shift left by two bits and add an offset of 0; the second one-dimensional Gaussian template (number 1) can convert integer coordinates... Shift left by two bits and add offset 1; the first one-dimensional Gaussian template (number 2) can convert integer coordinates... Shift left by two bits and add the offset value of 2; the first one-dimensional Gaussian template (number 3) can convert integer coordinates... Shift left by two bits and add the offset value of 3.
[0084] In this application, the laser line extraction speed is greatly accelerated by using a multi-parallel processing architecture. Under a global clock of 300M, the extraction speed of a single laser line for 100W resolution image data can reach 1200 frames. Higher processing speeds can be achieved by changing the degree of parallelism, which can meet the needs of embedded application scenarios with high-speed and low-power processing.
[0085] S203. Based on the gradient parameters and feature parameters, select the target pixels from each pixel in the grayscale image.
[0086] In this step, after the terminal determines the gradient parameters and feature parameters of each pixel in the first direction of the image coordinate system, it can filter out the target pixels from among the pixels in the grayscale image based on the gradient parameters and feature parameters.
[0087] The target pixel is the pixel with the largest feature parameter in its neighborhood along the first direction. That is, the pixel corresponding to the largest feature parameter in its neighborhood along the x-axis is determined as the pixel at the center of the laser line.
[0088] In some embodiments, the terminal can determine the sub-pixel offset of each pixel in the grayscale image based on gradient parameters and feature parameters. Then, the terminal can filter out the valid pixels from each pixel in the grayscale image based on the sub-pixel offset. Finally, the terminal selects the target pixel from the valid pixels.
[0089] For example, the subpixel offset can be determined by the negative of the ratio of the gradient parameter to the feature parameter, as shown in Equation (1).
[0090] (1)
[0091] Where t is the subpixel offset, Dx is the gradient parameter, and Dxx is the feature parameter.
[0092] For example, the terminal can filter out invalid pixels from each pixel in a grayscale image to obtain valid pixels. Invalid pixels are those whose absolute sub-pixel offset is greater than or equal to 1.
[0093] For example, the terminal can set the sub-pixel offset corresponding to pixels where |t|>1 to 1. Then, pixels where t=1 are identified as invalid pixels. Invalid pixels are independent of the center of the laser line and can be filtered out, thus filtering out the valid pixels from the grayscale image. It should be understood that by controlling the sub-pixel offset values to be greater than 1, the terminal's chip resources can be saved.
[0094] For example, after determining the effective pixels among each pixel, the pixel with the largest feature parameter in the neighborhood of the first direction can be selected as the target pixel by using the first direction as the statistical dimension and a non-maximum value filtering method. This target pixel is the pixel at the center of the laser line.
[0095] The size of the aforementioned neighborhood can be based on the width of the laser line. For example, if the width of a narrow laser line is typically less than 3 pixels, then the neighborhood of the narrow laser line can be set to 3 pixels. For example, if the width of a wide laser line is typically greater than 5 pixels, then the neighborhood of the wide laser line can be set to 5 pixels.
[0096] S204. Determine the sub-pixel coordinates of the laser line corresponding to the target pixel based on the integer coordinates corresponding to the target pixel.
[0097] In this step, after the terminal selects the target pixel from the pixels in the grayscale image, it can determine the sub-pixel coordinates of the laser line corresponding to the target pixel based on the integer coordinates of the target pixel.
[0098] In this context, integer coordinates correspond to the row and column positions of pixels, while sub-pixel coordinates of the laser line correspond to the fine position of the light stripe center of the activation line within the pixel.
[0099] For example, there is a correspondence between the identifiers of each pixel in the integer coordinate field, or the integer coordinates can be directly used as the identifiers of each pixel. Accordingly, the integer coordinates corresponding to the target pixel can be determined by the identifier of the target pixel.
[0100] In some embodiments, after determining the integer coordinates corresponding to the target pixel, the integer coordinates corresponding to the target pixel and the sub-pixel offset corresponding to the target pixel can be fitted to obtain the sub-pixel coordinates of the laser line corresponding to the target pixel.
[0101] For example, if the integer coordinates of the target pixel are (x1, y1) and the sub-pixel offset of the target pixel is t0, then the sub-pixel coordinates of the laser line (t0*x1, y1) are obtained by multiplying the value of the first x-axis in the integer coordinates with the sub-pixel offset.
[0102] S205. Extract the laser line based on the sub-pixel coordinates of the laser line corresponding to the target pixel.
[0103] In some embodiments, when the terminal determines the sub-pixel coordinates of the laser line corresponding to the target pixel, the line formed by connecting the target pixels can be used as the center of the laser line, thereby extracting the laser line.
[0104] In other embodiments, the terminal can transmit the subpixel coordinates of the laser line to the host computer, which then performs extreme correction and matching on the grayscale image to reconstruct a three-dimensional point cloud.
[0105] In this application, by using a one-dimensional Gaussian template instead of two-dimensional convolution, significant on-chip storage and computational resources are reduced. Finally, the extracted laser centerline coordinates are further corrected using a host computer, ensuring both low-power embedded applications and maintaining the algorithm's high accuracy. Furthermore, due to its low resource consumption, the terminal chip can be an FPGA chip, resulting in low cost. Accurate sub-pixel coordinates of the laser line can be extracted using simple convolution operations and minimal data computation. Finally, the laser line extraction method provided in this application exhibits excellent noise suppression. Because the algorithm involves calculating the second derivative, non-maximum suppression and eigenvalue selection result in excellent noise suppression.
[0106] The laser line extraction method provided in this application acquires multiple pixels in a grayscale image obtained by scanning a target object with a laser line. Using a preset one-dimensional Gaussian template, the gradient parameters and feature parameters of each pixel in the grayscale image are determined in a first direction in the image coordinate system. The gradient parameters characterize the rate of grayscale change of the light stripe formed by the laser line on the grayscale image at the corresponding pixel, and the feature parameters characterize the rate of curvature change of the light stripe at the corresponding pixel. Based on the gradient parameters and feature parameters, a target pixel is selected from the pixels in the grayscale image. The target pixel is the pixel with the largest feature parameter in its neighborhood in the first direction. The sub-pixel coordinates of the laser line corresponding to the target pixel are determined based on the integer coordinates of the target pixel. The laser line is extracted based on the sub-pixel coordinates of the laser line corresponding to the target pixel. Since two-dimensional convolution is not required, and instead a one-dimensional Gaussian template is used to extract the gradient parameters and feature parameters of each pixel in the first direction, and then the sub-pixel coordinates of the laser line are determined based on the gradient parameters and feature parameters, the target pixel with the largest feature parameter in its neighborhood is selected to calculate the corresponding sub-pixel coordinates of the laser line for laser line extraction. This significantly reduces the consumption of on-chip storage and processing resources.
[0107] Figure 5 A schematic diagram of another laser line extraction method provided in the embodiments of this application is shown below. Figure 5 As shown, the laser line extraction method includes steps S301 to S309:
[0108] S301. Acquire grayscale image data frame by frame.
[0109] S302. Decompose and reassemble the data of two adjacent grayscale images to obtain the number of pixels in the target group.
[0110] The number of target groups is equal to the number of one-dimensional Gaussian templates processed in parallel.
[0111] S303. Using a preset one-dimensional Gaussian template, determine the gradient parameters and feature parameters of each pixel in the grayscale image in the first direction of the image coordinate system.
[0112] The gradient parameter characterizes the rate of grayscale change of the light stripe formed by the laser line on the grayscale image at the corresponding pixel. The feature parameter characterizes the rate of curvature change of the light stripe at the corresponding pixel.
[0113] S304. Based on the number of the one-dimensional Gaussian template for parallel processing, the integer coordinates corresponding to the determined gradient parameters and feature parameters are offset and adjusted in the first direction.
[0114] S305. Determine the sub-pixel offset of each pixel in the grayscale image based on the gradient parameters and feature parameters.
[0115] S306. Based on the sub-pixel offset, filter out the effective pixels from each pixel in the grayscale image.
[0116] In some embodiments, the terminal can filter out invalid pixels from each pixel in a grayscale image to obtain valid pixels. Invalid pixels are pixels whose absolute value of subpixel offset is greater than or equal to 1.
[0117] S307. Select the target pixel from the valid pixels in each pixel.
[0118] S308. Fit the integer coordinates corresponding to the target pixel and the sub-pixel offset corresponding to the target pixel to obtain the sub-pixel coordinates of the laser line corresponding to the target pixel.
[0119] S309. Extract the laser line based on the sub-pixel coordinates of the laser line corresponding to the target pixel.
[0120] The laser line extraction method provided in this application acquires multiple pixels in a grayscale image obtained by scanning a target object with a laser line. Using a preset one-dimensional Gaussian template, the gradient parameters and feature parameters of each pixel in the grayscale image are determined in a first direction in the image coordinate system. The gradient parameters characterize the rate of grayscale change of the light stripe formed by the laser line on the grayscale image at the corresponding pixel, and the feature parameters characterize the rate of curvature change of the light stripe at the corresponding pixel. Based on the gradient parameters and feature parameters, a target pixel is selected from the pixels in the grayscale image. The target pixel is the pixel with the largest feature parameter in its neighborhood in the first direction. The sub-pixel coordinates of the laser line corresponding to the target pixel are determined based on the integer coordinates of the target pixel. The laser line is extracted based on the sub-pixel coordinates of the laser line corresponding to the target pixel. Since two-dimensional convolution is not required, and instead a one-dimensional Gaussian template is used to extract the gradient parameters and feature parameters of each pixel in the first direction, and then the sub-pixel coordinates of the laser line are determined based on the gradient parameters and feature parameters, the target pixel with the largest feature parameter in its neighborhood is selected to calculate the corresponding sub-pixel coordinates of the laser line for laser line extraction. This significantly reduces the consumption of on-chip storage and processing resources.
[0121] 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.
[0122] Based on the same inventive concept, this application also provides a laser line extraction device for implementing the laser line extraction method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more laser line extraction device embodiments provided below can be found in the limitations of the laser line extraction method described above, and will not be repeated here.
[0123] In one exemplary embodiment, such as Figure 6 As shown, a laser line extraction device 400 is provided, applied to an FPGA chip, including: an acquisition module 401, a determination module 402, a filtering module 403, a positioning module 404, and an extraction module 405, wherein:
[0124] The acquisition module 401 is used to acquire multiple pixels in a grayscale image of a target object obtained by laser line scanning;
[0125] The determination module 402 is used to determine the gradient parameters and feature parameters of each pixel in the grayscale image in the first direction of the image coordinate system through a preset one-dimensional Gaussian template. The gradient parameters are used to characterize the grayscale change rate of the light stripe formed by the laser line on the grayscale image in the corresponding pixel, and the feature parameters are used to characterize the curvature change rate of the light stripe in the corresponding pixel.
[0126] The filtering module 403 is used to filter out target pixels from each pixel in the grayscale image according to gradient parameters and feature parameters. The target pixel is the pixel with the largest feature parameter in the neighborhood in the first direction.
[0127] The positioning module 404 is used to determine the sub-pixel coordinates of the laser line corresponding to the target pixel based on the integer coordinates corresponding to the target pixel.
[0128] The extraction module 405 is used to extract the laser line based on the sub-pixel coordinates of the laser line corresponding to the target pixel.
[0129] In one embodiment, the filtering module 403 is further configured to determine the sub-pixel offset of each pixel in the grayscale image based on the gradient parameters and feature parameters; filter out the effective pixels in each pixel in the grayscale image based on the sub-pixel offset; and filter out the target pixel from the effective pixels in each pixel.
[0130] In one embodiment, the filtering module 403 is further configured to filter out invalid pixels from each pixel in the grayscale image to obtain valid pixels, wherein invalid pixels are pixels whose absolute value of subpixel offset is greater than or equal to 1.
[0131] In one embodiment, the filtering module 403 is further configured to fit the integer coordinates corresponding to the target pixel and the sub-pixel offset corresponding to the target pixel to obtain the sub-pixel coordinates of the laser line corresponding to the target pixel.
[0132] In one embodiment, multiple one-dimensional Gaussian templates process multiple pixels in a grayscale image in parallel; the determining module is further configured to adjust the integer coordinates corresponding to the determined gradient parameters and feature parameters in a first direction according to the number of the one-dimensional Gaussian templates processed in parallel.
[0133] In one embodiment, the acquisition module 401 is further configured to acquire grayscale image data frame by frame; decompose and reassemble the data of two adjacent grayscale images to obtain the target number of pixels, wherein the target number of pixels is equal to the number of one-dimensional Gaussian templates processed in parallel.
[0134] Each module in the aforementioned laser line extraction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0135] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a laser line extraction method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0136] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0137] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the laser line extraction method described above.
[0138] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the laser line extraction method described above.
[0139] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the laser line extraction method described above.
[0140] 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. When executed, the computer program 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 memory 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, artificial intelligence (AI) processors, etc., and are not limited to these.
[0141] 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 application.
[0142] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this 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 laser line extraction method, characterized in that, Applied to FPGA chips, the method includes: To acquire multiple pixels in a grayscale image of a target object obtained by laser line scanning; Using a preset one-dimensional Gaussian template, the gradient parameters and feature parameters of each pixel in the grayscale image in the first direction of the image coordinate system are determined. The gradient parameters are used to characterize the grayscale change rate of the light stripe formed by the laser line on the grayscale image in the corresponding pixel, and the feature parameters are used to characterize the curvature change rate of the light stripe in the corresponding pixel. Based on the gradient parameter and the feature parameter, a target pixel is selected from each pixel in the grayscale image. The target pixel is the pixel with the largest feature parameter in the neighborhood in the first direction. Based on the integer coordinates corresponding to the target pixel, determine the sub-pixel coordinates of the laser line corresponding to the target pixel; The laser line is extracted based on the sub-pixel coordinates of the laser line corresponding to the target pixel.
2. The method according to claim 1, characterized in that, The step of selecting target pixels from each pixel in the grayscale image based on the gradient parameters and the feature parameters includes: Based on the gradient parameters and the feature parameters, the sub-pixel offset of each pixel in the grayscale image is determined; Based on the sub-pixel offset, the effective pixels in each pixel of the grayscale image are filtered out; The target pixel is selected from the valid pixels among the individual pixels.
3. The method according to claim 2, characterized in that, The step of filtering out the effective pixels from each pixel in the grayscale image based on the sub-pixel offset includes: Invalid pixels are filtered out from each pixel in the grayscale image to obtain the valid pixels. The invalid pixels are pixels whose absolute value of subpixel offset is greater than or equal to 1.
4. The method according to claim 2, characterized in that, Determining the sub-pixel coordinates of the laser line corresponding to the target pixel based on the integer coordinates corresponding to the target pixel includes: The sub-pixel coordinates of the laser line corresponding to the target pixel are obtained by fitting the integer coordinates corresponding to the target pixel and the sub-pixel offset corresponding to the target pixel.
5. The method according to claim 1, characterized in that, Multiple one-dimensional Gaussian templates are used to process multiple pixels in a grayscale image in parallel; after determining the gradient parameters and feature parameters of each pixel in the grayscale image in a first direction in the image coordinate system using a preset one-dimensional Gaussian template, the method further includes: Based on the number of the one-dimensional Gaussian template for parallel processing, the integer coordinates corresponding to the determined gradient parameters and feature parameters are offset and adjusted in the first direction.
6. The method according to claim 5, characterized in that, The step of acquiring multiple pixels in a grayscale image of a target object obtained by laser line scanning includes: Data of the grayscale image is acquired frame by frame; The data of two adjacent grayscale images are decomposed and recombined to obtain the target number of pixels, wherein the target number of pixels is equal to the number of one-dimensional Gaussian templates in the parallel processing.
7. A laser line extraction device, characterized in that, The device, applied to an FPGA chip, includes: The acquisition module is used to acquire multiple pixels in a grayscale image of a target object obtained by laser line scanning; The determination module is used to determine the gradient parameters and feature parameters of each pixel in the grayscale image in the first direction of the image coordinate system using a preset one-dimensional Gaussian template. The gradient parameters are used to characterize the grayscale change rate of the light stripe formed by the laser line on the grayscale image at the corresponding pixel, and the feature parameters are used to characterize the curvature change rate of the light stripe at the corresponding pixel. A filtering module is used to filter out target pixels from each pixel in the grayscale image according to the gradient parameters and the feature parameters, wherein the target pixel is the pixel with the largest feature parameters in the neighborhood in the first direction. The positioning module is used to determine the sub-pixel coordinates of the laser line corresponding to the target pixel based on the integer coordinates corresponding to the target pixel. The extraction module is used to extract the laser line based on the sub-pixel coordinates of the laser line corresponding to the target pixel.
8. 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 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.