# A Vision-Based Two-Stage Framework for Inferring Physical Properties of the Terrain
## 2 Proposed Method
### Second Stage: From the Terrain Type to Physical Properties
Based on the prior information of the Gaussian distribution, we set a more reasonable parameter \(k\). We can take the data of optical characteristics as an example to illustrate the setting of \(k\). In the Gaussian distribution, the probability of data distribution is 68.27% in the range of (\(\mu-\sigma\), \(\mu+\sigma\)), and 95.45% in the range of (\(\mu-2\sigma\), \(\mu+2\sigma\)). Therefore, we can take \(\mu-\sigma\) and \(\mu+\sigma\) of all optical characteristics in Table 1 as the initial segmentation positions. Then better positions are selected as the final segmentation positions of optical characteristics in the range of (\(\mu-2\sigma\), \(\mu-\sigma\)) and (\(\mu+\sigma\), \(\mu+2\sigma\)). Accordingly, the optical characteristic value is divided into 11 segments in the range of 0 to 255 and we set \(k\) in \(k\)-means to 11. After clustering, the cluster number and the range of optical characteristic values are shown in Table 3. Additionally, we can do the same for the surface structure characteristics. The clustering results are shown in Table 4.  
To establish the mapping to physical properties, we describe the friction properties and stiffness properties in a discrete manner. We employed a method similar to that of [6]. Ten masters of the laboratory were asked to use the Likert scale to judge the level of friction and stiffness of each terrain in different states of the dataset. We used numbers 1-6 for the friction level (i.e., 1 most slippery; 6 least slippery) and 1-5 for the stiffness level (i.e., 1 most deformable; 5 least deformable). Then we measured the friction coefficient between terrains in each level and the robot foot (rubber material) and calibrated the corresponding friction coefficient of each level. We obtained the stiffnesses of the terrains [12; 43] and calibrated them as well. The levels of friction and stiffness and the corresponding physical values are shown in Tables 5 and 6. It should be noted that we assumed that the robot does not walk in the water, so we set the friction level and stiffness level of the water to 0. A level of 0 means the most dangerous and not suitable for walking. We also set the friction level and stiffness level of the unknown background the same way. \begin{table}
\begin{tabular}{l c c c c c c c c c} \hline \hline
**Range of Value** & 0–31.7 & 31.7–47.4 & 47.4–70.3 & 70.3–95.7 & 95.7–129.0 & 129.0–146.1 & 146.1–255 \\ \hline cluster number & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Cluster number and the range of surface structure characteristic values. \begin{table}
\begin{tabular}{l c c c c c c c c c} \hline \hline
**Level** & **1** & **2** & **3** & **4** & **5** \\ \hline friction coefficient & \textless{}0.1 & 0.1–0.25 & 0.25–0.5 & 0.5–0.7 & 0.7–0.8 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Friction coefficient and level. Using semantic features, optical characteristics and surface structure characteristics as elements of the input vectors, and corresponding friction levels and stiffness levels as output values, we establish a dataset of mapping relationships from terrain types to physical properties. Table 7 shows some examples of this dataset. We then feed these data to CART [44]. CART is a decision-making model, which is the abbreviation of classification and regression tree. It selects the best feature and the best cut point by calculating the Gini index shown in Equations (7) and (8) iteratively. \[Gini(D)=1-\sum_{j=1}^{J}(\frac{|C_{j}|}{|D|})^{2} \tag{7}\]  
where \(D\) is the training set; \(C_{j}\) is a subset of samples belonging to class \(j\). Then \(Gini(D)\) is used to calculate \(Gini(D_{1})\) and \(Gini(D_{2})\) in Equation (8):  
\[Gini(D,A)=\frac{|D_{1}|}{|D|}Gini(D_{1})-\frac{|D_{2}|}{|D|}Gini(D_{2}) \tag{8}\]  
where \(D_{1}\) and \(D_{2}\) are subsets of \(D\) divided by the value of feature \(A\). Finally, we get two decision trees for inferring friction properties and stiffness properties, respectively.