《数字图像处理》——高频强调滤波

Matlab自写高通滤波器函数:

function H=hpfilter(type,f,D0,n)
[M,N]=size(f);
n1=floor(M/2); n2=floor(N/2);
for i=1:M
 for j=1:N
 D(i,j)=[(i-n1)^2+(j-n2)^2]^0.5;
 end
end
switch type
    case 'ideal'
        H = double(D >= D0);
    case 'btw'
        if nargin == 3
            n = 1;
        end
        H = 1./(1+(D0./D).^(2*n));
    case 'gaussian'
        H = 1-exp(-(D.^2)./(2*(D0^2)));
    otherwise 
        error('Unkown filter type');
end

 (1) (2) (3) 

clear all;close all;clc;

f=imread('实验3_测试图像\6.胸部X射线图像.tif');

f1=im2double(f);[R, C]=size(f1);

f1=padarray(f1,[R C],'symmetric','post');

F1=fft2(f1);F=fftshift(F1);

D0=40;

H1=hpfilter('gaussian',f1,D0);

G1=H1.*F;G2=(0.5+0.75*H1).*F;

g1=real(ifft2(ifftshift(G1)));

g2=real(ifft2(ifftshift(G2)));

g1=g1(1:size(f,1),1:size(f,2));

g2=g2(1:size(f,1),1:size(f,2));

g3=histeq(g2);

subplot(221);imshow(f,[]);title('原图像');

subplot(222);imshow(g1,[]);title('高斯高通滤波结果');

subplot(223);imshow(g2,[]);title('高频强调滤波结果');

subplot(224);imshow(g3,[]);title('直方图均衡后结果');

实验结果如图所示:

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

星空不见云

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值