## 2 Related Methods
### Multi-Scale Morphological Detail Measure  
A multi-scale morphological detail measure (MSMDM) method [18] is used as a spatial detail information measure within a local region. By the multi-scale morphological gradient operator, the gradient information of an original image can be extracted at different scales. Moreover, summing the multiscale morphological gradients of a local region helps both to measure the clarity and to suppress noise within a local region. The detailed implementation process of MSMDM is as follows:  
Firstly, the multi-scale structural elements should be constructed, as detailed below:  
\[TE_{j}=\underbrace{TE_{1}\oplus TE_{1}\cdots\oplus TE_{1}}_{t},t\in\{1,2,3, \cdots,n\} \tag{3}\]  
where \(TE_{1}\) is a basic structure element whose radius is \(r\), and \(n\) is the number of scales.  
The structural elements with different shapes can extract different kinds of features contained in the original image. Moreover, it can be extended to several scales by altering the size of the structural elements. Then, using the structure element, a comprehensive gradient feature can be extracted from the original image.  
Then, a multi-scale morphological gradient operator is used to extract the gradient features \(G_{k}\) at scale \(t\) from an image \(g\).  
\[G_{k}(x,y)=g(x,y)\oplus TE_{k}-g(x,y)\ominus TE_{k},k\in\{1,2,3,\cdots,n\} \tag{4}\]  
where \(\oplus\) and \(\ominus\) denote the morphological expansion and corrosion operators, respectively.  
The gradients can be expressed as local pixel value difference information in the original image. In particular, the maximum and minimum pixel values in the local area for an original image can be obtained by the expansion and erosion operators, respectively. In essence, the morphological gradient is the difference between the results obtained by expansion and erosion operations. Thus, the local gradient information contained in an original image can be extracted completely by the morphological gradient. Moreover, the gradients can be extracted at different scales by using multi-scale structural elements.  
Moreover, the gradients at all scales are integrated into the multi-scale morphological gradient (MSMG).  
\[\text{MSMG}(x,y)=\sum_{k=1}^{n}\left[w_{k}\times G_{k}(x,y)\right] \tag{5}\]  
where \(w_{k}\) denotes the weight of the gradient at scale \(k\):  
\[w_{k}=\frac{1}{2\times k+1} \tag{6}\]  
The weighted summation is an effective method for fusing multi-scale morphological features. Thus, we can first multiply the gradient values at each scale with appropriate weights to obtain the morphological gradient values at each scale. Then, the morphological gradient values of all scales are summed, and, thus, the multiscale morphological gradient values are calculated.  
In this paper, we assign larger weights to the smaller scale gradients and smaller weights to the larger scale gradients. In particular, for the smoother parts of the image, the pixel values vary less and the corresponding gradient values are smaller. Thus, the gradient-weighted sum of different scales can reflect the spatial detail information.  
Finally, the multi-scale morphological gradients in local region are summed to calculate the MSMDM values and the specific details are shown in Formula (9). Summing the multi-scale morphological gradients can help measure the clarity as well as suppress the noise within a local region. Two examples of MSMDM are shown in Figure 1.  
\[\text{MSMDM}(x,y)=\sum_{(p,q)}\text{MSMG}(p,q),(p,q)\in B \tag{7}\]There are three parameters to be set in MSMDM, i.e., the shape of the structural element, the size of the basic structural element and the number of scales. In this paper, a flat structure is chosen as the shape of the structure element. To suppress the noise, the radius of the basic structural element \(TE_{1}\) is set to 4. Then the radius of the structural element at the \(n\)-th scale will be equal to \((2n+1)\). Finally, the number \(n\) of scales from 4 to 9 is tested experimentally, and the best results were obtained when \(n=6\).