Abstract
This article presents a novel line segment extraction algorithm using two-dimensional (2D) laser data, which is composed of four main procedures: seed-segment detection, region growing, overlap region processing, and endpoint generation. Different from existing approaches, the proposed algorithm borrows the idea of seeded region growing in the field of image processing, which is more efficient with more precise endpoints of the extracted line segments. Comparative experimental results with respect to the well-known Split-and-Merge algorithm are presented to show superior performance of the proposed approach in terms of efficiency, correctness, and precision, using real 2D data taken from our hallway and laboratory.
Introduction
In order to fulfill high-level tasks, autonomous localization and environment perception are indispensable functions of a mobile robot. 1,2 As for robot localization, proprioceptive sensors such as odometry and inertial sensors cannot avoid the problem of error accumulation, 3 thus exteroceptive sensors need be used together to achieve effective localization and mapping. 4 –7 Among various external sensors, two-dimensional (2D) laser sensors could provide precise and reliable environmental information with a large view angle, and thus they have been widely used in perception tasks including localization, mapping, and place recognition. 8 –11 To make a full use of laser information, in addition to point clouds, point and line features are important for map representation and localization. 12 –16
Compared with point features, line segment features are potentially valuable for higher level understanding of the environment, especially in the hallway, office area, and other semi-structured indoor environments. Therefore, on the basis of line segments, many algorithms of localization, mapping, and place recognition have been proposed. In the study by Lee et al., 17 the authors deal with outdoor place recognition using only line segments, which increases the robustness against changes of environments. The work by Lu and Song 18 proposes a heterogeneous landmark-based visual navigation approach for a monocular mobile robot, using an elegant combination of line segments and other visual features. In the study by Pfister et al., 19 the authors proposed a mapping algorithm to find the line-based map that best fits 2D laser data using Hough transform. Brunskill and Roy 20 presented a new simultaneous localization and mapping (SLAM) approach using incremental probabilistic principal component analysis (PCA), which clusters 2D laser data into line segments using the probabilistic PCA algorithm. Meanwhile, in the study by Nguyen et al., 21 a lightweight SLAM algorithm named OrthoSLAM is presented and experimentally validated, which uses mapping between lines that are parallel or perpendicular to each other in most structured environments. In the study by Abeles, 22 a robust local localization algorithm that uses line segments extracted from raw 2D laser data has been presented. An et al. 23 introduced an algorithm of plane extraction using line segments for three-dimensional mapping, which largely reduces the complexity. In the study by Mazuran and Amigoni, 24 the authors exploited the mutual compatibility for line segment matching in different scans. Although line segment features are widely used, in some practical applications, the performance of existing algorithms online segment extraction is unsatisfactory, in terms of the efficiency, correctness, and precision.
In this article, we propose a novel algorithm of line segment extraction using 2D laser data based on seeded region growing. Different from traditional approaches, the proposed algorithm borrows the idea of seeded region growing in the field of image processing, which is more efficient with more precise endpoints of the extracted line segments. At first, using the orthogonal least square approach together with a bearing-based condition, we present a seed-segment detection approach. Once a seed-segment is detected, it will be extended to be a full line segment through the proposed region growing technique, which helps improve the computational efficiency and correctness without iterative fitting process. In addition, overlap region processing and endpoint generation determine the endpoints of line segments with high precision. Experimental results show that our proposed algorithm has a better performance than the well-known Split-and-Merge 15,25 in terms of efficiency, correctness, and precision. The target of this work provides basis for localization, mapping, and place recognition with high-level information, which could help solve the “kidnapped robot” problem and loop closure. 19
The main contributions of this article include following aspects: (1) a new line segment extraction algorithm based on seeded region growing with 2D laser data; (2) more precise endpoints of extracted line segments; (3) experimental results show that our algorithm presents better performance in three aspects: efficiency, correctness, and precision.
The organization of the rest article is as follows. In the following section, we review related work. “Line segment extraction” section describes the process of line segment extraction using 2D laser data. The comparison criteria and experimental results are described in the “Experiment” section. Finally, some conclusion and future work are outlined.
Related work
An overview of existing works of line segment extraction is presented in “Existing algorithms” section. In “Seeded region growing” section, it is shown how seeded region growing is related to our algorithm. Finally, a summary is given to justify the proposed idea.
Existing algorithms
Line extraction using 2D laser data has been studied in many existing works. 15,26 Pavlidis and Horowitz 27 proposed Split-and-Merge, which becomes one of the most popular line segment extraction algorithm. Another successful implementation of Split-and-merge is Iterative-End-Point-Fit, as shown in Figure 1, which has been widely used in mobile robotics. 23,25,28,29 Siadat et al. 28 introduced a fast and simple algorithm called “Line-Tracking.” In addition, another line segment extraction algorithms are also proposed, including Line-Regression, 30 Hough-Transform, 19 and so on. A comparison of line segment extraction for indoor mobile robotics has been put forward in the work, 15 which concludes that Split-and-Merge provides the best performance among existing algorithms via comparative experiments.

