## 3 Design of a Computer Vision-Based Roadside Occupation Surveillance System (CVROSS)
### Decision Support in Roadside Parking  
#### 3.3.1 Evaluation of Parking Gaps  
In the following sections, parking-gap calculations, parking-space evaluation and decision support in parking are considered and evaluated, as shown in Figure 5. The block diagram shows that the entire computation involves three components: (i) conversion between pixel values and actual scale for road traffic, (ii) fuzzy logic for vehicle parking reservation and (iii) decision support for parking activities. After vehicles and objects have been recognized and matched, the CVROSS calculates parking gaps for each individual traffic lane. First, the conversion between the pixel value collected from the image and the actual scale should be implemented, via experimental studies. The actual scale of the road traffic is affected by the height of the camera (\(\mathrm{H_{c}}\)) from ground level and the viewing angle of the camera (\(\mathrm{\theta_{c}}\)). The conversion ratio is essential for estimating the actual number of parking spaces and is utilized in the following analysis. As indicated in Figure 6, in the first traffic lane, shown at the top of the image, there are three vehicles, and each of them has four corner points, i.e., \(\{(x_{1},y_{1})\), \((x_{2},y_{2})\), \((x_{3},y_{3})\), \((x_{4},y_{4})\}\subseteq\{\mathrm{X_{1}},\mathrm{Y_{1}}\}\) for the first vehicle \(\mathrm{V_{1}}\). In general, the four corner points of vehicle \(\mathrm{V_{n}}\) can be presented in the form \(\{(x_{4n-3},y_{4n-3})\), \((x_{4n-2},y_{4n-2})\), \((x_{4n-1},y_{4n-1})\), \((x_{4n},y_{4n})\}\subseteq\{\mathrm{X_{n}},\mathrm{Y_{n}}\}\), where \(n\) is the number of vehicles captured in the image. Figure 5: Overview of the computations in the CVROSS. In this study, it is supposed that the cameras are mounted on street lights and nearby facilities, so that the heights and viewing angles of the cameras may be different. Thus, adjustment of the images taken by cameras that are not mounted on street lights is needed, in order to standardize the image for conversion. Referring to the government's street-light design [34] and other work [35; 36], a conversion ratio mapping can be established to deal with various predefined heights and angles of the cameras, in order to standardize their field of view (FOV). Figure 7 illustrates the scenario of mounting cameras at different heights with different viewing angles. In the default setting, the cameras that are mounted on the street lights are set vertically, to cover a particular FOV. For other camera settings with different heights and viewing angles, the image and the FOV are then adjusted back to the default setting. To achieve the above goal, a conversion mapping profile is established via experimental studies for several predefined configurations, and thus the ratio \(L_{\alpha}/L_{p}\) is defined for the conversion between pixel values and actual scales for road traffic. Consequently, the conversion ratio can be applied for calculating the actual length and width of vehicles. After the four corner points of each vehicle have been retrieved, the CVROSS computes the maximum and minimum values of x and y, i.e., \(L_{(x,n)}\) and \(L_{(y,n)}\), to represent the actual length and width of vehicle V\({}_{n}\) respectively, according to Equations (1) and (2). Using the above information, the size of the vehicle captured by the camera is known, and the spaces for vehicle parking reservation are then computed using fuzzy logic:  
\[L_{(x,n)}=[\max(X_{n})-\min(X_{n})],\frac{L_{\alpha}}{L_{p}} \tag{1}\]  
Figure 6: Illustration of calculation of parking gaps. Figure 7: Illustration of various camera positions. \[\mathrm{L}_{(y,n)}=[\max(\mathrm{Y}_{n})-\min(\mathrm{Y}_{n})].\frac{L_{4}}{L_{p}} \tag{2}\]  
In fuzzy logic, there are three processes: fuzzification, the inference engine and defuzzification. These evaluate the reservation factor \(\gamma\in[0,1]\) and the estimated time of stay \(t_{s}\) from three inputs, i.e., parking time \(t_{p}\), \(\mathrm{L}_{(x,n)}\) and \(\mathrm{L}_{(y,n)}\).