{'fraction_non_alphanumeric': 0.018775425054761655, 'fraction_numerical': 0.0029206216751851465, 'mean_word_length': 4.673372781065089, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
An Optimal Method for Extracting the Center of Light Stripes

A method for extracting the center of the light stripe to effectively reduce the environmental noise is proposed in this paper. The block matching algorithm is adapted to use the global information in the structured light image to group image blocks with similar light stripe structures. The center coordinates of the light stripe in each group of image blocks are extracted by the gray gravity method, and its average value is used as the final center of light stripes in the similar image block, which reduces the influence of random noise on the accuracy of the extraction algorithm.


Introduction
The line structured light method is a common visual measurement method to obtain three-dimensional information on the surface of the measured object. In the actual measurement process, the width of the light stripe in the captured image is usually a few to dozens of pixels, the center of the light stripe should be accurately extracted from the image [1] . It is a key step to achieve measurement. When performing linear structured light detection, the light stripe is projected onto the surface of the measured object. Due to the different surface characteristics, three-dimensional shape, projection intensity and ambient light intensity of the measured object, it interferes with the imaging quality of the laser fringe image, which limits the extraction of the center of the light stripe [2] . Actually, there are similarities in the structured light stripes produced by a same laser projector, the light stripes have a fixed pattern of light intensity distribution, and present a similar light stripe structure in the acquired laser fringe image. In the image acquisition process, the presence of noise causes gray differences in the neighbors of similar light strips. Extracting the center of light strips with similar structures in the global image and using its average value as its center coordinates can effectively reduce noise interference and improve extraction accuracy.
In this paper, skeleton refinement algorithm is used to extract the central pixel of the light stripe, and an image block containing the basic structure of the light stripe in the neighbors of the central pixel is constructed. The light stripe structures with higher similarity are searched through block matching. Finally, the coordinates with a higher precision are extracted through the image global light stripe information.  Figure 1 Steps of center extraction algorithm based on block matching.

The extraction algorithm of the light stripe center
The steps of the algorithm for extracting the center of the light strip are shown in Figure 1: First, perform threshold processing on the captured structured light image, convert it into a binary image, refine the skeleton of the binary image, and peel it layer by layer to obtain the center pixel of the light stripe. Then, an image block containing light strip information is generated in the neighbors of each center pixel, and it is used as the basic unit for extracting the sub-pixel coordinates of the center of the light strip. Then use the block matching method to divide the image blocks with a certain degree of similarity into different block matching groups, obtain the gravity coordinates of the light strip structure in the group, use the gray gravity coordinates of the same group as the coordinate deviance at different position. Finally, the coordinate deviance is added to the corresponding center pixel coordinates of the respective image blocks in the group to obtain the sub-pixel coordinates of the center of the respective light stripe.

Skeleton refinement algorithm
Skeleton refinement algorithm is used in the structured light image to obtain the pixel-level coordinates of the center of the light stripe [3] . Firstly, the threshold segmentation is performed on the structured light image to obtain the binarized image of the segmented light stripe contour, and then the light stripe contour is refined layer by layer until the single-pixel skeleton of the contour is obtained, and the center pixel coordinates of the light strip are obtained in final.
This paper uses the threshold processing of local mean and standard deviation to extract structured light stripes, which can achieve better results when processing images with uneven background illumination. The algorithm first determines a fixed-size template, and determines the threshold of the center pixel of the template by calculating the standard deviation and mean of the template. The calculation formula is: where f (x, y) is the image before processing, g(x, y) is the image after processing, σ xy , m xy are the standard deviation and mean value of (x, y) neighbor pixels, a and b are constant coefficients. Traverse the entire image, the obtained binary image g(x,y) has a light stripe area of 1, and the rest is 0.
Then perform the skeleton refinement operation on the binary image, construct the 3×3 neighborhood of any pixel in the image to refine the skeleton of the binary image to obtain the center pixel of the light stripe.

Block matching
Generate an image block of size k×k (k is an odd number) in the neighbors of the center pixel of the light stripe extracted by the skeleton thinning method, and use it as the basic unit for extracting the center coordinates of the light strip, and use the block matching method to search for a certain similarity of 3 light stripe structure. Image blocks at the center pixel are generated from the structured light image I, P represents the query block, and Q represents the image block matching the query block. When the similarity between P and Q is less than a certain threshold, it is deemed that the two are similar to belong to the same group. In the search process, the distance of the image block is represented by d (P, Q). (2) where d represents the distance between two image blocks, the numerator represents the modulus of the query block and the matching block, and the denominator represents the size of the image block. The matching blocks whose distance from the query block P is less than a certain threshold constitute the group S P .
where τ represents the similarity threshold between the matching block and the query block. When the difference between the two images is less than τ, the two image groups are deemed to have high similarity and have the same light stripe center coordinates [4] .

Light stripe center coordinate extraction
The light stripe image blocks in the group S P have high similarity and contain the same light stripe structure. Using the mean value of their coordinates as the true value of the center coordinates of the light strip can reduce the interference of noise on the extraction of the sub-pixel center of the light stripe.
Let C(x C , y C ) be the central pixel extracted by the skeleton thinning method, P is the query block of size k×k centered on point C, and S P ={Q i I} is the matching block similar to this point Set, in each matching block, the gray gravity method is used to extract the center of the light strip. The pixel set in the x direction of the center point in the matching block is G x (x,y), and the pixel set in the y direction is G y (x,y). Then the sub-pixel positioning of the center of the light strip in the image can be determined by the center of gravity method [5] as Assuming n is the number of matching blocks in S P , find the center coordinates of the light stripe for all matching blocks in S P , and finally use its average value as the sub-pixel coordinate deviation of the center of the light stripe in the block matching group.

Experiment
Generate 10 multi-line structured light images with a multi-line Gaussian distribution with a peak value of 180 and a standard deviation of 2 as shown in Figure 2 (a), and the center of the fringe is equally spaced. In the experiment, the improved algorithm based on block matching, the traditional gray gravity method and the Steger method were used to extract the center line of the light strip in the image with a noise variance of 0.01, and their effects were compared. Figure 2 (b) is a partial enlarged view of the three algorithms when extracting the center line of the light strip. It can be seen that the gray gravity method is susceptible to noise interference when extracting the center image of the light stripe, and the error is large. The algorithm in this paper and the Steger algorithm are closer to reality light stripe center. Figure 2 (c) shows the average deviation of the center of the light strip on different light strips extracted using three algorithms. It can be seen that the accuracy of the algorithm proposed in this paper is higher than that of the traditional gray gravity method, and the average deviation is maintained at about 0.05 pixel, and the error is smaller. The error comparison of different methods for extracting the center line of the light stripe.

Conclusion
Line structured light is often affected by noise when extracting the center of the light stripe, which limits the accuracy of center extraction. This paper uses the global information in the structured light image to group image blocks with similar light strip structures through the block matching method, and obtain each light stripe structure group of the image. The center coordinates of the light stripes in the image block are taken as the final light stripe center coordinates, which reduces the influence of the random noise of the light stripe image on the accuracy of the extraction algorithm.