# Complex Color Space Segmentation to Classify Objects in Urban Environments
## 3 Image Segmentation Approach
### Segmentation Approach  
This study uses complex numbers to segment the complex image \(I\). As shown in the previous subsection, the _chromatic map_\(\mathbb{AB}\) represents the pixel density distribution along k-blocks on the complex image. In each block \((i,j)\) on the _chromatic map_\(\mathbb{AB}\), density \(M_{\mu}\) is calculated by counting the number of pixels \(M_{p}\) and averaging the intensity of each pixel on \(I\), as shown in Equation (6).  
\[M_{\mu}(i,j)=\left\{\begin{array}{cc}\dfrac{\sum_{p=1}^{M_{p}}I_{i,j}(p)}{M_ {p}}&\text{if}&M_{p}>0\\ 0&\text{in another case}\end{array}\right. \tag{6}\]  
Equation (7) calculates indexes \(ind_{Mp}\), showing blocks with a number of pixels greater than \(n_{px}\). In Equation (8), a second criterion is applied to obtain the final vector index \(ind_{M\mu}\), which stores the indexes for blocks on \(M_{\mu}\), which also agrees with \(ind_{Mp}\). The number of thresholds \(n_{th}\) is used in the segmentation process and is obtained from the cardinality of vector \(ind_{M\mu}\) (see Equation (9)).  
\[ind_{Mp}=M_{p}\geq n_{px} \tag{7}\]  
\[ind_{M\mu}=M_{\mu}\big{(}ind_{Mp}\big{)} \tag{8}\]  
\[n_{th}=card\big{(}ind_{M\mu}\big{)} \tag{9}\]  
Vector \(V_{\mu}\) is calculated using \(M_{\mu}\) and \(ind_{M\mu}\), as shown in Equation (10). \(V_{\mu}\) is the vector for average values used as thresholds in the segmentation process, which are still represented using complex numbers. The correlation matrix \(M_{corr}\) is obtained by dividing each threshold value by all the other values, as shown in Equation (11). Equation (12) represents the areas for average values bound by a circle \(|z-z_{0}|=R\). In this case, areas are defined as being within a unitary circle centered on each threshold value on the matrix \(M_{corr}\).  
\[V_{\mu}=M_{\mu}\big{(}ind_{M\mu}\big{)} \tag{10}\]  
\[M_{corr}(i,j)=\dfrac{V_{\mu}(i)}{V_{\mu}(j)}\hskip 28.452756 pti,j=\{1,\ldots,n_{th}\} \tag{11}\]  
\[M_{r_{\mu}}=|1-|M_{corr}|| \tag{12}\] \[=\left|\begin{pmatrix}1-\left|\dfrac{V_{\mu}(1)}{V_{\mu}(1)} \right|&1-\left|\dfrac{V_{\mu}(1)}{V_{\mu}(2)}\right|&\cdots&1-\left|\dfrac{V _{\mu}(1)}{Z_{\mu}(k)}\right|\\ 1-\left|\dfrac{V_{\mu}(2)}{V_{\mu}(1)}\right|&1-\left|\dfrac{V_{\mu}(2)}{V_{ \mu}(2)}\right|&\cdots&1-\left|\dfrac{V_{\mu}(2)}{V_{\mu}(k)}\right|\\ \vdots&\vdots&\ddots&\vdots\\ 1-\left|\dfrac{V_{\mu}(k)}{V_{\mu}(1)}\right|&1-\left|\dfrac{V_{\mu}(k)}{V_{ \mu}(2)}\right|&\cdots&1-\left|\dfrac{V_{\mu}(k)}{V_{\mu}(k)}\right|\end{pmatrix} \right)\right|\]  
The matrix values \(M_{r_{\mu}}\) are used to analyze the middle values. Beyond diagonal values, minimization was conducted on matrix \(M_{r_{\mu}}\). Minimum values obtained are then divided by two to ensure there is no overlap between areas centered around average values; this is expressed by \(V_{r\mu}\) in Equation (13). \(n_{th}\) values are stored in \(V_{r\mu}\), which contains the thresholds to conduct color segmentation. Algorithm 1 explains the implementation of the multi-threshold segmentation process on a color image.  
validation method used shows that the _chromatic map_ for the CamVid dataset produces better results in a \((8\times 16)\) combination, unlike the Cityscape database, which produced better results for \((16\times 8)\) values, as shown in the following subsection.  
Figure 6: CamVid segmented images for different block sizes. (**a**) Block size \(4\times 8\). (**b**) Block size \(4\times 16\). (**c**) Block size \(8\times 8\). (**d**) Block size \(8\times 16\).  
Figure 7: CamVid segmented images for different block sizes. (**a**) Block size \(16\times 8\). (**b**) Block size \(16\times 16\). (**c**) Block size \(32\times 8\). (**d**) Block size \(32\times 16\).