Light stripe center extraction method and system and medium

By judging the pixel point state column by column and cubic curve fitting, the problem of large error in the center extraction of light bars under the asymmetric peak is solved, and high accuracy and efficient light bars extraction are achieved.

CN120495388APending Publication Date: 2025-08-15HEFEI I TEK OPTOELECTRONICS CO LTD

Patent Information

Application Number
CN202510571416.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The existing light bar center extraction methods are prone to errors in the case of asymmetric peaks. The commonly used grayscale center of mass, grayscale fitting and Gaussian fitting methods are inaccurate in the extraction results under asymmetric peaks, and the existing patented methods are complex in calculations or are limited to symmetric peaks.

Method used

By judging the status of pixel points one by one, filtering out the inflection points and end points of the peak interval, building a curve fitting model, selecting the stagnant point closest to the inflection point as the center of the light bar, combining cubic curve fitting, it is compatible with symmetric and asymmetric peaks, and adding a peak interval checksum gradient difference judgment to improve accuracy.

Benefits of technology

It improves the accuracy and robustness of the center of the light bar, and can accurately extract the center of the light bar under different types of pixel distributions, reducing computing resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120495388A_ABST
    Figure CN120495388A_ABST
Patent Text Reader

Abstract

The invention provides a light stripe center extraction method and system and a medium. The method comprises the following steps: judging the pixel state of each pixel point column by column according to gray values of pixel points in an image containing light strips, and determining an inflection point of a current column and a first end point of a peak interval where the inflection point is located; based on the gray value of the first end point of the peak interval, calculating the absolute value of the difference between the gray value of each pixel point of the inflection point of the current column in the rear row and the gray value of the first end point, and judging a second end point of the peak interval; and constructing a curve fitting model based on the gray values and the row coordinates of the pixel points in the peak interval, obtaining stagnation points, which are greater than zero, of a fitting curve, and selecting the stagnation point closest to the inflection point as a light stripe center pixel point in the peak interval. The dynamic peak interval and cubic curve fitting are combined for use, the accuracy of the finally extracted light stripe center is higher than the calculation results of a gray centroid algorithm, Gaussian fitting and Rayleigh fitting, and the method has good accuracy and robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of visual measurement technology, and in particular to a light strip center extraction method, system and medium. Background Art

[0002] Visual measurement is a popular research area in industrial inspection applications, widely used in scenarios such as defect detection and target tracking. Common inspection methods mainly rely on non-contact measurement methods, such as line structured light measurement and spectral confocal scanning.

[0003] The basic principle of line structured light measurement is to project a series of parallel and narrow light strips onto the surface of the object to be measured and obtain the surface morphology and height information of the object by the degree of distortion of the light stripes.

[0004] The principle of line spectrum confocal measurement is that after the polychromatic light passes through the slit, a spectral line (linear light) is generated. The linear light is projected onto the surface of the object to be measured by the illumination system composed of the lens and the objective lens, and the linear area of the object to be measured is evenly illuminated. The measurement information of the surface of the object to be measured is obtained by the degree of distortion of the light strip corresponding to the linear area.

[0005] Whether it is line structured light measurement or line spectrum measurement, such as Figure 2 and 3 As shown in the figure, the ideal light stripe cross-sectional brightness distribution satisfies the Gaussian model (i.e., a symmetrical peak). Therefore, the brightest pixels in the light stripe cross section can be extracted, and these pixels form the centerline of the light stripe. The centerline combines both local and global characteristics of the light stripe and plays a key role in scenarios such as defect detection.

[0006] How to accurately and completely extract the line structured light projected onto the surface of an object is a key issue in visual measurement, and centerline extraction is the top priority.

[0007] Common methods for extracting light stripe centers include the grayscale centroid method, quadratic fitting, and Gaussian fitting. Due to the inherent thermal noise of the image sensor and the complexity of the application environment, the captured light stripes often do not meet ideal conditions. In such cases, using these conventional methods can easily lead to errors in the line center extraction results. Specifically, the grayscale centroid method will deviate from the light stripe center extraction results toward the side with a smaller gradient when encountering asymmetric peaks. Quadratic fitting and Gaussian fitting are fitting models for symmetrical peaks, and their principles inherently introduce bias in the case of asymmetric peaks.

[0008] Therefore, for the various possibilities of non-ideal conditions in the cross section of the light strip, other technical solutions need to be proposed to ensure the accuracy of the line center extraction results.

[0009] Chinese patent CN 118587272 A discloses a line center extraction method, system, and medium suitable for FPGA parallel computing. The patent proposes multiple analysis methods for different types of data to achieve efficient and accurate line center extraction. However, the classification analysis method proposed in the patent is overly complex, and the patent ultimately uses an extraction method similar to the grayscale centroid method to obtain sub-pixel line centers, which has limited accuracy.

[0010] Chinese patent CN118447079A discloses a method and apparatus for extracting the center of a laser stripe, a method for 3D reconstruction of an object, an electronic device, a laser scanner, and a computer-readable storage medium. This patent utilizes the characteristic of laser stripes having a certain width to determine the initial prediction point of the stripe to be processed by spacing the stripe at predetermined rows and columns. Dynamic adjustments are then made to the sub-images determined based on the initial prediction point, enabling real-time adjustment of the size of the regional image and its segmentation threshold. This improves the robustness and accuracy of the regional center point calculation for each regional image corresponding to the same stripe. The present application employs different technical approaches from those employed in this patent.

