Application of the Clahe Method Contrast Enhancement of X-Ray Images

—Due to the nonlinearity of the luminance function produced by many medical recording devices, the quality of medical images deteriorates, which creates problems in the visual research work of physicians. X-rays can be taken as an example. This article examines methods of improving the contrast of graphic images methods of improving the quality of X-ray images. The research was carried out in several stages. Attempts were made to increase the contrast of several dozen X-ray images to select the best image brightness using brightness conversion methods in the MATLAB system. Contrast enhancement was observed during the experiments, resulting in the selection of a brightness range corresponding to the visual contrast enhancement. The selection of variables γ for the selected brightness range of the image was performed. The possibilities of the image histogram equalization method were considered. To obtain the best result before performing gamma correction the method of X-ray image histogram equalization is suggested. An enhancement version of this algorithm is presented because of the comparison. Application of the adaptive histogram equalization algorithm with contrast limitation provides a visual effect of improving the contrast of X-ray images. The NIQE and BRISQUE evaluation functions, which do not use reference images, are used to objectively quantify the conversion results.


I. INTRODUCTION
This One of the most powerful tools of modern informatics is medical imaging. Medical imaging is used to accurately and timely diagnose health problems, allowing patients to be treated more effectively. Nowadays, digital medical images are composed of many millions of pixels, which allows them to be considered big data. In some cases, there is a need to enhance the quality of medical images. However, in digital radiography, this may require increasing the radiation dose to the patient. Therefore, the goal of medical imaging is not to obtain a perfect image, but to obtain an image that is sufficient in terms of diagnosis concerning a particular medical problem and that causes minimal harm to the patient.
The essence of methods to enhance the quality of X-ray images is as follows: apply some mathematical methods to low contrast images and enhancement the quality of the digital medical image for a more accurate diagnosis of health problems.

