Low-Light Mine Image Enhancement Algorithm Based on Improved Retinex

: Aiming at solving the problems of local halo blurring, insufficient edge detail preservation, and serious noise in traditional image enhancement algorithms, an improved Retinex algorithm for low-light mine image enhancement is proposed. Firstly, in HSV color space, the hue component remains unmodified, and the improved multi-scale guided filtering and Retinex algorithm are combined to estimate the illumination and reflection components from the brightness component. Secondly, the illumination component is equalized using the Weber–Fechner law, and the contrast limited adaptive histogram equalization (CLAHE) is fused with the improved guided filtering for the brightness enhancement and denoising of reflection component. Then, the saturation component is adaptively stretched. Finally, it is converted back to RGB space to obtain the enhanced image. By comparing with single-scale Retinex (SSR) algorithm and multi-scale Retinex (MSR) algorithm, the mean, standard deviation, information entropy, average gradient, peak signal-to-noise ratio (PSNR), and structural similarity (SSIM) are improved by an average of 50.55%, 19.32%, 3.08%, 28.34%, 29.10%, and 22.97%. The experimental dates demonstrate that the algorithm improves image brightness, prevents halo artifacts while retaining edge details, reduces the effect of noise, and provides some theoretical references for low-light image enhancement.


Introduction
Video monitoring is one of the several important means of coal mine safety management; however, the quality of the video monitoring images is poor due to the influence of light, dust, and water mist.Traditional algorithms for enhancement are liable to halo blurring, unclear edge details, and noise pollution, which reduces the effectiveness of the information contained in the image [1], thereby affecting the performance of the video monitoring system.Therefore, improving the visibility of mine images in low-light conditions is essential, which is also a prerequisite for improving the performance of the subsequent analysis and recognition of video images.
In recent years, many methods have been suggested by researchers to address the problem of enhancing mine images, which can be roughly divided into two types, those in the spatial domain and those in the frequency domain.Among them, the introduction of the Retinex algorithm has significantly enhanced the performance of image enhancement in coal mines, and researchers have conducted many studies based on this algorithm.Most of the coal mine image enhancement algorithms are rooted in the theory of Retinex, predominantly include single-scale Retinex [2], multi-scale Retinex [3], and multi-scale Retinex with color restoration (MSRCR) [4].The Retinex algorithm can improve image contrast and enrich detail in images [5], but it results in excessive enhancement and color imbalances.Wang et al. [6] introduced a method based on a nonlinear function that is based on the Retinex algorithm.Using a Gaussian filter to obtain the illumination component and constructing a nonlinear function for contrast enhancement, the enhanced image and the initial image are integrated to improve the contrast and reduce the impact of uneven lighting.Liu et al. [7] used a linear function to stretch the grayscale range of the brightness component, which was based on the Retinex algorithm model, and used a mapping function to perform color correction on the saturation component, avoiding the problem of low image contrast and achieving global enhancement.Wang et al. [8] proposed a method that combines Gabor filter with the principles of Retinex theory, which isolates the intensity component from the HSI space and enhances it with MSRCR, and then the SSR algorithm is applied using Gabor filter on the image in the RGB space.The weighted fusion of the images is consequently enhanced by the two different methods, which avoids an over-enhancement of the image.Lin et al. [9] proposed a Retinex framework that utilizes bilateral filtering to extract the reflection component in the HSI space, then transfers the image back to the RGB space to enhance it by combining a modified framework model with Gaussian pyramid transform, which reduces the blurring phenomenon and improves the quality of the image.Shang et al. [10] presented an adaptive image enhancement technique that utilizes the Retinex algorithm along with guided filtering to process the V component in the HSV space; it performs color compensation for saturation component, histogram equalization on the initial image to improve the contrast, and a fusion processing of the two, which is richer in information and increases the details.The above analysis shows that, although the current algorithms have the capability to improve the image brightness, they still have problems, such as the blurring of local halos and difficulty in retaining edge details.
To address the above problems, this paper proposes an improved image enhancement algorithm.The algorithm processes the different components separately in HSV color space, and finally converts them back to the RGB space.The above process mainly includes three parts: (1) an estimation of the illumination and reflection components from the brightness component; (2) brightness enhancement and denoising on illumination and reflection components; and (3) color correction is applied to the saturation component.The main contributions of this paper are as follows: (1) An improved guided filtering algorithm is proposed to replace the Gaussian filter in the Retinex algorithm to more accurately estimate the illumination component and reflection component from the brightness component.(2) Fusion of the contrast-limited adaptive histogram equalization algorithm and the improved guided filtering algorithm to process the reflection component to achieve brightness enhancement and denoising at the same time.(3) Propose an improved adaptive stretching method to process the saturation component to avoid color distortion.
The rest of this article is organized as follows.Section 2 introduces the relevant theoretical knowledge of Retinex.Section 3 is the algorithm proposed in this article.Section 4 conducts experimental verification and comparative analysis.Section 5 summarizes this article.