[0011] In addition, in the case of asymmetric peaks, an asymmetric fitting model can also be used. For example, the Rayleigh distribution function is a unilateral asymmetric peak model, which helps to improve the accuracy of line center extraction; however, this model is complex to use and is not suitable for symmetric peak cases, that is, it has limitations in its use in actual application scenarios. Summary of the Invention

[0012] The present invention provides a light strip center extraction method, system and medium, which at least solve one of the above technical problems.

[0013] To achieve the above objectives, the present invention proposes the following technical solutions: A light strip center extraction method comprising: Based on the grayscale values of the pixels in the image containing the light strip, the pixel state of each pixel is determined column by column, and the inflection point of the current column and the first endpoint of the peak interval where the inflection point is located are determined; based on the grayscale value of the first endpoint of the peak interval, the absolute value of the difference between the grayscale value of each pixel in the row following the inflection point of the current column and the grayscale value of the first endpoint is calculated to determine the second endpoint of the peak interval; Based on the grayscale value and row coordinates of the pixel points in the peak interval, a curve fitting model is constructed to obtain the stationary point greater than zero of the fitting curve, and the stationary point closest to the inflection point is selected as the center pixel point of the light strip in the peak interval.

[0014] Furthermore, before building the curve fitting model, it also includes: Calculate the grayscale value difference between the inflection point and the first endpoint, and the grayscale value difference between the inflection point and the second endpoint respectively. If the two grayscale value differences are both greater than the grayscale extreme difference threshold, the peak interval is reasonable, and the row coordinate range of the pixel point in the peak interval where the inflection point is located is from the first endpoint to the second endpoint; otherwise, discard the inflection point and the peak interval, and determine the next pixel point.

[0015] Furthermore, it also includes: Calculate the curvature of the stationary point closest to the inflection point. If the curvature meets the curvature threshold, use the stationary point as the coordinate of the center pixel of the light stripe in the peak interval. Otherwise, discard the inflection point and the peak interval and determine the next pixel.

[0016] Furthermore, it includes: if the pixel state of a pixel point in the current column is rising, the pixel state of its adjacent pixel point in the subsequent row is non-rising, and the grayscale value of the pixel point is greater than the grayscale value of the first endpoint, then the pixel point is a candidate point; and the grayscale values of the candidate point and at least one pixel point in the preceding and subsequent rows are not lower than the background threshold, then the candidate point is an inflection point; otherwise, the candidate point is discarded and the next pixel point is determined.

[0017] Furthermore, the pixel status includes: If the grayscale value of any pixel is greater than the grayscale value of its adjacent pixel in the previous row, the pixel state of the pixel is rising; If the grayscale value of any pixel is less than the grayscale value of its adjacent pixel in the previous row, the pixel state of the pixel is down; If the grayscale value of any pixel is equal to the grayscale value of its adjacent pixel in the previous row, and the grayscale value of the pixel is the full grayscale value, the pixel state of the pixel is overexposed; If the grayscale value of any pixel is equal to the grayscale value of its adjacent preceding pixel, and the grayscale value of the pixel is less than the grayscale full value, the pixel state of the pixel is the pixel state of its adjacent preceding pixel.

[0018] Furthermore, a curve fitting model is constructed, which also includes: calculating the gradient on the left side of the inflection point and the gradient on the right side of the inflection point respectively, and calculating the difference between the left gradient and the right gradient, and judging whether the difference is less than the gradient threshold; if it is less than the gradient threshold, it is considered that the pixel point distribution in the current peak interval constitutes a symmetrical peak; otherwise, it is considered that the pixel point distribution in the current peak interval does not constitute a symmetrical peak; based on the judgment result of the symmetrical peak, the corresponding curve fitting model is selected.

[0019] Furthermore, the curve fitting model is a cubic curve fitting model.

[0020] Furthermore, the method further includes: filtering the original image data to remove interference noise to obtain an image containing light stripes.

[0021] Based on the same inventive concept, the present application also proposes a light strip center extraction system, comprising: The peak interval determination module determines the pixel status of each pixel in the image containing the light stripe column by column based on the grayscale value of the pixel, determines the inflection point of the current column and the first endpoint of the peak interval where the inflection point is located; based on the grayscale value of the first endpoint of the peak interval, calculates the absolute value of the difference between the grayscale value of each pixel in the row following the inflection point of the current column and the grayscale value of the first endpoint, and determines the second endpoint of the peak interval; The center extraction module constructs a curve fitting model based on the grayscale value and row coordinates of the pixel points in the peak interval, obtains the stationary point greater than zero of the fitting curve, and selects the stationary point closest to the inflection point as the center pixel point of the light bar in the peak interval.

[0022] On the other hand, the present invention further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the method described above.

