1 Introduction

Laser measurement has been widely applied in many fields for its advantages of its advantages of high precision, high efficiency and non-contact. In industry, laser technology can be used for online monitoring of conveyor belt tearing [1]. For cultural relic protection and restoration, cultural relics nondestructive digitization can be realized by noncontact laser measurement technology [2]. Reverse engineering, welding inspection can also use this technology [3, 4]. In addition, 3D scanner has gradually entered into daily life and work. It can make the conversion from object to data come true. And 3D entities can be duplicated with the help of 3D printer, which helps to motivate our imagination and creativity, and also enriches our life [5, 6].

The hardware of 3D scanning system is usually composed of laser, camera and mechanical system. The laser acts as the light source which and the camera capture the light projected on the measured object's surface. The center of the laser stripe can be obtained by image processing using a certain algorithm, and 3D information of the object can be calculated through the location of laser stripe center and the parameters of the mechanical structure system [7, 8]. According to this method, Lin [9] et al. built a 3D desktop scanner for small complex objects, which costs low and can achieve high precision scanning. Li et al. [10] also used laser scanning and the structure from motion algorithm to improve the speed, accuracy and integrity of 3D scanning.

As the laser stripe has a certain width, more than one pixel of charge-coupled device (CCD) camera can receive the reflected light, so it is necessary to find out the center of the stripe with one-pixel-width before further calculation [11]. Accurately extracting the center of laser stripe from image is the key to ensure the success of scanning, and the accuracy of laser stripe center extraction directly affects the accuracy of 3D scanning. However, it is not easy to extract the center of laser stripe accurately because of the effect of scanning environment, the characteristics of scanned object and error of hardware equipment. The basic methods for extracting the stripe center include extremum method, threshold method, gray centroid method, etc. [12, 13]. Different methods often need to be adapted with different filtering methods to increase the accuracy if images are noisy. In addition, the accuracy of energy distribution model has an important influence on the extraction of laser stripe center. The pixel with maximum gray-scale value can be used as the center of laser stripe, which is the basic idea of extremum method [14, 15]. Sun [16] et al. thought that the energy distribution of laser stripe is approximately in accord with the uniform model. They proposed a laser stripe center extraction algorithm to achieve high robustness and precision. But more researchers think that the energy distribution of laser stripe is in the form of Gaussian distribution or skewed Gaussian distribution. Zhang Y [17] et al. studied the factors that can cause deviation of the laser stripe center and fitted the gray value of the pixel with Gaussian under the conditions of different laser incidence angles to get the law of the center deviation of laser stripe. Zhang L [18] et al. used gray centroid extraction method based on Otsu threshold to detect weld seam. This method can identify laser stripe better, but increases the computation and processing time. Song [19] et al. also used Otsu threshold method to extract pixels in light region. After filtering, the center of laser stripe was extracted by gray centroid method. 3D scanning experiment of object was carried out, and the STL model of object was obtained. When scanning the objects with high illumination and complex texture, the extraction accuracy of laser stripe would be reduced, so Hu [20] et al. came up with a normalized model to amplify the differences between laser stripe and background. They used an adaptive method and carried out the experiment of extracting laser stripe, getting a better effect. Li [21] et al. proposed an improved gray centroid method. After computing the center pixel of the laser stripe by tradition gray centroid method, each point is modified within an adaptive rectangular region to get a better extraction result.

The research of laser stripe extraction mainly focuses on how to improve the algorithm to extract the center accurately, or how to identify laser stripe accurately and quickly under specific operating conditions. If we can accurately recognize the waveform characters of laser stripe, we can choose or put forward more reasonable algorithms according to different waveform characters. The colors and materials of scanned objects for 3D scanners are often complex, and different colors and materials will lead to different waveform distribution of laser stripe. In addition, the average grayscale value of each pixel is used in most references. However, color photographs can be obtained by CCD camera. If the RGB intensity value is combined with center extraction algorithm, center extraction accuracy can be improved to a certain extent by using more information.

