A method, device, medium and equipment for debugging VCSEL light spot array into a line
Patent Information
- Application Number
- CN202610444563.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-07
- Publication Date
- 2026-08-18
AI Technical Summary
[0005]针对现有技术存在的问题,本发明实施例提供了一种VCSEL光斑阵列成线的调试方法、装置、介质及设备,以解决或者部分解决现有技术中在为TOF模组中的条列式发射端结构的条状光斑进行调试时,主要依赖人工经验,导致调试效率和调试精度都无法确保,影响条状光斑质量,从而影响TOF模组的整体性能的稳定性的技术问题
[0074]通过本发明的一个或者多个实施例,本发明具有以下有益效果或者优点:
Smart Images

Figure CN122592641A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, medium, and device for debugging VCSEL spot arrays. Background Technology
[0002] A vertical-cavity surface-emitting laser (VCSEL) is a semiconductor laser in which the laser beam is emitted perpendicular to the surface of a semiconductor chip. It features small size, high beam quality, and high integration, and is widely used in fields such as time-of-flight (TOF) modules.
[0003] Conventional TOF modules mostly use surface light emission mode, such as surface light... Figure 1 As shown. However, since the intensity of the laser pulse gradually attenuates with increasing measurement distance, the detection accuracy and effective detection distance of the module are limited. Therefore, currently, the surface light emitted by the VCSEL is focused into a dot matrix spot. The focusing characteristics of the dot matrix spot are used to improve the local laser pulse intensity, thereby compensating for the performance defects caused by surface light attenuation and meeting the detection requirements of the TOF module. The dot matrix spot is as follows. Figure 2 As shown, with the increasing demand for multi-channel detection, conventional dot-matrix spot designs can no longer meet the requirements for independent operation of multiple channels. Therefore, the BarsTX structure (strip-type emitter structure) is applied to multi-channel detection needs. In the BarsTX structure, the laser emitted by the VCSEL is directly incident on the lens, and the distance between the lens and the VCSEL is intentionally set to a non-focal position, i.e., defocused. After the laser beam passes through this defocused lens, the optical paths interfere with each other, ultimately forming strip-shaped spots. Compared with dot-matrix spots, strip-shaped spots can achieve partitioned correspondence of multiple channels, effectively avoiding spot interference between channels, thus achieving the design goal of independent operation of multiple channels.
[0004] The defocusing design of the BarsTX structure described above requires adjustment of the stripe-shaped light spot to determine the desired stripe-shaped light spot. However, existing technologies have significant drawbacks in the adjustment process of the stripe-shaped light spot: they rely on the engineer's subjective experience and visual judgment of the line formation effect of the stripe-shaped light spot. Due to the lack of clear adjustment feedback guidance, engineers find it difficult to accurately grasp the adjustment direction and adjustment step size, which not only significantly reduces adjustment efficiency but may also lead to inconsistent quality of the stripe-shaped light spot after adjustment, affecting the overall performance stability of the TOF module. Summary of the Invention
[0005] To address the problems existing in the prior art, this invention provides a method, apparatus, medium, and equipment for debugging VCSEL spot arrays, in order to solve or partially solve the technical problem that in the prior art, when debugging the strip-shaped spot of the strip-type transmitter structure in the TOF module, the main reliance on manual experience leads to the inability to ensure debugging efficiency and accuracy, affecting the quality of the strip-shaped spot and thus affecting the overall performance stability of the TOF module.
[0006] A first aspect of the present invention provides a method for debugging VCSEL spot array linearization, the method comprising: Acquire speckle images corresponding to different focus positions, determine the sharpness score of each speckle image, and determine the focus position corresponding to the speckle image with the highest score as the target focus position; the speckle image is obtained by taking a picture of the background white board using a camera when the VCSEL beam array is projected onto the background white board by the vertical cavity surface emission laser VCSEL. Using the target focus position as a reference point, defocus adjustment is performed on the lens and the vertical cavity surface-emitting laser to obtain a defocused image; it is determined whether the speckles in the defocused image are strip-shaped light spots. If so, the average measured linewidth of all strip-shaped light spots and the average aspect ratio of all strip-shaped light spots are determined. The line formation score is determined based on the average measured linewidth and the average aspect ratio of all the strip-shaped light spots. The adjustment direction is determined based on the line formation score, the average measured linewidth and the average aspect ratio of all the strip-shaped light spots. The line formation of the VCSEL light spot array is then optimized and adjusted based on the adjustment direction.
[0007] In the above scheme, determining the sharpness score of each speckle image includes: For each speckle image, the speckle image is preprocessed to obtain a preprocessed image; The preprocessed image is convolved using the Laplacian operator to obtain an edge-enhanced image. Obtain the response value of each pixel in the edge enhancement image, and then use the formula based on the response value. Determine the sharpness score of the speckle image. ; The M The height of the speckle image, the N The width of the speckle image, the x For the row index of the pixel, the y For the column index of the pixel, the The coordinates are ( x , y The response value of the pixel, the This is the average response value of all pixels.
[0008] In the above scheme, determining whether the speckle in the defocused image is a strip-shaped light spot includes: A target threshold is determined, and the defocused image is binarized using the target threshold to obtain a binarized image; A closing operation is performed on the binarized image to obtain a morphologically processed image; Extract each connected region from the morphologically processed image, and for each connected region, determine the area of the connected region, the aspect ratio of the minimum bounding moment of the connected region, and the compactness of the connected region; For each connected region, if the area of the connected region is greater than a preset first threshold, the aspect ratio of the minimum circumscribed moment is greater than a preset second threshold, and the compactness is less than a third threshold, then the speckle corresponding to the connected region is determined to be a strip-shaped light spot.
[0009] In the above scheme, determining the average linewidth of all strip-shaped light spots includes: A distance transformation is performed on each pixel of each stripe of light in the morphologically processed image to obtain a distance image; Extract multiple local maxima points from the distance image to form the center line of each strip-shaped light spot; For each center point of each center line, determine the first linewidth of the strip-shaped light spot measured at said center point; For each strip-shaped light spot, the second linewidth of the strip-shaped light spot is determined based on the first linewidth of the strip-shaped light spot measured at each center point, and the second linewidth is the average of the first linewidths. The measurement linewidth of the strip-shaped light spot is determined based on the second linewidth of the strip-shaped light spot; The average measurement linewidth of all strip-shaped light spots is determined based on the measurement linewidth of each strip-shaped light spot.
[0010] In the above scheme, determining the measurement linewidth of the striped light spot based on the second linewidth of the striped light spot includes: For each strip-shaped light spot, obtain the area of the connected region corresponding to the strip-shaped light spot and the length of the connected region; The measurement linewidth of the strip-shaped light spot is determined based on the area of the connected region, the length of the connected region, and the second linewidth of the strip-shaped light spot.
[0011] In the above scheme, determining the line score based on the average measured linewidth of all the strip-shaped light spots and the average aspect ratio of all the strip-shaped light spots includes: Obtain the density corresponding to each strip-shaped light spot, and determine the average density value based on the density of each strip-shaped light spot; According to the formula Determine the line score F ; The The sharpness score corresponding to the speckle image with the maximum score, the The preset reference maximum sharpness score, the As the first weighting coefficient, the This is the second weighting coefficient. The aspect ratio is the average value. The preset reference maximum aspect ratio, the This is the third weighting coefficient. The average compactness value, the The fourth weighting coefficient, the The average line width of the measurement, the The preset target line width.
[0012] In the above scheme, determining the adjustment direction based on the line score, the average measured linewidth of all strip-shaped light spots, and the average aspect ratio of all strip-shaped light spots includes: If the line score is less than the fourth threshold, then the debugging direction is determined to be adjusting the distance between the vertical cavity surface-emitting laser and the background whiteboard; If the average aspect ratio is less than the fifth threshold, then the debugging direction is determined to be adjusting the distance between the vertical cavity surface-emitting laser and the lens; If the average measured linewidth is greater than the sixth threshold or less than the seventh threshold, then the debugging direction is determined to be adjusting the distance between the vertical cavity surface-emitting laser and the lens.
[0013] A second aspect of the present invention provides a debugging device for VCSEL spot array linearization, the device comprising: The first determining unit is used to acquire speckle images corresponding to different focus positions, determine the sharpness score of each speckle image, and determine the focus position corresponding to the speckle image with the highest score as the target focus position; the speckle image is obtained by taking a picture of the background whiteboard using a camera when the time-of-flight module equipped with a vertical cavity surface emission laser (VCSEL) projects a VCSEL spot array onto the background whiteboard. The judgment unit is used to perform defocus adjustment operation on the lens and the vertical cavity surface-emitting laser with the target focus position as the reference point to obtain a defocus image; to determine whether the speckles in the defocus image are strip-shaped light spots, and if so, to determine the average measured linewidth of all strip-shaped light spots and the average aspect ratio of all strip-shaped light spots. The second determining unit is used to determine the line formation score based on the average measured linewidth of all the strip-shaped light spots and the average aspect ratio of all the strip-shaped light spots, determine the debugging direction based on the line formation score, the average measured linewidth of all the strip-shaped light spots and the average aspect ratio of all the strip-shaped light spots, and continue to optimize and debug the line formation of the VCSEL light spot array based on the debugging direction.
[0014] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in any of the first aspects.
[0015] A fourth aspect of the present invention provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps of the method described in any of the first aspects.
[0016] This invention provides a method, apparatus, medium, and device for debugging VCSEL spot array line formation. The method includes: acquiring speckle images corresponding to different focus positions, determining the sharpness score of each speckle image, and determining the focus position corresponding to the speckle image with the highest score as the target focus position; the speckle image is obtained by taking a picture of the background whiteboard using a camera when the VCSEL spot array is projected onto the background whiteboard by the vertical cavity surface-emitting laser (VCSEL); using the target focus position as a reference point, performing defocus adjustment operation on the lens and the VCSEL to obtain a defocus image; determining whether the speckles in the defocus image are strip-shaped spots, and if so, determining the average measured linewidth of all strip-shaped spots and determining the average linewidth of all strip-shaped spots. The method involves: 1) determining the average aspect ratio of all strip-shaped light spots; 2) determining a line formation score based on the average measured linewidth and aspect ratio of all strip-shaped light spots; 3) determining the adjustment direction based on the line formation score, the average measured linewidth, and the average aspect ratio of all strip-shaped light spots; and 4) further optimizing the line formation of the VCSEL light spot array based on the adjustment direction. This process first uses a sharpness score algorithm to lock the optimal focus position as a benchmark, eliminating focus deviation; secondly, it objectively determines the line formation status based on morphological and geometric features (aspect ratio, compactness, area), replacing manual visual judgment and eliminating errors caused by human experience; and finally, it establishes a closed-loop feedback through precise linewidth measurement and line formation score to clarify the adjustment direction and step size, achieving precise optimization. This method transforms traditional manual trial-and-error debugging into an automated, quantitative closed-loop process, significantly improving debugging efficiency and accuracy, ensuring the morphological regularity and linewidth consistency of the strip-shaped light spots, and effectively improving the overall performance stability of the TOF module. Attached Figure Description
[0017] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 This shows the planar light spot corresponding to the transmitter of a TOF module according to the prior art; Figure 2 The diagram shows a dot matrix light spot corresponding to the emitter of a TOF module according to an embodiment of the prior art when surface light emission is used.
[0018] Figure 3 A schematic diagram of a strip-type transmitter structure according to an embodiment of the present invention is shown; Figure 4 A schematic diagram of a strip-shaped light spot according to an embodiment of the present invention is shown; Figure 5 A schematic flowchart of a VCSEL spot array line forming debugging method according to an embodiment of the present invention is shown; Figure 6 A schematic diagram of a speckle image taken at a focal position according to an embodiment of the present invention is shown; Figure 7 A schematic diagram of a speckle image taken at another focus position according to an embodiment of the present invention is shown; Figure 8 A speckle image before preprocessing is shown according to an embodiment of the present invention; Figure 9 A preprocessed speckle image according to an embodiment of the present invention is shown; Figure 10 An image showing a degree of defocusing according to an embodiment of the present invention is illustrated. Figure 11 An image showing a defocused image at another degree of defocus according to an embodiment of the present invention is shown; Figure 12 A schematic diagram of a VCSEL spot array forming debugging device according to an embodiment of the present invention is shown. Detailed Implementation
[0019] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0020] To better understand the technical solution of this invention, the transmitter structure of the TOF module is first introduced here: the BarsTX structure, as shown below. Figure 3 As shown, the BarsTX includes: a lens 1, a driver 2, and a vertical-cavity surface-emitting laser 3; The vertical cavity surface-emitting laser 3 serves as the core of the light source and can emit an infrared laser array. The lens 1 is located above the vertical cavity surface-emitting laser 3. The lens 1 is used to collimate, focus, and shape the laser array emitted by the vertical cavity surface-emitting laser 3, control the beam divergence angle, and cooperate with subsequent defocusing operations to achieve speckle diffusion and fusion, ultimately forming a strip-shaped beam.
[0021] Driver 2 is used to provide stable drive current and timing control for vertical cavity surface-emitting laser 3 to ensure stable laser emission.
[0022] Based on the defocusing design of the BarsTX structure described above, it is necessary to adjust the stripe-shaped light spot to determine the desired stripe-shaped light spot, thereby achieving the goal of independent operation of multiple channels; the stripe-shaped light spot is as follows: Figure 4 As shown.
[0023] Based on this, the present invention provides a method for debugging VCSEL spot array linearization, such as... Figure 5 As shown, the method includes the following steps: S510, acquire speckle images corresponding to different focus positions, determine the sharpness score of each speckle image, and determine the focus position corresponding to the speckle image with the highest score as the target focus position; the speckle image is obtained by taking a picture of the background whiteboard using a camera when the time-of-flight module equipped with a vertical cavity surface emission laser (VCSEL) projects a VCSEL spot array onto the background whiteboard.
[0024] Speckle images are captured by a camera on a white background surface when a vertical-cavity surface-emitting laser (VCSEL) projects a beam array onto the surface. To determine the sharpest speckle image, the camera needs to capture images of the white background surface at different focus positions (focus distances). This allows for the acquisition of speckle images corresponding to different focus positions, determination of the sharpness score for each image, and identification of the focus position corresponding to the image with the highest score as the target focus position. Speckle images captured at different focus positions can be referenced. Figure 6 and Figure 7 .
[0025] In one implementation, determining the sharpness score for each speckle image includes: For each speckle image, the speckle image is preprocessed to obtain a preprocessed image; The preprocessed image is convolved using the Laplacian operator to obtain an edge-enhanced image; Obtain the response value of each pixel in the edge-enhanced image, and then use the formula based on the response value. Determine the sharpness score of a speckle image. ; M The height of the speckle image, N The width of the speckle image. x The row index of the pixel. y For the column index of the pixel, The coordinates are ( x , y The response value of the pixel. This is the average response value of all pixels.
[0026] Specifically, before determining the sharpness score of a speckle image, it needs to be preprocessed to reduce noise interference. This preprocessing mainly includes: The speckle image is converted to grayscale to obtain a grayscale image; The grayscale image is enhanced and filtered to obtain a preprocessed image.
[0027] In one embodiment, grayscale processing of the speckle image includes: The speckle image is converted to grayscale using formula (1): (1) In formula (1), For speckle images in pixel coordinates The brightness value in the red channel, For speckle images in pixel coordinates The brightness value in the green channel, For speckle images in pixel coordinates In the blue channel brightness value, pixel coordinates The grayscale value.
[0028] Image enhancement is performed on grayscale images using formula (2): (2) In formula (2), To enhance the image, This is a contrast limiting parameter used to suppress noise amplification. A value of 2.0 means that the histogram clipping factor is limited to 2; The size of the image blocks, This represents dividing a grayscale image into... The grid regions are divided, and histogram equalization is performed within each grid.
[0029] In formula (2), CLAHE stands for Contrast Limited Adaptive Histogram Equalization. That is, when enhancing a grayscale image, the CLAHE algorithm is used to enhance the image, as follows: First, divide the entire grayscale image into several... For each grid block, a grayscale histogram is calculated independently. Then, histogram equalization is performed on the grayscale values within the grid block. The purpose is to make the grayscale distribution more uniform, brighten dark areas, and add more depth to bright areas, thereby improving local contrast and making weak light spots and details clearer.
[0030] It should be noted that, to avoid over-amplifying noise and prevent dark noise points from being brightened into false spots, the histogram of each grid block is cropped before equalization, removing portions exceeding twice the average height. Finally, bilinear interpolation is used to smoothly fuse the results of each grid block, resulting in an enhanced image with improved local contrast and controllable noise, providing a high-quality image foundation for subsequent spot segmentation and feature extraction.
[0031] The enhanced image is filtered using formula (3) to reduce noise, resulting in a preprocessed image: (3) In formula (3), Pixel coordinates in the preprocessed image grayscale value, To enhance pixel coordinates in an image grayscale value, For Gaussian kernel function, k This is used to determine the size of the Gaussian kernel, the size of which is... , u This represents the horizontal offset of the Gaussian kernel. v This represents the vertical offset of the Gaussian kernel.
[0032] After obtaining the preprocessed image, the Laplacian operator is used to convolve the preprocessed image to enhance edge information, resulting in an edge-enhanced image. The variance of the response values of the edge-enhanced image is used as a sharpness evaluation index; the larger the index value, the sharper the image edges and the higher the contrast. Taking a speckle image as an example, the speckle image before preprocessing is as follows: Figure 8 As shown, the preprocessed speckle image is as follows: Figure 9 As shown.
[0033] The Laplace operator is shown in equation (4): (4) It can be seen that the Laplacian operator is mathematically defined as the image in... x , y The sum of the second-order partial derivatives in the direction is used to detect edge regions with abrupt changes in grayscale. However, since the preprocessed image is a discrete digital image, this invention uses a 3×3 convolution kernel to perform convolution operations with the preprocessed image. The second-order partial derivative calculation is approximated by weighted summation of neighboring pixels to obtain the edge intensity response map, which provides a basis for subsequent sharpness scoring.
[0034] That is, the preprocessed image is convolved according to formula (5): (5) In formulas (4) and (5), pixels in the image after Laplacian convolution The response value, For the Laplace operator, I The image to be processed. For the image to be processed in x Second-order partial derivatives in the direction, For the image to be processed in y Second-order partial derivatives in the direction, Pixel coordinates in the preprocessed image grayscale value, For the Laplacian convolution kernel in The weight value at that point, This represents the horizontal offset of the Laplacian convolution kernel. This represents the vertical offset of the Laplacian convolution kernel.
[0035] Then, determine the sharpness score of the speckle image according to formula (6). : (6) In formula (6), M The height of the speckle image, N The width of the speckle image. x The row index of the pixel. y For the column index of the pixel, The coordinates are ( x , y The response value of the pixel. The average response value of all pixels. The total number of all pixels in a speckle image.
[0036] Among them, the average response value of all pixels Determined according to formula (7): (7) In formula (7), This represents the total number of pixels in the speckle image. i The first in the speckle image i 1 pixel, The first in the speckle image i The response value of each pixel.
[0037] The sharpness score of the speckle image at different focus positions can be calculated using the above method, and the focus position corresponding to the maximum score is determined as the target focus position.
[0038] S511, using the target focus position as a reference point, perform defocus adjustment operation on the lens and vertical cavity surface-emitting laser to obtain a defocused image; determine whether the speckles in the defocused image are strip-shaped light spots, and if so, determine the average measured linewidth of all strip-shaped light spots and the average aspect ratio of all strip-shaped light spots.
[0039] Once the target focus position is determined, the lens and vertical cavity surface-emitting laser are adjusted to obtain a defocused image, using the target focus position as a reference point.
[0040] Specifically, the distance between the lens and the vertical-cavity surface-emitting laser (VCSEL) can be adjusted based on the target's focus position to regulate the degree of defocus. When the diameter of the diffused spot exceeds the distance between adjacent spots, individual speckles begin to merge. As the degree of defocus increases, multiple speckles merge into a larger connected region, significantly increasing in area and ultimately forming a strip-shaped spot. Subsequent quantification of the connected region's area, aspect ratio, and linewidth allows for objective evaluation of the line formation effect and determination of the optimal defocus position. Defocus images at different degrees of defocus can be referenced... Figure 10 and Figure 11 As shown.
[0041] Therefore, after each adjustment of the distance between the lens and the vertical-cavity surface-emitting laser, it is necessary to determine whether the speckle pattern in the corresponding defocused image is a strip-shaped light spot, including: Determine the target threshold, and use the target threshold to binarize the out-of-focus image to obtain a binarized image; A closing operation is performed on the binarized image to obtain a morphologically processed image; Extract each connected region from the morphologically processed image, and for each connected region, determine the area of the connected region, the aspect ratio of the minimum bounding moment of the connected region, and the compactness of the connected region; For each connected region, if the area of the connected region is greater than a preset first threshold, the aspect ratio of the minimum circumscribed moment is greater than a preset second threshold, and the compactness is less than a third threshold, then the speckle corresponding to the connected region is determined to be a strip-shaped light spot.
[0042] Specifically, an adaptive thresholding method is needed to separate the light spots and background in the out-of-focus image. Therefore, the target threshold must first be determined, including: The defocused image is denoised to obtain a denoised image; Candidate thresholds are determined based on each gray level in the denoised image, and the candidate thresholds are the gray values corresponding to the gray levels. Determine the inter-class variance corresponding to each candidate threshold, and determine the candidate threshold corresponding to the largest inter-class variance as the target threshold.
[0043] In one implementation, determining the inter-class variance corresponding to each candidate threshold includes: The inter-class variance corresponding to each candidate threshold is determined according to formula (8). : (8) The target threshold T is determined according to formula (9): (9) In formula (8), t The candidate threshold value ranges from 0 to... L -1, L The number of gray levels in a denoised image is typically... L It is 256; For denoised images, gray values less than or equal to t Pixel ratio, To denoise an image where the gray value is greater than t Pixel ratio, + =1; The mean gray value of the background region of the denoised image (gray value less than or equal to) t (average pixel grayscale value) The mean gray value of the spot region in the denoised image (gray value greater than) t (mean pixel grayscale value).
[0044] After determining the target threshold, the gray values in the denoised image that are greater than the target threshold are set to 255, and the gray values that are less than the target threshold are set to 0, thus obtaining a binarized image.
[0045] For defocused images that may contain small breaks or gaps due to noise or segmentation issues, it is also necessary to utilize structuring elements of a preset size (e.g., 3×3). S A closing operation is performed on the binarized image to connect adjacent light spots, resulting in a morphologically processed image. ,include: The binarized image is closed using formula (10): S (10) In formula (10), B For binarized images, This is the symbol for morphological dilation operations. This is the symbol for morphological erosion operation. That is, when performing a closing operation on a binarized image, the binary image is first dilated, and then eroded. .
[0046] After morphological processing, without changing the overall size and position of the light spot, adjacent but disconnected light spots can be connected into a complete connected region (more like a strip) to fill in the small black dots inside the light spot, making the outline smoother. Finally, a strip-shaped light spot region with complete outline and good connectivity is obtained, providing a reliable foundation for subsequent feature extraction.
[0047] Then, each connected region in the morphologically processed image is extracted, and the area of each connected region is determined. Minimum circumscribed moment of a connected region Aspect Ratio and the compactness of connected regions Among them, the area of the connected region can reflect the physical size of the strip-shaped light spot region, the aspect ratio of the minimum bounding rectangle can reflect the thinness of the strip-shaped light spot region, and the compactness of the connected region can reflect how close the shape of the light spot is to a circle. The compactness of the connected region ranges from (0,1], and the closer the compactness is to 1, the closer the shape of the connected region is to a circle.
[0048] In one implementation, the aspect ratio of the minimum bounding rectangle of the connected region is determined according to formula (11): (11) In formula (11), The width of the minimum bounding rectangle. The height of the minimum bounding rectangle. K For the first K Connected regions.
[0049] In one implementation, the compactness of the connected regions is determined according to formula (12): (12) In formula (12), The area of the connected region. Let be the perimeter of the connected region.
[0050] Then, according to formula (13), it can be determined whether the speckle in the defocused image is a strip-shaped light spot, that is, whether the speckle forms a line: (13) In formula (13), The line formation indicator is set to true, indicating that the speckle in the focal image is a strip-shaped light spot; if the line formation indicator is false, it indicates that the speckle in the focal image is not a strip-shaped light spot.
[0051] That is, for each connected region, if the area of the connected region is greater than a preset first threshold, the aspect ratio of the minimum circumscribed moment is greater than a preset second threshold, and the compactness is less than a third threshold, then the speckle corresponding to the connected region is determined to be a stripe-shaped light spot. The first threshold can be 100, the second threshold can be 3, and the third threshold can be 0.7.
[0052] This invention employs multi-dimensional feature joint determination of line formation state: for each connected region, the aspect ratio is simultaneously constrained. >3.0, Firmness <0.7 and area A line shape is determined only when all three conditions are met, and the line shape is greater than 100. This method achieves objective line formation judgment by quantifying geometric features, effectively filtering noise and invalid regions, improving the accuracy and robustness of line shape judgment, and providing a reliable basis for subsequent line width measurement and automated debugging.
[0053] If the speckle corresponding to the connected region is determined to be a strip-shaped light spot, then the average measured linewidth of all strip-shaped light spots and the average aspect ratio of all strip-shaped light spots are determined.
[0054] In one implementation, determining the average linewidth of all striped light spots includes: A distance transformation is performed on each pixel of each stripe of light in the morphologically processed image to obtain a distance image; Extract multiple local maxima points from the distance image to form the center line of each stripe-shaped light spot; For each center point of each center line, determine the first linewidth of the strip-shaped light spot measured at the center point; For each strip-shaped light spot, the second linewidth of the strip-shaped light spot is determined based on the first linewidth of the strip-shaped light spot measured at each center point, and the second linewidth is the average of the first linewidths. The measurement linewidth of the strip-shaped light spot is determined based on the second linewidth of the strip-shaped light spot; The average measurement linewidth of all strip-shaped light spots is determined based on the measurement linewidth of each strip-shaped light spot.
[0055] Specifically, formula (14) can be used to perform distance transformation on each spot pixel in each stripe of light in the morphologically processed image: (14) In formula (14), For pixels Euclidean distance between the nearest background pixel and the nearest background pixel. To perform morphological processing of the pixel coordinates of the background region in an image, background It is the background area.
[0056] After performing a distance transformation on each pixel in each strip of light spot, a distance image is obtained. Each pixel in the spot region (foreground region) of the distance image is traversed. If the Euclidean distance of a pixel is greater than or equal to the Euclidean distance of all pixels in its 8-neighborhood, then that pixel is identified as a local maximum. For each strip of light spot, multiple local maxima are connected by a center line; the local maxima located on this center line are also called the center point.
[0057] For each center point of each centerline, determine the first linewidth of the stripe-shaped light spot measured at the center point, including: The first line width measured at each center point is determined according to formula (15). : (15) Since the striped light spot area is not a regular rectangle, the first line width measured at each center point may be different. The first line width can also be understood as the line width corresponding to the center point of the striped light spot area. The first line width is twice the Euclidean distance between the center point and the nearest background pixel, that is, the first line width is twice the Euclidean distance between the center point and the edge of the striped area.
[0058] Then determine the second line width according to formula (16). : (16) In formula (16), The total number of center points.
[0059] After determining the second linewidth corresponding to each stripe-shaped light spot, for each stripe-shaped light spot, the measurement line of the stripe-shaped light spot is determined based on the second linewidth of the stripe-shaped light spot, including: For each stripe-shaped light spot, obtain the area and length of the connected region corresponding to the stripe-shaped light spot; The measurement linewidth of the striped light spot is determined based on the area and length of the connected region and the second linewidth of the striped light spot.
[0060] In one implementation, the measurement linewidth of the strip-shaped light spot can be determined according to formula (17). : (17) In formula (17),a These are the weighting coefficients, and the weighting coefficients take values in the range [0, 1]. The second linewidth of the strip-shaped light spot. The area of the connected region corresponding to the stripe-shaped light spot. is the length of the connected region corresponding to the strip-shaped light spot.
[0061] S512, determine the line formation score based on the average measured linewidth of all strip-shaped light spots and the average aspect ratio of all strip-shaped light spots, determine the debugging direction based on the line formation score, the average measured linewidth of all strip-shaped light spots and the average aspect ratio of all strip-shaped light spots, and continue to optimize and debug the line formation of the VCSEL light spot array based on the debugging direction.
[0062] When the speckles in the connected region are determined to be strip-shaped spots, since there are multiple strip-shaped spots, it is necessary to determine the line formation score based on the average measured linewidth and the average aspect ratio of all strip-shaped spots. Based on the line formation score, the average measured linewidth and the average aspect ratio of all strip-shaped spots, the debugging direction is determined, and the line formation of the VCSEL spot array is further optimized and debugged based on the debugging direction.
[0063] In one implementation, a line score is determined based on the average measured linewidth of all striped light spots and the average aspect ratio of all striped light spots, including: Obtain the density corresponding to each strip-shaped light spot, and determine the average density value based on the density of each strip-shaped light spot; Determine the line score according to formula (18) F ; (18) In formula (18), The sharpness score is the value corresponding to the speckle image with the highest score. The preset reference maximum resolution score, As the first weighting coefficient, This is the second weighting coefficient. The aspect ratio is the average. The preset reference maximum aspect ratio, This is the third weighting coefficient. The average density. It is the fourth weighting coefficient. To measure the average line width, The preset target line width; + + + =1.
[0064] After determining the line formation score, the adjustment direction can be determined based on the line formation score, the average measured linewidth of all strip-shaped light spots, and the average aspect ratio of all strip-shaped light spots, including: If the line score is less than the fourth threshold, the debugging direction is determined to be adjusting the distance between the vertical cavity surface-emitting laser and the background white board; If the average aspect ratio is less than the fifth threshold, then the debugging direction is determined to be adjusting the distance between the vertical cavity surface-emitting laser and the lens; If the average measured linewidth is greater than the sixth threshold or less than the seventh threshold, then the debugging direction is determined to be adjusting the distance between the vertical cavity surface-emitting laser and the lens.
[0065] Specifically, the fourth, fifth, sixth, and seventh thresholds can be determined based on the actual situation. For example, the fourth threshold could be 0.6, the fifth threshold could be 2.5, and the sixth threshold could be... The seventh threshold is , It can be determined according to the actual situation; for example, it can be 0.1.
[0066] For example, if the line score is less than 0.6, it indicates that the edges of the striped light spot area are blurry, and the found speckle image is not the sharpest image. Therefore, it is necessary to iterate through the axial distance between the vertical-cavity surface-emitting laser and the lens, and recalculate the sharpness score corresponding to each focus position. Since the vertical-cavity surface-emitting laser is installed in the TOF module, adjusting the distance between the vertical-cavity surface-emitting laser and the background white board can also be understood as adjusting the distance between the TOF module and the background white board.
[0067] If the average aspect ratio is less than 2.5, it means that the average aspect ratio is too small, the line formation effect is poor, and the speckles have not been fully merged into thin strips, indicating that the defocus is not enough. It is necessary to increase the distance between the VCSEL and the lens to improve the line formation effect.
[0068] If the average measured line width is too high or too low, it indicates an abnormal line width. For example, if the average measured line width is greater than... This indicates that the defocus is too large, requiring a reduction (fine-tuning) of the distance between the VCSEL and the lens; if the average measured line width is less than This indicates that the defocus is too small, and the distance between the VCSEL and the lens needs to be increased (fine-tuned).
[0069] In this way, the optimal focus position is locked as a benchmark through a sharpness scoring algorithm, eliminating focus deviation; the line formation status is objectively determined based on morphological and geometric features (aspect ratio, compactness, area), replacing manual judgment and eliminating errors caused by human experience; finally, a closed-loop feedback is established through precise linewidth measurement and line formation scoring to clarify the debugging direction and step size, achieving precise optimization. This method transforms traditional manual trial-and-error debugging into an automated, quantitative closed-loop process, significantly improving debugging efficiency and accuracy, ensuring the morphological regularity and linewidth consistency of the strip-shaped light spot, and effectively improving the overall performance stability of the TOF module.
[0070] Based on the same inventive concept as in the foregoing embodiments, this embodiment also provides a VCSEL spot array alignment debugging device, such as... Figure 12 As shown, the device includes: The first determining unit 121 is used to acquire speckle images corresponding to different focus positions, determine the sharpness score of each speckle image, and determine the focus position corresponding to the speckle image with the highest score as the target focus position; the speckle image is obtained by taking a picture of the background whiteboard using a camera when the time-of-flight module equipped with a vertical cavity surface emission laser (VCSEL) projects a VCSEL spot array onto the background whiteboard. The judgment unit 122 is used to perform defocus adjustment operation on the lens and the vertical cavity surface-emitting laser with the target focus position as the reference point to obtain a defocus image; to determine whether the speckles in the defocus image are strip-shaped light spots, and if so, to determine the average measured linewidth of all strip-shaped light spots and the average aspect ratio of all strip-shaped light spots. The second determining unit 123 is used to determine the line formation score based on the average measured linewidth of all the strip-shaped light spots and the average aspect ratio of all the strip-shaped light spots, determine the debugging direction based on the line formation score, the average measured linewidth of all the strip-shaped light spots and the average aspect ratio of all the strip-shaped light spots, and continue to optimize and debug the line formation of the VCSEL light spot array based on the debugging direction.
[0071] Since the apparatus described in the embodiments of this invention is used for implementing the VCSEL spot array forming debugging method of the embodiments of this invention, those skilled in the art can understand the specific structure and variations of the apparatus based on the method described in the embodiments of this invention, and therefore will not be described in detail here. All apparatuses used in the methods of the embodiments of this invention fall within the scope of protection of this invention.
[0072] Based on the same inventive concept, this embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any step of the method described above.
[0073] Based on the same inventive concept, this embodiment provides a computer-readable storage medium having a computing program stored thereon, which, when executed by a processor, implements the steps of any of the methods described above.
[0074] Through one or more embodiments of the present invention, the present invention has the following beneficial effects or advantages: This invention provides a method, apparatus, medium, and device for debugging VCSEL spot array line formation. The method includes: acquiring speckle images corresponding to different focus positions, determining the sharpness score of each speckle image, and determining the focus position corresponding to the speckle image with the highest score as the target focus position; the speckle image is obtained by taking a picture of the background whiteboard using a camera when the VCSEL spot array is projected onto the background whiteboard by the vertical cavity surface-emitting laser (VCSEL); using the target focus position as a reference point, performing defocus adjustment operation on the lens and the VCSEL to obtain a defocus image; determining whether the speckles in the defocus image are strip-shaped spots, and if so, determining the average measured linewidth of all strip-shaped spots and determining the average linewidth of all strip-shaped spots. The method involves: 1) determining the average aspect ratio of all strip-shaped light spots; 2) determining a line formation score based on the average measured linewidth and aspect ratio of all strip-shaped light spots; 3) determining the adjustment direction based on the line formation score, the average measured linewidth, and the average aspect ratio of all strip-shaped light spots; and 4) further optimizing the line formation of the VCSEL light spot array based on the adjustment direction. This process first uses a sharpness score algorithm to lock the optimal focus position as a benchmark, eliminating focus deviation; secondly, it objectively determines the line formation status based on morphological and geometric features (aspect ratio, compactness, area), replacing manual visual judgment and eliminating errors caused by human experience; and finally, it establishes a closed-loop feedback through precise linewidth measurement and line formation score to clarify the adjustment direction and step size, achieving precise optimization. This method transforms traditional manual trial-and-error debugging into an automated, quantitative closed-loop process, significantly improving debugging efficiency and accuracy, ensuring the morphological regularity and linewidth consistency of the strip-shaped light spots, and effectively improving the overall performance stability of the TOF module.
[0075] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the invention.
[0076] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0077] Similarly, it should be understood that, in order to simplify this disclosure and aid in understanding one or more of the various aspects of the invention, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, this method of disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into this detailed description, wherein each claim itself is a separate embodiment of the invention.
[0078] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0079] Furthermore, those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are intended to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
[0080] The various component embodiments of the present invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components of the gateway, proxy server, or system according to embodiments of the present invention. The present invention can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such programs implementing the present invention can be stored on a computer-readable medium or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0081] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0082] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0083] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for adjusting the linear formation of a VCSEL spot array, characterized in that, The method includes: Acquire speckle images corresponding to different focus positions, determine the sharpness score of each speckle image, and determine the focus position corresponding to the speckle image with the highest score as the target focus position; the speckle image is obtained by taking a picture of the background white board using a camera when the VCSEL beam array is projected onto the background white board by the vertical cavity surface emission laser VCSEL. Using the target focus position as a reference point, defocus adjustment is performed on the lens and the vertical cavity surface-emitting laser to obtain a defocused image; it is determined whether the speckles in the defocused image are strip-shaped light spots. If so, the average measured linewidth of all strip-shaped light spots and the average aspect ratio of all strip-shaped light spots are determined. The line formation score is determined based on the average measured linewidth and the average aspect ratio of all the strip-shaped light spots. The adjustment direction is determined based on the line formation score, the average measured linewidth and the average aspect ratio of all the strip-shaped light spots. The line formation of the VCSEL light spot array is then optimized and adjusted based on the adjustment direction.
2. The method as described in claim 1, characterized in that, Determining the sharpness score for each speckle image includes: For each speckle image, the speckle image is preprocessed to obtain a preprocessed image; The preprocessed image is convolved using the Laplacian operator to obtain an edge-enhanced image. Obtain the response value of each pixel in the edge enhancement image, and then use the formula based on the response value. Determine the sharpness score of the speckle image. ; The M The height of the speckle image, the N The width of the speckle image, the x For the row index of the pixel, the y For the column index of the pixel, the The coordinates are ( x , y The response value of the pixel, the This is the average response value of all pixels.
3. The method as described in claim 1, characterized in that, The step of determining whether the speckle in the defocused image is a strip-shaped light spot includes: A target threshold is determined, and the defocused image is binarized using the target threshold to obtain a binarized image; A closing operation is performed on the binarized image to obtain a morphologically processed image; Extract each connected region from the morphologically processed image, and for each connected region, determine the area of the connected region, the aspect ratio of the minimum bounding moment of the connected region, and the compactness of the connected region; For each connected region, if the area of the connected region is greater than a preset first threshold, the aspect ratio of the minimum circumscribed moment is greater than a preset second threshold, and the compactness is less than a third threshold, then the speckle corresponding to the connected region is determined to be a strip-shaped light spot.
4. The method as described in claim 3, characterized in that, The determination of the average linewidth of all strip-shaped light spots includes: A distance transformation is performed on each pixel of each stripe of light in the morphologically processed image to obtain a distance image; Extract multiple local maxima points from the distance image to form the center line of each strip-shaped light spot; For each center point of each center line, determine the first linewidth of the strip-shaped light spot measured at said center point; For each strip-shaped light spot, the second linewidth of the strip-shaped light spot is determined based on the first linewidth of the strip-shaped light spot measured at each center point, and the second linewidth is the average of the first linewidths. The measurement linewidth of the strip-shaped light spot is determined based on the second linewidth of the strip-shaped light spot; The average measurement linewidth of all strip-shaped light spots is determined based on the measurement linewidth of each strip-shaped light spot.
5. The method as described in claim 4, characterized in that, The step of determining the measurement linewidth of the striped light spot based on the second linewidth of the striped light spot includes: For each strip-shaped light spot, obtain the area of the connected region corresponding to the strip-shaped light spot and the length of the connected region; The measurement linewidth of the strip-shaped light spot is determined based on the area of the connected region, the length of the connected region, and the second linewidth of the strip-shaped light spot.
6. The method as described in claim 1, characterized in that, The determination of the line score based on the average measured linewidth of all the striped light spots and the average aspect ratio of all the striped light spots includes: Obtain the density corresponding to each strip-shaped light spot, and determine the average density value based on the density of each strip-shaped light spot; According to the formula Determine the line score F ; The The sharpness score corresponding to the speckle image with the maximum score, the The preset reference maximum sharpness score, the As the first weighting coefficient, the This is the second weighting coefficient. The aspect ratio is the average value. The preset reference maximum aspect ratio, the This is the third weighting coefficient. The average compactness value, the The fourth weighting coefficient, the The average line width of the measurement, the The preset target line width.
7. The method as described in claim 6, characterized in that, The step of determining the adjustment direction based on the line score, the average measured linewidth of all strip-shaped light spots, and the average aspect ratio of all strip-shaped light spots includes: If the line score is less than the fourth threshold, then the debugging direction is determined to be adjusting the distance between the vertical cavity surface-emitting laser and the background whiteboard; If the average aspect ratio is less than the fifth threshold, then the debugging direction is determined to be adjusting the distance between the vertical cavity surface-emitting laser and the lens; If the average measured linewidth is greater than the sixth threshold or less than the seventh threshold, then the debugging direction is determined to be adjusting the distance between the vertical cavity surface-emitting laser and the lens.
8. A VCSEL spot array forming debugging device, characterized in that, The device includes: The first determining unit is used to acquire speckle images corresponding to different focus positions, determine the sharpness score of each speckle image, and determine the focus position corresponding to the speckle image with the highest score as the target focus position; the speckle image is obtained by taking a picture of the background whiteboard using a camera when the time-of-flight module equipped with a vertical cavity surface emission laser (VCSEL) projects a VCSEL spot array onto the background whiteboard. The judgment unit is used to perform defocus adjustment operation on the lens and the vertical cavity surface-emitting laser with the target focus position as the reference point to obtain a defocus image; to determine whether the speckles in the defocus image are strip-shaped light spots, and if so, to determine the average measured linewidth of all strip-shaped light spots and the average aspect ratio of all strip-shaped light spots. The second determining unit is used to determine the line formation score based on the average measured linewidth of all the strip-shaped light spots and the average aspect ratio of all the strip-shaped light spots, determine the debugging direction based on the line formation score, the average measured linewidth of all the strip-shaped light spots and the average aspect ratio of all the strip-shaped light spots, and continue to optimize and debug the line formation of the VCSEL light spot array based on the debugging direction.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method according to any one of claims 1-7.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1-7.