1、选择一个经过低通滤波器滤波的模糊图象,利用sobel和prewitt水平边缘增强高通滤波器(模板)对其进行高通滤波图象边缘增强,验证模板的滤波效果。
2 选择一幅灰度图象分别利用 一阶Sobel算子和二阶Laplacian算子对其进行边缘检测,验证检测效果。
I = imread('lena512.bmp');
%第一部分
figure(1);
subplot(221),imshow(I);title('原始图像');
%9*9邻域模板
H1 = ones(9,9)/81;
I1 = imfilter(I,H1);
subplot(222),imshow(I1);title('9*9邻域模板');
J1 = edge(I1,'sobel');
subplot(223),imshow(J1);title('Sobel算子');
J2 = edge(I1,'prewitt');%prewitt算子锐化
subplot(224),imshow(J2);title('Prewitt算子');
%第一部分
figure(2);
subplot(221),imshow(I);title('原始图像');
subplot(222),imhist(I);title('直方图');
J3 = edge(I,'sobel');
subplot(223),imshow(J3);title('Sobel算子');
H2=fspecial('laplacian');%laplacian算子锐化
J4 = imfilter(I,H2);
subplot(224),imshow(J4);title('laplacian算子');
本文通过使用Sobel、Prewitt及Laplacian算子对图像进行边缘增强与检测,对比不同算子的效果。首先对图像应用低通滤波器进行平滑处理,然后采用Sobel和Prewitt算子进行高通滤波实现边缘增强;接着直接对原始图像应用Sobel及Laplacian算子进行边缘检测。
1296

被折叠的 条评论
为什么被折叠?



