## 3 Materials and Methods
### Automatic Parameter Calculation Method  
In order to perform reasonable compensation for each shadow area, it is necessary to customize the compensation model according to their condition. Therefore, a novel method of extracting relevant regions and matching the feature points is implemented for automatically calculating the values of the compensation parameters.  
First, each shadow area and its adjacent non-shadow area as shown in Figure 2(a) are gained by a morphological operation to calculate \(\overline{m}_{\text{SD}}\), \(\overline{m}_{\text{NSD}}\), \(r_{0}\) and \(r_{1}\). The Shadow area (SD) is obtained by  
Figure 2: Shadow compensation results by the original Wallis filter principle. (**a**) Test Image of Ground object Shadows, named TIGS; (**b**) Original Wallis compensation results of TIGS; (**c**) Test Image of a Cloud Shadow, named TICS; (**d**) Original Wallis compensation results of TICS.  
shadow detection initially. By applying a certain morphological dilation \(K_{1}\) times to each shadow area, a ring region with width \(K_{1}\) around each shadow area is acquired as its Non-Shadow area (NSD). The mean and standard deviation of the SD and NSD, \(\overline{m}_{\text{SD}}\) and \(\sigma_{\text{SD}}\), \(\overline{m}_{\text{NSD}}\) and \(\sigma_{\text{NSD}}\), are calculated. Additionally, combined with the empirical values of \(b\) and \(c\), \(r_{0}\) and \(r_{1}\) are determined for each region.  
Then, the feature points on the shadow and non-shadow lines are extracted and matched to automatically calculate the unknown parameters \(\alpha\) and \(\beta\). Since there are some ground objects divided by the shadow boundary into two parts, some feature points belonging to the same object can be found on both sides of the shadow boundary. As shown in Figure 3b, the non-shadow feature lines (green) and shadow feature lines (red) can be acquired by dilating and erasing the shadow region. Pairs of similar feature points are chosen by randomly selecting a series of points along the shadow boundary. Then, their closest feature points on the two types of feature lines are selected as the shadow feature point \(\text{P}_{\text{SD}}\) and the non-shadow feature point \(\text{P}_{\text{NSD}}\). If they are both exposed to the same amount of sunlight, they should have similar feature values. Therefore, the feature value \(g^{c}\) of a non-shadow feature point can be the approximate target value of its shadow similar feature value. \(\alpha\) and \(\beta\) can be calculated using Equations (12) and (13) Via using similar feature point pairs, corresponding equations based on them can be constructed to estimate the unknown parameters \(\alpha\) and \(\beta\) using the least-squares rule.  
\[\alpha=\frac{g^{c}}{\overline{m}_{\text{NSD}}+(g-\overline{m}_{\text{SD}}) \cdot\frac{\sigma_{\text{NSD}}}{\sigma_{\text{SD}}}} \tag{12}\]  
\[\beta=\frac{g-\overline{m}_{\text{SD}}}{\left(\frac{g^{c}}{\alpha}-\overline{ m}_{\text{NSD}}+r_{0}\cdot r_{1}\right)r_{1}} \tag{13}\]  
where \(g\) and \(g^{c}\) are the feature values of \(\text{P}_{\text{SD}}\) and \(\text{P}_{\text{NSD}}\), respectively. \(\overline{m}_{\text{NSD}}\) and \(\overline{m}_{\text{SD}}\), \(\sigma_{\text{NSD}}\) and \(\sigma_{\text{SD}}\), represent the mean values and standard deviations of the Non-Shadow area (NSD) and the Shadow area (SD), respectively. \(r_{1}\) and \(r_{0}\) are the multiplicative coefficient and the additive coefficient in the Wallis model, respectively.  
Finally, after all of the parameters are calculated, the regional compensation models can be customized for each shadow. The information in the different shadow areas can be strengthened by their customized compensation models to enable access to a self-adaptive adjustment.