[0023] The beneficial effects of the embodiments of the present invention are as follows: The embodiment of the present application proposes a light stripe center extraction method, which screens the pixel-level light stripe center coordinate position based on the grayscale value of each pixel point in the image containing the light stripe, and extracts the sub-pixel light stripe center coordinate position through curve fitting.

[0024] In the embodiment of the present application, the image containing light stripes is searched column by column, and the range of pixels in any column where the grayscale value changes from small to large and then to small is used as a candidate for the peak interval of the column. For the peak interval that meets the candidate conditions, the change process of the grayscale value is further determined by the pixel status of the adjacent pixels, and the grayscale value is determined by setting P i >P i-r The restriction condition is used to avoid the burrs in the image; at the same time, the background threshold is used to eliminate the interference of background noise to improve the accuracy of the judgment result.

[0025] Through the above screening process, a dynamic peak interval is obtained according to the grayscale value distribution of the pixel points to be compatible with different types of pixel distributions; for pixel distributions with special cases, the accuracy of the light stripe center extraction result is improved.

[0026] In addition, the present embodiment also includes a verification process for the rationality of the peak interval, which improves the curvature characteristics of the pixels in the peak interval and verifies the rationality of the grayscale value to eliminate the situation where the grayscale value distribution has a small fluctuation and may be the background. This embodiment proposes an implementation method that uses the grayscale value difference as the basis for judgment, which can avoid judgment errors caused by the jitter of the grayscale value of a single pixel.

[0027] The embodiment of the present application further proposes using the curvature of the selected stationary point in the fitting curve as a basis for verifying the rationality of the peak interval to improve the accuracy of the calculation results.

[0028] In the embodiments of the present application, factors such as the sensor's thermal noise and environment are taken into consideration, resulting in the light strip cross-section not having symmetrical peaks. For example, there may be 2-3 pixels with flat-top peaks, or the number of pixels that rise before the inflection point differs from the number of pixels that fall after the inflection point (such as M-shaped problems), and other special cases. If the symmetrical peak calculation method is continued to be used for the above special cases to extract the coordinate position of the light strip center, it will cause severe jitter of the light strip center, resulting in large errors in the final extraction result. Therefore, the present application proposes a calculation method using cubic curve fitting, which is compatible with various pixel distribution conditions such as symmetrical peaks and asymmetrical peaks.

[0029] Based on the embodiment of the present application, a center extraction method is proposed. Taking cubic curve fitting as an example, through the fitting comparison of asymmetric peak data, it can be seen that based on the combined use of the dynamic peak interval and cubic curve fitting in the embodiment of the present application, the accuracy of the light strip center finally extracted is higher than the calculation results of the grayscale centroid algorithm, Gaussian fitting, and Rayleigh fitting. The light strip center extraction method proposed in this application has good accuracy and robustness.

[0030] The embodiment of the present application also proposes a process for determining a symmetrical peak, calculating the difference between the gradient on the left side of the inflection point and the gradient on the right side of the inflection point, and using the gradient threshold to determine whether the current pixel distribution constitutes a symmetrical peak; based on the determination result, the corresponding curve fitting model is selected to save computing resources and improve computing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is a schematic flow chart of the light stripe center extraction method of the present invention; Figure 2 is an image containing light bars; Figure 3 yes Figure 2 A partial enlarged view of Figure 4 This is a schematic flow chart of the method in Example 1 of the present invention; Figure 5 This is a schematic flow chart of the method in Example 2 of the present invention; Figure 6 This is a schematic flow chart of the method in Example 3 of the present invention. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.

[0033] like Figure 1 As shown, this application proposes a light stripe center extraction method, comprising: The original image data is filtered to remove interference noise to obtain an image containing light stripes.

[0034] Based on the grayscale values of the pixels in the image containing the light strip, the pixel state of each pixel is determined column by column, and the inflection point of the current column and the first endpoint of the peak interval where the inflection point is located are determined; based on the grayscale value of the first endpoint of the peak interval, the absolute value of the difference between the grayscale value of each pixel in the row following the inflection point of the current column and the grayscale value of the first endpoint is calculated to determine the second endpoint of the peak interval; Based on the grayscale value and row coordinates of the pixel points in the peak interval, a curve fitting model is constructed to obtain the stationary point greater than zero of the fitting curve, and the stationary point closest to the inflection point is selected as the center pixel point of the light strip in the peak interval. Example 1

[0035] like Figure 4 As shown, this embodiment proposes a light stripe center extraction method, including: The original image data containing the light stripes is obtained and pre-processed to reduce the interference of noise on the extraction of the light stripe center. Furthermore, filtering is generally used as pre-processing for the original image data, such as median filtering, low-pass filtering, etc.

[0036] After preprocessing, an image containing light stripes is obtained, such as Figure 2 According to the grayscale value of each pixel in the image containing light stripes, the coordinate position of the pixel-level light stripe center is screened, and the sub-pixel light stripe center coordinate position is extracted through curve fitting.

[0037] In this embodiment, the image containing the light stripes is searched column by column, and a range of pixels in any column whose grayscale value changes from small to large and then to small is selected as a candidate for the peak interval of the column.

[0038] According to the grayscale value of the pixel points in the image containing the light strip, the pixel state of each pixel point is judged column by column to determine the inflection point of the current column; based on the inflection point of the current column, the row coordinate range of the pixel points in the peak interval where the inflection point is located is determined.

