# Illuminant Estimation Using Adaptive Neuro-Fuzzy Inference System
## 3 Proposed Method
### Features Extraction  
#### 3.1.1 CDF Extraction  
Since the color distribution is one of key spatial-domain information which is most related to illuminant estimation, in this study we extract several types of CDFs from an image. **Number of colors**. The color number in an image can be used to indicate the color range of the image. We use a number of colors, \(n^{c}\), for the re-quantized image with 6-bits each channel [20] as the first component in the CDFs of the proposed approach. **Chromaticity features. ** Let R, G, and B be Red, Green, and Blue measurements of an image pixel, the chromaticity values, \(r\) and \(g\), are calculated as follows:  
\[\left\{ \begin{array}{l}r=R/(R+G+B)\\ g=G/(R+G+B)\end{array} \right. \tag{2}\]  
We use four chromaticity features in the prior work [35] as follows. _Average color chromaticity_ is the chromaticity \((r^{a},g^{a})\) of the average RGB value \((R^{a},G^{a},B^{a})\), where:  
\[C^{a}=\frac{1}{n}\sum_{i=1}^{n}C_{i},\ \ C\in\{R,G,B\}, \tag{3}\]  
\(n\) is the pixel number in the image, and \(C^{a}\) is the channel average same with GW algorithm. _Brightest color chromaticity_ is the chromaticity \((r^{b},g^{b})\) of the color \((R^{b},G^{b},B^{b})\) of the pixel \(k\) which has the largest brightness value of \((R+G+B)\), i.e. :  
\[\left(R^{b},G^{b},B^{b}\right)=(R_{k},G_{k},B_{k}),\ \textit{where}\ k=\underset{i}{ \operatorname{arg\,max}}(R_{i}+G_{i}+B_{i}). \tag{4}\]  
This differs from WP algorithm that treats each RGB channels independently. _Dominant chromaticity_ is the chromaticity \((r^{d},g^{d})\) of the average RGB color \((R^{d},G^{d},B^{d})\) of the pixels belonging to a histogram bin, which has the largest count:  
\[C^{d}=\frac{1}{|H_{k}|}\sum_{j\in H_{k}}C_{j},\ \ C\in\{R,G,B\},\ \textit{ where}\ k=\underset{i}{\operatorname{argmax}}|H_{i}|, \tag{5}\]  
where \(H_{m}\) is the set of pixels in the \(m\)-th bin of the histogram. _Chromaticity mode_ in this study refers to the mode of the image color palette in chromaticity space. The color palette is generated by taking the average value of each bin in the RGB histogram that includes more than a predefined threshold of pixels [35]. A threshold  
Figure 1: Overview of the training phase and the testing phase for the proposed approach. of 200 pixels per bin is set in this study, which yields a palette of approximately 300 colors for a typical image. Each color in the palette is projected onto the normalized chromaticity plane, and an efficient 2D kernel density estimation is performed. The mode \((r^{m},g^{m})\) is assigned to be the chromaticity with the highest density. **Color moments** are some measures to characterize color distribution in an image. If the color in an image follows a certain probability distribution, the moments of that distribution can then be used as the features to identify that image based on color. Since color information is mainly distributed in low-order moments, it is sufficient to use three central moments to express the color distribution of the image, i.e., 1-order moments (Mean), 2-order moments (Standard deviation), and 3-order moments (Skewness). Let \(C_{i}\), \(C\in\{R,G,B\}\) represent the color component of the \(i\)-th pixel of an image, and \(n\) be the number of pixels in the image, then the three color moments can be defined as follows respectively:  
\[\mu_{C}=\frac{1}{n}\sum_{i=1}^{n}C_{i}\, \tag{6}\]  
\[\sigma_{C}=(\frac{1}{n}\sum_{i=1}^{n}{(C_{i}-\mu_{C})^{2}})^{\frac{1}{2}}, \tag{7}\]  
\[s_{C}=(\frac{1}{n}\sum_{i=1}^{n}{(C_{i}-\mu_{C})^{3}})^{\frac{1}{3}}. \tag{8}\]  
Considering the image size, in this paper we evenly divide an image into \(3\times 3\) sub-blocks, and nine moments will be calculated for each sub-block. Therefore, the image is characterized by 27 moments for each 3 color channels, i.e., in total 81 moments such as \(\varphi_{1},\varphi_{2},\cdots,\varphi_{81}\).