A list,





mark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1RJUUNtYXRsYWI=,size_16,color_FFFFFF,t_70#pic_ center)































HR0cHM6Ly9ibG9nLmNzZG4ubmV0L1RJUUNtYXRsYWI=,size_16,color_FFFFFF,t_70#pic_center)



























































































































































































Ii. Source code

clc,close all;
Image=im2double(rgb2gray(imread('couple.bmp'))); [height,width]=size(Image); % Obtain the size of the original Image, h row w column imshow(Image); % Show original picture M=1; % Set the maximum gray level fImage= m-image; % obtain gray tone function fLImage=log(fImage); % AvgW=zeros(height,width); w=1; % defines the neighborhood window radius as1
temp=zeros(2*w+1.2*w+1);
for x=1+w:height-w
    for y=1+w:width-w
        temp=fLImage(x-w:x+w,y-w:y+w);        
        AvgW(x,y)=sum(temp(:))/(2*w+1) ^2; End End % Average gray value alpha=3;
imshow(Image), title('Original image');
[height width c]=size(Image);
dark_I = zeros(height,width);
for y=1:height
    for x=1:width dark_I(y,x) = min(Image(y,x,:)); % calculate the minimum value of RGB after the image dark_I end end kenlRatio =.03;
krnlsz = floor(max([3, width*kenlRatio, height*kenlRatio])); dark_I2 = minfilt2(dark_I, [krnlsz,krnlsz]); Dark_I2 (height,width)=0;
dark_channel=dark_I2;
hh=floor(width*height*0.001);
bb=reshape(dark_channel,1[]); bb=sort(bb,'descend');
cc=find(bb>0,hh); 
dd=bb(cc(hh)); 
ee=dark_channel(find(dark_channel>dd)); 
AA=[ee];
num=length(find(dark_channel>dd));
sum=0;
for k=1:num
    sum=sum+AA(k);
end
meandc=floor(sum/num);
minAtomsLight = 240; A= min([minAtomsLight, meandc]); % Calculate atmospheric light A w0=0.9;  t0=0.3; % Set the adjustment parameter w0 value t=1-w0*(dark_channel/A); % Calculate transmittance t t= Max (t,t0); img_d =double(Image);
Copy the code

3. Operation results











Fourth, note

Version: 2014 a