数字图像处理 实验四:图像的锐化处理 matlab

  • 实验内容

1)任意选择一副灰度图像,使用拉普拉斯算子对图像进行锐化滤波,并和原

图像叠加,实现对图像的增强。

2)任意选择一副图像,使用 sobel 算子对图像进行锐化滤波,观察滤波效果。

3)任意选择一副图像,构造一个中心系数为-24 5×5 的类似于拉普拉斯模板对图像进行锐化,与中心系数为-8 3×3 拉普拉斯算子的结果相比,是否能得到更加清晰的结果?

  • 源程序和结果

A=imread('lena.bmp');

A=rgb2gray(A);

h1=fspecial('laplacian'); %拉普拉斯算子,模板默认大小为3*3

h2=fspecial('sobel');     %sobel算子,模板默认大小为3*3

h3=zeros(5,5);            %构造模板大小规格为5*5

for i=1:5

for j=1:5

if(i==3&&j==3)

h3(i,j)=-24;              %模板中间元素为-24

else

h3(i,j)=1;                %模板其它元素为1

end

end

end

h4=zeros(3,3);            %构造模板大小规格为3*3

for i=1:3

for j=1:3

if(i==2&&j==2)

h4(i,j)=-8;              %模板中间元素为-8

else

h4(i,j)=1;                %模板其它元素为1

end

end

end

A1=imfilter(A,h1);

A2=imfilter(A,h2);

A3=imfilter(A,h3);

A4=imfilter(A,h4);

figure(2);

subplot(1,2,1);imshow(A);title('原图');

subplot(1,2,2);imshow(A2);title('sobel3*3');

hold on;

figure(3);

subplot(2,2,1);imshow(A);title('原图');

subplot(2,2,2);imshow(A1);title('原图laplacian3*3');

subplot(2,2,3);imshow(A3);title('原图laplacian5*5(中心系数为-24)');

subplot(2,2,4);imshow(A4);title('原图laplacian3*3*(中心系数为-8)');

B=double(A)/256;B1=double(A1)/256;C=imadd(B,B1);

hold on;

figure(1);

subplot(1,3,1);imshow(A);title('原图');

subplot(1,3,2);imshow(A1);title('拉普拉斯');

subplot(1,3,3);imshow(C,[]);title('叠加');

 

 

 

  • 7
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

sftmnggsujgff.shhgft

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

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

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

打赏作者

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

抵扣说明:

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

余额充值