Enhancement of Low-Light Image using Homomorphic Filtering, Unsharp Masking, and Gamma Correction

—Now-a-days, a digital image can be found almost everywhere, and digital image processing plays a huge role in analyzing and enhancing the image so that it can be delivered in a good condition. Color distortion and loss of image details are the common problems that were faced by low-light image enhancement methods. This paper introduces a low-light image enhancement method that applied the concept of homomorphic filtering, unsharp masking, and gamma correction. The aim of the proposed method is to minimize the two problems stated while producing images of better quality when compared to the other low-light image enhancement methods. An objective evaluation was done on the proposed method, comparing the results produced by the enhanced method with other two existing low-light image enhancement methods. The results obtained showed the proposed method outshines the other two existing low-light image enhancement method in maintaining the image details and producing a natural looking image, achieving the lowest Mean Square Error (MSE) and Lightness Order Error (LOE) scores, and has the highest Features Similarity Index color (FSIMc), Features Similarity Index (FSIM), Structure Similarity Index (SSIM), and Visual information fidelity (VIF) scores. Future studies that should be made on this research are to implement dehaze and denoise functionality into the low-light image as well as enabling it to be applicable in real-time scenarios.


I. INTRODUCTION
It is undeniable that digital image processing is important as it helps to enhance the quality of an original image. A lowlight image, as its name suggests, is an image that is captured in a low-light environment. This type of image is typically found when the image is captured in the nighttime. Images captured during nighttime are lacking because the amount of light captured in the image is low. This would result in low visibility and details in objects that are captured and cause color distortion in the image.
Low-light image enhancement methods help to boost the features of objects captured in an environment where the light source is minimal. In a situation where hit-and-run occurred during nighttime and the car was captured in a CCTV, low light image enhancement methods can be used to obtain the visual information of image like the color of car, the shirt color of the driver, etc. and followed by digital image processing to gain more information on the accident occurs, for example, getting the car plate number to track the irresponsible driver. This becomes the motivation for the proposed low light image enhancement. To produce a clear and bright image, low-light image enhancement method like Retinex method, histogram equalization, neural network, gamma correction and homomorphic filtering were introduced [1]. A significant amount of research has been made on the methods of enhancing low-light image enhancement in recent years, however, there is still room for improvements in the techniques used to enhance low-light images. The problems faced in the enhancement of low-light images include color distortion and loss of image detail. Colors are hard to be distinguished in a low-light environment, thus, it is important to enhance lowlight image while retaining the color of the image. Loss of image details is another problem faced during the enhancement process.
In this paper, homomorphic filtering, unsharp masking, and gamma correction techniques have been applied to create a low-light image enhancement method. The input image will be processed with homomorphic filtering where the parameters values of the Gaussian high pass filter available for customization have been applied and Fast Fourier Transform (FFT) is used so that the time taken for the process can be cut down. Subsequently, to sharpen the image, unsharp masking is applied to the image. Finally, the requirement for gamma correction of the image is defined into four different states, low, medium, high, and none depending on the luminance. The gamma will be influenced by the luminance of the image and different values will be set as the gamma according to the different states of the image. The contribution of the research are as follows:  Introduced a method to enhance low-light images by classifying the state of low-light images into three stages  Enhanced low-light images with minimal color distortion issues There are a total of eight sections in this paper. The first section introduces the existing low light image enhancement methods and the related works, as mentioned above. Section II describes the related works. Section III mentioned about the image enhancement techniques that were applied in the proposed method. The proposed method was explained in detail in Section IV followed by experimental results that are shown in Section V. Discussions were presented in Section V, and the final section would be concluding this research.

II. RELATED WORK
Low-light image enhancement methods, namely Retinex method, histogram equalization, and neural network were some of the image enhancement methods that can be used to enhance a low-light image.

A. Retinex Method
The Retinex method uses the concept of human visual systems which perform automatic color and brightness adjustments on scenery that are captured by the human eyes [2]. This method expresses the image using the illumination and the reflection of the image [3]. Retinex methods include a Single-scale Retinex (SSR), multi-scale Retinex (MSR), and multi-scale Retinex with color restoration (MSRCR). SSR as well as MSR algorithms [4], [5] are algorithms that apply the Gaussian surround function on the input image. Both methods are used to obtain the reflection image by estimating the illumination level, the formula of SSR and MSR are listed below: Where I (x, y) is the input image, R (x, y) is the reflection image, i is the RGB color channels, (x, y) is the position of pixels in the image, K is the normalization factor while e is the exponential function, σ is the scale parameter, and * is convolution operator.
Here, k is Gaussian surround scales, the number of scales is represented with N, and ω are the scale weights. MSR has the advantage of having multiple scales which further enhances the details of image and contrast and produces images with improved visual effect.
An issue of color distortion effect might occur with SSR and MSR methods which leads to the introduction of MSRCR method [6], [7]. In this method, the color recovery of each color channel, C will be calculated based on the proportional relationship between RGB channels of the raw image and used to overcome the color distortion problem, which is: By combining color recovery of each color channel with MSR, the equation of MSRCR will be formed, where: Although MSRCR successfully solved the color distortion problem, it would lose image details in the bright region.
Retinex-based method is widely applied in low-light images, for instance, a fast algorithm based on Retinex was proposed by Liu et al. [8], where the low-light image will be converted to HSV color space, and linear function is used to stretch the gray level in V component followed by Retinex model which is applied to enhance the brightness of a low-light image. The method solved the problem of uneven brightness and make the low-light area clearer, yet there is a problem where this method will cause the details of the brighter area in the input image become vague due to the brightness enhancement. In [9], a Retinex model was able to produce a result where brightness and contrast were improved while preserving the details of the image as well as suppressed noise interference through performing various processing in illumination image estimation, reflection image acquisition, and post-processing. However, this method is time-consuming and causes noise amplification problems when input images have a higher amount of light loss. The low-light image enhancement technique by Shi et al. [10] also used the Retinex method and mixed with a generative adversarial network (GAN) to enhance an image under low-light conditions, although the method caused problems like noisy and overly enhanced results in low-light images, this method proved to be very useful in low-light images with very minimal light where the details of these type of image can be seen clearly. Another application of Retinex is observed in [11], where Retinex is applied in the low-light image for the purpose of autonomous vehicles, and successfully enhances the image illumination and improves the detection of the vehicle yet the problem of time consumed for the algorithm must be considered as the method should be working in real-time. In short, the Retinex method is useful in handling color distortion issues and sharpening capability but since Gaussian filtering is applied in the Retinex method, it can be a very complex, and the sharp boundary of an image might cause the image to be too bright.