[0039] Specifically, it includes: judging the pixel status of each pixel point column by column according to the grayscale value of the pixel points in the image containing the light strip, determining the inflection point of the current column and the first endpoint of the peak interval where the inflection point is located; based on the grayscale value of the first endpoint of the peak interval, calculating the absolute value of the difference between the grayscale value of each pixel point in the subsequent row of the inflection point of the current column and the grayscale value of the first endpoint, and judging the second endpoint of the peak interval.

[0040] Among them, the inflection point is: if the pixel state of the pixel point in the current column is rising, the pixel state of the pixel point adjacent to it in the subsequent row is non-rising, and the grayscale value of the pixel point is greater than the grayscale value of the first endpoint, then the pixel point is a candidate point; and the grayscale values of the candidate point and at least one pixel point in the preceding and subsequent rows are not lower than the background threshold, then the candidate point is an inflection point; otherwise, the candidate point is discarded and the next pixel point is determined.

[0041] Among them, pixel status includes: If the grayscale value of any pixel is greater than the grayscale value of its adjacent pixel in the previous row, the pixel state of the pixel is rising; If the grayscale value of any pixel is less than the grayscale value of its adjacent pixel in the previous row, the pixel state of the pixel is down; If the grayscale value of any pixel is equal to the grayscale value of its adjacent pixel in the previous row, and the grayscale value of the pixel is the full grayscale value, the pixel state of the pixel is overexposed; If the grayscale value of any pixel is equal to the grayscale value of its adjacent preceding pixel, and the grayscale value of the pixel is less than the grayscale full value, the pixel state of the pixel is the pixel state of its adjacent preceding pixel.

[0042] For the same column of pixels, if the row coordinate of any pixel is i, then the gray value of the pixel is P i , the pixel state is S i , the grayscale full value of the image is P max ; Among them, the grayscale full value is the maximum pixel value of the current image. For example, in an 8-bit image, the grayscale full value is 255.

[0043] In this embodiment, the pixel state of a pixel is defined based on the grayscale value relationship of adjacent pixels in the same column, as follows: If the gray value of pixel i is greater than the gray value of pixel i-1, that is, P i >P i-1 ; then the pixel state of pixel i is rising, S i = rise; If the gray value of pixel i is less than the gray value of pixel i-1, that is, P i <P i-1 ; then the pixel state of pixel i is down, S i = down; If the grayscale value of pixel i is the same as that of pixel i-1, and the grayscale value of pixel i is the full grayscale value, that is, P i =P i-1 , P i =P max ; then the pixel state of pixel i is overexposed, S i = overexposure; If the grayscale value of pixel i is the same as that of pixel i-1, and the grayscale value of pixel i is less than the grayscale full value, that is, P i =P i-1 , P i <P max ; then the pixel state of pixel point i is the pixel state of pixel point i-1, S i =S i-1 .

[0044] Based on the above-mentioned process of judging the pixel status of pixel points, it is possible to preliminarily screen out the coordinate range in which the grayscale value in this column changes from small to large, that is, the pixel status of multiple consecutive adjacent pixel points is rising; if there are pixel points with a non-rising pixel status, it can be preliminarily judged that a process of grayscale value changing from large to small may occur.

[0045] In this embodiment, the inflection point is defined as follows: if the pixel state of the pixel point i in the current column is rising (S i = rising), the pixel state of pixel i+1 is non-rising (S i+1 ≠ rise), and the grayscale value of pixel i is greater than the grayscale value of pixel ir (P i >P i-r ), then pixel i is the candidate point. Where i is the row coordinate of the pixel point, and r is the number of preset pixels before the candidate point.

[0046] In this embodiment, the change process of the gray value is determined by the pixel state of adjacent pixels, and the gray value is determined by setting P i >P i-r The restriction condition is used to avoid the burr situation in the image and improve the accuracy of the judgment result.

[0047] Determine whether the grayscale value of the candidate point and at least one pixel in the preceding and following rows is lower than the background threshold. If it is not lower than the background threshold, the candidate point is considered an inflection point. Otherwise, discard the pixel and continue to determine the next pixel.

[0048] Preferably, if the step unit of background threshold determination is two pixels, then the determination of P i-2 、P i 、P i+2 Is it lower than the background threshold? If it is not lower than the background threshold, then P i The number of pixels in the step unit can be set according to actual needs, and can also be set to one pixel or other number.

[0049] Preferably, after preprocessing, the grayscale values of the image pixels containing the light stripes can be screened one by one using a background threshold to obtain pixels with grayscale values greater than the background threshold. This is used to eliminate interference from background noise, narrow the scope of subsequent calculations, and improve computational efficiency. If the background threshold is determined before the pixel state is determined (i.e., after preprocessing), that is, if the grayscale value of the candidate point and at least one pixel in each of the preceding and succeeding rows is not less than the background threshold, then the candidate point is used as the inflection point.

[0050] After the above determination process, the inflection point (pixel point i) is obtained, and it is determined that a peak is initially obtained, and the complete peak interval range needs to be further obtained.

