## 3 Materials and Methods
### Imaging Space Conversion and Patrol Path Determination  
The proposed SVS is mounted on the robot parallel to the ground and separated by 212 mm. The field of view (FOV) is 45 degrees in the vertical and 58 degrees in the horizontal, respectively, as the plan and side views of the robot depicted in Figure 4a. The height and width of the visible windows are as follows: 1000 mm from SVS (828 mm \(\times\) 1109 mm), 2000 mm from SVS (1657 mm \(\times\) 2217 mm), and 3000 mm from SVS (2485 mm \(\times\) 3326 mm), as shown in Figure 4b. The FOV is resolved to \(640\times 480\) pixels, and each pixel is described with RGB color space and the world coordinates \(\left[\begin{array}{cc}x_{i,j}&y_{i,j}&d_{i,j}\end{array}\right]\), \(0\leq i\leq 640\), \(0\leq j\leq 480\), where \(x_{i,j}\), \(y_{i,j}\), and \(d_{i,j}\) are the width, height and depth from the center of SVS, respectively.  
In order to make the patrol path random, depth information of the image is analyzed for searching possible patrol paths in this research, instead of using existing path planning. In addition, to reduce the computation required for processing information in the identification of a suitable path, a region of interest (ROI) is defined from the following image coordinates (pixel number): (32,290) to (608,340), as shown in Figure 5a. The ROI is chosen based on the height where the SVS is installed and the width of the robot. Figure 5b presents a corresponding color image with ROI. Assume that \(i\) and \(j\) are the horizontal and vertical coordinates on the ROI image plane, where \(32\leq i\leq 608\) and \(290\leq j\leq 340\). In order to find a possible path region in ROI, the minimum depth at each column of ROI is selected as \(\overline{D}=\left[\begin{array}{ccc}\overline{d}_{1}&\overline{d}_{2}& \cdots&\overline{d}_{n}\end{array}\right]\) at first. The size thresholds of a path are defined as follows: depth \(d_{T}\) (1500 mm) and width \(w_{T}\) (3520 mm). In the following, four steps of suitable path identification are described:  
1. Initially, compare each \(\overline{d}_{n}\) in \(\overline{D}\) with the threshold of depth \(d_{T}\). The \(\overline{d}_{n}\) which are larger than \(d_{T}\) continuously are selected as a sub-section \(\overline{D}_{k}\), which \(\overline{D}_{k}\in\overline{D}\).
2. Select the largest section \(\overline{D}_{k}\) of \(\overline{D}\), and calculate the corresponding real width \(w_{k}\) of the selected section. Assume the selected section \(\overline{D}_{k}=\left[\begin{array}{ccc}\overline{d}_{1}^{k}&\overline{d}_ {2}^{k}&\cdots&\overline{d}_{m}^{k}\end{array}\right]\), \(m\leq n\), and the width of the corresponding world coordinates are \(\left[\begin{array}{ccc}x_{i,j}^{k_{1}}&x_{i,j}^{k_{2}}&\cdots&x_{i,j}^{k_{m} }\end{array}\right]\), then the width \(w_{k}\) of the section \(\overline{D}_{k}\) can be estimated as follows: \[w_{k}=\frac{\frac{m}{640}\Big{(}\overline{d}_{1}^{k}+\overline{d}_{m}^{k} \Big{)}\pi+\Big{(}x_{i,j}^{k_{m}}-x_{i,j}^{k_{1}}\Big{)}}{2},\] (1)  
Figure 4: (**a**) The plan and side views and (**b**) the field of view (FOV) of stereo vision system (SVS) at various distances of the robot.  
As long as the calculated width \(w_{k}\) exceeds width threshold \(w_{T}\), then this route (the region of selected section \(\overline{D}_{k}\)) is adopted as a suitable path. The angle \(\theta_{d}\) from the center of the image plane (the head of the robot) to the center of the path is then calculated to control the rotation of the robot. Assume \(i_{c}\) is the center of FOV, and \(i_{d}\) is the middle of the selected section \(\overline{D}_{k}\) on the horizontal axis of image coordinate, then the angle between the head of the robot and the center of the desired path can be calculated as follows: \[\theta_{d}=\Big{(}\frac{i_{d}-i_{c}}{640}\Big{)}58^{\circ}.\] (2)
4. If the analysis results fail to provide a viable path, the robot rotates counterclockwise (CCW) in search of another route.