B. Histogram Equalization
Histogram equalization (HE) is an image enhancement technique where in the grey level of the image, the smaller pixel population would be compressed whereas the larger pixel population is stretched to occupy a wide range [12]. The grey level of the image is then equalized. This method is widely used to improve image contrast [13] but it can cause overenhanced noise and loss of edges of objects [14]. Using the principles of histogram equalization, the image can be described as: (5) (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 13, No. 8, 2022 554 | P a g e www.ijacsa.thesai.org Where I is the probability of grey level in the image, Tp is the total pixels in the image, gL is the grey level, and ngL is the number of pixels in grey level. The cumulative distribution function (CDF) of the grey level of the image I can be evaluated as: Generally, histogram equalization (HE) performs equalized grey level distribution on the original image based on CDF to produce an enhanced image. This method can be executed in real-time, but it has the drawback of changing the brightness of the image. To tackle the problem faced in HE, mean preserving Bi-histogram equalization (BBHE) has been introduced which successfully preserved some of the original brightness of the image. However, it requires greater brightness preservation, which leads to the creation of the Minimum Mean Brightness Error Bi-Histogram Equalization (MMBEBHE) method [15]. This method successfully preserved more brightness and avoided excessive enhancement of the image, however, the Absolute Mean Brightness Error (AMBE) of every possible threshold level needed to be calculated through a full BBHE process would need a large computation process. Contrast Limited Adaptive Histogram Equalization (CLAHE) is another type of histogram equalization method introduced by Reza [16]. Through the algorithm, block effects in the enhancement process are weakened and enhancement of contrast has been limited using a threshold, which avoids overly enhanced contrast however one drawback observed is that the clip limit has to be manually entered. Another histogram equalization method was proposed by Zhuang and Guan [17], namely Mean and Variance based Sub image Histogram Equalization (MVSIHE) which enhances contrast and preserves details of the image; however, the methods are only tested in black and white images. Another method that used adaptive histogram equalization to enhance the contrast of probability distribution function was introduced by Sirajuddeen et al. [18] and able to enhance the image while preserving the details of an image, yet the method can cause oversaturation of color. Although HE can effectively improve contrast and image details, there are several drawbacks which include easily generated noise, color distortion, and image distortion.

C. Neural Network
A neural network is another method that is used to enhance and produce a clearer image with better quality. It is a method based on machine learning and since it is data-driven, the data collected are very important as they will affect the result produced. There are various types of image enhancement methods which apply the neural network, among them, deep convolutional neural network (CNN) technology has received a lot of attention [19]. Besides using a neural network to enhance a low-light image, it can also be used in denoising an image [20].
A low-light image enhancement method applying a neural network is introduced by Gómez et al. [21] which focuses on using CNN to improve low-light images that are captured from high-speed video endoscopy. They use a deep learning approach to enhancing the medical image that is targeted toward patients with laryngeal disorders, however, they lack ground-truth images. Thus, they introduce a method to generate darkened and realistic training images, and results show that the method proposed outperforms existing enhancement methods on the medical images. Besides, Ha et al. [22] applied CNN in CIELAB color space to enhance the low-light image. Their main idea is to split the low-light image into luminance and chrominance components before applying image enhancement on the respective components. The method proved to be very useful in removing undesired artifacts and preventing color distortion. Zero-Reference Deep Curve Estimation (Zero-DCE) is another low-light image enhancement method using a neural network that is proposed by Guo et al. [23] in which a set of best-fitting Light-Enhancement curves (LE-curves) would be estimated for the image using a Deep Curve Estimation Network (DCE-Net) and the enhanced image would be obtained after the curves are applied iteratively in the pixels of an image. The zero-DCE method can generate an image that fits various lightning conditions and performs well although there is a lack of reference images, however, the problem of the generated noises should be tackled in this method. A pipeline neural network is introduced by Guo et al. [24] which consists of a low-light image enhancement net (LLIE-net) and denoising for enhancement of the low-light image. They proved that MSR can be considered as CNN and using wavelet transformation to improve MSR results, thus, an end-to-end convolution network is proposed to enhance the low-light image. The method introduced can produce a quality image without needing to adjust the parameters manually but show lacking in some image as there is a limited dataset. The main drawback of using a neural network would include needing a lot of datasets to produce a well-enhanced image.

III. IMAGE ENHANCEMENT TECHNIQUES
Homomorphic filtering and gamma correction are popular techniques that are used to enhance low-light image [25]. This section briefly introduces the two techniques.

A. Homomorphic Filtering
Homomorphic filtering is one of the techniques used in enhancing an image in the frequency domain [26]. Homomorphic filtering would convert the image to the frequency domain and enhance the image using Fourier transform and apply a high pass filter before converting the image back to the spatial domain [27]. Here, F (x, y) is the input image whereas G (x, y) is the enhanced image. Log represents logarithmic transform that will be applied on the input image, FFT is applied on both illumination and reflection component, then H (u, v) is frequency filtering function will be applied, the output is then inversed using IFFT, and applied Exp, that is exponential before producing the enhanced image. The image I (x, y) can be represented as a multiplication of illumination, L (x, y) and reflectance of an image, R (x, y):

B. Gamma Correction
The gamma correction enhances the low-light image by adjusting the contrast of an image [28], enhancing the pixel intensity of the low-light area. The gamma correction method is also one of the fast and efficient ways to enhance a low-light image [29]. The general formula for this transformation is [30]: In this formula, γ is the gamma correction parameter, Fig. 2 shows some examples of gamma function transformation.
The output will be linear if γ = 1, which would return the same image. When γ>1, the low grey value area will be stretched, and the high grey value area will be compressed. In contrast, when γ<1, the low grey value will be compressed, and the high grey value will be stretched [31].

IV. THE PROPOSED METHOD
A digital image can be expressed as , where all values in the function are discrete quantities and finite. The notation of coordinates, where the image has P rows and Q columns originating from point is shown below [32].

(9)
To solve the problem of color distortion and loss of image details, this paper proposes a low-light image enhancement method using a homomorphic filtering method and gamma correction. Following are the steps carried out using the proposed algorithm: 1) Homomorphic filtering is applied on the RGB image 2) Unsharp masking is done on the enhanced image 3) Gamma correction based on the luminance of image is applied to produce the enhanced image.  After getting the RGB input image, the first process applied was homomorphic filtering as it can keep the image details and remove the uneven regions of an image caused by light. The process was followed by unsharp masking to sharpen the image, aimed to retain the details of the image. The final touch on the image would be gamma correction, this technique was applied to further enhance the details of underexposed and overexposed objects while avoiding color distortion problems [33].
The following section will introduce the types of enhancement done on the low-light image.

