## 2 Three-Dimensional Object Segmentation and Labeling Algorithm
### Object Extension and Merge Algorithm
If there is no extension object, continue to process the next object of Plane 1. If an extension object exists, the extension connection judgment is performed based on the two characteristics of a line segment, the closure property, and color continuity. Finally, the extension object with the line segment closure property and line segment color continuity in Plane 2 is extended and merged with the object in Plane 1. The label number of the extension object in Plane 2 is changed to be the same as that of the merged object in Plane 1. The record of the two extended and connected endpoints is canceled, the bounding box coordinate record of the merged object is modified, and the labeling data of the two objects are retained. Then, repeating the above process of cross-distance plane line segment extension using Plane 3 and the merged plane of Planes 1 and 2 until all the planes are processed. Figure 13 shows the result of the cross-distance plane line segment extension. Here, 1146 objects are merged into 821 objects after the cross-distance plane line segment extension. Figure 11: Illustration of the regions to calculate the average color values on both sides of the endpoints. It can be observed from Figure 13 that large amounts of background noise are retained. The general practice is to set a threshold to filter the objects with a small number of pixels; however, the size of the same object in the 2D image is different at different distances. Therefore, the filtering method may incorrectly filter out distant objects. The proposed algorithm uses the 3D information of an object to determine whether to retain the object, to eliminate the object filtering error. In the proposed algorithm, two predefined thresholds are provided to filter out the noises. The two thresholds are the maximum detection distance and minimum reserved area. The objects with a distance less than the maximum detection distance and an area larger than the minimum reserved area are retained as the foreground objects, and the rest belong to the background image. In the experiments, the disparity  
Figure 12: Processing result of Figure 8 after single-distance plane line segment extension. **(a)** Result of Plane 62 after line segment extension; **(b)** Result of Plane 62 after overlapping object processing; **(c)** Processing result of all distance planes. Figure 8:0 Processing result of cross-distance plane line segment extension using Figure 12c. value used as the maximum distance for effective detection is set as 5, and the distance calculated by Equation (2) is the maximum detection distance. Considering the retained object size is different for indoor and outdoor, the minimum reserved area of indoor and outdoor scenes is set to 25 cm\({}^{2}\) and 600 cm\({}^{2}\), respectively. Based on the relevant parameters of the KITTI camera system, the calculated maximum detection distance threshold is 77.3 m, and the minimum reserved area is 600 cm\({}^{2}\). There are originally 821 objects, as shown in Figure 8:1 After the threshold filtering, 16 foreground objects are retained, as shown in Figure 8:2