The rest of the paper is structured as follows: In Sect. 2, the characteristics of laser stripes received by CCD cameras with different laser stripe width, ambient light and different materials are obtained by experiments and classified; In Sect. 3, we study the extraction of several irregular light centers, and introduce weighted grayscale values. Extremum method, gradient method and gray centroid method are used to extract the center of laser stripe, and these methods under different conditions are compared; Discussion and conclusion are in Sects. 4 and 5.

2 Characteristics of laser stripe under different conditions

2.1 General rules of laser energy distribution

When the laser irradiates the measured object, the energy of laser stripe obeys Gaussian distribution. To obtain the energy distribution of laser, CCD camera is used to get the laser directly, and the picture of laser is taken. One of the transversal lines is chosen, and the gray-scale response curve of the laser is shown in Fig. 1. Under ideal conditions, the intensity of light on the surface of the object is Gaussian distribution. When an object is illuminated, the energy of original light will be divided into three parts: absorption, reflection and transmission (for opaque objects, the transmitted light is almost zero), and the proportion is different due to the different material and color of objects. The CCD camera mainly receives reflected light, including specular reflection and diffuse reflection. The reflection characteristics of objects varies with materials and surface of them, and the light obtained by CCD camera will be affected by ambient light. Considering the above factors, it is difficult for CCD camera to obtain a normal distribution of the light energy, which makes it difficult to extract the center of the laser stripe accurately. We mainly focus on the laser stripe width, ambient light intensity, the material of the scanned object and do experiments to analyze the influence of various factors on the characteristics of the light stripe.

Fig. 1
figure 1

RGB intensity response curve of laser

2.2 Influence of laser laser stripe width on its characteristics

For the laser selected in this experiment, the laser stripe width and brightness influence each other. The width and brightness of laser stripe determine the peak response and energy distribution, which are the two most critical variables that determine the accuracy of the extraction algorithm. In order to compare the effects of laser stripe width on the characteristics of the laser stripe, five groups of laser stripes with different widths were set up in this experiment. The laser stripe width was 1.0 mm, 2.0 mm, 3.0 mm, 5.0 mm and 9.0 mm, respectively, shown in Fig. 2.

Fig. 2
figure 2

a Laser stripe width 1.0 mm. b Laser stripe width 2.0 mm. c Laser stripe width 3.0 mm. d Laser stripe width 5.0 mm. e Laser stripe width 9.0 mm

For images of laser stripes with different stripe width, one of the transversal lines in each image is chosen, and the gray-scale response curve of the chosen line is obtained, as shown in Fig. 3.

Fig. 3
figure 3

RGB intensity response curves of different stripe width. a Laser stripe width 1.0 mm. b Laser stripe width 2.0 mm. c Laser stripe width 3.0 mm. d Laser stripe width 5.0 mm. e Laser stripe width 9.0 mm

It can be seen that lase stripes with different stripe width have different response characteristics. Because the laser is mainly red, the red response of the laser stripe is more obvious. When the laser stripe width is narrow, the energy is concentrated. The high energy will cause the CCD camera to enter the non-linear region, so a flat region appears at the top of the wave packet, and the peak disappears, which is not conducive to the extraction of laser stripe center. With the increase of stripe width, the characteristics of laser stripe begin to collapse from Gaussian distribution, and energy in the central area decreases. When the energy decreases, the laser stripe is more susceptible to the slight change of scanning object surface and the influence of CCD noise, that is, more noise points are generated, and the Gaussian distribution is no longer obvious. Therefore, it is favorable for laser stripe center extraction when the stripe width is in a reasonable range, but this reasonable range will also be affected by the material of the scanned object, the intensity of ambient light and other factors.

2.3 Influence of ambient light intensity on laser stripe characteristics

Ambient light is an important external factor affecting the response of the laser stripe, which produces direct interference to laser stripe we want to recognize. In laboratory conditions, we can use certain means to weaken the ambient light. But desktop 3D scanning devices are mainly for family, and the ambient light is uncontrollable, so it is one of the main factors that cannot be ignored. We set 0Lux, 77Lux, 150Lux and 211Lux, four different groups of ambient light, and carry out the experiment on stripe characteristics, shown in Fig. 4.

Fig. 4
figure 4

Laser stripes with different ambient light intensity. a 0Lux ambient light. b 77Lux ambient light c 150Lux ambient light. d 211Lux ambient light

