Demo entry 6641303

1

   

Submitted by anonymous on Sep 17, 2017 at 17:35
Language: Matlab. Code size: 1.8 kB.

%设定好当前路径
im_input=imread('room.png');%输入
PR = im_input(:, :, 1);
PG = im_input(:, :, 2);
PB = im_input(:, :, 3);

[N, M] = size(PR);
PR_d = double(PR);
PR_log = log(PR_d+1);%对数变换
Rfft2 = fft2(PR_d);%傅里叶变化
sigma = 100;
F = fspecial('gaussian', [N,M], sigma);
Efft = fft2(double(F));%傅里叶变换
DPR0 = Rfft2.* Efft;
DPR = ifft2(DPR0);%傅里叶逆变换
DPRlog = log(DPR +1); 
PRr = PR_log - DPRlog;%拉普拉斯锐化
PR_reflect = exp(PRr); 
PR_reflect_min = min(min(PR_reflect)); 
PR_reflect_max = max(max(PR_reflect));
PR_reflect = (PR_reflect - PR_reflect_min)/(PR_reflect_max-PR_reflect_min);%归一化处理
PR_reflect= adapthisteq(PR_reflect); %自适应均衡
 
PG_d = double(PG);
PG_log = log(PG_d+1);%对数变换
Gfft2 = fft2(PG_d);%傅里叶变换
DPG0 = Gfft2.* Efft;
DPG = ifft2(DG0);%傅里叶逆变换
DGlog = log(DPG +1);
PGg = PG_log - DPGlog;%拉普拉斯锐化
PG_reflect = exp(PGg);
PG_reflect_min = min(min(PG_reflect));
PG_reflect_max = max(max(PG_reflect));
PG_reflect=(PG_reflect-PG_reflect_min)/(PG_reflect_max-PG_reflect_min);%归一化处理
PG_reflect = adapthisteq(PG_reflect);%自适应均衡
 
PB_d = double(PB);
PB_log = log(PB_d+1);%对数处理
Bfft2 = fft2(PB_d);%傅里叶变换
DPB0 = Bfft2.* Efft;
DPB = ifft2(DPB0);%傅里叶逆变换
DPBlog = log(DPB+1);
PBb = PB_log - PDBlog;%拉普拉斯锐化
PB_reflect = exp(PBb);
PB_reflect_min= min(min(PB_reflect));
PB_reflect_max = max(max(PB_reflect));
PB_reflect = (PB_reflect - PB_reflect_min)/(PB_reflect_max -PB_reflect_min);%自适应均衡
EXPBb = adapthisteq(PB_reflect);
result1 = cat(3, PR_reflect, PG_reflect, PB_reflect);%合成
figure,imshow(im_input);%输出原始图像
figure,imshow(result1);%输出结果
L=rgb2hsv(result);
L_1=L(:,:,1);
L_2=L(:,:,2);
L_3=L(:,:,3);
L_22=adapthisteq(L_2);
L_33=adapthisteq(L_3);
result2=cat(3,L_1,L_22,L_33);
image_output=hsv2rgb(result2); 
figure,imshow(image_output);%输出最终结果

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).