# A Novel Shadow Removal Method Based upon Color Transfer and Color Tuning in UAV Imaging
## 2 Method Development
### Proposed Methodology
#### 2.1.2 Color Transfer Algorithm  
The first phase of the proposed algorithm consists of creating a \(B\) and \(LS\) pixels thresholding. This is accomplished by transforming \(i\) into HSV color space for the computation. The proposed thresholding operation is expressed in Equation (1).  
\[L_{b}(x,y)=\begin{cases}1,&\text{if }B(x,y)=\text{argmax}_{x,y}S(x,y)<L_{s}\\ 0,&\text{otherwise}\end{cases} \tag{1}\]  
where \(B\) represents the blue channel into an RGB image (\(i\)), \(S\) is the saturation in \(i\), \((x,y)\) is a position in an image \(i\), and \(L_{s}\) is a constant value to define low saturated regions. Its range is defined between 0 and 255, and in this work, 25 is selected.  
The following process related to \(L_{b}\) is the creation of the corresponding \(K_{s}\) and \(K_{u}\) image masks. An operation that creates a pair of different masks that include only the regions mentioned above is performed; this operation is expressed in Equation (2).  
\[\left\{\begin{array}{l}K_{s}=L_{b}\cap M\\ K_{u}=L_{b}\cap M^{c}\end{array}\right\} \tag{2}\]  
where \(K_{s}\) and \(K_{u}\) are the shadowed and unshadowed regions masks, respectively, that conform \(L_{b}\), \(M\) corresponds to the shadow mask of \(i\), and \(M^{c}\) represents the complement of the shadow mask.  
Aiming to reduce the statistical inconsistencies found in shadow and unshadowed regions into processed images, we propose applying a morphological dilation to \(M\); this is defined as \(\psi=\delta_{\lambda 5}(M)\), which allows increasing the statistical coincidence between shadowed and unshadowed regions.  
The operations mentioned above allow us to perform a statistical analysis divided into two groups: local color transfer through \(\psi\) and \(i\) and color transfer using \(L_{b}\) statistics through \(K_{s}\) and \(K_{u}\). The color transfer algorithm is based upon the work proposed by [31], where its main operation is executed in parallel for the mentioned pairs. Equation (3) describes the operation for the proposed color transfer algorithm.  
\[T_{o}(x,y)=\begin{cases}\left(p_{o}(x,y)-\overline{x_{o_{\psi}}}\right)\frac {\sigma_{o_{b}}}{\sigma_{o_{\psi}}}+\overline{x_{o_{\psi}}},&\text{if }L_{b}=0\\ \left(p_{o}(x,y)-\overline{x_{o_{K_{s}}}}\right)\frac{\sigma_{o_{K_{s}}}}{ \sigma_{o_{K_{u}}}}+\overline{x_{o_{K_{u}}}},&\text{otherwise}\end{cases} \tag{3}\]  
where \(T_{o}\) is a pixel in channel o of the output image at the position \((x,y)\), \(p_{o}(x,y)\) is a pixel in \(i\) at channel o, \(\overline{x_{o_{\psi}}}\) and \(\overline{x_{o_{K_{s}}}}\) are the means of the shadowed regions at channel o, \(\overline{x_{o_{\psi}}}\) and \(\overline{x_{o_{K_{u}}}}\) are the means of the unshadowed regions at channel o, \(\sigma_{o_{\psi}}\) and \(\sigma_{o_{K_{u}}}\) belong to standard deviations of the shadowed regions, and \(\sigma_{o_{\psi^{c}}}\) and \(\sigma_{o_{K_{u}}}\) are the standard deviations of the unshadowed regions. Finally, \(o\) refers to L, a, and b channels from a given CIE L*a*b image representation. After local color transfer computing, the output image T contains color correction at the shadowed regions. To visualize the results from the process, Figure 2(a) is used to illustrate the input image (i) to be processed by the proposed methodology. Figure 2(b) depicts the resulting image T.