For images of laser stripes with different ambient light intensity, one of transversal lines in each image is chosen, and the gray-scale response curve of the chosen line is obtained, as shown in Fig. 5.

Fig. 5
figure 5

RGB intensity response curves under different ambient light. a 0Lux ambient light. b 77Lux ambient light c 150Lux ambient light. d 211Lux ambient light

With the increase of ambient light intensity, the peak energy of laser stripe increases gradually until saturation is reached. With gradual enhancement of background light, the energy stripe of Gaussian distribution is gradually compressed upward, and the interference of background light on laser stripe center extraction will be enhanced. In conclusion, proper ambient light can increase peak energy of laser stripe, but it is not conducive to the recognition of laser stripe when the ambient light is too strong.

2.4 Influence of scanned object materials and colors on light stripe characteristic

The surface material of the scanned object is another important factor that effects the accuracy of lase center extraction. As a desktop-level scanning device, it must have good adaptability to daily necessities. For this reason, we choose ceramic, cloth, glass, metal, painting, paper and plastic and carry out the experiment on their laser stripe characteristics. The response curves are shown in Fig. 6. There are two types of light stripes for metallic materials. If the surface is smooth and the CCD camera is located at its mirror reflection position, a strong spot will be produced, whose stripe is shown in Fig. 6e. The rest of the metal material light stripe is shown in Fig. 6d.

Fig. 6
figure 6

RGB intensity response curves for different materials. a ceramic b cloth c glass d metal without strong reflection e metal with strong reflection f painting g paper h plastic

Different objects usually have different surface colors. According to the Raman reflection model, different color objects show different reflection and absorption characteristics. Four colors, red, green, blue and white, are selected for the experiment, and the material of them is paper. The response curves are shown in Fig. 7.

Fig. 7
figure 7

RGB intensity response curves for different colors. a red b green c blue d white

According to the pictures in Figs. 6 and 7, these stripes can be divided into four types: strong mirror reflection, diffuse reflection, absorption, strong transmission. These differences are expressed in the energy intensity, stripe width and shape of response curves. The response curves of some materials are quite different from Gaussian distribution, which will cause errors in laser stripe center extraction.

2.5 Classification of laser stripe

It is easier to extract the center of laser stripe if its energy distribution approximately obeys Gaussian distribution, but it is difficult to accurately extract the center of laser stripe in some other cases, such as bright spot, low brightness stripe and stripe with large width. The grayscale images of bright spot, low brightness stripe and stripe large width are shown in Fig. 8.

Fig. 8
figure 8

Grayscale images of laser stripe whose center are difficult to extract. a bright spot b low brightness stripe c stripe with large width

The bright spot is mainly due to the strong specular reflection of the scanned object. The pixel points received strong light are more than three times as much as that of normal situation, and the intensity of light is large enough to reach saturation. A lot of information about laser stripe center is lost and the stripe center will be difficult to extract. Figure 6e is a response curve of bright spot. Low brightness stripe waveform can be seen in Fig. 6c. It is caused by the larger proportion of transmitted or absorbed light of scanned object, resulting in lower reflection intensity, so less light can be received by the camera, and useful information is often susceptible to noise and random signal. Stripe with large width is mainly caused by wide stripe width of laser or some properties of object surface. Unlike bright spot, although it receives more pixels of light, it is not strong enough to reach saturation. The waveform of response curve shown in Fig. 3e is almost irregular, probably due to the fact that low energy is susceptible to interference. So stripe with large width is difficult to extract.

3 Laser stripe center extraction algorithm

Laser stripe center extraction is the recognition of laser stripe center in the CCD camera image. The method of laser stripe center extraction includes extremum method, gradient method, gray centroid method and so on. For standard Gaussian distribution, it is easy for every method to extract. But when the laser stripe width, brightness and environmental factors change, resulting in waveform changes, different methods will show different characteristics.

3.1 Extremum method

The intensity of laser stripe is higher than background, and the point with maximum gray-scale value can be used as the center of laser stripe, which is the basic idea of extremum method. The laser stripe center extraction formula of extremum method is as follows:

$$p_{\max }^{i} = \left\{ {\begin{array}{*{20}c} {(i,j), \, v_{{\text{(i,j)}}} = \max (V_{{\text{i}}} ) \, \max (V_{{\text{i}}} ){\, <\, 255 }} \\ {(i,j^{^{\prime}} ), \, v_{{{\text{(i,j}}_{{\text{t}}} {)}}} = \max (V_{{\text{i}}} ) \, \max (V_{{\text{i}}} ) \,=\, {255 }} \\ \end{array} } \right.$$
(1)
$$j^{^{\prime}} = \left(\sum\limits_{n = 1}^{n = t} {j_{{\text{n}}} }\right )/t$$
(2)

where, pimax is the point coordinate of laser stripe in line i; Vi is the gray-scale value used to extract laser stripe center of line i, and we can call Vi center extraction gray-scale value; v(i,j) is gray-scale value of point (i,j); t is the quantity of extreme points; j’ is the median coordinates after CCD saturation.

In addition, because the laser stripe light is red, its response value to red is higher than the other two colors, so using red value as the center extraction gray-scale value will get more obvious effect, that is, Vi in Eq. (1) is red response.

When grayscale response is not saturated, there is only one extreme point. However, when the grayscale response is saturated, the response of more than one point will reach the extreme value in the same line. Therefore, according to Gaussian energy distribution of laser stripe, the average coordinates of the extreme points can be regarded as stripe center.

However, when the response of CCD camera is saturated, it will be affected by random electronic noise. This will lead to an extraction error when using extremum method. Figure 9 shows the result of extremum method under the conditions of different widths and luminance, and Vi is also the red response.

Fig. 9
figure 9

Results of extremum method. a Laser stripe width 9.0 mm. b Laser stripe width 1.0 mm. c Laser stripe width 1.0 mm and low brightness

From experimental results of Fig. 9, it can be seen that the extremum method is better for extraction of low brightness and narrow stripe width, as shown in Fig. 9c. Under low brightness condition, the average energy of laser stripe is low, making CCD work in a linear region, and an acceptable accurate can be gotten with extreme method. However, because the image that CCD camera gets is in low energy, it will be affected by random signals. When the brightness is increased, as shown in Fig. 9b, the response of CCD camera is in saturated region. Some information of laser stripe center is lost, so the extraction result is not satisfactory. For the wider laser stripe, as shown in Fig. 9a, the extraction with extremum method is poor.

The extremum method used above only takes advantage of grayscale value or red response. It can be seen from the waveform characteristics of laser stripe that although red dominates, when the red response is saturated, the green response and the blue response still have some characteristics of Gaussian distribution. Therefore, the calculation of Vi in extremum method can be corrected appropriately, and laser stripe can be extracted by using the weighted gray value. The calculation of Vi is as follows:

$$V_{{\text{i}}} = r_{1} R + r_{2} G + r_{3} B$$
(3)

where, R,G,B are the grayscale value of red, green and blue response; r1, r2, r3 are the weight of red, green and blue grayscale value. In the calculation of grayscale value, r1, r2 and r3 are all taken 1/3.

To get the result of Fig. 10, [r1, r2, r3] = [1, 0, 0], this method can be called R-value extremum method. If we give green and blue a certain weight although red dominates, we can get the weighted gray value extremum method. For bright spot, we use two extremum methods to extract the center of the laser stripe. The weighted gray value extremum method takes [r1, r2, r3] = [0.7, 0.2, 0.1], and the result is shown in Fig. 10.

Fig. 10
figure 10

Laser spot and recognition results. a R-value extremum method. b Weighted gray value extremum method

As can be seen from Fig. 10, when the specular reflection is strong and the reflective spot appears, the laser stripe extraction result of R-value extremum method will no longer be the center of stripe. For weighted gray value extremum method, good experimental results are obtained. It can be seen that by adjusting the weight of RGB value, the influence of spot can be reduced by making use of the insensitivity of G value and B value to red light. Also, the larger weight of R value is retained so that the original laser line at the center can be correctly identified.

3.2 Gradient method

The laser irradiates the scanned object and leaves a laser beam on the surface of the scanned object. The laser has a clear boundary against its background, so grayscale value gradient can be used to identify the left and right edges of the laser stripe and the center of two edges can be regarded as the laser stripe center. This method can be called gradient method. The gradient method assumes that the laser stripe obeys a uniform distribution to some extent, and the middle point of left and right is the center of laser stripe. The algorithm is as follows:

$$\begin{gathered} gradient_{{\text{(i,j)}}} = v_{{\text{(i,j)}}} - v_{{\text{(i,j - 1)}}} \hfill \\ p_{\max }^{i} = \frac{{(p_{{\text{l}}}^{i} + p_{{\text{r}}}^{i} )}}{2} \hfill \\ p_{{\text{l}}}^{i} = \max (gradien_{{\text{i}}} ),p_{{\text{r}}}^{i} = \min (gradien_{{\text{i}}} ) \hfill \\ \end{gathered}$$
(4)

where, gradient(i,j) is the gradient of point (i,j); \(p_{{\text{l}}}^{i}\), \(p_{{\text{r}}}^{i}\) are the coordinate of left edge and right edge.

Similarly, we take the weighted gray value for analysis, weight [r1, r2, r3] = [0.7,0.2,0.1]. For bright spots, low brightness stripe and stripe with large width, results of gradient method are shown in Fig. 11.

Fig. 11
figure 11

Results of gradient method. a bright spot b low brightness stripe c stripe with large width

As can be seen from Fig. 11, although the bright spot affects the overall shape of the stripe, the bright spot is still symmetrical, so extraction effect is not greatly affected. Figure 11b is extraction result of the laser stripe under the condition of stripe width 1.0 mm and light intensity 30lux. The gradient method extracts a completely horizontal light center with excellent results. One of the reasons is that CCD camera works in linear region and its whole distribution can be obtained without distortion. Another reason is laser convergence, and the edge of the stripe is obvious. Even in the case of low brightness, there is still a large grayscale step, so it can be better recognized. Figure 11c is the result of the extraction of 180lux and 9.0 mm laser stripe. It can be seen that with the increase of stripe width, the edge characteristics become blurred, even if brightness increases, the edge can still be seen to have greater randomness. When the curvature of object surface varies greatly, it is easy to cut the laser surface into a wide laser stripe, and an unreliable result will be got by gradient method.

3.3 Gray centroid method

The gray centroid method is a method of detecting laser stripe center after we have known laser stripe area. Therefore, it is necessary to confirm the laser stripe area by threshold method, that is, remove the pixels whose gray value is less than a certain threshold, and then calculate the remaining points according to the following formula:

$$p^{i} = \frac{{(\sum {V_{{\text{(i,j)}}} j)} }}{{\sum {V_{{\text{(i,j)}}} } }}$$
(5)

where, pi is coordinate of laser stripe center of line i; j is the coordinate of laser stripe area.

The above formula shows that the gray centroid method is completely consistent with the Gaussian distribution characteristic of laser stripe. By increasing the weight of high brightness points and reducing the weight of low brightness points, the Gaussian distribution center of laser stripe is obtained. It can be seen that the gray centroid method uses the information of overall wave packet and is not susceptible to random factors.

Extremum method and gray centroid method are used to extract the center of low brightness stripe and stripe with large width respectively. The grayscale values used in calculation are weighted gray values. The weight of each color is the same as mentioned above. The results of extraction are shown in Fig. 12.

Fig. 12
figure 12

Comparison between extremum method and gray centroid method. a low brightness stripe b stripe with large width

As can be seen from Fig. 12, the gray centroid method has a very high recognition accuracy in the extraction of stripe with large width which is poor in other laser stripe processing algorithms. Because the gray centroid method uses the information of the whole laser stripe to weighted average, the recognition accuracy of the gray centroid method is better.

From the Fig. 12a, we can see that the gray centroid method has broken lines in the recognition of low brightness stripe. The gray centroid method is used to calculate the laser stripe after threshold calculation. For low brightness stripe, a global threshold may cause some lines whose response is under the threshold cut down, resulting in broken lines. So a variable threshold method is needed. The wave packet characteristics obtained under different conditions in the second section can be used as reference for threshold selection.

In addition, the above analysis shows that the weight matrix [r1, r2, r3] is also an important factor affecting the final processing results. The R value response is the strongest and can reflect the laser characteristics best, so larger weight should be given. However, with the increase of ambient light, G value shows a high normality. The common weight matrix [r1, r2, r3] = [1, 0, 0] used in the experimental processing is suitable for the stripes with low laser brightness. Weight matrix [r1, r2, r3] = [0.7, 0.2, 0.1] is suitable for high brightness stripes. When R value has been in the saturated response region, G and B value can be used to modify it. With the increase of brightness, the weight of G and B value should be gradually increased.

3.4 Laser stripe center extraction results

Except bright spot, low brightness stripe and stripe with large width, stripe in other phenomenon are easy to extract. Quantitative results have been done in this section.

The paper is selected as the material and the color is white. The pixel positions of laser stripe center in each line with the width of 1.0 mm, 2.0 mm, 3.0 mm, 5.0 mm and 9.0 mm are calculated by different extraction methods. After a linear fitting of the pixel positions of each line, standard deviations of extracted pixel position and fitting pixel position are calculated. The results of extremum method and gradient method are used for calculation. R-value (weight matrix [1, 0, 0]), gray value (weight matrix [1/3, 1/3, 1/3]) and weighted gray value (weight matrix [0.7, 0.2, 0.1]) are respectively used, and the results are shown in Fig. 13a. The pixel positions of laser stripe center in each line with ambient light intensity of 0Lux, 77Lux, 150Lux and 211Lux are calculated by different extraction methods in the same way, and the standard deviations are shown in Fig. 13b.

Fig. 13
figure 13

Standard deviations of different methods. a different laser stripe width b different ambient light intensity

With the increase of laser stripe width, a large error can be found in all extraction methods. For smaller laser width, the gradient method is better than the extremum method. With the increase of laser stripe width, the error of gradient method increases significantly. It can be seen from Fig. 3e that the gray value of large stripe width changes greatly, and sometimes the place where the gray value changes greatly is not at the edge of the laser stripe, which results in large error by gradient method. The method by R-value and weighted gray value with weight matrix [0.7, 0.2, 0.1] shows a similar result, and it is better than the method by gray value (weight matrix [1/3, 1/3, 1/3]).

For different ambient light, larger ambient light will increase the error, and there is little difference between the extreme value method and the gradient method. With the increase of ambient light intensity, the error by using average gray (weight matrix [1/3, 1/3, 1/3]) increases slower than other methods, mainly because this method also makes use of the ambient light.

Before extracting by gray centroid method, the region should be segmented to obtain the area containing laser stripe. The easiest way is to set a specific intensity as the threshold. If the threshold value is too small, the background which has not been removed will affect the accuracy of extraction. If the threshold value is too large, on the one hand, some useful information will be removed. On the other hand, for the light stripe with small gray value, the information of the whole line may be removed, and broken lines can be found. Take the threshold values of 50, 100 and 150 intensity respectively, and calculate the standard deviation of the extraction results three kinds of gray values. The standard deviations of different gray values of different laser stripe width are shown in Table 1, and the standard deviations of different gray values of different ambient light intensity are shown in Table 2.

Table 1 Standard deviations of different gray values of different laser stripe width by gray centroid method
Table 2 Standard deviations of different gray values of different ambient light intensity by gray centroid method

From two tables, it can be seen that the gray centroid method has high extraction accuracy, and the standard deviation of line fitting is generally less than 1 pixel. The standard deviation of the best extraction result under different ambient light intensity is 0.2–0.35 pixels. If the threshold value is too large, broken line phenomenon may happen, and the stripe center cannot be extracted, which has no standard deviation number in two tables. In a dark environment, a lower threshold can remove the background. However, in the case of strong ambient light, the extraction result is related to the selection of threshold, and the unreasonable threshold will cause poor extraction effect. For the selection of the three weighted matrices, the average gray value (weighted matrix [1/3, 1/3, 1/3]) is more likely to cause broken line phenomenon, and the extraction effect is poor. The extraction results of the other two weighted matrices are similar.

4 Discussion

Laser scanning has been applied in many fields. In most cases, it is often only for specific materials and environment. The characteristics of light stripe are almost consistent, so a specific method can be selected to extract the stripe center. In ref. [22], Wang et al. used line structured light for on-line measurement of rail profile, and gradient method was used to obtain the stripe center. In their study, only metal material in laboratory conditions was measured. In ref. [23], pseudo-stem diameter of banana was measured by 3D reconstruction algorithm by a low-cost device to estimate the crop health and growth of the plants. This study is aimed at the desktop-level low-cost device, which should have a wide range of adaptability, so the reflective light characteristics of different objects need to be considered, but there are few studies on this point.

The desktop-level equipment does not require high precision, so it can be realized by simple extraction algorithm. In ref. [13], Li D et al. chose Gaussian filter for gray value of the image to get the center of each transversal line, which means a large amount calculation should be used. In ref. [21], Li Y et al. used an improved gray centroid method combining with tangential vector. After fitting the extracted points using the moving least squares algorithm, sub-pixel accuracy was obtained. However, these algorithms need more computing time, and researchers often only aim at specific materials and environments, which may not have universal adaptability. Using these algorithms in different situations may not get better results. In this paper, we study the extraction effect of three methods which are almost the simplest. On the whole, the extraction error of gray centroid method is less than 1 pixel, which is consistent with the results of ref. [21].

The threshold should be used to segment the image area first by gray centroid method, and the selection of the threshold has a certain influence on the extraction results. In ref. [24], Zhang et al. chose the different threshold in different transversal lines. They used the threshold which is 10–20 smaller than the maximum gray value, and desirable extraction accuracy was achieved.

As for the weighted gray method, few scholars focused on it. The weighted matrices of the three gray values used in this paper are [1, 0, 0], [0.7, 0.2, 0.1], [1/3, 1/3, 1/3]. From the results, the weight has an impact on the error, in some cases, the influence is relatively large, but the influence results are not very consistent. If the ambient light is strong, the effect is better when the weight of the three colors is close. When the ambient light is dark and the light is concentrated, the error of using larger red weight will be smaller. But the choice of weight needs further study.

5 Conclusion

This paper focuses on the research of stripe extraction of desktop 3D laser scanner. Because desktop 3D scanners are mainly used in daily life and work, they must be widely adaptable to common objects. Under different conditions, the characteristics of laser stripe received by CCD camera are not exactly the same. Firstly, the characteristics of reflective laser stripe of the scanned object with different laser stripe width, ambient light intensity and different materials are obtained by experiments. The laser stripe grayscale value of red, green and blue response and its characteristics are analyzed. Extremum method, gradient method and gray centroid method are used to extract the laser stripes under different conditions, and the characteristics of each method are obtained by comparison. The main conclusions of this paper are as follows:

  1. (1)

    The characteristics of laser stripe energy distribution received by CCD camera under different conditions are obtained through experiments. Among them, the waveforms of bright spot, low brightness stripe and stripe with large width are complex or easily disturbed, so it is difficult to extract the center accurately.

  2. (2)

    In the study of algorithm, gray centroid method has shown a good extraction result in most cases. However, to low brightness stripes, this method may cause broken line due to unreasonable threshold selection, and its calculation efficiency is low. The gradient method mainly uses the information of laser stripe and background boundaries, and the extraction result is good under the condition of low brightness, but the extraction precision is not high under the condition of large width. The extremum method has poor extraction effect, and only applies to the case of low accuracy.

  3. (3)

    The characteristic quantity used in extraction process is the weighted gray-scale value. Red light is the main component of the laser used, so a large weight is given to distinguish stripe from the background. But red is easy to reach saturation. Meanwhile, green and blue have some properties of Gaussian distribution. So give green and blue certain weights so that after the saturation of red, the value of different pixel points still has a certain distinction.

  4. (4)

    For quantitative results, gray centroid method shows the best extraction result, but the threshold has an obvious effect on accuracy. The gradient method shows a better extraction result in small laser stripe width than extremum method, while for large laser stripe width, it performs worse than extremum method. For different ambient light intensity, weight matrix plays an important role to extraction result.

In the aspect of the use of weighted gray value, this article only made a preliminary study. The results of this paper show that this method is effective than the conventional grayscale method. But how to determine the weight more reasonably in different conditions remains to be studied.