# Illuminant Estimation Using Adaptive Neuro-Fuzzy Inference System
## 3 Proposed Method
### Illuminant Estimation  
In this stage, for a given image not included in the training set, its CDFs and IIFs are extracted and the CDFs' dimensionality is reduced by PCA algorithm; then using the parameters obtained in the training phase, some combination weights are calculated; finally, \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **ANFIS Settings** \\ \hline Initial FIS for training & genfis \\ Number of clusters & 4 \\ Output membership function & Linear \\ Number of outputs & 1 \\ Initial step size & 0.01 \\ Clustering type & Subtractive Clustering \\ Input membership function & Gaussian \\ Number of inputs & 8–16 \\ Training maximum epoch number & 60 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Specifications of the ANFIS models developed in this study. Figure 2: Examples of membership functions used by the ANFIS models developed for (**a**) estimation of \(r\) component, (**b**) estimation of \(g\) component, and (**c**) estimation of \(b\) component. In these three models, the inputs are chromaticity values of \(r_{i}\) and \(g_{i}\) (\(i=1,2,3,4\)) from the unitary algorithms: GW, WP, PCA-based, and LSR, respectively. The curves in cyan, purple, yellow, and magenta indicate the membership values for the four cluster regions respectively, responding to the number of clusters to be 4.  
the estimated illumination of the input image is obtained by weighting corresponding ANFIS model outputs. **CDF and IIF extraction**. Given an input image \(I_{in}\), the CDF vector \(\phi(I_{in})\) is extracted according to Equation (9). Using PC coefficient matrix \(P\) and the mean vector \(b\) from the training phase, the compact CDF vector \(\bar{\phi}(I_{in})\) is calculated as in Equation (12). In the meantime, the eight unitary methods, i.e., GW, WP, SOG, GE1, GE2, GGW, PCA-based, and LSR, are adopted to estimate illuminant color for the input image \(I_{in}\). Then all these estimates are normalized and formulated into an IIF vector, \(\theta(I_{in})\), as described in Equation (15). **Weight computation**. As we employ a two-step clustering strategy to group the training images, an input image can be classified into a specific cluster accordingly by the following two steps. First, we determine what degree this input image falls into cluster \(S_{i}\) by calculating the squared Euclidean distance \(d_{cdf}\) between \(\bar{\phi}(I_{in})\) and each cluster centroid \(c_{i}\); then further on, we determine what degree this image falls into cluster \(SS_{ij}\) by calculating the cosine distance \(d_{iif}\) between \(\theta(I_{in})\) and each cluster centroid \(c_{ij}\). Here the choice for the squared Euclidean distance and the cosine distance is because both similarity metrics are respectively used in the two-step clustering, as described in Section 3.2. In this study, we do not absolutely put an input image into a certain cluster, but determine all possibilities that an image belongs to every cluster. In order to measure what degree an image belongs to a cluster, we define the possibilities based on the distances \(d_{cdf}\) and \(d_{iif}\). Denoting \(d_{cdf,i}\) as the squared Euclidean distance from the CDFs of an input image \(I_{in}\) to the cluster centroid \(c_{i}\), \(i=1,2,\cdots,k_{1}\), the probability for the input image belonging to cluster \(S_{i}\) will be represented as a radial basis function:  
\[\eta_{i}=\frac{e^{-d_{cdf,i}/2\sigma_{1}^{2}}}{\sum\limits_{l=1}^{k_{1}}e^{-d_ {cdf,i}/2\sigma_{1}^{2}}},i=1,2,\cdots,k_{1}, \tag{21}\]  
where \(\sigma_{1}\) is the radial fall-off factor. Using these probabilities, we construct a CDF weight vector \(\mathbf{\eta}\) as follows:  
\[\mathbf{\eta}=[\eta_{1},\eta_{2}\cdots,\eta_{k_{1}}], \tag{22}\]  
which will be used to weight different estimates from all ANFIS models of cluster \(S_{i}\).