Steger algorithm parameter dual adjustment optimization method for workpiece three-dimensional measurement
The binary threshold and line width parameters in the Steger algorithm are optimized through the fitness function and genetic algorithm, which solves the time-consuming and labor-intensive problem of manually adjusting parameters, improves the accuracy and stability of center extraction of line structured light stripes, and reduces the cost of Computational complexity.
Patent Information
- Application Number
- CN202410728224.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-10-08
AI Technical Summary
In the online structured light stripe center extraction using the Steger algorithm, it is necessary to manually adjust the binarization threshold and line width parameters, resulting in high labor and time costs, and the calculation is complex and inaccurate, affecting the measurement accuracy.
The fitness function and genetic algorithm are used to automatically select the optimal parameter combination by randomly setting and optimizing the binary threshold and line width parameters, reducing the need for manual adjustment and improving the extraction effect.
It reduces labor costs and time costs, improves the accuracy and robustness of the Steger algorithm, reduces the complexity of calculating the light bar width, and significantly improves the extraction effect of the light bar center line.
Smart Images

Figure CN118747732A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of three-dimensional measurement, and in particular to a Steger algorithm parameter dual adjustment optimization method for three-dimensional measurement of a workpiece. Background Art
[0002] In industrial manufacturing, the measurement of special-shaped workpieces in factories has become crucial. Ensuring its high precision and high efficiency is an indispensable part of the production process. In recent years, with the rapid development of science and technology, non-contact measurement has become a hot spot in measurement. Visual ranging is an important direction in computer vision research. It is widely used in robotics and automatic navigation, object recognition, precise measurement, 3D reconstruction and other fields. As a non-contact measurement method, optical measurement technology has the advantages of high precision, high efficiency, no physical contact and relatively low cost in non-contact measurement. At the same time, it can handle complex shapes and special materials. Therefore, it is widely used in industrial measurement. Among the optical measurement methods, the measurement method combining line structured light and monocular camera stands out among many optical measurement technologies with its unique advantages of low cost, high applicability and high efficiency. This technology mainly includes three key parts: measurement system calibration, extraction of line laser stripe center, and 3D reconstruction of objects. Among them, the extraction of line laser stripe center is an extremely important part of the entire measurement process, and its accuracy is directly related to the measurement accuracy of the final workpiece. For the extraction of fringe centers, the Steger algorithm is currently the mainstream and efficient method. The Steger algorithm is based on the Hessian matrix and has high accuracy and robustness. However, it has large computational complexity.
[0003] With the continuous advancement of science and technology and the increasing requirements for the extraction of the center of structured light stripes, the Steger algorithm also has some defects: (1) The traditional Steger algorithm first needs to set an appropriate binarization threshold (thresh) to process the workpiece image containing line structured light. For the extraction of the center line of light stripes, the selection of the threshold is crucial. A lower threshold may cause noise points or unnecessary pixels to be included, while a higher threshold may cause the details of the required extracted target to be lost. It is necessary to adjust the threshold to obtain the best extraction effect. Usually, it is necessary to adjust the threshold according to the specific image characteristics and requirements. By testing different thresholds and observing the results of the required part extraction, adjustments are made according to actual needs. Manual adjustment of threshold parameters often requires repeated experiments and adjustments, which greatly increases labor costs and time costs. (2) Secondly, the Gaussian filter parameter (σ) used to solve the Hessian matrix in the Steger algorithm is the standard deviation of the Gaussian filter. According to experiments and experience, usually, Where w is the line width. The selection of an appropriate line width parameter in the Steger algorithm is crucial to the effect of feature extraction. If the line width is set too small, it may lead to inaccurate feature extraction or loss of detail information. If the line width is set too large, the extracted features may be too blurred, which is not conducive to subsequent analysis and processing. The w parameter generally needs to be calculated or roughly estimated through the light bar width calculation formula. The light bar width calculation formula is as follows:
[0004]
[0005] Where M and N are the row numbers of the light strips. W(i) represents the width of the light strip of the i-th row. The above formula estimates the width of the light strip of the current row based on the cumulative sum of the differences between the widths of the light strips of adjacent rows, which is a complex calculation. Roughly estimating the line width may lead to distortion and inaccuracy, and the reliability and verification are low. The estimated result may be significantly different from the actual situation, and due to the lack of strict verification, the accuracy of the result cannot be fully guaranteed. Summary of the invention
[0006] The purpose of the present invention is to find the optimal combination of binarization threshold parameters and line width parameters in order to further improve the performance and accuracy of the Steger algorithm in the measurement of special-shaped workpieces using line structured light and a monocular camera, in the most critical part of stripe center extraction. On the one hand, it is no longer necessary to manually adjust the threshold parameters through a large number of repeated experiments, thus reducing labor costs and time costs; on the other hand, it not only reduces the complexity of obtaining the light stripe width layer by layer, but also is more accurate than directly roughly estimating the light stripe width.
[0007] The technical solution adopted by the present invention to solve the technical problem is:
[0008] The present invention provides a dual adjustment optimization method of Steger algorithm parameters for three-dimensional measurement of workpieces, the steps are as follows:
[0009] S1 performs binarization processing on the workpiece image containing line structured light during the measurement process and randomly sets the binarization threshold thresh and line width w in solving the Hessian matrix in the Steger algorithm;
[0010] S2 sets the fitness function to measure the performance of the Steger algorithm in extracting stripes under different parameters. This function evaluates the effect of extracting the center of the light stripe based on the set of pixels on the center line of the extracted light stripe. If the center points of the light stripe are denser and continuous, it indicates that the extraction effect may be better; on the contrary, if the center points of the light stripe are more sparse and fewer, it may mean that the extraction effect is not good.
[0011] S3 selects the parent individuals according to the output of the fitness function. For each parameter individual composed of different thresh and w, calculate its fitness value. The higher the fitness, the better the parameter combination. Then use the fitness ratio selection algorithm to select the best parameter individuals composed of different thresh and w.
[0012] S4 performs a single-point crossover operation on the parameter individuals with different thresh and w combinations after the optimal selection to generate offspring parameter individuals, that is, to generate new parameter individuals with different thresh and w combinations; performs a mutation operation on the new offspring parameter combination individuals to introduce randomness to increase the diversity of parameter individuals;
[0013] S5 executes the algorithm through an iterative cycle. In each iteration, the score of the fitness function is calculated, and excellent parent parameter individuals are selected for crossover and mutation operations to generate new child parameter individuals and update the current population. This selection, crossover and mutation process is repeated until the preset number of iterations is reached or the change in the fitness function value is small enough.
[0014] Furthermore, the fitness function setting algorithm in S3 is specifically as follows:
[0015] I. Set the consistency function to measure the consistency and stability between the extracted fringe center points. The consistency function is obtained by calculating the standard deviation of the extracted fringe center points, that is, formula (1).
[0016]
[0017] Among them, std(x j ) represents the standard deviation in the jth dimension, n represents the number of samples, x ij It represents the value of the i-th sample in the extracted data set on the j-th dimension. represents the mean value in the jth dimension.
[0018] II. Set the distance function to measure the density and aggregation of the stripe center points, that is, calculate the average distance from the stripe center points to their mean points. The distance function is obtained by calculating the average distance between the extracted center points and their mean points, that is, formula (2).
[0019]
[0020] Among them, x i is the i-th data point in the dataset. is the mean of the dataset (the average of all data points). Represents data point x i to the mean of the data set The Euclidean distance of . It means averaging the sum of the distances from all data points to the mean to get the average distance.
[0021] III. The fitness function is the sum of normalized consistency and normalized density. The higher the value, the better the fitness of the individual. Through the fitness function, the excellent individuals in the genetic algorithm can be evaluated and selected according to the consistency and density of the stripe center points. The fitness function is the sum of the normalized standard deviation and the normalized average distance, that is, formula (3).
[0022] fit = consistency norm +distance norm (3)
[0023] Among them, fit is the fitness function value, consistency norm is the value of the normalized standard deviation, distance norm is the value of the normalized average distance.
[0024] Furthermore, the fitness ratio selection algorithm is a roulette wheel selection method, which increases the chance of individuals with high fitness values being selected based on the fact that individuals with higher fitness values have a greater selection probability, and obtains the optimal binarization threshold thresh and line width w through iteration.
[0025] Furthermore, after S2 obtains the fitness scores of all parameter combinations, it is determined whether the optimal value of the fitness function has changed sufficiently small compared to the optimal value of the previous generation. If it is the first generation or the optimal value of the fitness function has not changed sufficiently small compared to the optimal value of the previous generation, proceed to the next step, otherwise the output ends.
[0026] The advantages and positive effects of the present invention are:
[0027] (1) The present invention can find the optimal binarization threshold parameter, which no longer requires a large number of repeated experiments and manual adjustments, thus reducing labor costs and time costs.
[0028] (2) The present invention can find the optimal line width parameter, which not only reduces the complexity of obtaining the light stripe width layer by layer, but also is more accurate than directly roughly estimating the light stripe width, thereby improving the performance and accuracy of the Steger algorithm in detecting the center line of the light stripe in the image.
[0029] (3) By finding the optimal parameter combination, the performance of the Steger algorithm in light strip centerline detection is successfully improved, and its accuracy and robustness are enhanced. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1The figure is a flow chart of the present invention applied to three-dimensional measurement of workpieces.
[0031] Figure 2 The present invention provides a flowchart of a method for finding an optimal combination of binarization threshold parameters and line width parameters.
[0032] Figure 3 The figure is a flow chart of the algorithm method for setting the fitness function of the present invention.
[0033] Figure 4 This is a comparative experimental diagram of light strip center extraction obtained by and without the algorithm of the present invention.
[0034] Figure 5 The present invention is applied to the measurement area of the three-dimensional measurement of the workpiece, where 1, 2, and 3 are the inner diameter of the workpiece, the depth of the groove, and the tail length, respectively. DETAILED DESCRIPTION
[0035] The present invention is further described in detail below through specific examples. The following examples are only illustrative and not restrictive, and the protection scope of the present invention cannot be limited thereto.
[0036] See Figure 2 , implementation Figure 1 The steger method for extracting the center of a fringe includes the following steps:
[0037] S1 acquires an image dataset containing different light strip features. Before loading the image dataset, the image is preprocessed, including removing noise and adjusting brightness and contrast, to ensure the consistency and reliability of image quality.
[0038] S2 sets the range of the search variable (thresh, w). Based on experience and previous experimental results, the initial range of the threshold thresh is set to [0.1, 0.9], and the initial range of the line width w is set to [1, 10].
[0039] S3 generates an initial 50 different parameter combinations and sets the mutation probability to 0.2 to ensure sufficient search and optimization of the parameter space.
[0040] S4 takes thresh and w as two key parameters for optimization, takes each parameter combination as input, calls the extraction function in the Steger() algorithm, and performs fitness calculation to obtain the fitness function value fit of each parameter combination. See the fitness calculation module for details. Figure 3 , the fitness verification module is specifically as follows:
[0041] I. Calculate the standard deviation of the extracted stripe center points using formula (1) to obtain the value of the consistency function.
[0042]
[0043] Among them, std(x j ) represents the standard deviation in the jth dimension, n represents the number of samples, x ij It represents the value of the i-th sample in the extracted data set on the j-th dimension. represents the mean value in the jth dimension.
[0044] II. The value of the distance function distance is obtained by calculating the average distance between the extracted center points and their means using formula (2).
[0045]
[0046] Among them, x i is the i-th data point in the dataset. is the mean of the dataset (the average of all data points). Represents data point x i to the mean of the data set The Euclidean distance of . It means averaging the sum of the distances from all data points to the mean to get the average distance.
[0047] III. Calculate the fitness function fit value through formula (3), that is, calculate the normalized consistency function consistency and the normalized density function distance.
[0048] fit = consistency norm +distance norm (3)
[0049] Among them, fit is the fitness function value, consistency norm is the value of the normalized standard deviation, distance norm is the value of the normalized average distance.
[0050] After obtaining the fitness scores of all parameter combinations, S5 determines whether the optimal value of the fitness function has changed sufficiently little compared to the optimal value of the previous generation. If it is the first generation or the optimal value of the fitness function has not changed sufficiently little compared to the optimal value of the previous generation, proceed to the next step, otherwise the output ends.
[0051] S6 still sorts all parameter combinations by fitness, and uses the fitness ratio algorithm to select the best parameter individuals with different thresh and w combinations. In each selection process, 15 individuals are selected from the parameter combination.
[0052] After the selection is completed, S7 performs a single-point crossover operation on the selected parameter combination individuals to generate new parameter combination individuals. At the same time, the new parameter combination individuals are mutated according to the specified mutation rate (0.2) to avoid falling into the local optimal solution.
[0053] S8 returns to step 4.
[0054] S9Finally, the experimental results of Steger algorithm for extracting the center of light strips are compared before and after the optimization parameters to verify the effectiveness of the invented algorithm.
[0055] See Figure 4 , a control experiment is conducted to verify the effectiveness and feasibility of the present invention. After optimization by the algorithm of the present invention, the optimal parameter combination is obtained, that is, thresh is set to 0.9 and w is set to 2. Among them, groups (a), (b), (c), (d), and (e) are the results of extracting the center of the light stripe using the Steger method without the algorithm of the present invention, and group (f) is the result of extracting the center of the light stripe using the algorithm of the present invention. Through the comparative experiment, the contribution of the optimization algorithm to the extraction effect of the center of the light stripe can be clearly evaluated, as well as the improvements in accuracy, continuity, noise points, and distortion before and after optimization.
[0056] from Figure 4 The experimental results can be used to draw the following analysis:
[0057] (a) When thresh is set to 0.7 and w is set to 2, since thresh is too small, the light strip center extraction algorithm responds to more areas of the light strip, resulting in certain noise points in the light strip center extraction and reduced accuracy of light strip center extraction; however, the choice of w value is more appropriate and the center line is more continuous.
[0058] (b) When thresh is set to 0.6 and w is set to 2, the noise points increase significantly due to the further reduction of thresh, and the light strip center extraction effect becomes worse.
[0059] (c) When thresh is set to 0.8 and w is set to 1, the extracted center line does not match the actual light strip center due to the small w value, which lacks accuracy.
[0060] (d) When thresh is set to 0.8 and w is set to 5, the center point of the extracted light strip is relatively distant due to the large w value, and the center line is too blurred and cannot maintain continuity.
[0061] (e) When thresh is set to 0.3 and w is set to 7, since thresh is too small, there are many noise points in the extraction of the light strip center, and the extraction of the light strip center is inaccurate; at the same time, the w value is too large, resulting in the sparse extraction of the center point and discontinuous center line of the light strip.
[0062] By optimizing the parameter combination (f), that is, when thresh is set to 0.9 and w is set to 2, the Steger algorithm extracts the center line of the light stripe better, the center line is more continuous, and the noise points almost disappear. Compared with the unoptimized case, the optimized parameter combination can better extract the center line in the image, and the pixel point set is more dense and continuous, showing a significant improvement. This shows that the algorithm of the present invention can effectively optimize the parameters of the Steger algorithm and improve the accuracy and stability of stripe extraction.
[0063] See Figure 5 , press the required measurement area of the workpiece Figure 1 The measurement data are shown in Table 1, Table 2 and Table 3. As can be seen from the table, the standard deviation of the measurement result of the workpiece of the present invention and the actual size of the workpiece is within 0.21mm, of which the depth standard deviation is within 0.19mm, and the error is small, which further verifies that the present invention has high accuracy in the three-dimensional reconstruction measurement of objects, which is in line with expectations. This algorithm can reliably realize the effective detection of the overall features of special-shaped workpieces in practical applications, and can accurately construct their three-dimensional morphology; ensure the accurate measurement of the workpiece size, thereby meeting the size requirements in engineering and production.
[0064] Table 1, Table 2, and Table 3 show the accuracy of the measurement results of the inner diameter, groove depth, and tail length of the workpiece measurement area applied by the present invention.
[0065] Table 1 Inner circle diameter measurement control group experiment (unit: mm)
[0066]
[0067] Table 2 Depth measurement of grooves in control group experiment (unit: mm)
[0068]
[0069] Table 3 Tail length measurement control group experiment (unit: mm)
[0070]
[0071] The above description is only a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several modifications and improvements without departing from the inventive concept, which all belong to the protection scope of the present invention.
Claims
1. A dual adjustment optimization method for Steger algorithm parameters for three-dimensional measurement of workpieces, characterized in that: Here are the steps: S1 performs binarization processing on the workpiece image containing line structured light during the measurement process and randomly sets the binarization threshold thresh and line width w in solving the Hessian matrix in the Steger algorithm; S2 sets the fitness function and calculates the fitness value of each parameter individual composed of different thresh and w. The higher the fitness, the better the parameter combination. Then, the fitness ratio selection algorithm is used to select the best parameter individuals composed of different thresh and w. S3 performs a single-point crossover operation on the selected parameter individuals with different thresh and w combinations to generate offspring parameter individuals, that is, generates new parameter individuals with different thresh and w combinations; performs a mutation operation on the new offspring parameter combination individuals to introduce randomness to increase the diversity of parameter individuals; S4 executes the algorithm through an iterative cycle, calculates the score of the fitness function in each round of iteration, selects excellent parent parameter individuals for crossover and mutation operations to generate new child parameter individuals, updates the current population, and repeats this selection, crossover and mutation process until the preset number of iterations is reached or the change in the fitness function value is small enough; The fitness function calculation formula is: fit=consistency norm +distance norm Among them, fit is the fitness function value, consistency norm is the value of the normalized standard deviation, distance norm is the value of normalized average distance; Among them, std(x j ) represents the standard deviation in the jth dimension, n represents the number of samples, x ij It represents the value of the i-th sample in the extracted data set on the j-th dimension. represents the mean value on the jth dimension; Among them, x i is the ith data point in the dataset, is the mean of the dataset (the average of all data points), Represents data point x i to the mean of the data set The Euclidean distance of It means averaging the sum of the distances from all data points to the mean to get the average distance.
2. The Steger algorithm parameter dual adjustment optimization method for three-dimensional measurement of workpieces according to claim 1 is characterized in that: The fitness function evaluates the effect of extracting the center of the light strip according to the set of pixels on the center line of the extracted light strip.
3. The Steger algorithm parameter dual adjustment optimization method for three-dimensional measurement of workpieces according to claim 2 is characterized in that: The fitness ratio selection algorithm is a roulette wheel selection method, which increases the chance of individuals with high fitness values being selected based on the fact that individuals with higher fitness values have a greater selection probability, and obtains the optimal binarization threshold thresh and line width w through iteration.
4. The Steger algorithm parameter dual adjustment optimization method for three-dimensional measurement of workpieces according to claim 3 is characterized in that: After S2 obtains the fitness scores of all parameter combinations, it determines whether the optimal value of the fitness function has changed sufficiently small compared to the optimal value of the previous generation. If it is the first generation or the optimal value of the fitness function has not changed sufficiently small compared to the optimal value of the previous generation, proceed to the next step, otherwise the output ends.
5. An application of the Steger algorithm parameter dual adjustment optimization method for three-dimensional measurement of workpieces according to any one of claims 1 to 4 in the field of three-dimensional measurement.
Citation Information
Patent Citations
An image segmentation method based on directional crossover genetic algorithm and two-dimensional maximum entropy threshold segmentation algorithm
CN109035258A
Cited By
Casting tool identification method and equipment and storage medium
CN119832256A
