# Content-Adaptive Light Field Contrast Enhancement Using Focal Stack and Hierarchical Network
## 3 Proposed Method
### Statistical Feature Extraction  
In this part, contrast enhancement is performed on the above AIF image. In the contrast enhancement method based on HE [13; 44], the cumulative distribution function is used to change the histogram distribution into an approximate uniform distribution to enhance the contrast. However, the gray level of the transformed image is reduced, which makes some details disappear. If some images have high peaks in their histograms, the contrast will be unnaturally over-enhanced. This paper proposes an improved method considering these shortcomings. We adjust the local details by changing the mapping curve obtained by HE, which not only retains the superior performance of the enhanced part, but also reduces the amplitude of the over-enhanced part.  
As shown in Figure 4, the AIF image is obtained from the original FS by using the method in Section 3.1. We transform the original RGB image into a YUV format image, and then form the grayscale image (b). For image (b), considering the input, its range of grayscale is \([X_{0},X_{n-1}]\), which has n pixels in total. The probability density function \(P(r_{k})\) of level \(r_{k}\) is  
\[P(r_{k})=\frac{n_{k}}{n} \tag{6}\]  
where \(n\) is the sum of pixels in the image, and \(n_{k}\) is the frequency of occurrence of level \(r_{k}\); \(k=0,1,\ldots,N-1\). The histogram is the relationship between \(n_{k}\) and \(r_{k}\). On the basis of (6), the cumulative density function is  
\[C(r_{k})=\sum_{i=0}^{k}P(r_{i}) \tag{7}\]  
Figure 4: Flowchart of the contrast enhancement method. (**a**) Original AIF image; (**b**) Grey-scale map; (**c**) Grey-scale map after HE; (**d**) Grey-scale map after our method; (**e**) Enhanced AIF image. (**f**,**g**) represent formulas and algorithms used in the processing process (**f**) = Equation (8), (**g**) = Equation (9).  
HE uses the cumulative density function to map the image pixel values onto the entire dynamic range \([X_{0},X_{n-1}]\), as  
\[f(X)=X_{0}+(X_{n-1}-X_{0})C(X) \tag{8}\]  
Image (c) and the mapping curve, accordingly, are obtained using the above steps, and we subsequently adjust the mapping curve. As shown in Figure 4, \(T_{0}\) is the original curve, and \(T_{1}\) represents the mapped curve after histogram equalization.  
Yin = Yout; the output is the original AIF image at this time. Two parameters are adopted to adjust the mapping curve. Gain1 is used to adjust the brighter part, while gain2 is applied to adjust the darker part of the image. By comparing the curves \(T_{0}\) and \(T_{1}\) and selecting suitable values, the adjusted curve \(T\)' is attained  
\[T^{\prime}=T_{1}*gain(t)+T_{0}*[1-gain(t)] \tag{9}\]  
where \(t\) is 0 or 1, and _gain (t)_ is 0-1 to adjust the dark and bright parts, respectively. The optimized enhanced image (d) can be acquired by using this scheme, and subsequently recover the RGB image (e), which is the resulting light field image. The enhanced AIF image can be obtained by using this method. Then, the method of [PERSON] et al. [42] is used to generate the FS through AIF and DMAP.