II. LITERATURE REVIEW
In reviewing the experience of other researchers in this field, methods considered in the foreign literature have been studied. The paper [1] deals with contrast enhancement based on internal image decomposition, using Bregman split algorithm and CLAHE (Contrast limited adaptive histogram equalization). The authors show an enhancement meant in the images by evaluating the illumination and reflection levels using an internal image decomposition. A good contrast enhancement is obtained, but the proposed method is only for contrast enhancement and cannot be used for techniques like surface texture change, object insertion, etc.
In [2] Cheolkon Jung discusses the optimized perceptual tone mapping for contrast enhancement of images. The proposed method focuses on human visual attention by constructing a luminance histogram and performs contrast enhancement. The advantage of the method is that it enhancements the performance without excessive contrast enhancement. Contrast enhancement by this method requires more time compared to HE (Histogram equalization), CLAHE methods.
S.S. Haung [3] has proposed an effective method to change the histograms and enhance the contrast of digital images. This paper presents an automatic transformation method that enhancements the brightness of darkened images using gamma correction and brightness pixel probability distribution. It has been used to enhance the video data. The method proposed in the paper uses the differences between the frames to reduce the computational complexity. Experimental results have shown that the proposed method produces enhanced images of comparable or higher quality than those obtained using other methods.
(IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 13, No. 5, 2022 413 | P a g e www.ijacsa.thesai.org M. Shakeri [4] proposed an algorithm for contrast enhancement based on local histogram equalization. The peculiarity of the algorithm is to determine the number of subhistograms and to separate the histogram based on saturation. The algorithm worked in three stages. Initially, the estimation of the number of clusters for image brightness levels is done using histogram alignment. In the next step, the image luminance levels are clustered and finally, the contrast enhancement for each cluster is included separately. The algorithm is compared with other methods based on quality and quantity measurements. The application of the method produces natural-looking images and enhanced contrast. The disadvantages of the algorithm are the loss of detail at high levels of image brightness and the presence of noise in the output image.
In work [5] the authors have proposed a new method for improving medical images. First, the original medical image is decomposed into an NSCT (contour transform without subsampling) region with a low-frequency subband and several high-frequency sub-bands. A linear transformation is then used for the luminance coefficients of the low-frequency sub-band. An adaptive thresholding method is used for noise reduction of the coefficients of the high-frequency sub-bands. All sub-bands were then reconstructed into spatial regions using the inverse NSC transform. Next, unsharp masking was applied to increase the clarity of the details of the reconstructed image. Experimental results show that the proposed method outperforms other methods in terms of such characteristics as image entropy and PSNR (peak signal to noise ratio).
In [6] paper, the social network optimized approach for image fusion for contrast enhancement and brightness preservation is discussed. The social network optimization algorithm creates two quality images, one with better contrast, and increased entropy, and the second image with an increased peak signal-to-noise ratio. The two images are combined to produce an effective image later. Comparisons were made using HE, and linear contrast stretching. The results show that the proposed method provides a better peak signal-to-noise ratio, preserves brightness, and increases the contrast of any given image, resulting in a high-quality visual effect.
However, the number of edge pixels of this technique is large, while the fit value is smaller.
In [7], Se EunKim proposes an entropy-based method for contrast enhancement in the wavelet domain. Initially, he uses local entropy scaling in the wavelet domain to obtain the desired contrast. Mathematical methods were used, and then a color enhancement method was developed in the HSI (from hue, saturation, lightness (intensity)) color space. The algorithm worked in two steps: modifying the low frequencies in the wavelet domain and scaling the HSI color space by increasing the intensity component so that images in low light get detailed color information without any further processing. The peculiarity of the algorithm is that it is used in the HSI color space and provides an increase in the contrast of the image.
Huang Lidong [8] proposed a combination of adaptive histogram equalization with limited contrast and discrete wavelet transform to enhance the image. The algorithm works in three stages. First, the original image is allocated to lowand high-frequency components using a wavelet transform. The low-frequency coefficients are enhancements using the CLAHE method, while the high-frequency coefficients remain unchanged. When the wavelet transform is reversed, the image is mounted successfully. The proposed method is applicable for improving the local details of the image, preserving the details well, and suppressing noise. But the high-frequency component, which contains most of the noise in the original image, remains unchanged.
The authors of [9] propose a high-speed quantile-based histogram equalization (HSQHE) to preserve brightness and enhance contrast in the image. Contrast enhancement by this method is suitable for high-contrast digital images. Recursive segmentation of the histogram is not performed, so minimal time is required for segmentation. Entropy metrics are used to estimate PSNR of contrast enhancement. AMBE (Absolute Mean Brightness Error) is used to estimate brightness preservation. HSQHE preserves image brightness more accurately in a shorter time interval, but a high PSNR value is achieved only for certain images.
In [10], the authors propose a histogram modification scheme with entropy maximization. The method of histogram modification by entropy maximization divides the global histogram alignment into two stages: the pixel populations emergence (PPM) stage, which corresponds to the entropy maximization rule, and the gray-levels distribution (GLD) stage. The method gives good enhancement ments and avoids reinforced noise and distortions in the image, but there is a problem with excessive contrast stretching.
The proposed methods confirm the necessity of non-linear image brightness transformation methods for contrast enhancement, but it requires detailed study for more informative images after processing.

III. IMAGE ENHANCEMENT TECHNIQUES
Image enhancement techniques involve performing such transformations on the original image that lead to a result that is more suitable for a particular application [11]. Visual assessment of image quality is an extremely subjective process, and automatic calculation of the quantitative value of such an assessment is a very difficult task. To choose one or another method to enhance the contrast of a medical image, an evaluation of the result is necessary. Objective quality assessment algorithms are divided into benchmark and nonbenchmark. The different reference criteria use a comparative quality assessment when the reference image is usually known to look like, and its characteristics are known [13]. When dealing with low-contrast medical images, there are no benchmarks for comparison. Therefore, it is necessary to select those evaluation options that do not require a reference image.
Image enhancement approaches fall into two categories: spatial domain processing methods and frequency domain processing methods. The term spatial domain refers to the image plane as such, and this category combines approaches based on the direct transformation of image pixel values. www.ijacsa.thesai.org Frequency methods involve changing the images after the Fourier transform.
Let us consider some methods related to spatial processing methods. Spatial methods are described by the equation [12]: where f (x, y) is a function describing the original image, g (x, y) is the transformed image, and T is an operator over f defined in some neighborhood of a pixel with coordinates (x, y). The neighborhood of a pixel is understood as a square or rectangular area that is a subset of the image and is centered relative to the given pixel. The simplest version of the T operator occurs when the neighborhood consists of a single pixel, in which case the value of g is a function of f (x, y) and T is called a point type conversion.
Histogram transformations are divided into the following groups: linear logarithmic and power transformations. Histogram alignment of a digital image is a transformation of the original image in which the histogram of the transformed image has a more horizontal shape than the histogram of the original image.
To enhance image quality, it is necessary to increase such parameters as brightness range, contrast, sharpness, and sharpness. In combination, these parameters can be enhanced by aligning the histogram of the image. Histogram equalization algorithms are widely used to enhance the processed digital grayscale image. In general, such algorithms are simple to implement, have relatively low computational cost, and yet show high efficiency. The essence of such algorithms is to adjust the levels of the halftone image according to the probability distribution function of a given image (2) and, as a result, the dynamic range of brightness distribution increases. This leads to enhancement meant of visual effects, such as: brightness contrast, sharpness, and clarity.
where P(i) is the probability of the appearance of a pixel with brightness i, the normalized function of the histogram of the original image, j are the pixel coordinates of the processed image, H(j) is the transformed image [12]. Histogram equalization algorithms are divided into the following two types: local (adaptive) histogram equalization and global histogram equalization. In the global method, one chart is built, and the histogram of the entire image is equalized. In the local method, many histograms are constructed, where each histogram corresponds to only a part of the processed image. With this method, the local contrast of the image is enhancements, which makes it possible to obtain better processing results in general.
An enhancement version of the above algorithm is the Contrast limited adaptive histogram equalization (CLAHE) algorithm. The main feature of this algorithm is the limitation of the histogram range based on the analysis of the pixel brightness values in the processed block (3), thus the resulting image looks more natural and less noisy [14].
where da is the increment factor of the value of the histogram function, nc is the number of pixels that exceed the threshold value. It is worth noting that the classic CLAHE algorithm uses bilinear interpolation to eliminate boundaries between processed blocks. The imadjust function is the basic tool in the MATLAB package for converting the brightness of grayscale images. All input parameters of the imadjust function are real numbers in the range from 0 to 1, i.e., the range of brightness values must be normalized. The syntax of the function is defined as follows: The function J = imadjust(I, [low_in, high_in], [low_out, high_out], γ) additionally performs gamma correction of the converted brightness values. By default, the parameter γ = 1, which corresponds to an identical mapping [9].
Histogram equalization in MATLAB is implemented by the histeq function, which has the syntax: Where I is the input image, n is the number of intensity levels set for the output image J. If n is equal to the total number of possible levels of the input image, then histeq simply implements the transform function. If this number is less than the total number of possible levels of the input image, then histeq will redistribute the levels, so that they approximate the flat diagram. A true implementation of this method uses the maximum possible number of levels for n, which is 256. The CLAHE algorithm is implemented by the function adapthisteq, which has the following syntax: J = adapthisteq(I,Name,Value) The Name input parameters can be:  Number of rectangular context areas (tiles) into which adapthisteq divides the image, specified as a 2-element vector of positive integers;  Contrast enhancement limit, specified as a real scalar in the range [0, 1];  Number of histogram intervals used to build a contrastenhancing transformation (256 by default); www.ijacsa.thesai.org  Desired histogram shape;  Distribution parameter.
CLAHE works with small areas of the image, called tiles, rather than with the whole image. The contrast of each tile is increased so that the histogram of the output area roughly corresponds to the histogram specified by the "Distribution" value. Neighboring tiles are then combined using bilinear interpolation to eliminate artificially created borders. Contrast, especially in homogeneous areas, can be limited to avoid amplifying any noise that may be present in the image.

IV. INITIAL DATA AND DESCRIPTION OF EXPERIMENTAL STUDIES
We use X-ray images from the Kaggle database [15] to experiment with the application of image brightness conversion methods. The experiment aims to increase image contrast to obtain more information about a pulmonologist's lung image representation. The essence of methods to improve the quality of medical images is to apply mathematical methods to low contrast images and improve the quality of digital medical images to improve diagnostic accuracy.
Many experiments were conducted to apply the imadjust function to several X-ray images to select the most appropriate input parameters. The values for (4) were chosen in increments of 0.1 in the range from 0 to 1 (Table 1.).
The non-referential NIQE and BRISQUE evaluation functions were used to determine how much contrast was enhanced. The NIQE (Naturalness Image Quality Evaluator) and BRISQUE (Blind/Referenceless Image Spatial Quality Evaluator) functions are used in cases where no image reference is available. The NIQE (A) function compares the quality of image A relative to an abstract model image constructed from images of natural scenes. The BRISQUE (A) function compares the quality of image A with respect to another model image constructed from many images of natural scenes with certain distortions. The smaller the values of these functions, the higher the quality of the images. Thus, according to the data in Table 2, you can determine the best value of the input parameters of the imadjust function. When you select these parameters, you can visually display the result of the transformation and compare it with the original image (Fig. 1). Here the NIQE score for the original image is 4.0372 and for the transformed image the score is 3.3252. We can note the higher contrast of the transformed image and the NIQE score shows a lower value than that of the original image. Table 3 shows the best score values for the 10 test images.  Applying histogram equalization (5) of the original image before testing the imadjust function with the choice of the parameter γ, gives the result of enhancement image contrast (Table 4).   Table 5 shows the scores of 15 test images after applying the histogram equalization methods. In most cases, the results of applying the CLAHE method show a visual improvement in image contrast and a reduction in non-reference scores at the same time. In some cases, the estimates of the results of applying contrast-limited adaptive equalization do not decrease in value compared to the estimates of the original image.
As a result of analyzing the data in Table 5, it was decided that to improve the results of image contrast enhancement, it would be appropriate to replace the histogram equalization method with adaptive histogram equalization with contrast restriction. In the following experiment, function (6) was used to improve the contrast of image I in grayscale by transforming the values using adaptive histogram equalization with contrast restriction.
The application of this method was focused on the Distribution and SlipLimit parameters. The Distribution parameter takes the values 'uniform', 'rayleigh', 'exponential', which set the desired shape of the histogram. This parameter defines the distribution that adapthisteq uses as the basis for www.ijacsa.thesai.org creating the contrast conversion function. The selected distribution should depend on the type of input image. For example, underwater images seem more natural when using the 'rayleigh' distribution. The ClipLimit parameter is a contrast ratio that prevents oversaturation of the image, especially in homogeneous areas. These areas are characterized by a high peak on the histogram of a particular image fragment because many pixels fall within the same range of gray levels. Without clip limitation, the Adaptive Histogram Smoothing method can produce results that are, in some cases, worse than the original image. Its default value is 0.01.
The following steps were performed for several test X-ray images:  To determine the optimal value of the 'clipLimit' parameter, we chose its values from the interval [0, 1] in steps of 0.01.
 Calculation of objective estimates for all transformed images.
 Plotting objective estimates for all versions of images.
 Determination of the minimal estimates NIQE and BRISQUE;  Choosing the optimal visual representation of the image with the minimum objective estimates.
Construction of objective scores plots (Fig. 5) for several X-ray images showed that the values of cliplimit parameter can be limited from [0, 1] to [0, 0.2], as the following values were not informative. The minimal measures of the NIQE and BRISQUE estimates allow us to select images with improved contrast. This choice is related to the claim that the smaller the value of the non-reference score, the visually improved the image is. This assertion has been proven in previous studies, where a minimum NIQE score was more likely to coincide with an improved visual perception of the image.
A visual comparison of the original image (a) with the CLAHE-transformed image (b) with minimal BRISQUE estimation is shown in Figure 7. Here the parameter distribution at value 'rayleigh' takes minimum BRISQUE value equal to 9.1993, which corresponds to NIQE=3.2365 at value of parameter cliplimit=0.01. www.ijacsa.thesai.org A visual comparison of the original image (a) with the CLAHE-transformed image (b) with the minimum BRISQUE score is shown in Figure 9. Here the parameter distribution with 'exponential' value takes a minimum NIQE value of 2.8036, which corresponds to BRISQUE=12.6992 with the value of the parameter cliplimit=0.15.
A visual comparison of the original image (a) with the CLAHE-transformed image (b) with minimal BRISQUE estimation is shown in Figure 10. Here the parameter distribution at value 'exponential' takes minimum BRISQUE value equal to 6.9796, to which corresponds NIQE=3.0005 at value of parameter cliplimit=0.02.  The results of similar actions performed on the rest of the test images are shown in Table 6. Here are the non-reference estimates of the original image and the CLAHE transformation results with the selected values of the distribution parameter. For each value of this parameter, the minimum estimates of NIQE and BRISQUE, and their corresponding values of the cliplimit parameter and estimates have been determined. Table 6 shows the values of the obtained non-referential estimates of the original image and the transformed images using the CLAHE method. Changing the values of the distribution and cliplimit parameters, when performing the adaptive equalization method with contrast restriction, gives positive results. An analysis of the values in Table 6 gives a preference for the value of the 'distribution='exponential' parameter for certain values of the cliplimit parameter. This is evidenced by the NIQE and BRISQUE non-reference scores, which decrease in value as the contrast of medical images improves. As demonstrated by the laboratory studies performed, in many cases the NIQE score was more consistent with image improvement.
As a result of the performed laboratory studies, a combination of the gamma correction method and the adaptive histogram equalization method, in which contrast enhancement is limited to avoid causing or enhancing noise in the image, is considered appropriate.