A VARIATIONAL GAMMA CORRECTION MODEL FOR IMAGE CONTRAST ENHANCEMENT

. Image contrast enhancement plays an important role in computer vision and pattern recognition by improving image quality. The main aim of this paper is to propose and develop a variational model for contrast enhancement of color images based on local gamma correction. The proposed variational model contains an energy functional to determine a local gamma function such that the gamma values can be set according to the local infor- mation of the input image. A spatial regularization of the gamma function is incorporated into the functional so that the contrast in an image can be modi- ﬁed by using the information of each pixel and its neighboring pixels. Another regularization term is also employed to preserve the ordering of pixel values. Theoretically, the existence and uniqueness of the minimizer of the proposed model are established. A fast algorithm can be developed to solve the resulting minimization model. Experimental results on benchmark images are presented to show that the performance of the proposed model are better than that of the other testing methods.

1. Introduction. Contrast enhancement plays an important role in computer vision, pattern recognition, and image processing based on the improvement of visual quality. In many applications, we often encounter low contrast digital images, for example, images have uneven illumination, a large area of shadow or background, and a full black target. Such low contrast images are obtained because of many different factors including illumination and imaginative angles. In order to restore realistic scene, it is necessary to perform image processing procedures to enhance image contrast.
In general, there are three kinds of methods for enhancing dimmed images: spectral methods, histogram methods, and spatial methods, see [21] for an overview. Spectral methods are based on wavelet processing. For example, Tang et al. [31] proposed an image enhancement technology by using a multi-scale contrast measure in the wavelet domain. In [13], wavelet transform was proposed to perform the image enhancement in the wavelet domain with a non-linear operator applied to the wavelet coefficients.
Histogram methods transform the grayscale input image to an output image with a specified histogram. Global histogram equalization (GHE) [11] is one of the most popular histogram methods for efficient implementation. In [28], the histogram of the input image was calculated locally according to both the mean pixel values of the local regions and the local cumulative distribution functions. In [6], an automatic transformation technique based on gamma correction was proposed, and the transformation function was formulated by using the probability distribution function (corresponding to histogram) of the input image. In [34], Wang and Ng proposed a variational approach containing an energy functional to determine a local transformation such that the histogram can be redistributed locally. In [33], Wang et al. proposed a variational model containing an energy functional to adjust the pixel values of an input image directly so that the resulting histogram was redistributed to be uniform. Arici et al. [1] proposed a variational framework by making a trade-off between the histogram of the input image and the uniform one. Chen et al. [4] proposed to divide the histogram specification into sub-histogram specifications recursively. Variational approach based on the minimization of a fully smoothed l 1 -TV functional and its fast version were proposed in [3,18,19]. A two step algorithm for color image enhancement by using a hue and range preserving color adjustment was proposed by Nikolova et al. in [16,17].
Most spatial methods are based on Human Visual System (HVS). In [20], a total variation model for Retinex was proposed for image enhancement. In [2], Beghdadi and Negrate gave a new contrast measure based on the edge detection operators and the visual perception criterion. In [22], the average local contrast measure was increased within a variational framework which preserved the hue of the original image by coupling the channels. In [23], Polesel et al. introduced an adaptive filter which is used to control the enhancement in different regions. In [5], Cheng and Xu proposed a direct fuzzy contrast enhancement method which aimed to use the maximum fuzzy entropy principle to map an input image into the fuzzy domain, and then enhanced the input image. Rizzi et al. [25] proposed Automatic Color Equalization (ACE) based on a perceptual hypothesis, and Provenzi et al. [24] further proposed to work in the wavelet domain in order to reduce the computation time.
Gamma correction is another important contrast enhancement method with a varying adaptive parameter γ in the model. Many gamma correction methods and related generalizations have been proposed and studied in the literature, such as linear gamma correction method [35] and nonlinear gamma correction method [6,30]. In [35], the idea of the proposed gamma correction is to decrease the pixel values in the low grayscale and to increase the pixel values in the high grayscale, while to keep the pixel values in the middle range of grayscale. In order to handle different illumination effect, an adaptive gamma correction method which was used to modify the gamma values by using two nonlinear functions, was given in [30]. However, linear or nonlinear functions used to correct the illumination, may be uniform for different regions and patterns of an input image. Instead of using a fixed value, the gamma function can be adjusted by statistical information extracted from input images. In [12], an adaptive gamma correction method was proposed to use the cumulative distribution function to slightly modify the associated statistical histogram. All the above gamma correction models are global, and they may not able to restore the local details of low contrast input images. Therefore, it is necessary to set different gamma values for different regions in practical image contrast enhancement.
In this paper, we propose and develop a variational model for contrast enhancement based on local gamma correction. Different from other local adaptive gamma correction methods ( [29,10]), the proposed model is a variational type. In [29], Shi et al. used three-level thresholding algorithm to segment the image into three gray levels (dark, medium tone, and bright). Then the local gamma correction method was applied to these three levels respectively, and then the input image was linearly stretched. In [10], the most appropriate gamma value was chosen by computing k-nearest neighbors of the feature vectors of each region. The main contribution of this paper is to propose a variational approach containing an energy functional to determine a local gamma function such that the gamma values can be set automatically according to local information of input image. A spatial regularization of the gamma function is incorporated into the functional so that the contrast in input image can be modified by using the information of each pixel and its neighboring pixels. In particular, H 1 -norm regularization is employed in the regularization procedure. Another H 1 -norm regularization is also employed to preserve the ordering of pixel values. Theoretically, the existence and uniqueness of the minimizer of the proposed model are established. Experimental results on benchmark images are reported to show that the performance of the proposed model are better than that of the other testing methods (GC , GRC-AGC [7], LRC-AGC, and GHE [11]).
The outline of this paper is as follows. In Section 2, we present related work of gamma correction. In Section 3, we give the proposed variational model and the theoretical results. In Section 4, we develop the algorithm to solve the resulting model. In Section 5, numerical examples are shown to demonstrate the effectiveness of the proposed model and the proposed algorithm. Finally, some concluding remarks are given in Section 6.