[0051] like Figure 2 As shown, the ideal light stripe cross-sectional brightness distribution satisfies the Gaussian model, resulting in a symmetrical peak. If the peak is symmetrical, when the inflection point is pixel i, the complete peak range is [ir,i+r]. However, due to factors such as sensor thermal noise and environmental factors, the light stripe cross-sectional brightness may not exhibit symmetrical peaks. For example, there may be 2-3 pixels with flat-top peaks, or the number of pixels rising before the inflection point differs from the number of pixels falling after the inflection point (such as M-shaped problems). If the symmetrical peak calculation method is used to extract the coordinate position of the light stripe center in these special cases, severe jitter in the light stripe center will occur, resulting in large errors in the final extraction result.

[0052] Assume that the y coordinates of a series of pixel points are i , the corresponding equivalent gray value is g i , taking the line center extraction method described in patent CN 118587272 A as an example, the line center v c :

[0053] If a pixel y j Grayscale value jitter occurs, the grayscale value changes by Δj, then the jitter of the line center is Δv c :

[0054] When a flat-top peak appears, the jitter of the gray value mainly occurs on both sides of the peak interval, so in the above formula (y j -v c ) is approximately equal to the peak width radius.

[0055] The change of Δj is relatively large. For example, the grayscale value of the peak interval before the dithering is [174, 201, 224, 241, 250, 249, 236, 214, 183]. Adding a zero value does not affect the calculation result, and it becomes: [174, 201, 224, 241, 250, 249, 236, 214, 183, 0].

[0056] After dithering, there is a pixel misalignment in the peak interval, and the grayscale value is [201, 224, 241, 249, 250, 236, 214, 183, 150]. Adding a zero value does not affect the calculation result, and it becomes: [0, 201, 224, 241, 249, 250, 236, 214, 183, 150].

[0057] Therefore, Δj before and after the jitter is (174 - 0) + (150 + 0), resulting in Δv c As the value of becomes larger, it will cause greater jitter. According to actual testing, the jitter is about 0.15~0.3 pixel.

[0058] For practical applications of fine detection, the above calculation method is more sensitive to the jitter of grayscale values, which will lead to large deviations in the final detection.

[0059] Considering the above practical situation, this embodiment proposes a dynamic peak interval to obtain a complete peak interval based on the actual distribution of pixel grayscale values. The details are as follows: After the above determination process, the minimum row coordinate value of the peak interval (the row coordinate of the first endpoint) is preliminarily estimated to be ir, and the gray value corresponding to the pixel point is P i-r ; At the same time, get the inflection point (pixel i), its gray value is P i .

[0060] In this embodiment, the gray value of each pixel after the inflection point and the gray value of P are calculated in sequence. i-r By analyzing the difference, we can determine the descending interval of the peak interval and then determine the complete peak interval.

[0061] If pixel i is an inflection point, when the absolute value of the grayscale value difference between pixel i+f (second endpoint) and pixel ir is not less than the absolute value of the grayscale value difference between pixel i+f+1 and pixel ir, that is, |P i+f -P i-r |≥|P i+f+1 -P i-r |, then the row coordinate range of the pixel points in the peak interval where the inflection point is located is [ir,i+f].

[0062] Preferably, the above pixel state determination process can also be used to determine the complete peak interval. That is, the pixel state of each pixel after the inflection point is determined. When the pixel state of pixel i+f is rising (i.e. S i+f = rise), the row coordinate range of the pixel points in the peak interval where the inflection point is located is [ir,i+f].

[0063] In order to avoid the situation where the complete peak interval cannot be determined, the value of f is further limited in this embodiment, and f is set max , if at pixel i+f max If a pixel that meets any of the above criteria cannot be obtained, consider abandoning pixel i as the inflection point and determine the next pixel. max Set according to actual situation.

[0064] Preferably, in this embodiment, the value range of f is limited to [1,3r], that is, f max =3r. Preferably, the limit range of f can also be adjusted according to actual conditions.

[0065] After the above determination process, the row coordinate range of any peak interval in any column of pixels can be obtained. To further improve the accuracy of the calculation results, this embodiment proposes calculating the curvature characteristics of the peak interval based on the pixels in the peak interval to verify whether the peak interval is reasonable.

[0066] In this embodiment, the curvature of the grayscale value of the pixel point where the peak interval is located is used as the basis for determining the bending feature.

[0067] In the same image, the row coordinate ranges of the peak intervals of pixel data in different columns do not vary significantly. Therefore, the range of grayscale values within the peak interval can be used to equivalently represent the curvature feature, further screening the validity of the peak interval. Furthermore, using the grayscale value difference as the judgment basis can avoid judgment errors caused by jitter in the grayscale value of a single pixel.

[0068] In addition, this embodiment characterizes the curvature characteristics of the peak interval pixels by calculating the extreme difference in the grayscale values of the peak interval pixels, and can simply judge the distribution of the grayscale values of the current peak interval pixels. The cases where there is no obvious difference in the grayscale value distribution and the fluctuation is small, which may be the background, are excluded to increase the rationality of the peak interval pixels.

