## 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 fuzzification, the input and output parameters are fuzzified with a set of defined fuzzy classes, such as \"small\", \"medium\" and \"high\", and the degree of belongingness \(\mu\), all taking values between zero and one. For example, the parking time \(t_{p}\) is fuzzified with its corresponding membership functions to show the degree of belongingness, as in Equation (3) where \(x_{i}\) represents all elements in \(t_{p}\), \(\mu_{A}(x_{i})\) is the membership function of fuzzy class A in \(x_{i}\) and \(n\) is the total number of elements \(x\). In the inference engine, the set of rules R = {R\({}_{1}\), R\({}_{2}\), R\({}_{3}\),..., R\({}_{m}\)} is used to evaluate the aggregated outputs from the input parameters, where \(m\) is the total number of rules collected from interviewing the domain experts. The mechanism of the inference engine is referred to as [PERSON]'s method [37], where the consequences of the rules are expressed by fuzzy sets rather than linear mathematical expressions. Equation (4) shows the inference process for obtaining the aggregated outputs. The \"OR\" operator is applied for combining all the membership function values, resulting in a bounded area in the output membership functions. In defuzzification, the outputs in fuzzy sets are then converted back to crisp values \(x^{\prime}\) using the centroid method, which measures the centre of gravity of the bounded area, as shown in Equation (5). In the application, when the region of the vehicle is recognized in the image, the parking time, reservation factor and estimated time of stay for the vehicle can be measured, to truly reflect the occupied spaces for vehicle parking. The membership functions used in fuzzy logic are predefined intuitively by interviewing domain experts and industrialists, as shown in Table 1:  
\[t_{p}=\sum\
olimits_{i=1}^{n}\frac{\mu_{A}(x_{i})}{x_{i}} \tag{3}\]  
\[\mu_{B}(Y_{i})=\max\!\left\{\min\!\left[\mu_{A_{1}}(x_{1}),\ \mu_{A_{2}}(x_{2}),\ \ldots,\ \mu_{A_{j}}(x_{i})\right]\right\} \tag{4}\]  
\[x^{\prime}=\frac{\int\mu_{A}(x)\!\cdot\!dx}{\int\mu_{A}(x)dx} \tag{5}\] \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Parameter/Unit** & **Range** & **Fuzzy Class** & **Membership Function** & **Type** \\ \hline _Input_: & & & \\ \hline \multirow{3}{*}{\(\mathrm{L}_{(y,n)}/\mathrm{m}\)} & \multirow{3}{*}{\([0,18]\)} & Short & \([0,5,7]\) & trimf [1  \\  & & Medium & \([5,7,11,12]\) & trapmf [2  \\  & & Long & \([11,12,18]\) & trimf [1  \\  & & Narrow & \([2,25,3]\) & trimf [1  \\ \(\mathrm{L}_{(y,n)}/\mathrm{m}\) & \([2,4]\) & Medium & \([2,5,3,35]\) & trimf [1  \\  & & Wide & \([3,35,4]\) & trimf [1  \\  & & Night hour & \([0,0,6,9]\) & trapmf [2  \\ \(t_{p}\)/h & \([0,24]\) & Office hour & \([6,9,15,18]\) & trapmf [2  \\  & & Evening hour & \([15,18,24,24]\) & trapmf [2  \\ \hline _Output_: & & & \\ \hline \multirow{3}{*}{\(\gamma\)} & \multirow{3}{*}{\([0,1]\)} & Slightly increased & \([0,0.33,0.5]\) & trimf [1  \\  & & Substantially increased & \([0.33,0.5,0.67]\) & trimf [1  \\  & & Significantly increased & \([0.5,0.67,1]\) & trimf [1  \\  & & Short & \([0,60,120]\) & trimf [1  \\ \(t_{s}\)/min & \([0,360]\) & Medium & \([60,120,150,210]\) & trapmf [2 [2  \\  & Long & \([150,210,360]\) & trimf [1  \\ \hline \hline \end{tabular} Remarks: 1 trimf refers to the triangular shape of the membership functions;2 1 trapmf refers to the trapezoid shape of the membership functions.  
\end{table} 
Table 1: Definitions of fuzzy classes and membership functions in the CVROSS. To calculate the parking gap between vehicles, four situations should be taken into consideration, as shown in Figure 8. To prevent errors of unlimited value, the largest pixel value for length (the 640 th pixel rather than the first pixel), is utilized to compute the first gap, namely, the end gap (G\({}_{0}\)). Hence, in accordance with Equation (6), the end gap (G\({}_{0}\)) can be computed by subtracting the maximum \(x\)-value of the first vehicle V\({}_{1}\) from the maximum pixel value for length, i.e., 640 pixels.