## 3 Proposed Methods
### Stixels Generation Algorithm Based on Segmentation and Optimization (SGA-SO)  
Stixels are a superpixel environment description model based on the observation that geometries in an artificial environment are mainly composed of planes. A single stixel is defined as a thin earthbound rectangle with a fixed pixel width and vertical pose [10]. When describing the traffic scene, the stixel shows high accuracy and flexibility, and can compress the output data size, which is particularly suitable for the artificial environment mainly composed of horizontal and vertical structures. In this paper, the stixel includes four attributes: width, base point, top point and depth. The width is the pixel width of the stixel, the base point and the top point mark the beginning and end of each stixel, and the depth represents the distance between the stixel and the camera. On the basis of reference [10], SGA-SO is proposed in this paper. According to the features of the output result of the obstacle detection method proposed in this paper, SGA-SO is divided into two parts: horizontal segmentation and disparity optimization. SGA-SO first performs a column-by-column horizontal segmentation of obstacle superpixels according to a fixed width, and then further optimizes the initially segmented stixels. Figure 10 is the flow chart of SGA-SO. The input of SGA-SO is the pixel-level classification result of the Fusion output. SGA-SO first horizontally segments the input classification result. It divides the obstacle area according to the width of the stixel, simply divides it into a rectangular image, and then traverses each row of the rectangular image. If there is a pixel point judged to be an obstacle in a row in the rectangular image, it is considered that the row is an obstacle row. Then, divide the obstacle row and the adjacent obstacle row into the same stixel. The specific horizontal segmentation process is shown in Algorithm 1. Figure 10: Flow chart of SGA-SO. Figure 9: The probabilistic distribution of \(PR_{LSF}\) and classification result of OD-LSF method: (a) \(PR_{LSF}\) probability distribution; (b) OD-LSF method classification result. ```
Input:\(input\_img\): Pixel-level label image of classification result; \(width\): Stixel width; \(input\_img\_row\): The number of rows of the input image; \(input\_img\_col\): The number of columns of the input image; \(input\_img\_extract(a,b)\): Extract column \(a\) to column \(b\) of \(result\_img\) and return Mat type data; \(block\): Segmented rectangular image; \(block\_row\_data(i)\): The function is to return the data of row \(i\) in \(block\); \(judge(block\_row\_data(i))\): The function is to judge whether there is a pixel judged as an obstacle in row \(i\), and return \(0\) if it exists, otherwise return \(1\) Output: \(5\): List of \(stixel\) \(width=5\), \(f=0\), \(f\_last=0\), \(k=0\) \(N=input\_img\_col/width\) while\(k<N\)do \(block\_=input\_img\_extract(k*width,(k+1)*width)\), \(f=0\), \(f\_last=0\) while\(i<input\_img\_row\)do \(f=judge(block\_row\_data(i))\) if\(f==0\)and\(f\_last==1\) \(S\_push(stixel)\_,stixel()\) \(stixel\_push(block\_row\_data(i))\) elseif\(f==0\)and\(f\_last==0\) \(stixel\_push(block\_row\_data(i))\) endif \(f\_last=f\), \(i++\) endwhile \(k++\) endwhile
```  
**Algorithm 1** Horizontal Segmentation  
The superpixels detected as obstacles are horizontally segmented according to the fixed stixel width. The segmented stixels are shown in Figure 10(a), where the width of the stixel is \(5\) pixels. The depth value of the stixel is the average depth of the pixels it contains, and the redder its color is, the closer it is to the camera. Following the horizontal segmentation, obstacles with great differences in their depth may still be divided into the same stixel, such as the cars and buildings marked by a black box in Figure 10(a). In order to enable a stixel to better describe the obstacle, disparity optimization is further performed on the horizontally segmented stixels to obtain multi-layer stixels.