[0069] Preferably, in this embodiment, a "grayscale range threshold" is set, that is, within the peak interval, it is determined whether the grayscale value of the inflection point and the grayscale value range of the two endpoints of the peak interval are both greater than the grayscale range threshold; if not, the inflection point and the peak interval in which it is located are discarded.

[0070] Specifically, before constructing the curve fitting model, the grayscale value difference between the inflection point and the first endpoint, and the grayscale value difference between the inflection point and the second endpoint are calculated respectively. If the two grayscale value differences are both greater than the grayscale extreme value threshold, the peak interval is reasonable, and the row coordinate range of the pixel point in the peak interval where the inflection point is located is from the first endpoint to the second endpoint; otherwise, the inflection point and the peak interval are discarded, and the next pixel point is determined.

[0071] Take pixel i as the inflection point and the peak interval as [ir,i+f]; that is, calculate the gray value difference between pixel i and pixel ir (P i -P i-r ), the grayscale value difference between pixel i and pixel i+f (P i -P i+f ), if they are all greater than the grayscale range threshold, the peak interval is reasonable; otherwise, the peak interval is unreasonable.

[0072] If the peak interval is reasonable, a curve fitting model is constructed based on the grayscale value and row coordinates of the pixel points in the peak interval, and a stationary point greater than zero of the fitting curve is obtained. The stationary point closest to the inflection point is selected as the center pixel point of the light bar in the peak interval; otherwise, the peak interval is unreasonable, and the next pixel point is determined.

[0073] Based on the above determination process, it is known that pixel i is an inflection point, and the row coordinate range of its peak interval is [ir,i+f]. Considering that the current peak interval may have special cases such as asymmetry and flat peaks, this embodiment constructs a cubic curve fitting model based on the pixels in the peak interval to meet various possibilities of symmetric and asymmetric peaks, thereby avoiding the problem of poor extraction accuracy caused by the mismatch between the current curve model and the data.

[0074] If there are N pixels in the current peak interval, the row coordinates of the N pixels are y1, y2, ..., y N , the corresponding grayscale values are P1, P2, ..., P N , then the cubic curve fitting model constructed by the grayscale value and row coordinates of the pixel points in the peak interval is:

[0075] Where P represents the grayscale value, a=[a0,a1,a2,a3] T represents the unknown parameters of the cubic curve fitting model, y represents the row coordinate, and i = 1, 2, ..., N.

[0076] According to the gray value and row coordinate of each pixel in the peak interval, the following equations are constructed:

[0077] Substitute the grayscale value and row coordinate of each pixel in the peak interval into the above equations and calculate a=[a0,a1,a2,a3]T Specific value of .

[0078] Furthermore, by setting the derivative of the cubic curve fitting model to zero, two stationary points greater than zero can be obtained; the stationary point closest to the inflection point is selected as the center pixel point of the light strip in the peak interval.

[0079] Based on the implementation described in Example 1 of the present application, in the case of an asymmetric peak, a simulation test was conducted on the accuracy of line center extraction using random noise.

[0080] This application proposes to use two sets of asymmetrically distributed data to verify the accuracy of different algorithms.

[0081] The center coordinate of the theoretical line of the first set of asymmetrically distributed data is 7, and the center coordinate of the theoretical line of the first set of asymmetrically distributed data is 9.

[0082] This embodiment uses Gaussian fitting, grayscale centroid, and Rayleigh fitting as comparison objects.

[0083] Using each calculation method, we added 10,000 random Gaussian noises to each set of data and averaged the light stripe centers extracted from the 10,000 fitting results. The results are shown in the following table: Table 1

[0084] As can be seen from the above table, in the fitting verification of the first set of data with the theoretical center coordinate of 7, the center extraction result (7.038) of the cubic polynomial fitting proposed in this embodiment is closer to the theoretical value 7; in the fitting verification of the second set of data, the center extraction result (8.957) of the cubic polynomial fitting proposed in this embodiment is closer to the theoretical value 9.

[0085] Through the fitting comparison of asymmetric peak data, it can be seen that based on the combined use of dynamic peak interval and cubic curve fitting in the embodiment of the present application, the accuracy of the light stripe center finally extracted is higher than the calculation results of the grayscale centroid algorithm, Gaussian fitting, and Rayleigh fitting. The light stripe center extraction method proposed in this application has good accuracy and robustness. Example 2

[0086] like Figure 5 As shown, based on Example 1, in order to further improve the calculation efficiency, this embodiment adds a determination of the symmetry of the peak interval before curve fitting, as follows: The gradient on the left and right sides of the inflection point are calculated respectively, and the difference between the left and right gradients is calculated to determine whether the difference is less than the gradient threshold. If it is less than the gradient threshold, the pixel distribution in the current peak interval is considered to constitute a symmetrical peak; otherwise, the pixel distribution in the current peak interval is considered not to constitute a symmetrical peak.

[0087] Preferably, in this embodiment, for the pixels within the peak interval, the grayscale value difference between every two adjacent pixels is calculated; the sum of all differences on the left side of the inflection point is used as the left gradient G of the inflection point. L , take the sum of all differences on the right side of the inflection point as the right gradient G of the inflection point R .

