## 3 Image-Enhancement-Related Algorithms
### Improved Adaptive Contrast Enhancement(IACE)
The gradient strength is divided into three intervals by two thresholds, \(T_{1}\) and \(T_{2}\):  
\[G_{Ig}=\{G(x,y)|0<G(x,y)\leq T_{1},\forall G(x,y)eG\} \tag{13}\]  
\[G_{mg}=\{G(x,y)|T_{1}<G(x,y)\leq T_{2},\forall G(x,y)eG\} \tag{14}\]  
\[G_{hg}=\{G(x,y)|G(x,y)>T_{2},\forall G(x,y)eG\} \tag{15}\]  
Edge points often correspond to the boundaries of objects, textures, or structures in an image, while these boundaries are associated with details of interest, so a large number of edge points are usually present when a region contains rich details [20]. In this paper, the ratio of the number of edge point pixels within each gradient interval to the total number of edge point pixels was used as the weighting factor for each gradient interval. This can more accurately reflect the degree of contribution of each gradient interval to the image details. This processing is expressed as:  
\[w(x,y)=\left\{ \begin{array}{ll}w_{1},&0<G(x,y)\leq G_{lg}\\ w_{2},&G_{lg}<G(x,y)\leq G_{mg}\\ w_{3},&otherwise\end{array} \right. \tag{16}\]  
where, \(w_{1}\), \(w_{2}\), and \(w_{3}\) are the weighting factors of the three gradient intervals. Each pixel in the original image is assigned a specific gradient weighting factor based on the gradient strength, and the weighting coefficient is determined according to the percentage of edge points in the corresponding gradient interval. This processing is expressed as:  
\[w_{i}=\frac{N_{i}}{\sum_{i=1}^{3}N_{i}}\quad i=1,2,3 \tag{17}\]  
where, \(N_{i}\) is the number of edge points for each gradient level. The number of edge point pixels for each gray level in each gradient interval is shown in Figure 8.  
The histogram of edge points in the gradient interval for an X-ray image with unclear texture details is usually in the form of a single narrow peak, as shown in the three panels of Figure 8. If the peak shape becomes flat, the distribution of pixels of different gray levels within the gradient level will be more even and the texture details of the image become sharper. The distribution of the number of pixels at the edge points of each gray level in the gradient interval is processed using a Gaussian function, which is defined as:  
\[f(x)=\frac{1}{\sqrt{2\pi}\sigma}e^{-\frac{(x-y)^{2}}{2\sigma^{2}}} \tag{18}\]  
where, \(x\) is a random variable, and \(\mu\) and \(\sigma\) are the parameters of the Gaussian function. \(\mu\) is the mean value of \(x\) and it is used to adjust the positions of the Gaussian peaks, while \(\sigma\) is the variance of \(x\) and it determines how flat the peaks are. The larger the value of \(\sigma\) is, the flatter the peak becomes. In this paper, the values of \(\mu\) and \(\sigma\) are defined as follows:  
\[\mu=\sum_{i=0}^{l-1}i\cdot p(i) \tag{19}\]  
\[\sigma=\frac{1}{\beta}\sqrt{\sum_{i=0}^{l-1}(i-\mu)^{2}p(i)} \tag{20}\]  
where, \(l\) denotes all gray levels, \(i\) denotes the \(i\) th gray level. \(p(i)\) is the probability density of the \(i\) th gray level, which is the number of edge points within the \(i\) th gray level divided by the total number of edge points, and \(\beta\) is a constant. When \(\sigma\) becomes larger, the image detail enhancement is more significant. To prevent excessive sharpening of the  
Figure 8: **(a) Histogram of the number of edge point pixels at each gray level in the low gradient interval; (b) Histogram of the number of edge point pixels at each gray level in the moderate gradient interval; (c) Histogram of the number of edge point pixels at each gray level in the high gradient interval. **  
image, a value of \(\beta=1.5\) is adopted. According to Figure 9, after using the Gaussian function to process the histograms of edge points in different gradient intervals, the peaks become flatter. After obtaining the numbers of edge pixel points for all grey levels in different gradient intervals, weighted summation is performed using the relative weights of the gradients and the numbers of edge pixel points.