A simple, fast and effective low-light image enhancement method

A simple, fast and effective low-light image enhancement method

1. This article introduces a more practical method with good shadow removal effect. It is selected from a paper by Tao in 2004. The title is "An Integrated Neighborhood Dependent Approach for Nonlinear Enhancement of Color Images". Interested friends carefully Read it carefully. The paper is short, so it shouldn't be too difficult, and the results are excellent.
Second, briefly introduce the idea of ​​the paper
insert image description here

Figure 1
This is an image with serious shadows. Obviously, the result of the image shooting is not very satisfactory. After referring to the ideas in Tao's paper, it is found that the dark area of ​​the image can be improved and the shadow part of the image can be removed. essay ideas

1. First, convert the color image in the RGB color space into a grayscale image, and normalize the image to obtain the normalized I(x,y), which is linearly changed by the following formula (specifically, why use this I don't really understand this kind of linear transformation) The author of the paper means that this transformation can greatly increase the brightness of dark pixels (regions), while the brightness enhancement of bright pixels (regions) is low, or even negative enhancement. So as to achieve better results.

	a=0.24,b=0.5;
In(x,y)=(I(x,y)^a+(1-I(x,y))^b+I(x,y)^2)/2

2. Then, the grayscale enhanced image I(x, y) is convolved with the Gaussian kernel function of different scales on I(x, y). The result of the convolution contains the brightness information of the adjacent pixels of the image. Correlation can be taken to deal with image boundaries.
The representation of the Gaussian kernel function and the convolution formula are as follows:
G ( x , y ) = Ke e ( − ( x 2 + y 2 ) / c 2 ) G(x,y)=Ke^{(-(x ^2+y^2)/c^2)}G(x,y)=K e((x2+y2)/c2 )where c is the scale or the Gaussian surrounding space constant
I ′ ( x , y ) = I ( x , y ) ∗ G ( x , y ) I'(x,y)=I(x,y)*G( x,y)I(x,y)=I(x,y)G(x,y)

3. Do contrast enhancement between the grayscale image and the center pixel image
R ( x , y ) = I n ( x , y ) r ( x , y ) R(x,y)=In(x,y)^{r( x,y)}R(x,y)=In(x,y)r(x,y)
r ( x , y ) = I ′ ( x , y ) / I ( x , y ) r(x,y)=I'(x,y)/I(x,y) r(x,y)=I(x,y)/I(x,y)

4. In order to obtain a better image effect, image contrast enhancement is performed on multiple convolution results of different scales, and the final result is based on the linear combination of these multiple scales.
R ( x , y ) = ∑ i 3 wi R i ( x , y ) R(x,y)=\sum_i^3w_iR_i(x,y)R(x,y)=i3wiRi(x,y )
is generally enough to take 3, and in this paper wi (related to the scale) is 1/3.

5. After the first few steps of processing, we can get an enhanced image, and find that the shadow removal effect of the image is better.
insert image description here
Basically, the shadow part of the image is removed, and the brightness is greatly improved without affecting the brightness of other pixels. The next thing to do is to restore the colors of the image.

6. To restore the color in the image, the linear color restoration process can also be used to obtain the enhanced color image. The color restoration formula is as follows:
R j ( x , y ) = I j ( x , y ) I ( x , y ) ∗ λ R_j(x,y)={I_j(x,y)\over I(x,y) }*\lambdaRj(x,y)=I(x,y)Ij(x,y)λ
λ \lambdaλ adjusts the tone of the three bands, λ \lambdain this articleThe value of λ is 1, and the result is also very good.
I j ( x , y ) I_j(x,y)Ij(x,y ) refers to the R, G, and B channels of the original image.

7. The result of the picture after color restoration insert image description hereAfter the color restoration by the above method, the result is almost perfect, whether it is color, brightness or details, it has achieved a very good effect.
In order to prove that it is not only suitable for one scene, the second picture is displayed: insert image description herethrough the display of the above two images, I think the effect of such a picture surpasses many other methods, and the effect is particularly good.
Let's take SSR (single-scale retinex enhancement for comparison): the retinex algorithm can also improve the brightness of the image to a certain extent, but the effect is obviously not as good as Tao's method
insert image description here. Not as good as the above method. MSR and MSRCR, I think the effect is definitely not as good as Tao's method.
The following is part of the matlab code used in the implementation of the thesis, because there are many built-in functions in matlab, so it is not difficult to implement.

%%
%2019年10月20日-2019年10月21日
%论文:An Integrated Neighborhood Dependent Approach for Nonlinear Enhancement of Color Images
clc
clear
I=im2double(imread('three.png'));
I1=rgb2gray(I);
In=(I1.^(0.24)+(1-I1).*0.5+I1.^2)/2;
%通过高斯核对灰度增强图像做卷积运算
sigma=5;
window = double(uint8(3*sigma)*2 + 1);
G1=fspecial('gaussian',window,sigma);
Guass1=imfilter(I1,G1,'conv','replicate','same');
r1=Guass1./I1;
R1=In.^r1;
sigma=20;
window = double(uint8(3*sigma)*2 + 1);
G2=fspecial('gaussian',window,sigma);
Guass2=imfilter(I1,G2,'conv','replicate','same');
r2=Guass2./I1;
R2=In.^r2;
sigma=240;
window = double(uint8(3*sigma)*2 + 1);
G3=fspecial('gaussian',window,sigma);
Guass3=imfilter(I1,G3,'conv','replicate','same');
r3=Guass3./I1;
R3=In.^r3;
R=(R1+R2+R3)/3;
Rr=R.*(I(:,:,1)./I1);
Rg=R.*(I(:,:,2)./I1);
Rb=R.*(I(:,:,3)./I1);
rgb=cat(3,Rr,Rg,Rb);
imshow([I rgb]);

Guess you like

Origin blog.csdn.net/weixin_44690935/article/details/102680513