[0088] After the determination of the peak interval row coordinate range and rationality verification, the pixel point i is obtained as the inflection point, the pixel point row coordinate range of the peak interval is [ir,i+f], and the gray value of the pixel point in the peak interval is P i-r ,P i-r+1 ,...,P i-1 ,P i ,P i+1 ,...,P i+f-1 ,P i+f ; Then G L =(P i-r+1 -P i-r )+(P i-r+2 -P i-r+1 )+...+(P i -P i-1 ) G R =(P i -P i+1 )+(P i+1 -P i+2 )+...+(P i+f-1 -P i+f ) Judge G L With G R The difference between the values of and the gradient threshold is preferably set according to the actual situation. In this embodiment, if an 8-bit image is taken as an example, the preset gradient threshold is 10.

[0089] Preferably, a number of pixel points on the left side of the inflection point may be selected to calculate the left gradient; similarly, the same number of pixel points on the right side of the inflection point may be selected to calculate the right gradient.

[0090] Based on the determination results of the symmetrical peaks, the corresponding curve fitting model is selected.

[0091] If it is a symmetrical peak, the cubic curve fitting model described in Example 1 can be used, or low-order operations such as Gaussian fitting or quadratic curve fitting can be selected to reduce the amount of calculation, save computing resources, and improve computing efficiency.

[0092] If it is an asymmetric peak, the cubic curve fitting model described in Example 1 or other models such as Rayleigh fitting can be used. The corresponding fitting model is selected according to the actual situation to improve the calculation efficiency and accuracy of the calculation results. Example 3

[0093] like Figure 6 As shown, this embodiment, based on any of the above embodiments, proposes a new implementation method for the rationality of pixel points in the peak interval.

[0094] After obtaining the pixel row coordinate range [ir,i+f] of the complete peak interval, this embodiment does not directly perform the determination within the peak interval as described in Example 1 to determine whether the grayscale value of the inflection point and the grayscale value extremes of the two endpoints of the peak interval are both greater than the grayscale extreme threshold; if not, the inflection point and the peak interval in which it is located are discarded.

[0095] After obtaining the row coordinate range [ir,i+f] of the pixel points in the complete peak interval, this embodiment performs data fitting on the row coordinates and grayscale values of the pixel points in the peak interval, constructs a curve fitting model, and obtains a stationary point greater than zero of the fitting curve; calculates the curvature of the stationary point closest to the inflection point, and if the curvature meets the curvature threshold, uses the stationary point as the coordinate of the center pixel point of the light strip in the peak interval; otherwise, the peak interval is unreasonable, the inflection point and the peak interval are discarded, and the next pixel point is determined.

[0096] In this embodiment, before performing data fitting, the “symmetrical peak” determination process described in Example 2 may be performed to select a suitable fitting model.

[0097] Based on the same inventive concept, the present application proposes a light strip center extraction system to perform the above-mentioned method, including: The peak interval determination module determines the pixel status of each pixel in the image containing the light stripe column by column based on the grayscale value of the pixel, determines the inflection point of the current column and the first endpoint of the peak interval where the inflection point is located; based on the grayscale value of the first endpoint of the peak interval, calculates the absolute value of the difference between the grayscale value of each pixel in the row following the inflection point of the current column and the grayscale value of the first endpoint, and determines the second endpoint of the peak interval; The center extraction module constructs a curve fitting model based on the grayscale value and row coordinates of the pixel points in the peak interval, obtains the stationary point greater than zero of the fitting curve, and selects the stationary point closest to the inflection point as the center pixel point of the light bar in the peak interval.

[0098] Also includes: The peak interval verification module includes: calculating the grayscale value difference between the inflection point and the first endpoint, and the grayscale value difference between the inflection point and the second endpoint. If the two grayscale value differences are both greater than the grayscale extreme difference threshold, the peak interval is reasonable, and the row coordinate range of the pixel point in the peak interval where the inflection point is located is from the first endpoint to the second endpoint; otherwise, the inflection point and the peak interval are discarded, and the next pixel point is determined.

[0099] Alternatively, the stationary point closest to the inflection point obtained by the center extraction module is used to calculate the curvature of the stationary point closest to the inflection point. If the curvature meets the curvature threshold, the stationary point is used as the coordinate of the central pixel point of the light strip in the peak interval; otherwise, the peak interval is unreasonable, the inflection point and the peak interval are discarded, and the next pixel point is determined.

[0100] The symmetrical peak determination module calculates the gradient on the left side and the gradient on the right side of the inflection point based on the inflection point obtained by the peak interval determination module or the peak interval verification module, and calculates the difference between the left gradient and the right gradient to determine whether the difference is less than the gradient threshold; if it is less than the gradient threshold, it is considered that the pixel point distribution of the current peak interval constitutes a symmetrical peak; otherwise, it is considered that the pixel point distribution of the current peak interval does not constitute a symmetrical peak; based on the determination result of the symmetrical peak, the center extraction module selects the corresponding fitting model.

[0101] The pre-processing module filters the original image data and removes interference noise to obtain an image containing light stripes.

[0102] Based on the same inventive concept, the present application also proposes a computer-readable storage medium, including a computer program, which implements the above-mentioned method when executed by a processor.