2.1.
Global raised cosine function. The principle of gamma correction is that a transformation function is applied to an input image such that the contrast of the output image is enhanced. In general, the transformation function is formulated as follows: where r max is the maximal brightness of the input image (for example, it is equal to 255 for a 8-bit image), and γ is generally a fixed value for contrast adjustment [14]. If γ is less than one, the enhanced image becomes brighter. If γ is greater than one, the enhanced image becomes darker. The main issue of this approach is that the value of γ is fixed, and it is independent of pixel locations and the statistics of the grayscale values of a set of neighborhood pixels. Therefore, the approach generates an enhancement stereotypical for all kinds of grayscale values, image patterns and regions of input images. In [12], Huang et al. proposed a new adaptive gamma correction model by using weighting distribution (AGCWD). The AGCWD model assigns several different values of γ to their corresponding grayscale pixel values. Note that the pixels in bright regions are easy to become saturated, which lead to poor contrast at the bright regions. Saha et al. [7] proposed a novel raised cosine function based adaptive gamma correction (RC-AGC) for efficient global contrast enhancement. The values of γ are determined by the raised cosine function: is the probability distribution function of the input image, and pdf min and pdf max represent the minimum and the maximum probability density values respectively. It has shown in [7] that the performance of the RC-AGC method is better than that of the AGC method.

