## 3 Experimental Results  
To verify the practicality of the proposed algorithm, the test images from the KITTI dataset [34] for outdoor scenes, and test images from the Middlebury dataset [38] for indoor scenes are used. Because the KITTI and Middlebury test images do not provide the distance and size of objects in the images, a dual-camera system is made to capture indoor and outdoor images and measured the actual distance and size of objects in the images to verify the estimated data of the proposed algorithm. The overall accuracy (_OA_) [39] is used to compare the accuracy of the segmented objects with the ground truths in this paper. The  
Figure 14: The result after threshold filtering. Figure 15: Object segmentation result. \(OA\) is defined as Equation (7), where the _TP_, _TN_, _FP_, and _NT_ are true positive, true negative, false positive, and false negative, respectively. \[OA=\frac{TP+TN}{TP+TN+FP+FN} \tag{7}\]  
The proposed algorithm uses Visual C++ 2015 for programming. In addition to the disparity value of the image pair, the distance calculation for stereo vision required relevant hardware parameters, such as baseline, focal length, sensor size, and image resolution. The relevant parameters will be explained in the subsequent experimental results. The KITTI dataset includes images captured by vehicles driving on outdoor roads. The Point Gray Flea2 color cameras (FL2-14S3C-C) and the 1/2\" Sony ICX267 CCD sensor are adopted. The focal length is 4 mm, and the baseline is 54 cm. The first test image pair selected from the KITTI database is Test image 1, as shown in Figure 2a,b. The image resolution is 1242 \(\times\) 375 pixels. Regarding related parameters, the maximum detection distance is 77.3 m, the separation distance is 30 cm, and the minimum reserved area is 600 cm\({}^{2}\). Figure 15 shows the foreground objects segmented by the proposed algorithm. After foreground object segmentation, the remaining image is the background image, as shown in Figure 16.  
Sixteen different objects are segmented in Test image 1. Then, based on the label number of each foreground object in Figure 15, the foreground objects are sequentially segmented from the image and estimated the distance and size of the objects. For size estimation, the width is defined as the difference in distance between the leftmost and rightmost contour pixels within the bounding box of each object, and the height is defined as the difference in distance between the top and bottom contour pixels. The object distance is defined as the minimum distance value of all contour pixels of the foreground object. Table 1 lists the relevant segmentation results and 3D information, including the segmentation result, distance, and size of the foreground object. Because ground removal also removed the contour of the foreground object in contact with the ground, the object height is slightly reduced. For example, for objects 5, 8, and 16, the calculated heights of the vehicles are lower. From the results of Test image 1, it can be observed that objects with different distances and overlapping objects can be effectively detected and segmented. These segmented objects are suitable for the input of subsequent image recognition, and the object size information can be used as an important reference. Figure 16: Background image of Test image 1. The second set of test images selected from KITTI is Test image 2, which is an outdoor scene beside the road. The experimental results of Test image 2 are shown in Figure 17. Figure 17a is the image pair. The image resolution is 1224 \(\times\) 370 pixels, and the hardware parameters and the threshold values used by the algorithm are the same as those of Test image 1. Figure 17b is the detection result of the object edge contour. The object segmentation result is shown in Figure 17c, and the remaining image is the background image, as shown in Figure 17d. A total of 14 different foreground objects are detected and segmented from Test image 2.