Improved histogram equalization low-illumination image enhancement method
Through the improved histogram equalization method combined with dynamic median filtering algorithm, the problem of brightness, contrast and detail improvement in low-illumination image processing is solved, and efficient and real-time image enhancement is achieved, suitable for a variety of scenarios, especially in computing Resource-constrained railway foreign matter detection.
Patent Information
- Application Number
- CN202411314871.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-20
AI Technical Summary
When processing images in low-illumination environments, it is difficult to effectively improve brightness, contrast and detail clarity, and artifacts or amplification noise are often introduced, especially in scenarios where computing resources are limited, real-time performance is poor.
The improved histogram equalization method is adopted, combined with the median filtering algorithm (AMF) of dynamic neighborhood radius and the adaptive histogram equalization (CLAHE), and the brightness of the image is enhanced through a two-stage allocation strategy and a bilinear interpolation method. Contrast, while removing noise, is suitable for a variety of low-illumination image processing scenarios.
It realizes the brightness, contrast and detail retention capabilities of the image while maintaining low computing costs and real-time performance, enhances the overall performance of the foreign object detection system, and avoids noise amplification and color distortion problems.
Smart Images

Figure CN119168875A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to an improved histogram equalization low-illumination image enhancement method. Background Art
[0002] In low-light environments, the captured images usually have problems such as insufficient brightness, reduced contrast, and blurred details, which seriously affect the accuracy of the image and the reliability of subsequent analysis. Therefore, low-light images must be enhanced to improve their brightness, contrast, and detail clarity, thereby providing a reliable basis for subsequent object recognition and classification. This type of image processing technology has a wide range of applications in multiple fields. For example, in railway foreign object intrusion detection, by analyzing the image data of the railway perimeter, obstacles on the track can be discovered in a timely manner, thereby preventing train accidents. The core of the present invention is to improve image quality in low-light environments, and is suitable for image enhancement tasks in a variety of scenarios.
[0003] Traditional image enhancement methods, such as frequency domain transformation and Retinex algorithm, can improve the contrast and visual effects of images, but they are limited in their effectiveness when processing low-light images in complex environments. For example, these algorithms often fail to fully retain the detailed information of the image and may introduce artifacts or amplify noise. In addition, although deep learning-based image enhancement algorithms have powerful enhancement capabilities, they have poor real-time performance and high computational costs. For example, their application is limited in railway foreign object detection scenarios where computing resources are limited.
[0004] Therefore, it is necessary to provide an improved histogram equalization low-illumination image enhancement method to solve the above technical problems. Summary of the invention
[0005] To solve the above technical problems, the present invention provides an improved histogram equalization low-illumination image enhancement method, which can improve the brightness, contrast and detail retention ability of the image at a lower computational cost and while maintaining real-time performance, thereby significantly enhancing the overall performance of the foreign object detection system.
[0006] An improved histogram equalization low-light image enhancement method, characterized in that the method comprises the following steps:
[0007] S1: Input the low-light image K0 to be enhanced, and obtain key image feature information such as brightness distribution, contrast level, color histogram and noise density information of image K0 to complete image input;
[0008] S2: Performing preliminary pixel denoising on the input low-light image K0 based on the median filter AMF algorithm with dynamic neighborhood radius and the key feature information of the image, eliminating the noise in the image acquisition process by dynamically adjusting the neighborhood radius, and obtaining the denoised image K1;
[0009] S3: Based on the improved contrast-limited adaptive histogram equalization CLAHE algorithm, the low-light image K1 after preliminary denoising is enhanced to improve the brightness and contrast of the image and obtain the enhanced image K2;
[0010] S4: The enhanced image K2 is denoised again using the AMF algorithm to eliminate the pixel noise generated during the image processing process, and the final denoised image K3 is obtained;
[0011] S5: The final denoised image is taken as the image K3 enhancement result of the low illumination image and outputted.
[0012] Preferably, step S2 specifically includes:
[0013] S201: Input the image K0 to be denoised with a size of m×n, select the initial neighborhood radius η0 and the maximum neighborhood radius η max ;
[0014] S202: P i,j represents the pixel at the i-th row and j-th column in image K0 (i=1,2,...,m; j=1,2,...,n), with pixel level I i,j , and initialize the pixel coordinate loop variables i=1, j=1 and the neighborhood radius η=η0;
[0015] S203: P i,j As the center, a neighborhood window Ω with a radius of η is constructed, and the set of pixel levels of all pixels in Ω is denoted as I Ω (i,j), the maximum pixel level in the set is The minimum pixel level is The median pixel value is
[0016] S204: Determine pixel-level median Whether the corresponding pixel point is a noise point;
[0017] If the pixel-level median satisfies or Then determine the median pixel If it is a noise point, the neighborhood radius η is increased to η = η + 1, and a new median pixel is recalculated in the expanded neighborhood window until η0 reaches the maximum neighborhood radius η max , if η≤η max , then return to step S203;
[0018] If the pixel-level median satisfies This indicates that the pixel point corresponding to the current pixel level median is not a noise point, and denoising can be performed based on the neighborhood window Ω, and the process jumps to step S206;
[0019] S206: Determine the center point P i,j Whether it is a noise point;
[0020] If P i,j Pixel Level I i,j satisfy or Then it means pixel P i,j is a noise point, and the pixel-level median of the neighborhood window Ω is Replace pixel P i,j Pixel Level I i,j ,Right now Then complete the pixel point P i,j Denoising;
[0021] If P i,j Pixel Level I i,j satisfy Represents pixel P i,j If it is a non-noise point, its original pixel level is kept unchanged and the process jumps to step S207;
[0022] S207: Update loop variable i=i+1. If i>m, jump to step S208, otherwise return to step S202;
[0023] S208: Update loop variable j=j+1, and set i=1; if all pixels of image K0 have been denoised, that is, j>n, then end the algorithm and output the denoised image K1, otherwise return to step S202.
[0024] Preferably, step S3 specifically includes:
[0025] S301: input an image K1 with a size of m×n and N pixel levels, and divide the image K1 into q equal parts in the width direction and p equal parts in the height direction, and then divide the entire image into p×q sub-blocks;
[0026] S302: Selecting the image contrast limit Max_Contrast and the maximum number of pixels ClipLimit according to actual needs;
[0027] S303: Clip the grayscale histogram of any sub-block (i, j), and denote the sub-block at the i-th row and j-th column by (i, j) (i∈{1,2,3,...,p},j∈{1,2,3,...,q}). Suppose the number of pixels contained in pixel level k (k=0,1,2,...,N-1) is n. k ; The pixel points whose pixel levels exceed the limit ClipLimit are called default points. Let the number of default points contained in pixel level k be m k ,but:
[0028] m k =max{n k -ClipLimit,0} (1)
[0029] Assume that the total number of default points of sub-block (i, j) is Num_points, then:
[0030]
[0031] With ClipLimit as the limit, the grayscale histogram of the sub-block (i, j) is clipped. Let the number of pixels contained in the pixel level after clipping be n. k ',but:
[0032]
[0033] Then, the default points are evenly distributed to all pixel levels by average distribution. The number of default points Num_average allocated to each pixel level is:
[0034]
[0035] After redistribution, the number of pixels contained in pixel level k (k = 0, 1, 2, ..., N-1) is N k ,but:
[0036] N k =n k ′+Num_average (5)
[0037] S304: Based on the original number of pixels at each pixel level, the default points are initially allocated. The specific steps are as follows:
[0038] ① Input the total number of pixel levels N and the sub-block grayscale histogram function Hist(k) (k=0,1,2,...,N-1);
[0039] ② Select the image contrast limit Max_Contrast and the pixel number limit ClipLimit at each pixel level, and calculate the total number of default points Num_points and the average number of default points Num_average based on equations (2) and (4);
[0040] ③ Initialize pixel-level loop variable k = 0;
[0041] ④ According to the number of pixels Hist(k) contained in pixel level k, adjust the grayscale histogram:
[0042] a. If Hist(k) ≥ ClipLimit, it means that the number of pixel points at pixel level k exceeds the limit ClipLimit, and it needs to be adjusted to ClipLimit;
[0043] b. If ClipLimit - Num_average ≤ Hist(k) < ClipLimit, it means that although the number of pixel points Hist(k) at pixel level k does not exceed the limit ClipLimit, it will exceed the limit after supplementing Num_average pixel points. At this time, the number of default points Num_fill(k) allocated to pixel level k should be re - determined, and the total number of default points to be allocated Num_points should be updated to ensure that the number of pixel points contained in pixel level k after allocation exactly reaches the limit ClipLimit, that is:
[0044] Num_fill(k) = ClipLimit - Hist(k) (6)
[0045] Num_points = Num_points - Num_fill(k) (7)
[0046] c. If Hist(k) < ClipLimit - Num_average, it means that the number of pixel points Hist(k) at pixel level k does not exceed the limit ClipLimit, and after supplementing Num_average pixel points to it, it still does not exceed the limit. At this time, Num_average pixel points can be directly supplemented to it, and the total number of default points to be allocated Num_points should be updated, that is:
[0047] Num_points = Num_points - Num_average (8)
[0048] Let the adjusted grayscale histogram function be Hist(k)′, then:
[0049]
[0050] ⑤ Adjust the value of the pixel - level loop variable k, that is, k = k + 1;
[0051] ⑥ Judge the value of the pixel - level loop variable k. If k < N, jump to step ④, otherwise jump to step ⑦;
[0052] ⑦ Output the remaining number of default points Num_points. If Num_points = 0, it means that all default points have been allocated and no secondary allocation is required; if Num_points > 0, it means that there are still remaining default points after the initial allocation and secondary allocation is needed.
[0053] S305: If the number of remaining default points Num_points after the initial allocation is not zero, the remaining default points need to be secondary allocated, and the specific steps are as follows:
[0054] ① Input the number of default points remaining after the initial allocation (Num_points);
[0055] ② Set the initial pixel level starting point j0, let j0 = 0;
[0056] ③ Set the current pixel level starting point j, let j = j0;
[0057] ④ Based on the principle of equal spacing, determine the pixel-level spacing Stepsize of the secondary distribution;
[0058] by represents the smallest integer less than or equal to a, then:
[0059]
[0060] ⑤ Taking j as the pixel-level starting point and Stepsize as the pixel-level spacing, calculate the target pixel-level set Ω0 of the secondary distribution, that is:
[0061] Ω0={j,j+Stepsize,j+2×Stepsize,...,j+p×Stepsize} (11)
[0062] In formula (11),
[0063] ⑥ Determine whether the number of pixels in each pixel level in the set Ω0 has reached the limit, and remove the pixel level whose number of pixels has reached the limit ClipLimit. The pixel level set obtained after removal is recorded as Ω, and the number of pixel levels in Ω is n Ω ;
[0064] ⑦ Assign a default point to each pixel level in Ω, and update the number of remaining default points Num_points, that is:
[0065] Num_points = Num_points - n Ω (12)
[0066] ⑧ Adjust the initial pixel level starting point j0, and set j0=j0+1;
[0067] ⑨ Determine whether the number of remaining default points Num_points is zero. If there are still remaining default points to be allocated, that is, Num_points>0, jump to step ③. If the default points have been allocated, that is, Num_points=0, the adjustment of the sub-block histogram is completed.
[0068] S306: performing equalization processing on the grayscale histogram after the two-stage allocation, and eliminating the boundaries between sub-blocks based on the bilinear interpolation method to generate an enhanced final image K2;
[0069] S307: For the color image, the image is enhanced by using the brightness channel components in the three color spaces of RGB, Lab, and HSV. Based on the peak signal-to-noise ratio (PSNR), the color space with the highest PSNR is selected as the final image K3 output.
[0070] Compared with the prior art, the improved histogram equalization low-light image enhancement method provided by the present invention has the following advantages:
[0071] The following beneficial effects:
[0072] Compared with the prior art, the present invention no longer relies on deep learning algorithms with high computational costs and poor real-time performance, but is based on an improved CLAHE algorithm and a dynamic neighborhood radius median filter AMF algorithm to enhance the quality of low-light images. On the basis of the improved CLAHE algorithm, a low-computational complexity contrast-limited dynamic neighborhood radius median filter adaptive histogram equalization AMF-CLAHE fusion method is proposed. Based on the traditional CLAHE algorithm, this method adds a two-stage allocation strategy, which can effectively avoid noise amplification and color distortion problems while improving image contrast and details. Subsequently, by dynamically adjusting the neighborhood radius of the median filter, the noise in the low-light image can be better removed and the clarity of details can be improved.
[0073] Railway foreign body detection is mentioned as an application example. The core of this method is image enhancement technology, which is applicable to a variety of low-light image processing scenarios. In order to meet the real-time requirements, the present invention provides an image enhancement solution that can adapt to different environments, ensuring that it has high real-time performance and reliability while improving image quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 It is a flow chart of the present invention.
[0075] Figure 2 This is a performance test image of the present invention.
[0076] Figure 3 This is the image enhancement result of the existing CLAHE algorithm.
[0077] Figure 4 This is the final image enhancement result of the present invention.
[0078] Figure 5 is the improvement rate of the image evaluation index of the present invention. DETAILED DESCRIPTION
[0079] In order to make the purpose, technical solution and features of the present invention clearer, the present invention is further described below in conjunction with the embodiments and drawings. This embodiment is only used to explain the present invention and is not intended to limit the present invention. This embodiment uses two sets of images to perform algorithm performance testing, one set of images is a local low-light natural image set, and the other set of images is a low-light railway perimeter image set, which are respectively applied to general image algorithm performance testing and algorithm performance testing under low-light conditions of railways.
[0080] The present invention provides an improved histogram equalization low-light image enhancement method, as shown in the attached Figure 1 As shown, the enhancement method includes the following steps:
[0081] S1: Randomly select two images from the local low-light natural image set and the low-light railway perimeter image set, obtain the image brightness distribution, contrast level, color histogram and noise density information to complete the image K0 input. The algorithm performance test image is as follows Figure 2 shown.
[0082] S2: Based on the dynamic neighborhood radius median filtering AMF algorithm and the key feature information of the image, preliminary pixel denoising is performed on the input low-illumination natural image set and low-illumination railway perimeter image set, and the noise in the image acquisition process is eliminated by dynamically adjusting the neighborhood radius to obtain the denoised image K1.
[0083] S3: Based on the improved contrast-limited adaptive histogram equalization CLAHE algorithm, the low-light image after preliminary denoising is enhanced to improve the brightness and contrast of the image and obtain the enhanced image K2. The image enhancement results of the CLAHE algorithm are shown in the attached figure. Figure 3 shown.
[0084] S4: The AMF algorithm is used again to denoise the enhanced image K2 to eliminate the pixel noise generated during the image processing process, and the final denoised image K3 is obtained.
[0085] S5: The final denoised image K3 is taken as the image enhancement result of the low illumination image and output. The final image enhancement result is shown in the attached figure. Figure 4 shown.
[0086] Step S2 specifically includes:
[0087] S201: Input a low-light natural image set and a low-light railway perimeter image with an m parameter value of 8 and an n parameter value of 8, and select an initial neighborhood radius η0 parameter value of 3 and a maximum neighborhood radius η max The parameter value is 8.
[0088] S202: P i,jrepresents the pixel at the i-th row and j-th column in image K (i=1,2,...,m; j=1,2,...,n), and its pixel level is I i,j , and initialize the pixel coordinate loop variables i=1, j=1 and the neighborhood radius η=η0;
[0089] S203: P i,j As the center, a neighborhood window Ω with a radius parameter value of 3 is constructed, and the set of pixel levels of all pixels in Ω is denoted as I Ω (i,j), the maximum pixel level in the set is The minimum pixel level is The median pixel value is
[0090] S204: Determine pixel-level median Whether the corresponding pixel point is a noise point;
[0091] If the pixel-level median satisfies or Then determine the median pixel If it is a noise point, the neighborhood radius η is increased to η = η + 1, and a new median pixel is recalculated in the expanded neighborhood window until η0 reaches the maximum neighborhood radius η max , if η≤η max , then return to step S203;
[0092] If the pixel-level median satisfies This indicates that the pixel point corresponding to the current pixel level median is not a noise point, and denoising can be performed based on the neighborhood window Ω, and the process jumps to step S206;
[0093] S206: Determine the center point P i,j Whether it is a noise point;
[0094] If P i,j Pixel Level I i,j satisfy or Then it means pixel P i,j is a noise point, and the pixel-level median of the neighborhood window Ω is Replace pixel P i,j Pixel Level I i,j ,Right now Then complete the pixel point P i,j Denoising;
[0095] If P i,j Pixel Level I i,j satisfy Represents pixel P i,j If it is a non-noise point, its original pixel level is kept unchanged and the process jumps to step S207;
[0096] S207: Update loop variable i=i+1. If i>m, jump to step S208, otherwise return to step S202;
[0097] S208: Update loop variable j=j+1, and set i=1; if all pixels in image K have been denoised, that is, j>n, then end the algorithm and output the denoised image, otherwise return to step S202.
[0098] Preferably, step S3 specifically includes:
[0099] S301: input a low-light natural image set and a low-light railway perimeter image with an m parameter value of 8 and an n parameter value of 8, and an original grayscale image with 256 pixels, and divide the image into 8 equal parts in the width direction and 8 equal parts in the height direction, and then divide the entire image into 64 sub-blocks;
[0100] S302: Selecting the image contrast limit Max_Contrast parameter value as 0.01 and the maximum number of pixels ClipLimit;
[0101] S303: Clip the grayscale histogram of any sub-block (i, j), and denote the sub-block at the i-th row and j-th column by (i, j) (i∈{1,2,3,...,p},j∈{1,2,3,...,q}). Suppose the number of pixels contained in pixel level k (k=0,1,2,...,N-1) is n. k ; The pixel points whose pixel levels exceed the limit ClipLimit are called default points. Let the number of default points contained in pixel level k be m k ,but:
[0102] m k =max{n k -ClipLimit,0} (1)
[0103] Assume that the total number of default points of sub-block (i, j) is Num_points, then:
[0104]
[0105] With ClipLimit as the limit, the grayscale histogram of the sub-block (i, j) is clipped. Let the number of pixels contained in the pixel level after clipping be n. k ',but:
[0106]
[0107] Then, the default points are evenly distributed to all pixel levels by average distribution. The number of default points Num_average allocated to each pixel level is:
[0108]
[0109] After redistribution, the number of pixels contained in pixel level k (k = 0, 1, 2, ..., N-1) is N k ,but:
[0110] N k =n k ′+Num_average (5)
[0111] S304: Based on the original number of pixels at each pixel level, the default points are initially allocated. The specific steps are as follows:
[0112] ① Input the total number of pixel levels N and the sub-block grayscale histogram function Hist(k) (k=0,1,2,...,N-1);
[0113] ② Select the image contrast limit Max_Contrast and the pixel number limit ClipLimit at each pixel level, and calculate the total number of default points Num_points and the average number of default points Num_average based on equations (2) and (4);
[0114] ③ Initialize pixel-level loop variable k = 0;
[0115] ④ According to the number of pixels Hist(k) contained in pixel level k, adjust the grayscale histogram:
[0116] a. If Hist(k)≥ClipLimit, it means that the number of pixels at pixel level k exceeds the limit ClipLimit and needs to be adjusted to ClipLimit;
[0117] b. If ClipLimit-Num_average≤Hist(k)<ClipLimit, it means that the number of pixels at pixel level k, Hist(k), does not exceed the limit ClipLimit, but will exceed the limit after adding Num_average pixels. At this time, the number of default points Num_fill(k) assigned to pixel level k should be re-determined, and the total number of default points to be assigned Num_points should be updated to ensure that the number of pixels at pixel level k after allocation just reaches the limit ClipLimit, that is:
[0118] Num_fill(k)=ClipLimit-Hist(k) (6)
[0119] Num_points = Num_points - Num_fill(k) (7)
[0120] c. If Hist(k) < ClipLimit - Num_average, it means that the number of pixel points Hist(k) at pixel level k does not exceed the limit ClipLimit, and even after supplementing Num_average pixel points to it, it still does not exceed the limit. At this time, Num_average pixel points can be directly supplemented to it, and the total number Num_points of default points to be allocated is updated, that is:
[0121] Num_points = Num_points - Num_average (8)
[0122] Let the adjusted gray - level histogram function be Hist(k)′, then:
[0123]
[0124] ⑤ Adjust the value of the pixel - level loop variable k, that is, k = k + 1;
[0125] ⑥ Judge the value of the pixel - level loop variable k. If k < N, jump to step ④; otherwise, jump to step ⑦;
[0126] ⑦ Output the remaining number Num_points of default points. If Num_points = 0, it means that all default points have been allocated and no secondary allocation is required; if Num_points > 0, it means that there are still remaining default points after the initial allocation and secondary allocation is needed.
[0127] S305: If the remaining number Num_points of default points after the initial allocation is not zero, then the remaining default points need to be secondarily allocated. The specific steps are as follows:
[0128] ① Input the remaining number Num_points of default points after the initial allocation;
[0129] ② Set the initial pixel - level starting point j0, and let j0 = 0;
[0130] ③ Set the current pixel - level starting point j, and let j = j0;
[0131] ④ Based on the equal - spacing principle, determine the pixel - level spacing Stepsize for the secondary allocation;
[0132] Let represent the smallest integer less than or equal to a, then:
[0133]
[0134] ⑤ Taking j as the pixel-level starting point and Stepsize as the pixel-level spacing, calculate the target pixel-level set Ω0 of the secondary distribution, that is:
[0135] Ω0={j,j+Stepsize,j+2×Stepsize,...,j+p×Stepsize} (11)
[0136] In formula (11),
[0137] ⑥ Determine whether the number of pixels in each pixel level in the set Ω0 has reached the limit, and remove the pixel level whose number of pixels has reached the limit ClipLimit. The pixel level set obtained after removal is recorded as Ω, and the number of pixel levels in Ω is n Ω ;
[0138] ⑦ Assign a default point to each pixel level in Ω, and update the number of remaining default points Num_points, that is:
[0139] Num_points = Num_points - n Ω (12)
[0140] ⑧ Adjust the initial pixel level starting point j0, and set j0=j0+1;
[0141] ⑨ Determine whether the number of remaining default points Num_points is zero. If there are still remaining default points to be allocated, that is, Num_points>0, jump to step ③. If the default points have been allocated, that is, Num_points=0, the adjustment of the sub-block histogram is completed.
[0142] S306: performing equalization processing on the grayscale histogram after the two-stage allocation, and eliminating the boundaries between sub-blocks based on the bilinear interpolation method to generate an enhanced final image;
[0143] S307: Calculate quantitative evaluation indicators such as mean square error MSE, peak signal-to-noise ratio PSNR and structural similarity SSIM before and after image enhancement, as shown in Table 1. It can be seen that for low-illumination natural images and low-illumination railway perimeter images, the detail retention ability and color image enhancement quality of the AMF-CLAHE image enhancement fusion algorithm are better than the CLAHE algorithm, and the color of the output image is more balanced.
[0144] Table 1 Evaluation of CLAHE and AMF-CLAHE image enhancement performance
[0145]
[0146] In order to verify the performance of the AMF-CLAHE algorithm when processing large-scale input images, this paper randomly selects 30 images from the low-illumination natural image set and 90 images from the low-illumination railway perimeter image set, and randomly numbers each image as 1, 2, ..., 120 to form the AMF-CLAHE algorithm performance test set.
[0147] For any image i (i=1,2,...,120) in the test set, let the mean square errors of the enhancement results obtained by CLAHE and AMF-CLAHE algorithms be and The peak signal-to-noise ratios are and The structural similarities are and Then the mean square error reduction rate k of input image i is i,MSE , peak signal-to-noise ratio improvement rate k i,PSNR And the structural similarity improvement rate k i,SSIM They are defined as:
[0148]
[0149] The CLAHE and AMF-CLAHE algorithms are used to enhance each image in the test set, and the improvement rate k of the evaluation index of each image is calculated. i,MSE ,k i,PSNR ,k i,SSIM and its maximum value Minimum average value and 0.5 quantile Statistics such as , are used to evaluate the performance of the AMF-CLAHE algorithm when processing large-scale input images.
[0150] The improvement rate of the evaluation index of each image is shown in the attached Figure 5 Its maximum value, minimum value, arithmetic mean and 0.5 quantile statistics are shown in Table 2.
[0151] Table 2 Statistics corresponding to the improvement rate of each evaluation index
[0152]
[0153] By the attached Figure 5 As shown in Table 2, after the AMF-CLAHE algorithm is used for enhancement, the mean square error of the image is reduced by 66.29% on average, and the peak signal-to-noise ratio and structural similarity are increased by 36.22% and 19.91% on average. Except for images 1 and 37, the peak signal-to-noise ratio improvement rates of the remaining images are roughly in the range of [0.15, 0.60], and the algorithm has good robustness.
[0154] In summary, compared with the existing CLAHE algorithm, the AMF-CLAHE image enhancement fusion algorithm proposed in this paper has better performance in low-illumination image enhancement.
Claims
1. An improved histogram equalization low-light image enhancement method, characterized in that: The method comprises the following steps: S1: Input the low-light image K0 to be enhanced, and obtain key image feature information such as brightness distribution, contrast level, color histogram and noise density information of image K0 to complete image input; S2: Performing preliminary pixel denoising on the input low-light image K0 based on the median filter AMF algorithm with dynamic neighborhood radius and the key feature information of the image, eliminating the noise in the image acquisition process by dynamically adjusting the neighborhood radius, and obtaining the denoised image K1; S3: Based on the improved contrast-limited adaptive histogram equalization CLAHE algorithm, the low-light image K1 after preliminary denoising is enhanced to improve the brightness and contrast of the image and obtain the enhanced image K2; S4: The enhanced image K2 is denoised again using the AMF algorithm to eliminate the pixel noise generated during the image processing process, and the final denoised image K3 is obtained; S5: The final denoised image is taken as the image K3 enhancement result of the low illumination image and outputted.
2. The improved histogram equalization low illumination image enhancement method according to claim 1, characterized in that: Step S2 specifically includes: S201: Input the image K0 to be denoised with a size of m×n, select the initial neighborhood radius η0 and the maximum neighborhood radius η max ; S202: P i,j represents the pixel at the i-th row and j-th column in image K0 (i=1,2,...,m; j=1,2,...,n), with pixel level I i,j , and initialize the pixel coordinate loop variables i=1, j=1 and the neighborhood radius η=η0; S203: P i,j As the center, a neighborhood window Ω with a radius of η is constructed, and the set of pixel levels of all pixels in Ω is denoted as I Ω (i,j), the maximum pixel level in the set is The minimum pixel level is The median pixel value is S204: Determine pixel-level median Whether the corresponding pixel point is a noise point; If the pixel-level median satisfies or Then determine the median pixel If it is a noise point, the neighborhood radius η is increased to η = η + 1, and a new median pixel is recalculated in the expanded neighborhood window until η0 reaches the maximum neighborhood radius η max , if η≤η max , then return to step S203; If the pixel-level median satisfies This indicates that the pixel point corresponding to the current pixel level median is not a noise point, and denoising can be performed based on the neighborhood window Ω, and the process jumps to step S206; S206: Determine the center point P i,j Whether it is a noise point; If P i,j Pixel Level I i,j satisfy or Then it means pixel P i,j is a noise point, and the pixel-level median of the neighborhood window Ω is Replace pixel P i,j Pixel Level I i,j ,Right now Then complete the pixel point P i,j Denoising; If P i,j Pixel Level I i,j satisfy Represents pixel P i,j If it is a non-noise point, its original pixel level is kept unchanged and the process jumps to step S207; S207: Update loop variable i=i+1. If i>m, jump to step S208, otherwise return to step S202; S208: Update loop variable j=j+1, and set i=1; if all pixels of image K0 have been denoised, that is, j>n, then end the algorithm and output the denoised image K1, otherwise return to step S202.
3. The improved histogram equalization low illumination image enhancement method according to claim 1, characterized in that: Step S3 specifically includes: S301: input an image K1 with a size of m×n and N pixel levels, and divide the image K1 into q equal parts in the width direction and p equal parts in the height direction, and then divide the entire image into p×q sub-blocks; S302: Selecting the image contrast limit Max_Contrast and the maximum number of pixels ClipLimit according to actual needs; S303: Clip the grayscale histogram of any sub-block (i, j), and denote the sub-block at the i-th row and j-th column by (i, j) (i∈{1,2,3,...,p},j∈{1,2,3,...,q}). Suppose the number of pixels contained in pixel level k (k=0,1,2,...,N-1) is n. k ; The pixel points whose pixel levels exceed the limit ClipLimit are called default points. Let the number of default points contained in pixel level k be m k ,but: m k =max{n k -ClipLimit,0} (1) Assume that the total number of default points of sub-block (i, j) is Num_points, then: With ClipLimit as the limit, the grayscale histogram of the sub-block (i, j) is clipped. Let the number of pixels contained in the pixel level after clipping be n. k ',but: Then, the default points are evenly distributed to all pixel levels by average distribution. The number of default points Num_average allocated to each pixel level is: After redistribution, the number of pixels contained in pixel level k (k = 0, 1, 2, ..., N-1) is N k ,but: N k =n k ′+Num_average (5) S304: Based on the original number of pixels at each pixel level, the default points are initially allocated. The specific steps are as follows: ① Input the total number of pixel levels N and the sub-block grayscale histogram function Hist(k) (k=0,1,2,...,N-1); ② Select the image contrast limit Max_Contrast and the pixel number limit ClipLimit at each pixel level, and calculate the total number of default points Num_points and the average number of default points Num_average based on equations (2) and (4); ③ Initialize pixel-level loop variable k = 0; ④ According to the number of pixels Hist(k) contained in pixel level k, adjust the grayscale histogram: a. If Hist(k)≥ClipLimit, it means that the number of pixels at pixel level k exceeds the limit ClipLimit and needs to be adjusted to ClipLimit; b. If ClipLimit - Num_average ≤ Hist(k) < ClipLimit, it means that although the number of pixels Hist(k) at pixel level k does not exceed the limit ClipLimit, it will exceed the limit after supplementing Num_average pixels. At this time, the number of default points Num_fill(k) assigned to pixel level k should be re - determined, and the total number of default points to be assigned Num_points should be updated to ensure that the number of pixels contained in pixel level k after assignment exactly reaches the limit ClipLimit, that is: Num_fill(k) = ClipLimit - Hist(k) (6) Num_points = Num_points - Num_fill(k) (7) c. If Hist(k) < ClipLimit - Num_average, it means that the number of pixels Hist(k) at pixel level k does not exceed the limit ClipLimit, and it still does not exceed the limit after supplementing Num_average pixels. At this time, Num_average pixels can be directly supplemented to it, and the total number of default points to be assigned Num_points is updated, that is: Num_points = Num_points - Num_average (8) Let the adjusted grayscale histogram function be Hist(k)′, then: ⑤ Adjust the value of the pixel - level loop variable k, that is, k = k + 1; ⑥ Judge the value of the pixel - level loop variable k. If k < N, jump to step ④, otherwise jump to step ⑦; ⑦ Output the remaining number of default points Num_points. If Num_points = 0, it means that all default points have been allocated and no secondary allocation is required; if Num_points > 0, it means that there are still remaining default points after the initial allocation and secondary allocation is needed. S305: If the number of remaining default points Num_points after the initial allocation is not zero, the remaining default points need to be secondarily allocated. The specific steps are as follows: ① Input the number of remaining default points Num_points after the initial allocation; ② Set the initial pixel - level starting point j0, and let j0 = 0; ③ Set the current pixel - level starting point j, and let j = j0; ④ Based on the equal - spacing principle, determine the pixel - level spacing Stepsize for the secondary allocation; by represents the smallest integer less than or equal to a, then: ⑤ Taking j as the pixel - level starting point and Stepsize as the pixel - level spacing, calculate the target pixel - level set Ω0 for the secondary allocation, that is: Ω0 = {j, j + Stepsize, j + 2×Stepsize,..., j + p×Stepsize} (11) In formula (11), ⑥ Determine whether the number of pixels in each pixel level in the set Ω0 has reached the limit, and remove the pixel level whose number of pixels has reached the limit ClipLimit. The pixel level set obtained after removal is recorded as Ω, and the number of pixel levels in Ω is n Ω ; ⑦ Allocate one default point to each pixel level in Ω, and update the number of remaining default points Num_points, that is: Num_points=Num_points-n Ω (12) ⑧ Adjust the initial pixel - level starting point j0, and let j0 = j0 + 1; ⑨ Determine whether the number of remaining default points Num_points is zero. If there are still remaining default points to be allocated, that is, Num_points>0, jump to step ③. If the default points have been allocated, that is, Num_points=0, the adjustment of the sub-block histogram is completed. S306: performing equalization processing on the grayscale histogram after the two-stage allocation, and eliminating the boundaries between sub-blocks based on the bilinear interpolation method to generate an enhanced final image K2; S307: For the color image, the image is enhanced by using the brightness channel components in the three color spaces of RGB, Lab, and HSV. Based on the peak signal-to-noise ratio (PSNR), the color space with the highest PSNR is selected as the final image K3 output.
Citation Information
Cited By
Contrast enhancement method for ultrasonic detection image of generator circuit breaker box
CN120876340A