Iterative-End-Point-Fit algorithm.
However, the process of Split-and-Merge works on the overall scan data, other than considering line segments separately. For this reason, breakpoints may appear in line segments to make them incomplete. One typical example is shown in Figure 2. Meanwhile, recursive manner leads to the performance degrading in the computational efficiency.

A typical example, using Split-and-Merge (the green solid line represents the complete line segment and it is broken by the red star breakpoint).
Seeded region growing
Seeded region growing 31 is an effective method for image segmentation, which is widely used in image processing. The main function of seeded region growing is to partition an image into regions. Fan et al. 32 conducted an extensive and comparative studies about seeded region growing, and then they propose an automatic seeded region growing algorithm and a seed tracking algorithm. The work by Fan and Lee 33 relaxes the constant grey value assumption and proposes a stable seeded region growing algorithm.
Conventional seeded region growing is a local method with no global view of the problem and thus it is sensitive to noise. However, laser data are more reliable and accurate compared with image data, seeded region growing using laser data presents satisfactory performance. 34,35
Summary
In this article, we treat the line segment extraction problem as a special kind of region segmentation. Different from existing algorithms, our proposed algorithm uses seed-segment and region growing instead of recursion and breakpoint detectors. Thus, the efficiency and correctness are improved in the extraction process. In order to obtain the precise endpoints of line segments, the processes of overlap region processing and endpoint generation are proposed. In the summary, through the design of seed-segment detection, region growing, overlap region processing, and endpoint generation, the proposed algorithm achieves superior performance, in terms of efficiency, correctness, and precision.
Line segment extraction
This section presents the proposed line segment extraction algorithm using 2D laser data based on seeded region growing, which is different from previous methods. At first, orthogonal least squares are explained in the “The orthogonal least square method” section. The “Seed-segment detection” section describes the process of seed-segment detection. The following subsections provide an effective solution to extracting complete line segments from seed-segments, including region growing, overlap region processing, and endpoint generation. The overall block diagram is shown in Figure 3

