Matlab学习9-图像处理之非线性锐化滤波

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


前言

空域滤波增强

  • 卷积原理
    • 多维连续卷积
  • 线性平滑滤波
    • 领域平均法、选择平均法、Wiener滤波
  • 非线性平滑滤波
    • 中值滤波
  • 线性锐化滤波
    • Laplacian算子
  • 非线性锐化滤波
    • Prewitt算子
    • Sobel算子
    • Log算子

Matlab学习9-图像处理之非线性锐化滤波
Prewitt算子、Sobel算子、Log算子

一、Prewitt算子

效果
在这里插入图片描述

代码

% prewitt算子
img=imread("img/lena.bmp");
subplot(3,2,2),imshow(img),xlabel("原始图像");

MaskPrewittV=fspecial("prewitt");
MaskPrewittH=MaskPrewittV';

KB1=filter2(MaskPrewittH,img);
subplot(3,2,4),imshow(uint8(KB1)),xlabel("水平模板滤波图像");
subplot(3,2,5),imshow(uint8(double(img)+KB1)),xlabel("水平模板滤波加法叠加图像");
subplot(3,2,6),imshow(uint8(double(img)-KB1)),xlabel("水平模板滤波减法叠加图像");

二、Sobel算子

效果
在这里插入图片描述

代码

% sobel算子
img=imread("img/liftingbody.png");
subplot(3,3,2),imshow(img),xlabel("原始图像");

MaskPrewittV=fspecial("sobel");
MaskPrewittH=MaskPrewittV';

KB1=filter2(MaskPrewittH,img);
subplot(3,3,4),imshow(uint8(KB1)),xlabel("水平模板滤波图像");
subplot(3,3,5),imshow(uint8(double(img)+KB1)),xlabel("水平模板滤波加法叠加图像");
subplot(3,3,6),imshow(uint8(double(img)-KB1)),xlabel("水平模板滤波减法叠加图像");

KB2=filter2(MaskPrewittV,img);
subplot(3,3,7),imshow(uint8(KB2)),xlabel("垂直模板滤波图像");
subplot(3,3,8),imshow(uint8(double(img)+KB2)),xlabel("垂直模板滤波加法叠加图像");
subplot(3,3,9),imshow(uint8(double(img)-KB2)),xlabel("垂直模板滤波减法叠加图像");

三、Log算子

效果在这里插入图片描述
代码

% log算子
img=imread("img/liftingbody.png");
subplot(2,2,1),imshow(img),xlabel("原始图像");

MaskLog=fspecial("log");
KB=filter2(MaskLog,img);
subplot(2,2,2),imshow(uint8(KB)),xlabel("LOG算子滤波图像");
subplot(2,2,3),imshow(uint8(double(img)+KB)),xlabel("滤波加法叠加图像");
subplot(2,2,4),imshow(uint8(double(img)-KB)),xlabel("滤波减法叠加图像");

点击获取源码
https://gitee.com/CYFreud/matlab/tree/master/image_processing/demo9_220502

猜你喜欢

转载自blog.csdn.net/CHengYuP/article/details/125037979