[0103] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0104] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A light strip center extraction method, characterized in that: include: Based on the grayscale values of the pixels in the image containing the light strip, the pixel state of each pixel is determined column by column, and the inflection point of the current column and the first endpoint of the peak interval where the inflection point is located are determined; based on the grayscale value of the first endpoint of the peak interval, the absolute value of the difference between the grayscale value of each pixel in the row following the inflection point of the current column and the grayscale value of the first endpoint is calculated to determine the second endpoint of the peak interval; Based on the grayscale value and row coordinates of the pixel points in the peak interval, a curve fitting model is constructed to obtain the stationary point greater than zero of the fitting curve, and the stationary point closest to the inflection point is selected as the center pixel point of the light strip in the peak interval.

2. The light stripe center extraction method according to claim 1, characterized in that: Before building the curve fitting model, it also includes: Calculate the grayscale value difference between the inflection point and the first endpoint, and the grayscale value difference between the inflection point and the second endpoint respectively. If the two grayscale value differences are both greater than the grayscale extreme difference threshold, the peak interval is reasonable, and the row coordinate range of the pixel point in the peak interval where the inflection point is located is from the first endpoint to the second endpoint; otherwise, discard the inflection point and the peak interval, and determine the next pixel point.

3. The light stripe center extraction method according to claim 1, characterized in that: Also includes: Calculate the curvature of the stationary point closest to the inflection point. If the curvature meets the curvature threshold, use the stationary point as the coordinate of the center pixel of the light stripe in the peak interval. Otherwise, discard the inflection point and the peak interval and determine the next pixel.

4. The light stripe center extraction method according to claim 2 or 3, characterized in that: include: If the pixel state of the pixel point in the current column is rising, the pixel state of the adjacent pixel point in the subsequent row is non-rising, and the grayscale value of the pixel point is greater than the grayscale value of the first endpoint, then the pixel point is a candidate point; and the grayscale values of the candidate point and at least one pixel point in the preceding and subsequent rows are not lower than the background threshold, then the candidate point is an inflection point; otherwise, the candidate point is discarded and the next pixel point is determined.

5. The light stripe center extraction method according to claim 4, characterized in that: Pixel status, including: If the grayscale value of any pixel is greater than the grayscale value of its adjacent pixel in the previous row, the pixel state of the pixel is rising; If the grayscale value of any pixel is less than the grayscale value of its adjacent pixel in the previous row, the pixel state of the pixel is down; If the grayscale value of any pixel is equal to the grayscale value of its adjacent pixel in the previous row, and the grayscale value of the pixel is the full grayscale value, the pixel state of the pixel is overexposed; If the grayscale value of any pixel is equal to the grayscale value of its adjacent preceding pixel, and the grayscale value of the pixel is less than the grayscale full value, the pixel state of the pixel is the pixel state of its adjacent preceding pixel.

6. The light stripe center extraction method according to claim 1, characterized in that: Constructing a curve fitting model also includes: calculating the gradient on the left side of the inflection point and the gradient on the right side of the inflection point respectively, and calculating the difference between the left gradient and the right gradient, and judging whether the difference is less than the gradient threshold; if it is less than the gradient threshold, it is considered that the pixel point distribution in the current peak interval constitutes a symmetrical peak; otherwise, it is considered that the pixel point distribution in the current peak interval does not constitute a symmetrical peak; based on the judgment result of the symmetrical peak, the corresponding curve fitting model is selected.

7. The light stripe center extraction method according to claim 1, characterized in that: The curve fitting model is a cubic curve fitting model.

8. The light stripe center extraction method according to claim 1, characterized in that: Also includes: The original image data is filtered to remove interference noise to obtain an image containing light stripes.

9. A light strip center extraction system, characterized in that: include: The peak interval determination module determines the pixel status of each pixel in the image containing the light stripe column by column based on the grayscale value of the pixel, determines the inflection point of the current column and the first endpoint of the peak interval where the inflection point is located; based on the grayscale value of the first endpoint of the peak interval, calculates the absolute value of the difference between the grayscale value of each pixel in the row following the inflection point of the current column and the grayscale value of the first endpoint, and determines the second endpoint of the peak interval; The center extraction module constructs a curve fitting model based on the grayscale value and row coordinates of the pixel points in the peak interval, obtains the stationary point greater than zero of the fitting curve, and selects the stationary point closest to the inflection point as the center pixel point of the light bar in the peak interval.

10. A computer-readable storage medium comprising a computer program, wherein when the computer program is executed by a processor, the method for extracting the center of a light stripe according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Laser light stripe center extraction method and device, object three-dimensional reconstruction method, electronic equipment, laser scanner and computer readable storage medium

    CN118447079A

  • Line center extraction method and system suitable for FPGA (Field Programmable Gate Array) parallel operation and medium

    CN118587272A

Cited By

  • Line laser spot centroid acquisition method and device, focusing method and device and computing equipment

    CN121746414A

  • Peak value calculation method and system

    CN122265420A

  • A peak calculation method and system

    CN122265420B

  • A method and system for peak identification of bimodal superimposed curves

    CN122473552A

  • A peak positioning method, system and electronic device for multi-peak superimposed curves

    CN122714533A