A. Luminance and Contrast Enhancement
Homomorphic filtering would be used to enhance the luminance and contrast while normalizing the brightness of the image. The idea of this method is to separate illumination and reflectance while applying two different transfer functions to have more control. However, the Fourier transform cannot separate the product of two functions.

Fourier fxy≠Fourier Lxy×Fourier R (x, y)
Thus, to apply homomorphic filtering, five steps will be required. First, logarithmic function is applied to the input image, note that the log of the image is expressed as illumination and reflectance of image [34].
Applying (12) to Direct Fourier transform (DFT), and its inverse transform, they can be expressed as: To speed up the Fourier transformation process, FFT algorithm is used instead. Here, the process of analyzing the input frequency of data would be faster as the time complexity of DFT is , whereas for FFT the time complexity is . To find the FFT of the image, the equation can be expressed as [35]: The default values chosen for the parameters to adjust the Gaussian filter are set to 1.05 for the high-frequency gain, 0.99 for the low-frequency gain, 2 for the constant, and 200 for the cut off frequency.
The constant, c to control the slope steepness, the highfrequency gain, γ H is set to be greater than 1 and the lowfrequency gain, γ L is set to be lower than 1 to amplify the reflectance of the image while decreasing the illumination and enhancing the contrast of the image. Though there are many suggestions on how these values should be assigned, there are no actual suitable values for these parameters [36]. The values of the parameters can be changed and experimented on to produce a satisfying result. The high pass filter, H u v) will then be applied on the Fourier transform, where it will allow high-frequency component while reducing the low-frequency component.
Followed by Inverse Fast Fourier Transform (IFFT) being applied on the image: After that, the enhanced illuminance and reflectance of image will be obtained, and to recover the original image, exponential function will be used to reverse the log applied in (11).

B. Image Details Enhancement
After enhancing the luminance and contrast of the image, the edges of objects in the image would be enhanced so that the details of the image will not lose easily. Thus, unsharp masking would be applied to the image. Box blur method is chosen for the blurring process, Mask is then obtained with the formula of: Where k here denotes the size of the kernel used for the low-pass filter. Here the value of k is set to 3. Therefore, a 3x3 matrix is used. The reason for using a low kernel size, 3x3 matrix is because the number of pixels that will be blurred will increase as the size of the kernel increases [37] and it would also affect the overall luminosity of the image. Mask is then obtained with the formula of: After that, result of unsharp masking is obtained using (22), Where λ =1 to apply the unsharp mask.