2.2.
Local raised cosine function. We note that the above discussed gamma correction models are global, and the values of γ are set independently with the positions of the pixels of the input image. Therefore, local image details may not be preserved. One idea is to incorporate the position information in the raised cosine function. The values of γ are determined as follows: .
Here, at each pixel location x, we compute a local probability density function: , and pdf min and pdf max represent the minimum and the maximum local probability density values respectively.
As an example, we show the difference between the global raised cosine function based adaptive gamma correction (GRC-AGC) using (1) and the local raised cosine function based adaptive gamma correction (LRC-AGC) using (2). As shown in Figure 1, GRC-AGC cannot preserve the image details very well. For example, the regions containing the girl's dress and the curtain cannot be enhanced properly. On the other hand, LRC-AGC can keep more image details. For comparison, we refer to the zooming regions in Figure 1.
It is interesting to note that local raised cosine functions work individually. In this paper, we propose a collaborative model among all local raised cosine functions so that the resulting image can be further enhanced via an variational approach.
3. The proposed model. In this section, we propose a novel variational model to determine a local gamma function such that the gamma values can be set according to the local information of the input image. In the following discussion, f (r, x) represents the objective local transformation function with r referring to the intensity variable and x referring to the location variable, Ω is the image domain. In order to minimize the differences among the local gamma functions at the nearby pixel locations, the spatial regularization of the local gamma function is incorporated into the objective functional for the enhancing process. In particular, we consider the H 1 -norm regularization |∇f | 2 in the model, where ∇ denotes the gradient operator of the objective function f with respect to the horizontal and vertical directions of an image. Moreover, we incorporate another intensity regularization term so that the ordering of intensity of the output image can be similar to that of the input image, i.e., similar intensity values preserve after the enhancement transformation. The proposed variational model is given as follows: where f 0 = 1 2 (1+cos(π·cdf w (x, r))) is the LRC function, and f r is the first derivative of f with respect to r, α 1 , α 2 are two positive parameters to balance these three terms in the model. Let us study the existence and the uniqueness of the minimizer of J(f ). Firstly, the proposed model can be reformulated as follows: For any (r, x) ∈ Λ ≡ (0, 1) × Ω, the energy functional is well defined in the following admissible set: Here W 1,2 [(0, 1); L 2 (Ω)] denotes the space of functions in W 1,2 where each function is of (0, 1) → L 2 (Ω). Similarly, L 2 [(0, 1); W 1,2 (Ω)] denotes the space of functions in L 2 where each function is of (0, 1) → W 1,2 (Ω). Proof. First, if we set f to be constant, the energy will be finite, which implies that problem (3) is the correct setting. Noting that 0 is a lower bound of J(f ) which implies that inf J(f ) exists. Suppose {f n } is a minimizing sequence of J(f ), then there exists a constant M > 0 such that J(f n ) ≤ M . The above inequality reads as: therefore, we have Λ (f n r ) 2 dxdr ≤ M . The above inequality guarantees that the sequence {f n } is uniformly bounded in W 1,2 [(0, 1); L 2 (Ω)], thus, up to a subsequence, there exists f * ∈ W 1,2 [(0, 1); L 2 (Ω)] such that f n f * in W 1,2 [(0, 1); L 2 (Ω)]. Since W 1,2 [(0, 1); L 2 (Ω)] is compactly embedded in L 2 [(0, 1); L 2 (Ω)] (see [9] for details), we get: As a consequence of the lower semicontinuity for the W 1,2 -norm, we have: By using the inequality Λ |∇f n | 2 dxdr ≤ M , we know that Ω |∇f n | 2 dx is uniformly bounded for almost every r ∈ (0, 1), combining this with the facts f n ∈ L ∞ ((0, 1) × Ω) and 0 ≤ f ≤ 1, we can derive that {f n } is uniformly bounded in W 1,2 (Ω) for almost every r ∈ (0, 1). By using the same compactness property, up to a subsequence also denoted by {f n }, there exists a function f r * ∈ W 1,2 (Ω) such that, for fixed r, Combining the above convergence results with (4), we can easily deduce that f r * = f * (r, x) for almost every r ∈ (0, 1). By using the lower semicontinuity of the W 1,2norm, for almost every r ∈ (0, 1), Then we can easily get: and f * ∈ L 2 [(0, 1); W 1,2 (Ω)]. Meanwhile, because of the convergence result (4), we have: Combining (5), (6), and (7), we obtain: Meanwhile, by using the convergence results, we have f * ∈ Σ. Noting that the proposed functional J(f ) is strict convex on (f, ∇f, f r ), leads to the uniqueness of the solution. This completes the proof.
4. The proposed algorithm. In this section, we develop an efficient algorithm to solve (3). Let's first introduce the following notation: It is used for the projection of the objective function between 0 and 1 as required in (3). Then we can rewrite problem (3) as follows: subject to u = f , v = f , w = f r and z = f . For this constrained optimization problem, we employ the alternating direction method of multipliers (ADMM) [8] to solve it. By using the Lagrangian multiplier λ 1 , λ 2 , λ 3 , λ 4 to the linear constraints, the augmented Lagrangian function is given as: Here the scalar product ·, · is the corresponding inner product. Then the ADMM iterations are described in the following algorithm: as the initial input data; (ii) At the k − th iteration: • Given f k , λ k 1 , λ k 2 , λ k 3 , λ k 4 , and compute u k+1 , v k+1 , w k+1 , z k+1 by solving: • Given u k+1 , v k+1 , w k+1 , z k+1 , and calculate f k+1 by solving: (9) argmin f L(u k+1 , v k+1 , w k+1 , z k+1 , λ k 1 , λ k 2 , λ k 3 , λ k 4 ).
• Updating λ k+1 1 , λ k+1 2 , λ k+1 3 , λ k+1 4 by using: We rewrite the subproblem in (8) as follows: where Note that all parameters in L 1 (u, v, w, z) can be separated. Then the minimization problem (11) can be solved separately. Firstly, u k+1 , w k+1 have the following closed form solution by solving the corresponding Euler-Lagrange equation: The Euler-Lagrange equation of the subproblem corresponding to v k+1 is given as follows: and it can be solved by using Fast Fourier Transform if periodic condition is considered. Finally, the following projection gives z k+1 : z k+1 = max(min(f k − λ k 4 2β , 1), 0). For the subproblem in (9), we rewrite it as follows: where The corresponding Euler-Lagrange equation is given as follows: this equation can be solved by using Fast Fourier Transform if periodic condition is considered. We note that the convergence result for ADMM can be used here for the proposed algorithm, see the detail information in [8]. We conclude it as the following theorem: Theorem 4.1. Letf ,λ 1 ,λ 2 ,λ 3 ,λ 4 be arbitrary and let β > 0. Then the sequence {u k , v k , w k , z k , λ k 1 , λ k 2 , λ k 3 , λ k 4 } generated by (8)-(10) converges to (u * , v * , w * , z * , λ * 1 , λ * 2 , λ * 3 , λ * 4 ), which is a saddle point of L (i.e, the unique solution of the problem in (3)).

