📄 4f fresnel-filter.m
字号:
%这个程序是模拟4f系统滤波处理,在滤波面加菲涅尔滤波片
close all
%模拟4f系统对图像进行滤波处理
V=imread('E:\个人文件\毕业设计\衍射 matlab程序\V.bmp'); %读入字母V
V=im2double(V);
subplot(1,2,1);imshow(V);title('字母V');
V1=fftshift(fft2(V)); % 将图像频谱低频部分移到中央,高频部分移到四周
subplot(1,2,2);imshow(abs(V1)*16/max(max(abs(V1))));title('字母V经物面到达频谱面后的频谱图'); %字母V经物面到达频谱面后的频谱图
r=16;
a=4*sqrt(r);
b=0;
%生成菲涅尔滤波片
F=ones(256,256);
for k=1:30
p=6*sqrt(k*r);
for x=1:256
for y=1:256
r1=sqrt((x-128)^2+(y-128)^2);
if r1>=a&r1<=p
F(x,y)=b;
end
end
end
a=p;
b=abs(b-1);
end
subplot(1,2,1);imshow(F);title('菲涅尔滤波片');
figure,subplot(1,3,1);imshow(F);title('菲涅尔滤波片');
B2=V1.*F; % 滤波
subplot(1,3,2);imshow(abs(B2)*64/max(max(abs(B2))));title('经频谱面滤波后频谱图');
C2=ifft2(B2);
subplot(1,3,3);imshow(abs(C2)/max(max(abs(C2))));title('滤波后的字母');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -