Rapid Contrast Enhancement Algorithm for Natural Contrast-Distorted Color Images

Digital images are often obtained with contrast distortions due to different factors that cannot be avoided on many occasions. Various research works have been introduced on this topic, yet no conclusive findings have been made. Therefore, a low-intricacy multi-step algorithm is developed in this study for rapid contrast enhancement of color images. The developed algorithm consists of four steps, in that the first two steps include separate processing of the input image by the probability density function of the standard normal distribution and the softplus function. In the third step, the output of these two approaches is combined using a modified logarithmic image processing approach. In the fourth step, a gamma-controlled normalization function is applied to fully stretch the image intensities to the standard interval and correct its gamma. The results obtained by the developed algorithm have an improved contrast with preserved brightness and natural colors. The developed algorithm is evaluated with a dataset of various natural contrast degraded color images, compared against six different techniques, and assessed using three specialized image evaluation methods, in that the proposed algorithm performed the best among the comparators according to the used image evaluation methods, processing speed and perceived quality.


Introduction
Contrast enhancement (CE) is an important subject in digital image processing and computer vision [1]. Improving the contrast increases the visibility of image features and reveals the latent image details [2]. The contrast is a distinctive image feature that tells if an image has a bad or quality [8], in that images with a low-contrast effect usually own a limited dynamic range and they are unfavorable to be used in many real applications [1]. The low-contrast effect often happens due to different causatives, including bad weather, unsuitable illumination, and many more [3]. The low-contrast image usually has deficient colors and improper representation of image details, which prevents optical systems from performing their correct functions properly [4]. Images with adequate contrast are typically viewed better than their low contrast counterparts [7]. Contrast can be defined as the difference between the minimum and maximum values of the image. CE owns two types which are global and local. The global type is prevalent in enhancing digital images and providing good quality images. However, the local type improves the local contrast depending on local information [5].
CE aims at improving the dynamic range of the image to provide better visual quality without creating any errors or losing details. CE is described as if a layer of murkiness is removed from the image to reveal better details [6]. CE can also be divided into two main categories direct and indirect [6]. The direct methods utilize a distinct term for direct enhancement, while the indirect methods boost the contrast using underused dynamic regions, and most CE methods are often indirect [7]. The indirect category can also be divided into several subgroups: methods that analyze the image to process its high and low frequencies, histogram processing techniques, and transformbased techniques. The second subgroup gained the most attention from these three subgroups because of its intuitive and straightforward implementation characteristics. In the methods based on the second subgroup, the contrast is modified by altering the histogram pattern so that the new histogram becomes more spread to the natural range than the original histogram [5].
Different algorithms have been introduced in the past years to handle the lowcontrast effect. some of these algorithms are reviewed in Section 2 of the article. This study is just a small contribution to the field of digital image processing. The proposed algorithm has low complexity and does not use the concept of histogram equalization. The significance of this study lies in developing an algorithm that owns a simple structure and achieves the processing rapidly and efficiently, with minimal input to the algorithm so that it becomes easier to be used by the operator. The key objectives of this study are to develop a low-intricacy multi-step algorithm for contrast enhancement and to provide rapid yet efficient processing for different contrast-distorted color images.
The algorithm developed in this study consists of four distinct steps, for which each step contributes significantly to the enhancement process. Furthermore, adjusting the contrast is managed using one parameter. The algorithm is tested with various realcontrast degraded images and compared with six algorithms. Besides, three well-known image evaluation methods are used to assess the quality of the comparisons' results. The remaining sections of this article are arranged in the following manner: a concise description of the previous research work is given in Section 2. The developed algorithm is explained in detail in Section 3. Performed comparisons and experiments along with their discussion are demonstrated in Section 4. Finally, important conclusions are drawn in Section 5.

Literature Review
Different developments have been proposed in the last decade. In Pal & King [9], a model that improves the image tonality is suggested using the concept of fuzzy sets. This model includes initial enhancement, smoothing, and final enhancement, in that both the primary and final enhancements include the extraction of fuzzy properties corresponding to pixels and then apply the contrast intensifier of the fuzzy operator. Wang et al. [10] proposed a technique named dualistic sub-image histogram equalization (DSIHE). It works by dividing the input image into two sub-images that have the same size. Then, these sub-images are equalized in a successive way using histogram equalization. Lastly, improved sub-images are combined to form the final output.
While in [11], Agaian et al. introduced a new technique that functions in the frequency domain. Its main aim is to modify the magnitude of certain coefficients to obtain a better contrast representation. This algorithm starts by applying an orthogonal transform. Then, the obtained transform coefficients are multiplied by a pre-determined factor. Lastly, an inverse orthogonal transform is applied to get the final output. Yang and Park [12] developed an algorithm that depends on the concept of histogram equalization (HE). It utilizes a mapping function to adjust the image gradients by placing constraints on the probability density function with bin underflow (BU) and bin overflow (BO). The BUBO operation can provide proper control over the enhancement process using a single parameter. Using this feature, the enhancement using the HE technique can be achieved can produce results that have better qualities than the original image and the classical HE technique.
Likewise, Wang and Ward [13] provided a weighted and thresholded HE (WTHE) technique that can also control the amount of enhancement. Initially, the classical HE method is applied to the input image. Then, the histogram of the processed image is modified using thresholding and weighting approaches. Next, a power-law function is applied to maintain a low probability of grey levels. Lastly, a normalization function is applied to stretch the image intensities to the natural range. In Al-Wadood et al. [14], a technique named dynamic histogram equalization (DHE) is proposed, in that it starts by dividing the histogram of the input image into several sub-histograms until it is confirmed that no dominating parts exist in any sub-histogram. Next, each subhistogram is modified by allocating a new dynamic range using HE. This process can prevent the over-enhancement and washed-out effects produced by the classical HE technique and ensures a proper enhancement for the contrast. The output is obtained by applying a separate transformation on each partition then combining them to form the resulting image.
Moreover, Kim and Chung [15] introduced a method called recursively separated and weighted histogram equalization (RSWHE). It initially divides the histogram of the input into several sub-histograms recursively then modifies them via a weighting process based on the used normalized power-law function, by segmenting an input histogram into one or more sub-histograms recursively. In Wang et al. [16], a technique named flattest histogram specification with accurate brightness preservation (FHSABP) is developed. Initially, a mean brightness restraint HE technique is applied to the input image as an initial processing stage. Then, a process that includes simplifying the convex optimization for FHBP is implemented to modify the contrast. Finally, a histogram specification approach is applied to stretch the intensities to the natural range.
In Hanmandlu et al. [17], the authors developed an algorithm that first changes the input image to the hue, saturation, and value (HSV) color domain and the processing happens on the V channel. Then, a power-law-based process is utilized to enhance the overexposed image regions. Next, the saturation part of the HSV is processed by a different power-law approach to restoring the information loss in the image's overexposed regions. After that, the fuzzy contrast, entropy, and visual factors are determined to be used later with the bacterial foraging method that helps in the training of the algorithm's parameters. Finally, Gaussian and triangular functions are computed for the overexposed and underexposed regions to get the resulting image.
Besides, Hashemi et al. [18] introduced a genetic-based technique that employs an unpretentious chromosome arrangement with different genetic operators to improve the contrast, in that it can remap the image intensities to get a resulting image with better contrast. Also, Poddar et al. [19] introduced a method called non-parametric modified histogram equalization (NMHE), in that it initially determines the clipped histogram and the full histogram of the input image. Next, two measures are attained to adjust the pristine histogram that are the spike-free histogram and the measure of un-equalization. Lastly, a special modification function is implemented to determine the resulting image. Moreover, Zuo et al. [20] introduced a histogram-based method named range limited bihistogram equalization (RLBHE). It first partitions the histogram of the input image into two different sub-histograms using a special thresholding approach that depends on reducing the intra-class variance to well-separate the background from the objects. Next, the equalization range is determined, and the final image is produced by remapping the sub-histograms.
Furthermore, Singh and Kapoor [21] proposed an algorithm called median meanbased sub-image clipped histogram equalization (MMSICHE). The MMSICHE starts by calculating the median and the average values of the input image. Then, a distinct plateau limit is utilized to clip the histogram of the input image. Next, the resulting histogram is portioned, and every partition is processed by the classical HE considering the median and the average values that have been previously computed. Lastly, the processed parts are joined to form the final image. In Gu et al. [22], an algorithm called robust image contrast enhancement (RICE) was introduced. RICE starts by determining the input image histogram to be processed by dissimilar histogram adjustment approaches. Next, the resulting histograms are checked using the metric of contrast. When the anticipated scores are obtained, the favorite histogram is applied, and the output image is obtained.
On the other hand, Draa and Bouaziz [23] proposed a new method that employs the concept of the artificial bee colony (ABC) to remap the input image intensities and modify them to produce a resulting image with improved contrast and perceived details. Jiang et al. [24] provided a method called a histogram specification approach (HSA). It first converts the image to the HSI domain. Next, the average brightness in the image is determined, followed by the implementation of a distinct histogram specification method to adjust the contrast, preserve the brightness, and prevent the occurrence while preserving color lucidity. Then, a specially designed equalization approach is implemented, and the outcome of this phase is transformed to the RGB domain to get the resulting image.
The last method to be reviewed is by Parihar et al. [25], in that they proposed an algorithm called fuzzy contextual contrast enhancement (FCCE). It initially evaluates the input image's index of similarity via the fuzzy aspect. Then, the fuzzy dissimilarity histogram and the fuzzy contrast factor are determined computed for the input image. Next, a special transformation that depends on the aforesaid factors is utilized to improve the contrast. This phase outcome is processed again with another transformation to produce the resulting image. As noticed from the reviewed methods, various of such employ the concept of histogram equalization. The methods in this field that produce adequate results usually own complex structures and/or excessive calculations, in that a rather long processing time is needed to produce the results. Still, no conclusive findings have been made and thus, the opportunities for providing new research remain standing.

Proposed Algorithm
The algorithm introduced in this study was built depending on distinct equations that represent different processing notions. Besides, the key motivation behind building this algorithm is to obtain adequate results in terms of perceived details for the original distorted observations rapidly and without artifact generation. In the field of image enhancement, many s-curve transformation functions are known to result in contrast modifications [29][30][31]. Likewise, the features of any two images can be combined using logarithmic image processing (LIP) models. Many such equations exist and have been used in different research topics related to image enhancement [32][33][34]. After combining the features of both images, one or more additional enhancement methods are required to be implemented to produce the last outcome with adequate quality.
Using these ideas, the developed algorithm is structured. Initially, the original image is processed by two different curvy transformation functions to produce two different Contrast modified images. Then, a suitable LIP model is selected to combine the features of both images to get an image that owns a distinct contrast enhancement. Finally, a gamma-corrected stretching function is applied to stretch the intensities to the standard interval and correct the gamma at the same time. To give more details regarding the developed algorithm, the input image is first processed by the probability density function of the standard normal distribution (PDF-SND), which is a curvy transformation function that is used to modify the contrast of a given image. In its simplest case, the PDF-SND can be expressed using Eq.1 [35,36]. (1) where i,j are image coordinates, f(i,j) is the resulting contrast-modified image, g(i,j) is the input contrast-distorted image. Next, the input image g(i,j) is processed again by a softplus function. This function is another type of curvy transformation that can be used to modify the contrast of a given image. The softplus function is computed using Eq.2 [37], where s(i,j) is the second resulting contrast-modified image. After getting two contrast-modified images, a LIP model is utilized to merge the features of both contrastmodified images f(i,j) and s(i,j). Different LIP models exist for this objective, yet the main goal here is to choose one model that has low complexity and does the job efficiently. Thus, the LIP model proposed in [38] was adopted and amended to be suitable for contrast enhancement. In Eq.3, the original model is described, where l(i,j) is an image that has the features of both f(i,j) and s(i,j). The modified LIP model can be computed using Eq.4.
Until here, we have combined the characteristics of two contrast-modified images. What remains is that its intensities should be fully stretched to the standard interval, as well as, the gamma of image l(i,j) should be corrected to produce the ultimate output. Therefore, a gamma-controlled normalization function is utilized for these purposes. Accordingly, the standard normalization function can be defined using Eq.5 [39], where max and min are the highest and lowest pixel values in image l(i,j), n(i,j) is a contrast-stretched image by normalization. The gamma-controlled normalization function, which is used as the final processing step, can be computed using Eq.6, where n(i,j) is the resulting final image of the developed algorithm, γ is a gamma correction parameter that is responsible for adjusting the image contrast. Parameter γ satisfies γ > 1, where a higher γ value leads to further amelioration in the image contrast. Finally, the value of γ must be determined manually by the operator to get the best quality image. The framework of the developed algorithm can be depicted in the flowchart given in Figure 1.

Results and Discussion
In this part, everything concerning the experiments and comparisons is given. As for the used dataset, its images were obtained and gathered from many websites, and different researchers who provided the images free of charge. All the used images are real contrast-distorted color images. The reason for this is to truly check the processing capabilities and efficiency of the proposed and comparative algorithms, in that more than 50 low-contrast images were collected and used. Figure 2 displays some image samples used in this study. The reason for using the average of performances is that more than one image has been used in the comparison process, and different images produce different results. Using the average can simplify the means of reaching the best judgment when it comes to understanding the best performance. The proposed algorithm is compared against six modern algorithms that are already explained in the literature review section of the article. The comparison algorithms are the following: adaptive gamma correction with weighting distribution (AGCWD), non-parametric modified histogram equalization (NMHE), median means based sub-image clipped histogram equalization (MMSICHE), histogram specification approach (HSA), robust image contrast enhancement (RICE), and fuzzy contextual contrast enhancement (FCCE). Measuring the quality of images is not easy, as different methods exist to achieve this task. The available image evaluation methods vary in concept since each method utilizes different image features in its evaluation. Therefore, three different image evaluation methods were selected in this study. The first is the colorfulness (CFN), which is a modern metric that utilizes the standard deviation and the average features of the input image to predict its color quality using a distinct equation. This metric can be used to predict the amount of the perceived colors in the assessed image, in that a higher output indicates that more colors are predicted in the assessed image [26].
The second is the BIQME which means blind image quality measure of enhanced images. This metric utilizes seventeen features in an image to determine its scores, including colors, sharpness, contrast, naturalness, and brightness. It utilizes different statistical and mathematical models to detect these features. Among such, the entropy of the phase congruence, log-Gabor filters, contrast energy, Gaussian derivatives, discrete wavelets, information entropy, and other traits are applied to determine the features. The outputs are pooled together using distinct measurements to get the final score. This metric is used with digital images that have altered brightness, brightness, colors, and other attributes. A higher score indicates that the assessed image has a better appearance in terms of brightness, colors, and contrast [27].
The third is the BTMQI which means blind tone-mapped quality index. This metric analyzes the structural information and naturalness in an image to produce its score. Accordingly, local statistics, the entropy, and Sobel operators have been used for this task and their results are combined using a specific regression unit. The output of this metric indicates the naturalness of appearance, in that the lower scores show that an image has a more natural appearance to the observer [28]. The three metrics used are no-reference, which means that they need only one image entry. In short, the CFN measures the perceived quality of colors, BIQME measures the perceived quality of brightness and contrast, and the BTMQI measures how natural the image appears to the observer. The outputs of these metrics are numeric values that are greater than zero, achieving the best visual quality whenever the value is high for CFN and BIQME, and low for BTMQI.
The proposed and comparative algorithms were implemented using the MATLAB 2018a programming environment with a processor Core i5-8300H 2.30 GHz and 8 GB memory. The proposed and the comparison algorithms, the image evaluation methods, measuring the runtimes are all achieved under that environment. Some real contrast distorted images are selected and processed using the developed and the comparison methods, and their results are saved as images, and the runtimes are recorded. Next, all the saved images are gathered and inputted to each image evaluation metric separately to record the accuracy. After recording the accuracy for all images, the average performances are computed for each method and added to determine which method is the best in terms of metrics and runtime. Finally, the average performances are copied to Microsoft Excel to generate the graphical charts.
The rest of this section is organized as follows: the experimental results are demonstrated in Figure 3 - Figure 5 in addition to their explanations. Next, the outputs of the performed comparisons are displayed in Figure 6 - Figure 8 along with the sores of the utilized image evaluation methods that are provided in Table 1, the graphical charts of Table 1 that can be observed in Figure 9 - Figure 12. What is more, the required discussions regarding the made comparisons are delivered and some concluding statements are given to end this chapter. From the results in Figure 3 - Figure 5, the filtered images appear with way better quality than their original observations, as the colors appear very clear and bright, the brightness is preserved from being extremely amplified, and the contrast is improved to look natural to the observer. The histograms provided in each figure support the afore statements, as the histograms of the resulting images show a better allocation of image intensities in the dynamic range than the histograms of the original images that are limited to specific ranges, which indicates that they have unsatisfactory quality.    Table 1 demonstrate the results of comparisons. For these figures and this table, the original contrast distorted images have remarkably low contrast, faded colors, and unsuitable naturalness. The results of AGCWD appear almost the same as the original degraded image with a minor contrast change and brightness increase. That's why it scored the least in BTMQI, and slightly higher than the degraded image in BIQME, with above moderate reading in CFN, and it was the third-fastest method according to the average runtime. The results of NMHE appear with modified colors, slightly increased brightness with a touch of contrast enhancement. That's why it scored almost like AGCWD in BTMQI, and below moderate in BIQME, with moderate reading in CFN, and it was the second-fastest method according to the average runtime. The MMSICHE provided some minor distortions to the processed images with proper colors noticeable brightness increase in some image regions, and somewhat acceptable contrast. That's why it scored moderately in BTMQI and BIQME, with high reading in CFN, and it was somewhat slow according to the average runtime.

Figure10:
The graphical charts of the average BIQME scores.

Figure11:
The graphical charts of the average CFN scores.

Figure12:
The graphical charts of the average runtime.
As for the HSA, the colors were not well-presented; the images appear not natural, with somewhat acceptable contrast. That's why it scored below moderate in BTMQI, above moderate in BIQME, with below moderate reading in CFN, and it was the slowest method according to the average runtime. RICE on the other hand did not provide images with vast differences from the original images. It only provided a slight contrast adjustment. That's why it scored worse than the original image in BTMQI, below moderate in BIQME, with below moderate reading in CFN, and it was the fourthfastest method according to the average runtime. The FCCE provided somewhat pale colors to the processed images with adequate contrast and slight brightness increase. That's why it scored high in BTMQI and BIQME, with the worst reading in CFN, and it was the fifth-fastest method according to the average runtime.
As for the proposed algorithm, it performed the best according to the obtained quality scores and visible appearance, as it delivered the highest readings in all the three-quality metrics in addition to being the fastest among the comparable methods. This happens because vivid colors, natural contrast, and preserved brightness are observed in the results. This is important because such visually pleasing results are obtained with an algorithm that utilizes four processing steps only. As known, it is an apprehensive duty to develop an algorithm that involves low calculations yet delivers adequate results with satisfactory visual traits. Such duty is successfully attained in this study as the results are visually pleasing, outperformed various methods, and appeared with no processing errors.

Conclusion
In this study, a low-intricacy multi-step algorithm for adequate contrast enhancement of color images is developed. It consists of four distinct steps, in that each step contributes to the successful enhancement process. The first two steps include processing the input image with two different equations that can perform curvy transformations that can modify the contrast. Then, the output of these equations is combined using a modified LIP model to get the features of both images. Finally, a gamma-controlled normalization approach is used to stretch the image intensities to the natural range and adjust the gamma simultaneously. The input to the developed algorithm is a contrast-distorted image and parameter γ, while the output is a contrastedenhanced image. To know the real performance of the developed algorithm, only real-contrast distorted images were used in all experiments and comparisons. The results of the developed algorithm are compared against six advanced algorithms and their accuracies are measured using three well-known metrics, in that all the empirical trials were achieved under the MATLAB environment. Form the obtained outcomes, it is obvious that the developed algorithm provided well-performances, as it delivered betterquality results in terms of contrast enrichment, brightness preservation, and adequate colors with no visible filtering errors. Likewise, it was the fastest in processing different types of images. These findings are noteworthy because the developed algorithm only utilizes four processing steps and yet it outperformed the performances of many advanced algorithms. Finally, this algorithm can be used with systems that require low calculations to produce their outcomes. The future works of this study can be further adapting the algorithm to be utilized with other real applications such as forensics, medicine, remote sensing, and so forth, and it can be developed more to become fully automated.