Overall block diagram.
The orthogonal least square method
The standard least square method for line fitting may yield unsatisfactory parameter estimation results, because it only minimizes the vertical distance of each point from the line. For this reason, the orthogonal linear fitting method, 36 which minimizes the perpendicular distance of each point from the line and is adopted in this article to obtain satisfactory line fitting results.
Let a line denoted by ax + by + c = 0, with a, b, and c being coefficients, and at least one of a and b is not zero, the distance d from a point (x, y) to this line is given by
Accordingly, the sum of squares of distances of a number of n points to the line is given by
with di being the distance of the i th point to the line. Take the partial derivatives of f(a, b, c) with respect to a, b, and c, then set them equal to zero, we can obtain the parameter estimation results.
Seed-segment detection
Every complete line segment is obtained from a seed-segment, which consists of a small amount of successive 2D laser points. In the whole process of line segment extraction, a precise method about seed-segment detection plays a significant role. Therefore, the detection of a seed-segment is very strict, which needs to satisfy some conditions.
At first, several successive laser points are used to fit a straight line by the means of orthogonal least squares, parameters (a, b, c) are obtained after the line fitting process. Ideal seed-segment should satisfy following two requirements.
(1) Distance from point to line. The distance from every point in the seed-segment to the fitting straight line should be less than a given threshold ∊, which has been set to range precision of the laser. In this article, the model of the laser sensor we used is UTM-30LX, so the threshold is set as ∊ = 0.03m.
(2) Distance from point to point. The distance from every point in the seed-segment to its predicted position also should be less than a given threshold, which is an empirical threshold δ, where the threshold is set as δ = 0.1m. This requirement prevents the seed-segment from including breakpoints, which is described in detail in Figure 4
where the predicted point
where the parameter θ is the bearing of the laser pointer. Accordingly, the predicted position (

The predicted position of laser point (the blue solid line obtained by fitting six consecutive points; the red dashed line obtained by the bearing of the laser point).
The candidate that satisfies above requirements will be considered as a seed-segment, which is the beginning of the region growing process. The whole algorithm of seed-segment detection is shown as algorithm 1.

Seed-segment detection
In algorithm 1,
Region growing
As a typical image segmentation method, 31 region growing examines neighboring pixels of initial seed points and determines whether the pixel neighbors should be added to the region.
In this article, we apply the idea of region growing to line segmentation, and the main goal of laser line extraction is to partition 2D laser data into some line segments. The unique property of the laser points in the same line segment is the distance from themselves to the fitting straight line, which are all less than a given threshold.
The process of region growing will be excited when seed-segment detection is successful. When a laser point is added into the line segment, we will refit current line segment. Let Line(Pb, Pf) describes a line segment from point Pb to point Pf and distance(P, Line) denotes the distance from a point P to a straight line Line.

Region growing
Overlap region processing
Some complete line segments are got from the 2D laser data after region growing, but two adjacent line segments may have an overlap region, as shown in Figure 5, which will have some negative influence on the description of environment structure.

Formation of an overlap region (collinear relationship).
Two overlap adjacent line segments have two spatial structure relationships: collinear (Figure 5) and non-collinear. For the former, we refit all laser points belonging to two adjacent line segments. In addition, the process of dealing with overlap region is to compare the distance from a laser pointer to a different line segments for the latter, this method is algorithm 3.

Overlap region processing
Endpoint generation
After the above steps, the line parameters (a, b, c), start point index m, and endpoint index n of the line segment can be obtained. The endpoints of line segments can be calculated from the fitting straight line and its vertical line, this method is shown in Figure 6. According to this rule, the proposed method has good consistency for the obtained endpoints of the line segments.

Endpoint (red cross represents the endpoint).
Assume that the formulas of the straight line and its vertical line are as follows, except at least one of a and b is not zero
where the point (x0, y0) is the outermost point along the current line segment. Accordingly, the intersection point (xs, ys) of above two straight lines is as follows
Experiment
Setup
In order to evaluate the performance of our proposed algorithm, some experiments are carried out. We selected two laser scan data sets taken from a hallway and a laboratory. As shown in Figure 7, the hallway only contains doors, walls, and some fire fighting equipments, which are suitable for line extraction, while there are some desks and chairs in the laboratory.

Environment (a) hallway; (b) laboratory.
The laser sensor in our experiments is UTM-30LX produced by HOKUYO. The main parameters of the laser sensor are detailed in Table 1. The proposed line segment extraction algorithm has been implemented on the mobile robot called Pioneer-3DX shown in Figure 8. The laser sensor is mounted on the mobile robot, and we obtained two data sets from the hallway and the laboratory through manual operating the mobile robot.
Specification parameters.

Experimental platform.
We will compare our algorithm (Currently, a video of experimental results is available at https://youtu.be/yNN9NRioOBc. The source code is available at https://github.com/ghm0819/laser-line-segment.) with the well-known Split-and-Merge(https://github.com/kam3k/laser_line_extraction.) algorithm, two algorithms are implemented with C/C++. In addition, the system parameters are shown in Table 2.
Parameter value.
Runtime
A complete comparison of computational time of our proposed algorithm and Split-and-merge is carried out in this subsection. Two data sets taken from a hallway and a laboratory are used to record the computational time of two algorithms. Without loss of generality, we select first 1000 frames to display the result, as shown in Figure 9.

Computational time of two algorithms.
As shown in Table 3 and Figure 9, our proposed algorithm is more stable and much faster than Split-and-Merge, because our method does not need to split the data iteratively.
Computational time (in milli second) using two algorithms.
Correctness
The meaning of correctness 15 is defined as follows:
where NumMatch is the number of matches, NumExtLine is the number of line segments extracted, TrueLines is the number of true line segments in the environment. An ideal line extraction algorithm should present a high TR and a low FR.
The evaluation of correctness relies on human participation by manually labeling how many true line segments in the current environment. We randomly selected 10 frames from two data sets, respectively and then recorded the results of line segment extraction, as shown in Table 4 and Figure 10 (wherein the green rectangles show the line segments that are not extracted successfully). It is shown that the proposed algorithm achieves better performance in terms of correctness.
Correctness.

Comparison of precision (completeness) of line segments. The white points represent the laser points, the red solid line segments represent the extracted line segments. Obviously, in the yellow circles, Split-and-Merge fails to extract complete line segments, especially near the endpoints, and in the green rectangles, Split-and-Merge fails to extract line segments successfully (Environment: (a) and (b) are in the laboratory; (c) and (d) are in the hallway. Algorithm: (a) and (c) are Split-and-Merge; (b) and (d) are our proposed algorithm.
Precision
Different from the criterion in the study by Nguyen et al., 15 precision is defined as the completeness of the line segment, especially around the endpoints (measuring whether all laser points belonging to the line segment are exacted) instead of quantitative description of line parameters. In the study by Nguyen et al., 15 the gap of line parameters between different algorithms is very small when the line segment is fully detected because all algorithms use total least squares to obtain line parameters. In fact, we are more concerned about the completeness of the extracted line segment.
According to this criterion of precision, comparative results of Split-and-Merge and the proposed algorithm are shown in Figure 10, wherein it is seen that some points of line segments in the yellow circles are not detected by Split-and-Merge. Thus, the proposed algorithm presents better performance in terms of precision.
Conclusion
This article has presented a novel algorithm of line segment extraction using 2D laser data based on seed-segment detection and region growing. The whole algorithm is composed of seed-segment detection, region growing, overlap region processing, and endpoint generation instead of recursion and breakpoint detectors. We use two data sets taken from a hallway and a laboratory for experimental evaluation, and it is shown that compared with the well-known Split-and-Merge, our algorithm presents better performance in three aspects: efficiency, correctness, and precision.
Future work will focus on using the extracted line segments to address the global localization and loop closure with 2D laser sensors.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported in part by National Natural Science Foundation of China under grant nos. 61573195 and U1613210.