Experimental results.
In this section, we present the experimental results to illustrate the effectiveness of the proposed model and the proposed algorithm. For color images, we make use of the HSV color space, i.e., we enhance the V-channel separately, and keep the H-channel and the S-channel unchanged. In the following experiments, the stopping criteria of algorithm is set to be = 10 −3 , and the window size of the local transformation function is set to be 21 × 21. When the ADMM method is employed, we set β = 1, and λ 0 1 = λ 0 2 = λ 0 3 = λ 0 4 = 0 as the initial parameters for iterations. In the numerical tests, we use ALC [15,2], DE [27], SSIM [32], PSNR to compare the performance of different methods: • Here r i is the gray-level value at pixel i, and E i is the mean edge gray-level which is defined in a neighborhood N i of size s × s pixels and entered at pixel  i. Practically, we choose s = 3, and E i = Σ k∈N i S k r k Σ k∈N i S k where S k is the edge value computed by Sobel operators [11,26]. The higher the ALC value is, the better contrast the image has; where p(I(k))is the probability of pixel intensity I(k) which is estimated from the normalized histogram. The higher the value of discrete entropy, the better the enhancement is in terms of providing better image details; • where µ X , µ Y , σ X , σ Y are the means and the variances of X, Y respectively and σ XY is the covariance of X and Y . 5.1. The parameters of α 1 and α 2 . In the first experiment, we test the effect of the two parameters α 1 and α 2 . We consider the low-contrast input image in Figure  2, and we also display the enhanced results by using several pairs of (α 1 , α 2 ) in Figure 2. The enhanced results are corresponding to (α 1 , α 2 ) = (1000, 10), (1000, 100), (1000,1000), (1000, 10000), (10, 1000), (100, 1000), (1000,1000), (10000, 1000). We observe from the results in Figure 2 that the transformed result has many artifacts when α 1 is small, while the result tends to be visually better as α 1 getting larger because of the role of the spatial regularization term. We also find that as α 2 increases, the intensity consistency of the enhanced results becomes stronger, thus the details have been restored, see especially the carpet in the dark region. We show the ALC values and the DE values in Table 1. We see from the table that ALC and DE decrease when α 1 or α 2 increases, which reflects the role of the two regularization terms.