C. Brightness Enhancement
The last step before producing the enhanced image is to perform gamma correction on the enhanced image based on the luminance of the image. In this stage, the gamma value will change according to various luminance to prevent overenhancement of the already enhanced image. It also controls the overall brightness of the image that is shown on the monitor screen and does not cause serious color distortion.
Here, an algorithm has been proposed to enhance the image where the image will be changed according to the different luminance of the image. The main concept is to separate the luminance of an image into three stages, that is when the luminance is equal to 30, 60, and 120. The reason for separating to three stages is to determine whether the low-light enhancement effect should be low, medium, high, or none. If the low-light image is dark, where the luminance of the image is equal to or lower than 30 then it needs high enhancement, the gamma will be configured to 0.4, else if the low-light image is moderately dark, where the luminance is equal or lower than 60 but higher than 30, the enhancement of the image will be done moderately, where gamma will be set to 0.75. When the luminance of the image is lower than 120, the image will be considered slightly unclear, then a low amount of enhancement will be applied to the low-light image, where the gamma will be set to 0.8. Finally, if the luminance of the image is higher than 120, the image will be considered a clear image, therefore the gamma will be set to 1. The value of gamma is determined empirically after testing various values on the lowlight images. Fig. 4 shows the concept of the proposed idea. In short, the proposed method was tuned to enhance the luminance, contrast, image details and brightness of the image. www.ijacsa.thesai.org V. EXPERIMENTAL RESULTS TID2013 dataset [38] has been chosen to evaluate the potential and effects of the proposed method. MATLAB version R2021b running on a laptop with Intel Core i5-8250u CPU operating at 1.60 GHz with physical memory of 8.00 GB was chosen to obtain the results. A comparison between the proposed method with the LIME [39] method and DYNENH [40] method has been made. A visual comparison between the results of "Wall", "Caps", "Portrait", "Barn", "Forest", "Airplane", "Lighthouse", and "Flower" is listed in Fig. 5.

A. Visual Analysis
Visual comparison made in Fig. 5 showed that the images that were enhanced using the LIME method caused an overenhancement problem and caused color distortion and loss of image details in the enhanced image. The color distortion can be observed in the overly enhanced image of the lighthouse where in the ground truth, the roof of the house beside is dark brown whereas, in the enhanced image, the color of the roof has turned bright and reddish-brown color. Besides, the loss of image details occurred in the LIME method as there are some figures in the lighthouse image which was unable to be captured clearly. Another apparent image that showed an overenhancement problem with the LIME method is the airplane. The color of the letters "SIX-SHOOTER" has become a skyblue color instead of the deep blue color in its ground truth. Forest image has also shown an obvious color distortion after being enhanced with the LIME method, where the enhanced image shows bright yellowish-green bushes and trees compared to the original dull green color. On the other hand, the DYNENH method gives rise to the problem of the loss of details in the image. This can be seen in the airplane image, where the low-light image is not properly enhanced, making the image turn dark and blurry. After getting the input of lowlight image, homomorphic filtering will be applied to the lowlight image, enhancing the luminance of the whole image, followed by unsharp masking that enhances the contrast of the image and sharpens the edges of the image so that the details of the image will be seen clearer, finally, the gamma correction will be done on the image according to the image"s luminance, gamma if then arranged according to the luminance of the image, as proposed in our method.

B. Image Details Preservation
An objective evaluation has been chosen to compare the differences between the three low-light image enhancement methods, which include Features Similarity Index (FSIM), Features Similarity Index color (FSIMc) [41], Mean Square Error (MSE), and Structural Similarity Index (SSIM) [42]. FSIM and FSIMc have proven to be effective and consistent in evaluating image quality by measuring the image chromatic features, and higher FSIM and FSIMc indicate that an enhanced image is more similar to the ground truth. MSE is a full-reference quality metric that finds the average of squared intensity differences of distorted and reference image pixels. The smaller MSE represents small errors, and the enhanced image is similar to the ground truth. Besides that, SSIM is used to compare normalized pixel intensities" patterns, therefore a higher SSIM value represents the higher similarity of structural features between the ground truth and the enhanced image [42], [43], [44]. Table I shows the evaluation result for the preservation of image details. The proposed method has proven to be best as compared to the LIME and DYNENH methods. The FSIMc, FSIM, and SSIM are the highest among all the compared methods which indicate that the proposed method can preserve the details of the image better when compared to the other two. The proposed method has adjusted the luminance and contrast of the image using the frequency domain method and applied the unsharp masking method to enhance the edges of the object in the image, therefore producing enhanced images that are similar to their originals. Besides that, the proposed method also has the lowest MSE values when compared with the other two methods.

