Laser line center point extraction method and system based on sharpness value segmentation punishment
By scanning the laser stripe image column by column and processing the grayscale distribution data, combined with bidirectional segmentation penalty and calibration of real laser line samples, the problem of misselection of the laser line center point in the existing technology is solved, and accurate extraction of the laser line center point is achieved in complex industrial scenarios.
Patent Information
- Application Number
- CN202611456015.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-18
- Publication Date
- 2026-11-20
AI Technical Summary
Existing sharpness evaluation methods are difficult to accurately characterize the actual quality of candidate laser stripes in complex industrial interference scenarios, leading to misselection of the laser line center point.
By scanning the input laser stripe image column by column, the effective area and laser line width are determined using the extreme points of the first derivative of the grayscale distribution data. The original sharpness value is calculated, and the ideal sharpness value and the upper limit of the excess value are calibrated according to the sharpness distribution of the real laser line sample. Bidirectional segmented penalty is performed, and a comprehensive score is obtained by combining other light stripe quality evaluation scores.
It improves the accuracy of sharpness evaluation, reduces the misselection of laser line center point in complex industrial interference scenarios, and ensures the accuracy of laser line center point selection.
Smart Images

Figure CN123141818A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of industrial vision inspection and image processing technology, and in particular to a method and system for extracting the center point of a laser line based on segmented penalty of sharpness value. Background Technology
[0002] Line structured light 3D measurement technology projects laser lines onto the surface of an object and uses an industrial camera to capture images of the laser stripes formed on the surface. The 3D information of the object is then calculated based on the center position of the laser stripes in the image. Due to its non-contact nature, high measurement accuracy, and real-time performance, this technology has been widely applied in 3D reconstruction, reverse engineering, weld inspection, and industrial dimensional measurement. The center position of the laser stripes is fundamental to the 3D coordinate calculation, and its extraction result directly affects the accuracy of line structured light 3D measurement. Existing methods for extracting the laser line center point mainly include the extreme value method, the gray-level centroid method, and the Steger algorithm. The extreme value method uses the extreme gray-level position on the laser stripe cross-section as the center position; the gray-level centroid method calculates the gray-level distribution centroid based on the gray-level values of each pixel within the cross-section; and the Steger algorithm determines the sub-pixel center position of the laser stripe using the Hessian matrix. In industrial inspection scenarios, due to factors such as the material of the object surface, ambient lighting, and imaging noise, there may be multiple positions in the same image column that meet the preliminary detection conditions. Therefore, it is usually necessary to further determine the true center point of the laser line from multiple candidate points.
[0003] Existing technologies typically involve scanning laser stripe images column by column, determining the boundaries of candidate laser stripes based on grayscale changes or the extreme values of the first derivative, obtaining the center position, boundary position, laser line width, and grayscale distribution data within the boundary range for each candidate point, and then evaluating the quality of the candidate points using multiple evaluation metrics. For example, the grayscale value evaluation metric measures the brightness of the laser stripe based on the grayscale value of the candidate point; the width evaluation metric measures the geometric width of the laser stripe based on the pixel distance between the two boundaries; the edge steepness evaluation metric measures the edge sharpness based on the grayscale decrease rate from the peak to the two side boundaries; the unimodality and peak dominance evaluation metric are used to determine the peak structure of the candidate laser stripe; the grayscale integral energy evaluation metric measures the energy distribution within the boundary range; and the left-right offset evaluation metric measures the symmetry of the laser stripe based on the distance between the grayscale centroid and the geometric peak. To simultaneously consider the grayscale energy and geometric width of the candidate laser stripe, existing technologies can also calculate a sharpness value based on the ratio of the grayscale integral energy within the boundary range to the laser line width to characterize the sharpness of the candidate laser stripe, and evaluate candidate points according to the principle that the higher the sharpness value, the higher the sharpness score. After completing each scoring, the sharpness score is combined with the grayscale value score, width score, edge steepness score, and grayscale integral energy score according to their respective weights to obtain the comprehensive score of each candidate point. The candidate point with the higher comprehensive score is determined as the center point of the laser line in the corresponding image column.
[0004] However, specular reflection, large-area glare, spatter, and bright backgrounds on the surface of metal workpieces can create grayscale peaks in laser stripe images that resemble real laser lines. Grayscale value evaluation mainly reflects absolute brightness, while width evaluation mainly reflects geometric width. Evaluation indicators such as edge steepness, single-peak nature, and left-right offset also focus on the local morphology of candidate light stripes. Even after calculating different indicators separately and then weighting them together, candidate light stripes with different shapes and qualities may still obtain similar comprehensive evaluation results. Although sharpness evaluation utilizes both grayscale energy and width information, when evaluating based on a higher sharpness value, glare pseudo-peaks with narrow widths and high grayscale values may receive abnormally high sharpness scores due to their larger grayscale integral energy and smaller width term. When the overall image background is bright, the grayscale difference between candidate light stripes and the background decreases, which may cause the sharpness evaluation results of different candidate points to become similar. Some interference peaks with low grayscale values but extremely narrow widths may also obtain evaluation results that do not match the real laser lines due to their excessively small width term. These factors can all cause the sharpness evaluation results to deviate from the actual quality of the candidate light stripes, further affecting the overall score and center point selection. Therefore, in complex industrial interference scenarios, existing sharpness evaluation methods are unable to accurately characterize the actual quality of candidate laser stripes, easily leading to misselection of the laser line center point. Summary of the Invention
[0005] This application provides a method and system for extracting the center point of a laser line based on a segmented penalty of sharpness value. This method enables the sharpness evaluation results to more accurately correspond to the actual quality of candidate laser stripes, reducing the misselection of laser line center points in complex industrial interference scenarios. This application provides the following technical solution: In a first aspect, this application provides a method for extracting the center point of a laser line based on a segmented penalty of sharpness value, the method comprising: The input laser stripe image is scanned column by column to obtain the center points of candidate laser stripes and their corresponding grayscale distribution data. Based on the first derivative extreme points of the grayscale distribution data, determine the effective region and laser line width of the center point of each candidate laser stripe; The grayscale values of the pixels within the effective area are summed to obtain the grayscale integral energy, and the original sharpness value is obtained based on the ratio of the grayscale integral energy to the square of the laser line width. The ideal sharpness value is calibrated based on the original sharpness value distribution of real laser line samples, and the upper limit of the excess value is determined based on the ideal sharpness value; Based on the relationship between the original sharpness value, the ideal sharpness value, and the upper limit of the excess value, a bidirectional segmented penalty is performed to obtain a penalized sharpness score. The sharpness score increases linearly before the ideal sharpness value, decreases with a first penalty slope between the ideal sharpness value and the upper limit of the excess value, and decreases with a second penalty slope greater than the first penalty slope after the upper limit of the excess value. The sharpness score after penalty is weighted and summed with other light stripe quality evaluation scores, and the center point of the candidate laser stripe with the highest comprehensive score is determined as the center point of the laser line.
[0006] In one specific implementation, the step of scanning the input laser stripe image column by column to obtain the center points of candidate laser stripes and their corresponding grayscale distribution data includes: The laser stripe images are scanned sequentially along the image column direction to locate potential laser center positions in each image column, thus obtaining candidate laser stripe center points; Record the center position, upper boundary position, lower boundary position, laser line width, and grayscale sequence between the two boundary positions of each candidate laser stripe center point, and use the grayscale sequence as the corresponding grayscale distribution data.
[0007] In a specific implementation scheme, determining the effective region and laser line width of each candidate laser stripe center point based on the extreme points of the first derivative of the grayscale distribution data includes: For each candidate laser stripe center point, the left and right edge points of the corresponding candidate stripe are determined using the first derivative extrema. The region between the left and right edge points is defined as the unique valid calculation region, and the laser line width is determined based on the upper and lower boundary positions, wherein: ; ; In the formula, This is the only valid calculation region. and These are the left and right edge points corresponding to the extreme points of the first derivative, respectively. The laser line width is... and These refer to the upper boundary position and the lower boundary position, respectively.
[0008] In one specific implementation, the step of summing the pixel grayscale values within the effective area to obtain the grayscale integral energy, and obtaining the original sharpness value based on the ratio of the grayscale integral energy to the square of the laser linewidth, includes: For the upper boundary position With the lower boundary position The grayscale values of the pixels between them are directly summed, without deducting the product of the average grayscale value of the boundary points and the width of the laser line, to obtain the grayscale integral energy. Introducing a scaling factor The original sharpness value is calculated according to the following formula: ; ; In the formula, The gray-scale integral energy, pixel position grayscale value at that location The laser line width is... This is a scaling factor used to scale the numerical range of the original sharpness value. This is the original value for sharpness.
[0009] In one specific implementation scheme, the step of calibrating the ideal sharpness value based on the original sharpness value distribution of the real laser line sample, and determining the upper limit of the excess value based on the ideal sharpness value, includes: Select real laser line samples from the labeled data and calculate the raw sharpness value of each real laser line sample; The distribution of raw sharpness values for each real laser line sample is statistically analyzed. The median of this raw sharpness value distribution is determined as the ideal sharpness value, and the upper limit of the excess value is determined according to the following formula: ; ; In the formula, For the first The original sharpness value of a real laser line sample. The number of actual laser line samples. The ideal sharpness value is... This is the upper limit of the excess value.
[0010] In a specific implementation scheme, the step of performing bidirectional segmented penalty based on the relationship between the original sharpness value, the ideal sharpness value, and the upper limit of the excess value to obtain a penalized sharpness score includes: Based on the ideal sharpness value and the upper limit of the excess value, the penalized sharpness score is calculated according to the following piecewise function: ; In the formula, The sharpness score is given after the penalty. The original sharpness value, The ideal sharpness value is... The upper limit of the excess value, The first penalty slope, The second penalty slope is used; when the calculation result of the piecewise function is less than 0, the post-penalized sharpness score is determined to be 0.
[0011] In one specific implementation, the step of weighted summing of the penalized sharpness score with other light stripe quality evaluation scores, and determining the center point of the candidate laser stripe with the highest comprehensive score as the center point of the laser line, includes: The penalized sharpness score of each candidate laser stripe center point is mapped to a uniform score range with at least one other light stripe quality evaluation score. Glare scene detection is performed on the current laser stripe image or the current image column, and the sharpness weight is adjusted according to the scene detection results. The sharpness weight corresponding to the glare scene is greater than the sharpness weight corresponding to the non-glare scene. Based on the sharpness weight and the weights corresponding to the other light stripe quality evaluation scores, the scores are weighted and summed to obtain the comprehensive score of each candidate laser stripe center point, and the candidate laser stripe center point with the highest comprehensive score is determined as the laser line center point of the corresponding image column.
[0012] Secondly, this application provides a laser line center point extraction system based on sharpness value segmentation penalty, which adopts the following technical solution: A laser line center point extraction system based on sharpness value segmentation penalty includes: The candidate center acquisition module is used to scan the input laser stripe image column by column to obtain the center points of candidate laser stripes and their corresponding grayscale distribution data. The effective region determination module is used to determine the effective region and laser line width of each candidate laser stripe center point based on the first derivative extreme points of the grayscale distribution data. The original sharpness calculation module is used to sum the pixel grayscale values in the effective area to obtain the grayscale integral energy, and to obtain the original sharpness value based on the ratio of the grayscale integral energy to the square of the laser line width. An ideal sharpness calibration module is used to calibrate an ideal sharpness value based on the original sharpness value distribution of a real laser line sample, and to determine an upper limit for the excess value based on the ideal sharpness value. The segmented penalty calculation module is used to perform bidirectional segmented penalty based on the relationship between the original sharpness value, the ideal sharpness value, and the upper limit of the excess value, to obtain a penalized sharpness score. The sharpness score increases linearly before the ideal sharpness value, decreases with a first penalty slope between the ideal sharpness value and the upper limit of the excess value, and decreases with a second penalty slope greater than the first penalty slope after the upper limit of the excess value. The comprehensive scoring and selection module is used to weight and sum the penalized sharpness score with other light stripe quality evaluation scores, and determine the center point of the candidate laser stripe with the highest comprehensive score as the center point of the laser line.
[0013] Thirdly, this application provides an electronic device, the device including a processor and a memory; the memory stores a program, the program being loaded and executed by the processor to implement a laser line center point extraction method based on sharpness value segmentation penalty as described in the first aspect.
[0014] Fourthly, this application provides a computer-readable storage medium storing a program that, when executed by a processor, is used to implement a laser line center point extraction method based on sharpness value segmentation penalty as described in the first aspect.
[0015] First, the effective area of the center point of each candidate laser stripe is defined based on the extreme points of the first derivative, so that the gray-scale integrated energy and the laser line width both originate from the same candidate light stripe range. Then, the original sharpness value is calculated by the ratio of the gray-scale integrated energy to the square of the laser line width, thus linking the gray-scale energy and geometric width of the candidate light stripe in the same evaluation quantity, avoiding the problem that evaluating brightness or width separately cannot reflect the combined relationship between the two. Furthermore, the ideal sharpness value is calibrated based on the distribution of the original sharpness values of real laser line samples, so that the sharpness evaluation of candidate points is no longer based on the larger the value, but on the sharpness distribution of real laser lines as the judgment benchmark. When the gray energy of a candidate point is insufficient or its width is too large, causing the original sharpness value to be lower than the ideal sharpness value, the sharpness score increases with the increase of the original sharpness value. When the original sharpness value of the real laser line is slightly higher than the ideal sharpness value but does not exceed the upper limit due to the influence of illumination, the score is reduced according to the first penalty slope. When a glare pseudo-peak with a narrow width and high gray level produces an original sharpness value exceeding the upper limit due to the increase of the numerator and the decrease of the denominator, the score is reduced according to a larger second penalty slope. Therefore, candidate points will no longer continuously obtain higher scores due to abnormally increased original sharpness values, and the normal sharpness changes of the real laser line can be distinguished from the abnormally high sharpness of glare pseudo-peaks. Finally, the penalized sharpness score is weighted and summed with other light stripe quality evaluation scores, so that the center point selection is simultaneously constrained by sharpness characteristics and other light stripe quality characteristics, avoiding the dominance of a single index in the point selection result under bright background, specular reflection, or splash interference. This makes the sharpness evaluation result more accurately correspond to the actual quality of the candidate laser stripe and reduces the misselection of laser line center points in complex industrial interference scenarios.
[0016] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, the preferred embodiments of this application are described in detail below with reference to the accompanying drawings. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the laser line center point extraction method based on sharpness value segmentation penalty in the embodiments of this application.
[0018] Figure 2 This is a schematic diagram of the overall process of the laser line center point extraction method based on sharpness value segmentation penalty in the embodiments of this application.
[0019] Figure 3 This is a comparison diagram of candidate point selection when the laser line is in a large-area glare area in the embodiments of this application.
[0020] Figure 4 This is a comparison diagram of candidate point selection in a large-area discrete glare region in the embodiments of this application.
[0021] Figure 5This is a comparison diagram of splash interference and candidate point selection under a bright background in the embodiments of this application.
[0022] Figure 6 This is a comparison diagram of candidate point selection under discrete glare and bright background in the embodiments of this application.
[0023] Figure 7 This is a comparison diagram of candidate point selection under discrete glare and bright background in the embodiments of this application.
[0024] Figure 8 This is a comparison diagram of candidate point selection when the laser line is in a large area of glare and the background is bright in the embodiments of this application.
[0025] Figure 9 This is a comparison image of candidate point selection in a large-area glare scene in the embodiments of this application.
[0026] Figure 10 This is a comparison image of candidate point selection in a reflected glare scene according to the embodiments of this application.
[0027] Figure 11 This is a comparison diagram of candidate point selection under the combined effects of a bright background and noise interference in the embodiments of this application.
[0028] Figure 12 This is a comparison image of candidate point selection under another bright background and noisy interference scenario in the embodiments of this application.
[0029] Figure 13 This is a structural block diagram of the laser line center point extraction system based on sharpness value segmentation penalty in the embodiments of this application.
[0030] Figure 14 This is a block diagram of an electronic device for extracting the center point of a laser line based on segmented penalty of sharpness value in an embodiment of this application. Detailed Implementation
[0031] The specific embodiments of this application will be described in further detail below with reference to the accompanying drawings and examples. The following examples are used to illustrate this application, but are not intended to limit the scope of this application.
[0032] Optionally, this application uses the laser line center point extraction method based on sharpness value segmentation penalty provided in various embodiments as an example for application in an electronic device. The electronic device is a terminal or server. The terminal can be a computer, tablet computer, etc. This embodiment does not limit the type of electronic device.
[0033] Reference Figure 1 This is a flowchart illustrating a laser line center point extraction method based on sharpness value segmentation penalty according to an embodiment of this application. The method includes at least the following steps: Step S100: Scan the input laser stripe image column by column to obtain the center points of candidate laser stripes and their corresponding grayscale distribution data.
[0034] In step S100, the input laser stripe image is scanned column by column to obtain the center points of candidate laser stripes and their corresponding grayscale distribution data. This step is used to locate the center positions of possible laser lines in each image column and record the position, boundary, width, and grayscale data corresponding to the center points of each candidate laser stripe to form mutually independent candidate point data.
[0035] Specifically, the laser stripe image is scanned sequentially along the image column direction to locate the potential laser center position in each image column, thus obtaining the candidate laser stripe center point; the center position, upper boundary position, lower boundary position, laser line width, and grayscale sequence between the two boundary positions of each candidate laser stripe center point are recorded, and the grayscale sequence is used as the corresponding grayscale distribution data.
[0036] First, the pixel grayscale values in each image column are read sequentially according to the order of the image columns, forming a column grayscale sequence arranged according to the pixel position.
[0037] Secondly, the potential laser center locations are located based on the column grayscale sequence, and these potential laser center locations are determined as candidate laser stripe center points. When multiple potential laser center locations exist in the same image column, each potential laser center location is retained, and the center position of each candidate laser stripe center point is recorded. .
[0038] Subsequently, the upper boundary position of the center point of each candidate laser stripe was recorded. Lower boundary position and laser linewidth, where the upper boundary position Corresponding to the positive peak position, the lower boundary position The corresponding negative peak position is negativePeak; the upper boundary position is read. and lower boundary position The position of each pixel grayscale value at The grayscale sequence is obtained by arranging the pixels according to their positions, and the center position, upper boundary position, lower boundary position, laser line width and grayscale sequence are associated with the center point of the corresponding candidate laser stripe.
[0039] Through the above processing, when real laser lines, glare pseudo-peaks, or other interference peaks exist in the same image column, the corresponding candidate laser stripe center points can be retained respectively, and a clear correspondence between each candidate laser stripe center point and grayscale distribution data can be established, providing a data basis for the independent quality evaluation of each candidate laser stripe center point.
[0040] Step S200: Determine the effective region and laser line width of each candidate laser stripe center point based on the first derivative extreme points of the grayscale distribution data.
[0041] In step S200, the boundary positions are determined using the first-order derivative extrema points formed by the gray-scale changes on both sides of the candidate light stripe, and the effective region and laser line width are uniformly determined based on the boundary positions. This step is used to limit the calculation range of each candidate light stripe and obtain the corresponding geometric width.
[0042] Specifically, firstly, for each candidate laser stripe center point, the left and right edge points of the corresponding candidate stripe are determined using the extrema of the first derivative. Secondly, the region between the left and right edge points is defined as the unique valid calculation region, where: ; Subsequently, the laser line width is determined based on the positions of the upper and lower boundaries, where: ; In the formula, This is the only valid calculation region. and These represent the left and right edge points corresponding to the extreme points of the first derivative, respectively. The laser line width, and These are the upper and lower boundary positions, respectively.
[0043] Through the above processing, the effective area and the laser line width can have a unified and clear boundary basis, reduce the influence of grayscale data outside the candidate light stripe range on the calculation results, and ensure that the calculation range of the center point of different candidate laser stripes is objective and reproducible.
[0044] Step S300: Sum the pixel gray values in the effective area to obtain the gray-scale integral energy, and obtain the original sharpness value based on the ratio of the gray-scale integral energy to the square of the laser line width.
[0045] In step S300, the raw sharpness value is calculated based on the effective area of the center point of each candidate laser stripe and the laser linewidth. This step is used to correlate the grayscale energy and geometric width of the candidate light stripes in the same evaluation metric to characterize the sharpness of the candidate light stripes.
[0046] Specifically, firstly, regarding the upper boundary position and lower boundary position The grayscale values of the pixels between the given points are directly summed, without deducting the product of the average grayscale value of the boundary points and the laser line width, to obtain the grayscale integral energy, where: ; Secondly, a scaling factor is introduced. And calculate the raw sharpness value according to the following formula: ; In the formula, The energy is the grayscale integral. pixel position grayscale value at that location The laser line width, This is the scaling factor used to scale the numerical range of the original sharpness value. This is the original sharpness value.
[0047] Furthermore, grayscale integral energy It directly uses the complete grayscale integral within the effective area, instead of subtracting the product of the average grayscale value of the boundary points and the laser line width from the sum of pixel grayscale values; that is, it does not use... ,in, This represents the average gray level of the boundary points. This preserves the complete energy information within the effective area, preventing excessive compression of the gray level energy of candidate light stripes due to substrate subtraction when the image background is too bright.
[0048] In addition, the denominator of the raw sharpness value is the square of the laser line width. Among them, gray-scale integral energy The square of the laser linewidth reflects the energy intensity of the candidate light stripe. This reflects the geometric width of the candidate light stripe. Compared to using the first power of the laser line width, using the square of the laser line width can enhance the impact of width variation on the original sharpness value; compared to using the cube of the laser line width, using the square of the laser line width can reduce excessive suppression of the real laser line with a larger width. In one embodiment, the laser line width of the extremely narrow pseudo-peak is approximately 3 pixels, and the laser line width of the real laser line is approximately 7 to 11 pixels.
[0049] Coefficient of scaling This is a configurable parameter that can be set based on camera parameters, image resolution, or lighting conditions. It is used to uniformly scale the raw sharpness value under different imaging conditions. When scaling the raw sharpness value is not required, the scaling factor... Take 1.
[0050] Through the above processing, the gray-scale integral energy increases with the increase of the energy intensity of the candidate light stripe, and the square of the laser linewidth increases with the increase of the width of the candidate light stripe. Therefore, the original sharpness value can simultaneously reflect the gray-scale energy and geometric width of the candidate light stripe, distinguish candidate light stripes with different combinations of energy intensity and width, and provide unified evaluation data for judging whether the original sharpness value deviates from the sharpness range of the real laser line.
[0051] Step S400: Calibrate the ideal sharpness value according to the original sharpness value distribution of the real laser line sample, and determine the upper limit of the over-value based on the ideal sharpness value.
[0052] In step S400, a sharpness evaluation benchmark is established using the raw sharpness value distribution of real laser line samples, and an upper limit for exceeding the benchmark is set. This step is used to determine the typical sharpness level corresponding to the real laser line and to provide a boundary basis for the bidirectional segmented penalty of the raw sharpness value.
[0053] Specifically, firstly, real laser line samples are selected from the labeled data, and the raw sharpness value of each real laser line sample is calculated. Each sample in the labeled data has a sample label indicating whether it is a real laser line. The samples were determined to be real laser line samples, and the original sharpness values of each real laser line sample were obtained according to the original sharpness value calculation method in step S300. .
[0054] Secondly, the distribution of raw sharpness values for each real laser line sample is statistically analyzed. The median of the raw sharpness value distribution is determined as the ideal sharpness value, and the upper limit of the excess value is determined according to the following formula: ; ; In the formula, For the first The original sharpness value of a real laser line sample. The number of actual laser line samples. For ideal sharpness value, This represents the upper limit of the sharpness value. The median is used to represent the typical sharpness level of real laser line samples. The raw sharpness values of each real laser line sample are arranged in ascending order. When the number of real laser line samples is odd, the raw sharpness value in the middle position is used; when the number of real laser line samples is even, the average of the two raw sharpness values in the middle position is used. Compared to using the arithmetic mean of all raw sharpness values, the median is less affected by a small number of outliers, thus keeping the ideal sharpness value stable.
[0055] Value Limit Set to ideal sharpness value The ideal sharpness value is 1.5 times the maximum sharpness value, used to distinguish between raw sharpness values that are close to the typical sharpness level of a real laser line and raw sharpness values that significantly exceed that typical sharpness level. The ideal sharpness value and the upper limit of the excess value together form three continuous sharpness intervals: the interval not greater than the ideal sharpness value, the interval between the ideal sharpness value and the upper limit of the excess value, and the interval greater than the upper limit of the excess value.
[0056] Furthermore, the ideal sharpness value can be updated according to a preset update cycle, or it can be updated when the number of newly added real laser line samples reaches a preset number. During the update, the newly added real laser line samples are added to the annotation data, the distribution of the original sharpness values is re-statistically analyzed and the median is calculated, and the upper limit of the excess value is re-determined based on the updated ideal sharpness value to adapt to changes in workpiece batches, lighting conditions, or camera parameters.
[0057] Through the above processing, a unified evaluation benchmark can be established based on the actual sharpness distribution of real laser line samples, avoiding the judgment of candidate light stripe quality solely based on the absolute magnitude of the original sharpness value. Furthermore, the ideal sharpness value and the upper limit of the excess value can be used to distinguish different degrees of sharpness deviation, providing a clear basis for using different scoring relationships for normal sharpness changes and abnormally high sharpness.
[0058] Step S500: Perform bidirectional segmented penalty based on the relationship between the original sharpness value, the ideal sharpness value, and the upper limit of the excess value to obtain a penalized sharpness score. The sharpness score increases linearly before the ideal sharpness value, decreases according to the first penalty slope between the ideal sharpness value and the upper limit of the excess value, and decreases according to the second penalty slope, which is greater than the first penalty slope, after the upper limit of the excess value.
[0059] In step S500, the ideal sharpness value and the upper limit of the excess value are used as segment boundaries, and different scoring relationships are adopted according to the numerical range in which the original sharpness value is located. This step is used to change the one-way evaluation method where the larger the sharpness value, the higher the score, and to distinguish the candidate laser stripe center points with normal sharpness, slightly exceeding the limit, and severely exceeding the limit.
[0060] Specifically, firstly, the raw sharpness value of each candidate laser stripe center point is compared with the ideal sharpness value and the upper limit of the excess value to determine the numerical range corresponding to the raw sharpness value. Based on the ideal sharpness value and the upper limit of the excess value, the penalized sharpness score is calculated according to the following piecewise function: ; In the formula, The sharpness score is determined after the penalty. This is the original sharpness value. For ideal sharpness value, This is the maximum value. The first penalty slope, The second penalty slope is used; when the calculation result of the piecewise function is less than 0, the sharpness score after penalty is set to 0.
[0061] Secondly, when At that time, a linear mapping is performed based on the ratio of the original sharpness value to the ideal sharpness value. When the original sharpness value increases from 0 to the ideal sharpness value, the penalized sharpness score increases accordingly from 0 to 255, so that candidate points that do not reach the typical sharpness level of a real laser line receive the corresponding score according to their original sharpness value.
[0062] when When this interval is defined as slightly over-optimized, the sharpness score is reduced based on the degree to which the original sharpness value exceeds the ideal sharpness value and the first penalty slope. A smaller first penalty slope results in a smaller penalty for candidate points whose original sharpness value slightly exceeds the ideal sharpness value.
[0063] Subsequently, when When this interval is deemed to be severely over-limit, a score of 0.7 is used as the baseline for calculating the score for this interval. The sharpness score is then reduced based on the degree to which the original sharpness value exceeds the over-limit and the second penalty slope. The second penalty slope is approximately 2.5 times that of the first penalty slope, causing the sharpness score to decrease by a larger margin when the original sharpness value significantly exceeds the over-limit. The lower limit of the sharpness score after penalty is set to 0 to prevent negative values from occurring when the original sharpness value is extremely high.
[0064] Furthermore, the scoring benchmarks for the first penalty slope, the second penalty slope, and the severe over-limit interval were determined using experimental data from real laser lines and interference peak samples. The first penalty slope was used to control the score decrease within the slight over-limit interval, and the second penalty slope was used to control the score decrease within the severe over-limit interval.
[0065] Through the above processing, the center points of candidate laser stripes that are close to the ideal sharpness value can maintain a high sharpness score, the candidate points that slightly exceed the ideal sharpness value will be penalized by a small amount, and the glare pseudo-peaks that have serious false sharpness due to extremely narrow width or high gray level will be penalized by a larger amount, thereby reducing the possibility of pseudo-peaks with abnormally high sharpness getting high scores in the candidate point evaluation.
[0066] Step S600: The sharpness score after penalty is weighted and summed with other light stripe quality evaluation scores, and the center point of the candidate laser stripe with the highest comprehensive score is determined as the center point of the laser line.
[0067] In step S600, the penalized sharpness score is incorporated into the comprehensive evaluation system along with other light stripe quality evaluation scores, and the laser line center point is selected based on the comprehensive score. This step is used to comprehensively utilize the quality characteristics of candidate light stripes in different dimensions, avoiding the determination of the laser line center point based solely on a single evaluation index.
[0068] Specifically, firstly, the penalized sharpness score of the center point of each candidate laser stripe is mapped to a unified score range along with at least one other light stripe quality evaluation score. Other light stripe quality evaluation scores include at least one of grayscale value score, width score, edge steepness score, and grayscale integral energy score. In one embodiment, all scores are mapped to a range of 0–255 to eliminate dimensional differences between different evaluation indicators, ensuring that all scores participate in the comprehensive evaluation within a unified score range.
[0069] Secondly, glare scene detection is performed on the current laser stripe image or the current image column. The sharpness weight is adjusted based on the scene detection results, with the sharpness weight corresponding to glare scenes being greater than that corresponding to non-glare scenes. When multiple extremely narrow peaks are detected in the current laser stripe image or the current image column, and the original sharpness values of these peaks are generally high, the current laser stripe image or the current image column is determined to be a glare scene, and the sharpness weight corresponding to the penalized sharpness score is increased. When the above features are not detected, the current laser stripe image or the current image column is determined to be a non-glare scene, and the sharpness weight is decreased. In one implementation, the sharpness weight is configured to be 3 to 6 based on experimental testing, and the contribution of other light stripe quality evaluation scores is controlled by their respective weights.
[0070] Subsequently, based on the sharpness weight and the weights corresponding to the other light stripe quality evaluation scores, the scores are weighted and summed to obtain the comprehensive score of each candidate laser stripe center point. The candidate laser stripe center point with the highest comprehensive score is then determined as the laser line center point of the corresponding image column. Specifically, the comprehensive score of each candidate laser stripe center point is calculated within each image column, the comprehensive scores are compared, and the candidate laser stripe center point with the highest comprehensive score is selected.
[0071] Through the above processing, the penalized sharpness score can be used together with the evaluation results such as gray value, width, edge steepness and gray integral energy to participate in the center point selection. The contribution of the penalized sharpness score in the comprehensive evaluation can be adjusted according to the glare scene detection results, thereby reducing the impact of a single evaluation index on the point selection result and reducing the misselection of laser line center points in complex industrial interference scenarios.
[0072] In summary, combining Figure 2This application involves scanning the input laser stripe image column by column to obtain the center points and grayscale distribution data of candidate laser stripes. The boundaries of the candidate stripes are determined based on the extreme points of the first derivative of the grayscale distribution data. The region between the two boundaries is used as the unique effective calculation region, and the laser line width is determined. The pixel grayscale values within the effective region are directly summed to obtain the grayscale integral energy that retains complete energy information. The original sharpness value is calculated based on the ratio of the grayscale integral energy to the square of the laser line width. Real laser line samples are selected from the labeled data, and the median of the original sharpness value distribution of the real laser line samples is calibrated as the ideal sharpness value. The ideal sharpness value is then used to calculate the desired sharpness. The value determines the upper limit of the excess value; using the ideal sharpness value and the upper limit of the excess value as segment boundaries, the original sharpness value is penalized in two directions, so that the sharpness score increases linearly before the ideal sharpness value, decreases according to the first penalty slope in the slightly excess value range, and decreases according to the larger second penalty slope in the severely excess value range; then the penalized sharpness score is mapped to a unified score range along with the light stripe quality evaluation scores such as gray value, width, edge steepness, and gray integral energy; the sharpness weight is adjusted according to the glare scene detection results, the scores are weighted and summed, and the center point of the candidate laser stripe with the highest comprehensive score is determined as the center point of the laser line of the corresponding image column.
[0073] By defining a unique effective computational region through the extreme points of the first derivative, the gray-scale integrated energy and laser linewidth can adopt a unified boundary benchmark, reducing the impact of gray-scale data outside the candidate light stripe range on the evaluation results. Directly accumulating the complete gray-scale information within the effective region avoids excessive energy compression of candidate light stripes caused by substrate subtraction against a bright background. Furthermore, the ratio of gray-scale integrated energy to the square of the laser linewidth correlates energy intensity and geometric width in the same evaluation metric, mitigating the problem of failing to reflect the combined relationship when evaluating brightness and width separately. Establishing the evaluation benchmark based on the median of the sharpness distribution of real laser line samples allows sharpness evaluation to move beyond simply comparing numerical values. The algorithm shifts to assess the deviation of candidate points from the typical sharpness level of real laser lines. It distinguishes between slight and severe over-sharpness by using different penalty slopes. This results in a smaller penalty for slight sharpness increases in real laser lines caused by imaging changes, while glare pseudo-peaks with extremely narrow widths and high grayscale are penalized more severely due to inflated sharpness. By combining other light stripe quality evaluation scores and adjusting the sharpness weight according to the glare scene, it avoids a single index dominating the center point selection. This allows the sharpness evaluation results to more accurately correspond to the actual quality of candidate laser stripes, reducing misselection of laser line center points in complex industrial interference scenarios such as specular reflection, large-area glare, splashing, and bright backgrounds.
[0074] Based on the explanation of each step of the above method, to further illustrate the specific process of evaluating and selecting candidate laser stripe center points in complex industrial interference scenarios, the following uses a laser stripe image of a metal workpiece acquired by an industrial camera as an example. This image contains both real laser lines and large-area flat glare. By comparing the candidate point scores and selection results with and without bidirectional segmentation penalty, the effect of bidirectional segmentation penalty on suppressing false peaks with abnormal sharpness is demonstrated.
[0075] An industrial camera captures images containing laser stripes on the surface of a metal workpiece. The FIR-peak algorithm scans the input laser stripe images column by column to obtain the center points of candidate laser stripes and their corresponding grayscale distribution data for each image column. Based on the extreme points of the first derivative of the grayscale distribution data, the effective region and laser line width of each candidate stripe are determined. The grayscale integral energy is obtained by directly summing the pixel grayscale values within the effective region, and the raw sharpness value is obtained based on the ratio of the grayscale integral energy to the square of the laser line width. Subsequently, an ideal sharpness value and an upper limit for exceeding the limit are calibrated based on the distribution of raw sharpness values from real laser line samples. A bidirectional segmented penalty is applied to the raw sharpness value, and the penalized sharpness score is then weighted and summed with other stripe quality evaluation scores. The center point of the laser line is selected based on the comprehensive score.
[0076] In this embodiment, real laser line samples are selected from the labeled data. Based on the original sharpness value distribution of the real laser line samples, the ideal sharpness value is calibrated to 25, and the upper limit of the excess value is set to 37.5. Taking some candidate laser stripe center points in column 150 of the image as an example, the peak gray level, laser line width, gray level integral energy, real label, and sharpness score with or without bidirectional segmentation penalty for each candidate point are shown in Table 1.
[0077] Table 1. Examples of sharpness scores with and without bidirectional segmentation penalty
[0078] The table shows that the sharpness index can distinguish most pseudo-laser line scenes. The true center point A scores the highest. For candidate point B, its sharpness score is extremely high without using a penalty function: Candidate point B: S raw = 520 / 4 ≈130.00, S sharp = 255 × S raw / 25.0 ≈ 1326.0. This score is significantly higher than the actual laser line center point A, thus making it easy for candidate point B to be incorrectly selected in the overall evaluation. After adding the penalty function: (S raw = 130.00 > 37.5): S sharp= 255 × [0.7 - 0.01333 × (130.00 - 37.5) / 12.5] ≈ 153.3. After penalty, the sharpness score of candidate point B is lower than that of the true laser line center point A. The original sharpness values of candidate points C, D, and E do not exceed the ideal sharpness value, and their corresponding sharpness scores are obtained according to a linear increase relationship. After weighted summing of the penalized sharpness scores of each candidate point with other light stripe quality evaluation scores, candidate point A obtains the highest comprehensive score and is determined as the laser line center point of this image column.
[0079] To further illustrate the impact of bidirectional segmentation penalty on candidate point selection results under different industrial interference scenarios, the candidate point ranking results were compared with and without bidirectional segmentation penalty, while keeping other scoring items and corresponding weights consistent. Figures 3 to 6 In the diagram, subgraph (a) represents the candidate point selection results without bidirectional segmentation penalty, and subgraph (b) represents the candidate point selection results after bidirectional segmentation penalty. Red candidate points represent the candidate points ranked first in comprehensive score, green candidate points represent the candidate points ranked second in comprehensive score, yellow candidate points represent the candidate points ranked third in comprehensive score, and blue candidate points represent other candidate points besides the top three in comprehensive score.
[0080] Reference Figure 3 , Figure 3 This is a comparison chart of candidate point selection when the laser line is in a large area of glare. The chart shows that when a large area of flat glare and the real laser line coexist, the sharpness score without bidirectional segmentation penalty is easily affected by the extremely narrow glare pseudo-peak. After bidirectional segmentation penalty, the score of candidate points with abnormally high sharpness decreases, and the candidate point with the highest comprehensive score is closer to the center of the real laser line.
[0081] Reference Figure 4 , Figure 4 This is a comparison chart of candidate point selection in a large area of discrete glare. The chart shows that when multiple discrete glare pseudo-peaks are distributed around the laser stripe, the bidirectional segmentation penalty can reduce the sharpness score of extremely narrow and bright candidate points, so that the candidate point with the highest comprehensive score is transferred from the discrete glare area to the vicinity of the real laser line.
[0082] Reference Figure 5 , Figure 5 This is a comparison chart of candidate point selection under splash interference and bright background. The chart shows that when splash interference produces multiple local grayscale peaks and the overall image background is bright, bidirectional segmentation penalty can reduce the number of candidate points with abnormal sharpness entering the top of the comprehensive score, so that more candidate points with higher comprehensive scores are distributed near the real laser line.
[0083] Reference Figure 6 , Figure 6 This is a comparison of candidate point selection under discrete glare and bright background. The figure shows that when discrete glare and bright background work together, without bidirectional segmentation penalty, glare pseudo-peaks are more likely to get higher comprehensive scores. However, after bidirectional segmentation penalty, the candidate points ranked first and second in comprehensive score are more distributed along the real laser line.
[0084] The comparison of the four industrial interference scenarios above shows that, with other light stripe quality evaluation scores and corresponding weights remaining consistent, bidirectional segmentation penalty on the original sharpness value can reduce the score of abnormally high sharpness pseudo-peaks, change the comprehensive score ranking between glare pseudo-peaks and the real laser line center point, thereby reducing the misselection of laser line center point in complex industrial interference scenarios.
[0085] Furthermore, as a preferred embodiment, to verify whether the application of bidirectional segmentation penalty can improve the accuracy of laser line center point selection in complex industrial interference scenarios, six sets of laser stripe images containing discrete glare, large-area glare, reflected glare, bright background, and noise interference were selected for comparative testing. Under the condition that the candidate point extraction method, other light stripe quality evaluation scores, and corresponding weights remain consistent, the top-1 correct selection rate and top-1+top-2 correct coverage rate were calculated separately for both without and with bidirectional segmentation penalty. The top-1 correct selection rate represents the proportion of the candidate point with the highest overall score that is the true laser line center point, and the top-1+top-2 correct coverage rate represents the proportion of the top two candidate points in the overall score ranking that contain the true laser line center point. Figures 7 to 12 In the diagram, subgraph (a) represents the candidate point selection results without bidirectional segmentation penalty, and subgraph (b) represents the candidate point selection results after bidirectional segmentation penalty. Red candidate points represent the candidate points ranked first in comprehensive score, green candidate points represent the candidate points ranked second in comprehensive score, yellow candidate points represent the candidate points ranked third in comprehensive score, and blue candidate points represent other candidate points besides the top three in comprehensive score.
[0086] Reference Figure 7 , Figure 7 This is a comparison chart of candidate point selection under discrete glare and bright background. The chart shows the ranking results of candidate points with and without bidirectional segmentation penalty when multiple discrete glare pseudo-peaks are distributed near the real laser line. Figure 7 The results show that without bidirectional segmentation penalty, the correct selection rate of top1 is 75.1%, and the correct coverage rate of top1+top2 is 86.6%. After bidirectional segmentation penalty, the correct selection rate of top1 increases to 95.8%, and the correct coverage rate of top1+top2 increases to 99.9%, indicating that bidirectional segmentation penalty can reduce the influence of discrete glare pseudo-peaks on the selection of the center point of the real laser line.
[0087] Reference Figure 8 , Figure 8 This is a comparison chart of candidate point selection when the laser line is in a large-area glare area and the background is bright. The chart shows the candidate point ranking results with or without bidirectional segmentation penalty when the real laser line and the large-area glare area overlap. Figure 8 The results show that without bidirectional segmentation penalty, the correct selection rate of top1 is 12.5%, and the correct coverage rate of top1+top2 is 20.5%. After bidirectional segmentation penalty, the correct selection rate of top1 increases to 62.1%, and the correct coverage rate of top1+top2 increases to 72.3%, indicating that bidirectional segmentation penalty can suppress candidate points with abnormally high sharpness when the real laser line overlaps with the glare area.
[0088] Reference Figure 9 , Figure 9 This is a comparison chart of candidate point selection in a large-area glare scene. The chart shows the candidate point ranking results with or without bidirectional segmentation penalty when there is continuous large-area glare around the laser stripe. Figure 9 The results show that without bidirectional segmentation penalty, the correct selection rate of top 1 was 65.6%, and the correct coverage rate of top 1+top 2 was 86.2%. After implementing bidirectional segmentation penalty, the correct selection rate of top 1 increased to 74.2%, and the correct coverage rate of top 1+top 2 increased to 89.4%, indicating that bidirectional segmentation penalty can reduce the number of abnormal candidate points caused by large-area glare from entering the top of the comprehensive score.
[0089] Reference Figure 10 , Figure 10 This is a comparison chart of candidate point selection in a reflective glare scene. The chart shows the ranking results of candidate points with and without bidirectional segmentation penalty when the surface of a metal workpiece reflects light to form a bright area. Figure 10 The results show that without bidirectional segmentation penalty, the top 1 correct selection rate is 83.5%, and the top 1+top 2 correct coverage rate is 93.5%. After bidirectional segmentation penalty, the top 1 correct selection rate increases to 87.3%, and the top 1+top 2 correct coverage rate increases to 97.1%, indicating that bidirectional segmentation penalty can further improve the candidate ranking of the real laser line center point in the already high-correct-selection-rate reflection glare scene.
[0090] Reference Figure 11 , Figure 11 This is a comparison chart of candidate point selection under the combined effects of a bright background and noise interference. The chart shows the candidate point ranking results with and without bidirectional segmentation penalty when the overall background of the image is relatively bright and there are multiple noise peaks. Figure 11The results show that without bidirectional segmentation penalty, the correct selection rate of top1 is 46.8%, and the correct coverage rate of top1+top2 is 74.6%. After bidirectional segmentation penalty, the correct selection rate of top1 increases to 90.2%, and the correct coverage rate of top1+top2 increases to 93.1%, indicating that bidirectional segmentation penalty can significantly reduce the misselection of laser line center point under bright background and noise coupling interference.
[0091] Reference Figure 12 , Figure 12 This is a comparison chart of candidate point selection under another bright background and noisy interference scenario. The chart shows the candidate point ranking results with or without bidirectional segmentation penalty when the laser stripe shape, noise distribution, and background brightness change. Figure 12 The results show that without bidirectional segmentation penalty, the correct selection rate of top1 is 31.5%, and the correct coverage rate of top1+top2 is 58.1%. After bidirectional segmentation penalty, the correct selection rate of top1 increases to 51.9%, and the correct coverage rate of top1+top2 increases to 75.2%, indicating that bidirectional segmentation penalty can still improve the candidate ranking of the center point of the real laser line under different bright backgrounds and noise distribution conditions.
[0092] Table 2 is a summary table of sharpness index test data with and without bidirectional segmentation penalty. The table summarizes... Figures 7 to 12 The correct selection rate of top 1 and the correct coverage of top 1+top 2 for the six test scenarios.
[0093] Table 2 Summary of sharpness index test data with and without bidirectional segmentation penalty
[0094] As shown in Table 2, in the six complex industrial interference scenarios, the top-1 correct selection rate after bidirectional segmentation penalty was higher than that without bidirectional segmentation penalty, increasing by an average of 52.5% to 76.9%, an increase of 24.4 percentage points; the top-1+top-2 correct coverage rate increased by an average of 69.9% to 87.8%, an increase of 17.9 percentage points. Figure 8 , Figure 9 and Figure 12 The relatively low absolute correct selection rate is due to the fact that, in the comparative test, to highlight the impact of the presence or absence of bidirectional segmentation penalty on the sharpness score, the weight of the sharpness score relative to other light stripe quality evaluation scores was increased, thus reducing the influence of other evaluation indicators on the selection result. This test setup also illustrates that the selection of the laser line center point cannot rely solely on a single evaluation indicator; it requires a comprehensive judgment combining multiple light stripe quality evaluation scores.
[0095] pass Figures 7 to 12As can be seen from the comparison results in Table 2, the bidirectional segmented penalty can reduce the scores of glare false peaks and noise peaks with abnormally high sharpness, improve the ranking of the real laser line center point in the comprehensive score, and show a positive effect in different scenarios such as discrete glare, large area glare, reflected glare, bright background and noise interference. This verifies that the present application can improve the accuracy and stability of laser line center point selection in complex industrial interference scenarios.
[0096] Figure 13 This is a structural block diagram of a laser line center point extraction system based on sharpness value segmentation penalty according to an embodiment of this application. The system includes at least the following modules: The candidate center acquisition module is used to scan the input laser stripe image column by column to obtain the center points of candidate laser stripes and their corresponding grayscale distribution data. The effective region determination module is used to determine the effective region and laser line width of each candidate laser stripe center point based on the extreme points of the first derivative of the grayscale distribution data. The original sharpness calculation module is used to sum the pixel gray values in the effective area to obtain the gray-scale integral energy, and obtain the original sharpness value based on the ratio of the gray-scale integral energy to the square of the laser line width. The ideal sharpness calibration module is used to calibrate the ideal sharpness value based on the original sharpness value distribution of the real laser line sample, and to determine the upper limit of the over-value based on the ideal sharpness value; The segmented penalty calculation module is used to perform bidirectional segmented penalties based on the relationship between the original sharpness value, the ideal sharpness value, and the upper limit of the excess value, to obtain a penalized sharpness score. The sharpness score increases linearly before the ideal sharpness value, decreases according to the first penalty slope between the ideal sharpness value and the upper limit of the excess value, and decreases according to the second penalty slope, which is greater than the first penalty slope, after the upper limit of the excess value. The comprehensive scoring and point selection module is used to weight and sum the sharpness score after penalty with other light stripe quality evaluation scores, and determine the center point of the candidate laser stripe with the highest comprehensive score as the center point of the laser line.
[0097] For relevant details, please refer to the above method implementation examples.
[0098] Figure 14 This is a block diagram of an electronic device provided in one embodiment of this application. The device includes at least a processor 1401 and a memory 1402.
[0099] Processor 1401 may include one or more processing cores, such as a quad-core processor or an octa-core processor. Processor 1401 may be implemented in at least one hardware form selected from DSP (Digital Signal Processor), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). Processor 1401 may also include a main processor and coprocessors. The main processor is a CPU (Central Processing Unit) for performing image processing and data computation tasks, and the coprocessors assist in performing specific computational tasks. In some embodiments, processor 1401 integrates a GPU (Graphics Processing Unit) for performing column-by-column scanning of the laser stripe image, first-order derivative calculation, gray-scale integral energy calculation, and parallel scoring processing of candidate laser stripe center points.
[0100] The memory 1402 may include one or more non-transitory computer-readable storage media, and may also include high-speed random access memory and non-volatile memory, including one or more disk storage devices or flash memory devices. In some embodiments, the memory 1402 is used to store laser stripe images, the original sharpness value distribution of real laser line samples, ideal sharpness values, excess value upper limits, and various scoring parameters. The non-transitory computer-readable storage media in the memory 1402 stores at least one instruction, which is loaded and executed by the processor 1401 to implement the laser line center point extraction method based on sharpness value segmentation penalty provided in this application embodiment.
[0101] Optionally, this application also provides a computer-readable storage medium storing a program that is loaded and executed by a processor to implement the laser line center point extraction method based on sharpness value segmentation penalty in the above method embodiments.
[0102] Optionally, this application also provides a computer product including a computer-readable storage medium storing a program that is loaded and executed by a processor to implement the laser line center point extraction method based on sharpness value segmentation penalty in the above method embodiments.
[0103] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0104] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for extracting the center point of a laser line based on piecewise penalty of sharpness value, characterized in that, The method includes: The input laser stripe image is scanned column by column to obtain the center points of candidate laser stripes and their corresponding grayscale distribution data. Based on the first derivative extreme points of the grayscale distribution data, determine the effective region and laser line width of the center point of each candidate laser stripe; The grayscale values of the pixels within the effective area are summed to obtain the grayscale integral energy, and the original sharpness value is obtained based on the ratio of the grayscale integral energy to the square of the laser line width. The ideal sharpness value is calibrated based on the original sharpness value distribution of real laser line samples, and the upper limit of the excess value is determined based on the ideal sharpness value; Based on the relationship between the original sharpness value, the ideal sharpness value, and the upper limit of the excess value, a bidirectional segmented penalty is performed to obtain a penalized sharpness score. The sharpness score increases linearly before the ideal sharpness value, decreases with a first penalty slope between the ideal sharpness value and the upper limit of the excess value, and decreases with a second penalty slope greater than the first penalty slope after the upper limit of the excess value. The sharpness score after penalty is weighted and summed with other light stripe quality evaluation scores, and the center point of the candidate laser stripe with the highest comprehensive score is determined as the center point of the laser line.
2. The laser line center point extraction method based on sharpness value segmentation penalty according to claim 1, characterized in that, The step of scanning the input laser stripe image column by column to obtain the center points of candidate laser stripes and their corresponding grayscale distribution data includes: The laser stripe images are scanned sequentially along the image column direction to locate potential laser center positions in each image column, thus obtaining candidate laser stripe center points; Record the center position, upper boundary position, lower boundary position, laser line width, and grayscale sequence between the two boundary positions of each candidate laser stripe center point, and use the grayscale sequence as the corresponding grayscale distribution data.
3. The laser line center point extraction method based on sharpness value segmentation penalty according to claim 2, characterized in that, The step of determining the effective region and laser line width of each candidate laser stripe center point based on the first derivative extrema of the grayscale distribution data includes: For each candidate laser stripe center point, the left and right edge points of the corresponding candidate stripe are determined using the first derivative extrema. The region between the left and right edge points is defined as the unique valid calculation region, and the laser line width is determined based on the upper and lower boundary positions, wherein: ; ; In the formula, This is the only valid calculation region. and These are the left and right edge points corresponding to the extreme points of the first derivative, respectively. The laser line width is... and These refer to the upper boundary position and the lower boundary position, respectively.
4. The laser line center point extraction method based on sharpness value segmentation penalty according to claim 3, characterized in that, The process of summing the pixel grayscale values within the effective area to obtain the grayscale integral energy, and obtaining the original sharpness value based on the ratio of the grayscale integral energy to the square of the laser linewidth, includes: For the upper boundary position With the lower boundary position The grayscale values of the pixels between them are directly summed, without deducting the product of the average grayscale value of the boundary points and the width of the laser line, to obtain the grayscale integral energy. Introducing a scaling factor The original sharpness value is calculated according to the following formula: ; ; In the formula, The gray-scale integral energy, pixel position grayscale value at that location The laser line width is... This is a scaling factor used to scale the numerical range of the original sharpness value. This is the original value for sharpness.
5. The laser line center point extraction method based on sharpness value segmentation penalty according to claim 4, characterized in that, The process of calibrating the ideal sharpness value based on the original sharpness value distribution of real laser line samples, and determining the upper limit of the excess value based on the ideal sharpness value, includes: Select real laser line samples from the labeled data and calculate the raw sharpness value of each real laser line sample; The distribution of raw sharpness values for each real laser line sample is statistically analyzed. The median of this raw sharpness value distribution is determined as the ideal sharpness value, and the upper limit of the excess value is determined according to the following formula: ; ; In the formula, For the first The original sharpness value of a real laser line sample. The number of actual laser line samples. The ideal sharpness value is... This is the upper limit of the excess value.
6. The laser line center point extraction method based on sharpness value segmentation penalty according to claim 5, characterized in that, The step involves performing a bidirectional segmented penalty based on the relationship between the original sharpness value, the ideal sharpness value, and the upper limit of the excess value, to obtain a penalized sharpness score, including: Based on the ideal sharpness value and the upper limit of the excess value, the penalized sharpness score is calculated according to the following piecewise function: ; In the formula, The sharpness score is given after the penalty. The original sharpness value, The ideal sharpness value is... The upper limit of the excess value, The first penalty slope, The second penalty slope is used; when the calculation result of the piecewise function is less than 0, the post-penalized sharpness score is determined to be 0.
7. The laser line center point extraction method based on sharpness value segmentation penalty according to claim 6, characterized in that, The step of weighted summing of the penalized sharpness score with other light stripe quality evaluation scores, and determining the center point of the candidate laser stripe with the highest comprehensive score as the center point of the laser line, includes: The penalized sharpness score of each candidate laser stripe center point is mapped to a uniform score range with at least one other light stripe quality evaluation score. Glare scene detection is performed on the current laser stripe image or the current image column, and the sharpness weight is adjusted according to the scene detection results. The sharpness weight corresponding to the glare scene is greater than the sharpness weight corresponding to the non-glare scene. Based on the sharpness weight and the weights corresponding to the other light stripe quality evaluation scores, the scores are weighted and summed to obtain the comprehensive score of each candidate laser stripe center point, and the candidate laser stripe center point with the highest comprehensive score is determined as the laser line center point of the corresponding image column.
8. A laser line center point extraction system based on sharpness value segmentation penalty, characterized in that, include: The candidate center acquisition module is used to scan the input laser stripe image column by column to obtain the center points of candidate laser stripes and their corresponding grayscale distribution data. The effective region determination module is used to determine the effective region and laser line width of each candidate laser stripe center point based on the first derivative extreme points of the grayscale distribution data. The original sharpness calculation module is used to sum the pixel grayscale values in the effective area to obtain the grayscale integral energy, and to obtain the original sharpness value based on the ratio of the grayscale integral energy to the square of the laser line width. An ideal sharpness calibration module is used to calibrate an ideal sharpness value based on the original sharpness value distribution of a real laser line sample, and to determine an upper limit for the excess value based on the ideal sharpness value. The segmented penalty calculation module is used to perform bidirectional segmented penalty based on the relationship between the original sharpness value, the ideal sharpness value, and the upper limit of the excess value, to obtain a penalized sharpness score. The sharpness score increases linearly before the ideal sharpness value, decreases with a first penalty slope between the ideal sharpness value and the upper limit of the excess value, and decreases with a second penalty slope greater than the first penalty slope after the upper limit of the excess value. The comprehensive scoring and selection module is used to weight and sum the penalized sharpness score with other light stripe quality evaluation scores, and determine the center point of the candidate laser stripe with the highest comprehensive score as the center point of the laser line.
9. An electronic device, characterized in that, The device includes a processor and a memory; the memory stores a program that is loaded and executed by the processor to implement a laser line center point extraction method based on sharpness value segmentation penalty as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a program that, when executed by a processor, is used to implement a laser line center point extraction method based on sharpness value segmentation penalty as described in any one of claims 1 to 7.