Preservation of the details.
In the second experiment, we test the effect of the detail preserving. We compare the proposed model with GC, GRC-AGC, LRC-AGC, and GHE. The experiment is based on 4 low-contrast color images. The enhanced results corresponding to GC with γ = 1/2.2, GC with γ = 1/5, GRC-AGC, LRC-AGC, GHE, and the proposed model are displayed in Figures 3-6. We also show the corresponding zooming parts respectively. We see from the results that GC model usually produce over enhanced effect, and cause a serious loss of details. For the LRC-AGC model, there are plenty of artifacts in the corresponding enhanced results, which makes the details visually unpleasant. Noting that GRC-AGC and GHE are global models without considering the local information, which give the enhanced results without texture and details preservation. As we can see from the enhanced results, the proposed model provides very good detail preserving effect in contrast enhancement, see especially the yellow flowers in the first row, the dress of the girl in the third row, the stairs in the fifth row, and the gray background in the seventh row.
We report the values of ALC and DE of different methods in Table 2. We remark that the best numbers are in bold face. We see that the proposed model gives the best DE values (excluding LRC-AGC which generates many unexpected artifacts) which is corresponding to more details based on the four testing images. Meanwhile, we find the ALC values of the enhanced results by using the proposed model are quite competitive. Therefore, the proposed model provides reasonable values of ALC and DE by balancing both the visual quality and detail preserving. These results show that the proposed model can recover the details and enhance the contrast very well.   by using GC with γ = 1/2.2, GC with γ = 1/5, GRC-AGC, LRC-AGC, GHE, and the proposed model. We can see from the results that LRC-AGC usually generate over enhanced contrast results, and the visual quality of the enhanced images by using the proposed model is competitive with the other testing methods.
In Table 3, we report the PSNR values and the SSIM values of different methods applying to the low-contrast images in Figures 7-8. We find that when we compare the two measures of different methods between the enhanced results and the groundtruth images, the proposed model is always better than the other testing methods. Again these results show that the proposed method can recover the details and enhance the contrast suitably.

Input
GC-1/2.2 GC-1/5 GRC-AGC LRC-AGC GHE Proposed Figure 5. First row (from left to right): the input low contrast image; the enhanced results by using GC with γ = 1/2.2; the enhanced results by using GC with γ = 1/5; the enhanced results by using GRC-AGC; Second row: the enhanced results by using LRC-AGC; the enhanced results by using GHE; the enhanced results by using the proposed model. The corresponding zooming parts are displayed in the last two rows respectively.
6. Concluding remarks. Gamma correction is an important contrast enhancement method achieved by employing a varying adaptive parameter γ. In this paper, we propose and develop a variational model for contrast enhancement of color images based on local gamma correction. Different from other local adaptive gamma correction methods, the proposed model is a variational model. The contribution of this paper is to propose a variational approach containing an energy functional to determine a local gamma function such that the gamma values can be set according to the local information of the input images. A spatial regularization of the gamma Input GC-1/2.2 GC-1/5 GRC-AGC LRC-AGC GHE Proposed Figure 6. First row (from left to right): the input low contrast image; the enhanced results by using GC with γ = 1/2.2; the enhanced results by using GC with γ = 1/5; the enhanced results by using GRC-AGC; Second row: the enhanced results by using LRC-AGC; the enhanced results by using GHE; the enhanced results by using the proposed model. The corresponding zooming parts are displayed in the last two rows respectively.
function is incorporated into the functional so that the contrast in an image can be modified by using the information of each pixel and its neighboring pixels. In particular, H 1 -norm regularization is employed in the regularization procedure. Another H 1 -norm regularization is also considered to satisfy the need for keeping the gray value orders. Theoretically, the existence and uniqueness of the minimizer of the proposed model are established. Experimental results are reported to show that the performance of the proposed model are competitive with the other compared methods for several image types.