# Online Street View-Based Approach for Sky View Factor Estimation: A Case Study of Nanjing, China
## 2 Materials and Methods  
### Estimation of the SVF with the BMapSVF  
_Based Method_  
The automatic estimation of the SVF follows a four-step workflow (see Figure 2). Firstly, a series of image tiles is obtained from a street view service. The significant 360\({}^{\circ}\) horizontal field of view and a maximum vertical field of view of 180\({}^{\circ}\) eliminate the need for panoramic stitching. Retrieval of BSV is accomplished through the APIs of these services, and the acquired data is then securely stored in MySQL.  
Figure 2: Flow of SVF calculation based on BSV, the red dots represent the sampling points.  
Secondly, the panoramic image undergoes processing through a deep learning semantic segmentation model for pixel-wise segmentation. The semantic segmentation model for images, particularly DeepLabv3 [36], is a convolutional neural network designed to attain high accuracy and efficiency in pixel-wise segmentation tasks. It utilizes an encoder-decoder architecture with atrous convolution to capture features at various scales while preserving spatial resolution, facilitation precise segmentation of objects. Moreover, it integrates multi-scale features to enhance segmentation accuracy in complex scenes. The training dataset for this study comprises 5000 finely annotated images (2975 for training, 500 for validation, and 1525 for the test set) from the cityscapes dataset, which focuses on the semantic understanding of urban street scenes [37]. Training DeepLabv3 on cityscapes enables semantic segmentation of panoramic images into 19 classes, with a specific emphasis on achieving sky segmentation accuracy of 85% intersection over union (IOU) in this study. Following that, a model-based transfer learning [38; 39] method is utilized to transfer the training results to BSV.  
Thirdly, Fisheye images are obtained by projecting the panorama images from a cylindrical projection to an azimuthal projection [40]. The cylindrical BSV panorama is characterized by a width denoted as \(W\) and a height as \(H\). It is assumed that the coordinates (0, 0) correspond to the center pixel of the fisheye image, representing the origin of the fisheye image. Therefore, the radius of the fisheye image is,  
\[r=\frac{W}{2\pi} \tag{1}\]  
The coordinate of any pixel in the panorama is \(P\left(x,y\right)\), calculated from its bottom-left corner, while the coordinate of any pixel in the fisheye image is denoted as \(F\left(x,y\right)\):  
\[\alpha=\frac{2\pi\times P_{x}}{W}-\frac{\pi(W-1)}{W},\beta=\frac{\pi\times P_{y }}{H}-\frac{\pi(H-1)}{2H} \tag{2}\]  
\[\left\{\begin{array}{l}F_{x}=rcos(\alpha)\times sin\beta\\ F_{y}=rsin(\alpha)\times sin\beta\end{array}\right. \tag{3}\]  
Finally, the \(SVF\) is estimated from fisheye images, and the results are stored in MySQL. The calculation of the \(SVF\) from the fisheye image is based on the following formula [28]:  
\[SVF=\sum\limits_{i=0}^{n}\omega\times\frac{f(i)}{\sum\limits_{i=0}^{n}\omega} \tag{4}\]  
\[\omega=sin(\varphi)\times\left(\frac{\varphi}{90^{\circ}}\right)^{-1} \tag{5}\]  
\[f(i)=\left\{\begin{array}{l}1,\ (if\ \text{pixel is sky})\\ 0,\ (if\ \text{pixel is not sky})\end{array}\right. \tag{6}\]  
where \(n\) represents the total number of pixels in the fisheye images and \(\omega\) represents the weight associated with each pixel in the fisheye image. This weight is derived by calculating the distance between the location of each pixel in the fisheye image and the origin, and converting it to an Angle (\(\varphi\)). Additionally, \(f(i)\) is a function that determines the visibility of the sky at a specific pixel.