C. Naturalness Preservation and Visual Information
The naturalness preservation and visual information of the enhanced image were also evaluated. Lightness order error (LOE) has been used to assess the naturalness preservation of the enhanced image [45]. The lower LOE represents better naturalness preservation as LOE shows the value of lightness distortion in the image. Visual information fidelity (VIF) can measure the accuracy which relates to the quality of visual information that is perceived by the human visual system [46], [47]. It helps in identifying the distortion of visual information in the enhanced image, therefore a higher VIF means a better image quality. Table II shows the value of LOE and VIF of the images for each method. According to the results, the proposed method has the lowest LOE and highest VIF among all the other methods, proving that it can enhance low-light images and produce a better image with the lowest value of lightness distortion and highest accuracy compared to the other two methods.

VI. DISCUSSION
The luminance and contrast of low-light image was enhanced during the homomorphic filtering, which had the advantage of maintaining details of image while also removing the uneven regions of images that were caused by light. To tackle the issue of loss of image details, unsharp masking would be used to sharpen the image and produce clearer edge for the object. This step also prevents the loss of the object edges in the image on the following step, that is gamma correction. Gamma correction would show the details of objects that are underexposed or overexposed while avoiding color distortion problem. The results shown in Section V had proved how the proposed method excelled than the other two existing methods. The proposed method had successfully preserved the details of image, achieving the highest FSIMc, FSIM values compared to the other two existing methods, that is, above 0.9, showing its effectiveness in recovering the chromatic features of the image. Besides that, it also achieved the SSIM values above 0.8, showing the similarity of the pixels" pattern between the enhanced image and the ground truth. Additionally, the proposed method managed to have lowest MSE among the three, reaching the lowest value of 183.0 in the "Barn" image. Homomorphic filtering and unsharp masking have contributed a lot in maintaining the details of the images. Aside from preserving the details of the image, the proposed method also showed its capability in enhancing the low-light image while preserving the naturalness of image and visual information. It managed to achieve lowest LOE and highest VIF scores. Gamma correction played a big role in showing the details of underexposed and overexposed objects while avoiding the color distortion problems, which led to a more natural looking image. Therefore, all three processes involved in the proposed method are important in maintaining the chromatic features of image, its structure, as well as enhancing the image and producing a natural looking image. The proposed method in this research has successfully enhanced a low-light image and produced an enhanced image with minimal color distortion and with clear details. The results showed that the proposed method has better visual quality compared to other methods. The proposed method also achieved the lowest MSE and LOE scores, and the highest FSIMc, FSIM, SSIM, and VIF scores. This proves that the proposed method has the lowest color distortion and is the best in preserving the details of the image, thus outperforming the other two low-light image enhancement methods.

VII. CONCLUSION
This research has successfully created a method in the gamma correction stage that enhances the low-light image using the concept of separating the luminance of the image into three stages and enhancing them with specified gamma according to the stage it belongs to. Compared to other lowlight enhancement methods, the proposed method performs better in minimizing the color distortion errors, retaining the image details, and producing a more natural enhanced image. Additionally, the proposed method can preserve features of the image better compared to the other two low-light image www.ijacsa.thesai.org enhancement methods. Although the proposed method can enhance the image with minimal color distortion and is able to produce an image with clear details, it is not tuned to remove the haze of a low-light image, and this might cause difficulties when the low-light image is taken in a hazy environment. Besides that, since the parameters of the values for the high pass filter are determined empirically, they have to be adjusted manually rather than using the default values to produce a satisfying result. As the image enhancement becomes more important in digital images, there will be a lot of improvements made to the proposed method before it can be applied in daily lives. The future work will be focused on improving the method so that it can dehaze and reduce the noise in low-light images; these functionalities are important as low-light images might be captured in a hazy situation, for an instant a hazy day, and a noisy low-light image should be considered. Another thing to work on is to upgrade the method so that it can be applied in real-time applications. The method had the drawback of being unable to utilize the best high pass filter for the low-light image since the values of parameters for the high pass filter had to be adjusted manually for some images. In the future, an algorithm should be implemented for the high pass filter so that it can automatically find the best values for the parameters of the high pass filter.