## 3 Materials and Methods
### Shadow Compensation Model Based on Wallis Filter and LCC Model  
The original Wallis filter is commonly used for image dodging to recover an uneven color. It typically can complement the lost color, but it is not sufficient enough to recover the shaded information caused by shadows. Hence, this study improved the original Wallis model by introducing the intensity coefficient and stretching coefficient to promote brightness and contrast that is more effective for shadow compensation. The general form of the Wallis filter is defined as follows:  
\[g^{c}(i,j)=g(i,j)\cdot r_{1}+r_{0} \tag{8}\]  
Or another form is expressed as follows:  
\[g^{c}(i,j)=\Big{[}g(i,j)-\overline{m}_{g}\Big{]}\frac{\Big{(}c\cdot\sigma_{f }\Big{)}}{\Big{(}c\cdot\sigma_{g}+\frac{\sigma_{f}}{c}\Big{)}}+b\cdot \overline{m}_{f}+(1-b)\cdot\overline{m}_{g} \tag{9}\]  
where, \(g^{c}(i,j)\) and \(g(i,j)\) represent the target image and the original image, respectively. The parameters \(r_{1}\) and \(r_{0}\) are the multiplicative coefficient and the additive coefficient, respectively, where \(r_{0}=b\cdot\overline{m}_{f}+(1-b-r_{1})\cdot\overline{m}_{g}\) and \(r_{1}=\Big{(}c\cdot\sigma_{f}\Big{)}/\Big{(}c\cdot\sigma_{g}+\sigma_{f}/c \Big{)}\). \(\overline{m}_{g}\) and \(\sigma_{g}\) represent the mean and standard deviation of the component in the local area around the pixel \((i,j)\). \(\overline{m}_{f}\) and \(\sigma_{f}\) are the target mean and standard deviation for this area, respectively. \(c\) (\(c\)\(\in\)[0,1]) is the image contrast extension coefficient, which is proportional to the local window size. \(b\) (\(b\)\(\in\)[0,1]) is the image brightness coefficient. The original Wallis filter, essentially a type of image enhancement principle, is typically used in image dodging to solve the disproportionate color problems [35; 36], but it is not functional for shadow compensation directly. For example, in Figure 2 two different types of shadows cast by a building and cloud were compensated for the component \(I\) with the original Wallis filter. Compared to the original shadow areas, the brightness after shadow compensation is strengthened slightly. However,the overall contrast and brightness in shadow areas are still not good enough to be the same as the non-shadow areas. Consequently, shaded information is not recovered completely. Its main weakness is that \(r_{1}\) and \(r_{0}\) are fixed when the target means and standard deviations of the features acquired from the non-shadow areas are combined with a certain \(b\) and \(c\). Consequently, the filter is equivalent to a linear transformation. However, because the contrast and brightness in the shadow region are so low and the influence of \(c\) is not sufficient to extend the contrast, this linear transformation is not efficient enough to enlarge the difference to recover the information. When it is used for shadow compensation directly, it cannot be valid for more serious information loss by shadows. For this reason, a valid parameter to increase the contrast should be introduced to be used in shadow compensation. Since the Linear Correlation Correction (LCC) model in Equation (10) is a very classic method and useful in shadow compensation. By using \(\overline{m}_{\text{NSD}}\) and \(\overline{m}_{\text{SD}}\), \(\sigma_{\text{NSD}}\) and \(\sigma_{\text{SD}}\), which represent the mean values and standard deviation of the Non-Shadow area (NSD) and the Shadow area (SD), this model can more accurately enhance the shadow information to the NSD value. However, it is also not able to adjust the contrast and brightness flexibly.