Retinex Theory
Retinex is a model based on the vision perception and adjustment of the brightness of surrounding objects [11], and its basic principle is to divide the image I(x, y) into illumination component L(x, y) and reflection component R(x, y) [12].(x, y) represents the spatial coordinates in the image, that is, the pixel position in the image.x usually represents the horizontal position, and y represents the vertical position.The illumination component encompasses the variations in brightness.Object features and color information are presented in the reflection component, and its principle model is presented in Figure 1.Based on the principles of Retinex theory, the above process can be formulated as ( Since the logarithmic form is closest to the process attributes of humans experiencing brightness, transferring it to the logarithmic domain yields log(I(x, y)) = log(L(x, y) × R(x, y)) = log(L(x, y)) + log(R(x, y)). ( In the Retinex algorithm, the calculation of the illumination component is commonly achieved through the application of a Gaussian filter as the center-surround mechanism, which is estimated as where G(x, y) represents the Gaussian filter and * is the convolution symbol.
Based on Equation (2), Figure 2 depicts the diagram of the Retinex algorithm.

Proposed Method
This paper, firstly, in the HSV space, adopts the improved multi-scale guided filtering algorithm for the brightness component to extract the illumination component, which can accurately retain the edge details while avoiding halo artifacts.Secondly, the extracted illumination component adopts the Weber-Fechner algorithm to perform adaptive brightness correction, and the reflection component is processed using a fusion method of contrast limited adaptive histogram equalization and improved guided filter to prevent excessive enhancement and image distortion; then, the principal component analysis is performed to fuse the two components.Thirdly, to prevent the color distortion, an improved adaptive stretching method is used to balance the saturation component.Finally, the three components are fused and converted back to the RGB space.The framework is presented in Figure 3.

Improved Guided Filtering
Guided image filtering (GIF) was first introduced by Kaiming He et al. [13], and its process can be regarded as an ordinary linear translation transform filtering model.The satisfied linear relationship is where q i is the linear conversion of the guide image I i in the local window; the linear coefficients of the corresponding window are represented by a k and b k ; and w k is a local window with a radius, r, and a center pixel, k.
The linear coefficients are fitted using the least squares method [14], and the cost function is where ε refers to a fixed regularization term used to avoid the value a k from becoming overly large [15].Weighted guided image filtering (WGIF) introduced an edge weighting factor Γ I (k) [16] based on GIF to adaptively adjust the regularization parameter.Γ I (k) is defined as follows: where N refers to the overall pixel count; σ 2 I,1 (k) is the variance of the guide image that denotes the varying scope of values in the input image of 3 × 3 window [17]; ψ is a very small constant, which in general takes the value of (0.001 × L) 2 ; and L reflects the range of values presented in the input image.
Although WGIF reduces the halo blurring phenomenon at the boundary, its edgeaware factor is determined by assessing the variance within local windows at different areas.However, the areas with larger variance are not always edge areas and are insensitive to the weak edge areas in the image.Therefore, the gradient information is introduced into the new edge-aware weight; at the same time, it can enhance the capability to perceive subtle edges in the image, thus improving the robustness of the algorithm.The proposed new edge-aware weight is calculated by where φ(k) is defined as k)and σ 2 I,r (k)are the variances of the pixels in the 3 × 3 window and the (2r + 1) × (2r + 1) window, respectively; G is the Gaussian filter; g(k) refers to the gradient size of the pixel k, G(k) = (k x ) 2 + k y 2 ; and k x and k y are the gradients along the x and y directions.
It can be determined from the linear model of Equation (4) that ∇q i = a k ∇I i .It is evident that the filtering effect of the image is influenced by a k .If the value of a k is 1, it implies that the image is situated in the edge region and is well preserved; if a k is 0, it implies that the image is situated in the flat region and the smoothing effect is better.WGIF lacks the edge constraints, and the edge cannot be preserved very well.On this basis, a new edge protection constraint γ(k) is proposed to preserve the edge while retaining the slight details in the comparatively smooth regions.The expression of γ(k) is where g(k) is the gradient size of the pixel k.When it is located in the edge area, the magnitude of g(k) is larger and γ(k) is closer to 1; when it is located in the smooth area, the magnitude of g(k) is smaller and γ(k) is closer to 0. Therefore, the new cost function is changed to Thus, the best values for a k and b k are determined as where µ k and p k are the mean values of the guide image and the input image in the window w k , respectively; σ 2 k is the variance of the guide image in the window w k ; and |w| is the amount of pixel k.
Putting the magnitude of a k and b k into Equation (4), the expression for the output image can be represented as where a i and b i are the average values of a k and b k within the window w k , respectively.To prove that the improved guided filtering algorithm (WWGIF) has a more effective edge-preserving result, the filtering results are compared with the other three filtering algorithms GIF, WGIF, and gradient domain guided image filtering (GDGIF) [18], using the same regularization parameters and filtering radius, ε = 0.2 2 , r = 16.The original image in Figure 4 is from a publicly available image on the Internet, from which we can see that the algorithm presented in this paper exhibits superior edge-preserving effects compared to GDGIF and effectively avoids the local halo blurring phenomenon of GIF, which can maintain the intricate edges of the image and retain the weak details of the relatively flat areas.According to the data provided in Table 1, it is apparent that PSNR and SSIM indexes of the improved filtering algorithm are significantly improved compared to GIF, WGIF, and GDGIF.This means that WWGIF improves the quality of the image and shows better performance in these filters.

Extraction and Enhancement of Illumination Component
In this article, the improved guided filtering algorithm is combined with the Retinex algorithm, and at the same time, different scales are used to weigh it for the extraction of illumination components, which can not only effectively avoid the halo blur phenomenon, but also retain the edge features and particulars of the initial input image to a greater extent.The expression can be presented in the following form: where q n (x, y) is the improved guided filtering for the nth scale (n = 1, 2, . . .N, N = 3 in this paper), and w n is its weight, for which the three weight values in this article are The Weber-Fechner Law is a psychophysical expression that illustrates the correlation between the sensory intensity of human perception and the sensory intensity of external environmental stimulation [19].In terms of light intensity changes, it can be used to indicate the logarithmic linear relationship between the way the human eye perceives changes in light intensity L out and the initial light intensity L in .After obtaining the estimated illumination component, to enhance the visual quality and perceptual impact, the illumination component is enhanced.Referring to the above principle, a brightness enhancement method is proposed, which can boost the overall quality of the unevenly illuminated image by adaptively adjusting the bright and dark regions and can maintain the details of the initial image [20].The expression of its linear relationship is where λ and λ o are constants.In order to make the algorithm more applicable and to reduce the amount of computation, a new function is used to fit the curve of the function of Equation ( 14).The expression is as follows: where L in refers to the image for enhancement, L in_g refers to the estimated reflection component, and k is the adaptive adjustment parameter.

Extraction and Enhancement of Illumination Component
CLAHE is based on histogram equalization [21], which introduces interpolation operations to obtain smoother images.The flow of the algorithm is shown in Figure 5. CLAHE preserves the details and restricts the contrast amplification in the locally smoothed areas [22], but it cannot completely suppress the noise.The WWGIF filtering algorithm can restore details and reduces the appearance of noise.Therefore, the CLAHE-WWGIF algorithm is proposed for the reflection component to further diminish the impact of noise while increasing the image contrast to maintain the details.The formula of CLAHE algorithm is For the reason that most of the noise is presented in the reflection component, the noise still exists after CLAHE processing, so WWGIF is performed on the CLAHE-processed image to improve the contrast while suppressing the noise to improve the quality of the image [23].The formula for denoising is where R(i) is the contrast-enhanced image after CLAHE processing.In Figure 6, the initial image is a low-light image with Gaussian white noise in the LIME dataset, while b, c, and d are the images processed by CLAHE, WWGIF, and CLAHE-WWGIF, respectively.The contrast and brightness of the image after the CLAHE algorithm are obviously enhanced [24], but there is obvious noise in the background.When comparing with b and d, it is obvious that the image has been enhanced by CLAHE-WWGIF, the regional noise is obviously suppressed, and the image has been enhanced in terms of quality.

Enhancement of Saturation Component
In HSV space, the saturation component determines the overall color impression of the image.When enhancing low-light images, the enhancement of brightness will also cause the saturation to change accordingly.Processing only the brightness component will cause the image to be altered and appear desaturated, with color imbalance [25], causing the image to look overexposed and inconsistent with human visual effects.Therefore, an adaptive stretching method is put forward to alter the saturation component.The expression is as follows: where S in is the input saturation component; low value and high value are minimum and maximum boundaries of the saturation component stretching, respectively, which are calculated based on the percentile of the saturation distribution.The percentile indicates the percentage of the values in the data that are less than or equal to the initial value and can be customized by selecting the saturation value of the percentile that you want to retain.As can be seen in Figure 7, after adaptive stretching, the saturation range is extended to a wider range, and then the stretched image has richer color variations and light and dark levels.

Experiment and Analysis
To assess the efficacy of the proposed method in this paper for low-light image enhancement in coal mines, MATLAB (Ver.9.14) was used to conduct simulation experiments.Three low-light monitoring images of coal mines are selected and compared with SSR, MSR, and Ref. [6], whereby the first two are from publicly available images of underground coal mines on the Internet, and the latter is from an image taken from an actual underground coal mine surveillance video.The outcomes of the experiments are depicted in Figures 8-10  As can be seen from the above images, the original images are all images of coal mines in a low-light situation, and the images are darker overall, making it difficult to distinguish the details in them.The processing method using the SSR algorithm enhances the brightness of the images to some degree, but its brightness enhancement effect is limited, and the images still have distortion problems, resulting in a departure from the true color.On the other hand, for the processing method using the MSR algorithm, the brightness is greatly improved, and the details of the images are enriched.But the images are overall too bright, and halo artifacts are prone to appear in bright areas; moreover, the noise in the images are also amplified in the process, resulting in overall unclear and fuzzy images.The method used in Ref. [6] has richer details, but the color of the images shows some bias; the edges of the images are fuzzy, and the details are not clear.By contrast, the algorithm utilized in this study obviously improves the brightness of the images, reduces the halo blur phenomenon while improving the contrast, can better retain the edge details, and suppresses the influence of noise.Additionally, the color effect with our algorithm is more in line with human vision and can largely improve the quality of the coal mine images.
To objectively assess the level of image enhancement, the effect of enhancement is evaluated through six metrics such as mean, standard deviation (SD), information entropy (IE), and average gradient (AG).The metrics have the following specific definitions: where MN refers to the dimensions of the image.Mean is employed to assess the average pixel value, which indicates the mean brightness; as the value increases, the image quality improves.

Standard deviation
where µ is the mean of the image.SD is employed to assess the spread of grayscale values among the image pixels, a larger value means a wider distribution of pixel values, that is, the greater the quality of the image.

3.
Information entropy where p(i) denotes the probability of a pixel appearing within the image.IE is utilized to assess the quantity of information presented within the image; a higher entropy value equals a more uniform distribution of pixel values in the image, and the image has higher levels of texture and detail.

4.
Average gradient where ∂y are the gradients of the image in both the horizontal and vertical directions.AG assesses the level of fluctuation in pixel values across the image, and a higher AG indicates the presence of more edges and details.

5.
Peak signal-to-noise ratio where I(x, y) and I ′ (x, y) are the images before and after enhancement, respectively.PSNR is a metric employed to quantify the similarity between the original and reconstructed images.A larger PSNR value means less distortion and higher quality between the reconstructed image and the initial image.

6.
Structural similarity where µ x is the mean of x; σ 2 x is the variance of x; σ xy is the covariance of x and y; and c 1 and c 2 are two constants.SSIM is used to evaluate the structural similarity between the images, and a higher value of SSIM denotes that the two images are more structurally similar.
Tables 2-4 demonstrate the comparison of the algorithm presented in this paper with the SSR and MSR algorithms.The values of various metrics of the images are greatly improved compared to the algorithm in Ref. [6].Furthermore, the metrics are also improved, which means that the method introduced in this paper demonstrates a substantial advancement in enhancing low-light images, which can obviously improve the brightness and effectively reduce the halo blurring phenomenon as well as retain the improved edge details, and to a certain extent, reduce the impact of noise.

Conclusions
To address the issues of halo blurring, poor edge preservation, and serious noise in the traditional coal mine image enhancement methods, a new image enhancement algorithm is proposed.Firstly, the initial image is transferred to the HSV space, where the improved multi-scale guided filtering and Retinex algorithm are fused to effectively extract the illumination component for the brightness component, avoiding halo artifacts while retaining the edge details.Secondly, the extracted illumination component uses the Weber-Fechner algorithm for adaptive brightness correction, and the reflection component uses a fusion method for contrast enhancement and denoising, which suppresses noise while avoiding excessive enhancement.Thirdly, the saturation component is enhanced with the improved adaptive stretching method, and the color component is adjusted to prevent color distortion.Lastly, the image is converted back to the RGB space.The algorithm in this study proves that it can enhance the brightness of low-light images in coal mines while reducing the appearance of noise and halo artifacts, and also preserve edge details.Through this comprehensive processing, the enhanced image is better in terms of visual aspects and detail retention, which can better meet the needs of mine monitoring videos.

Figure 3 .
Figure 3.The framework of this paper.

Figure 7 .
Figure 7. Histogram of initial and stretched S components. .

Table 1 .
Performance comparison of different filtering algorithms.

Table 2 .
Evaluation results of different algorithms for Image 1.

Table 3 .
Evaluation results of different algorithms for Image 2.

Table 4 .
Evaluation results of different algorithms for Image 3.