图像的锐化和边沿检测 实验报告

一、实验目的

1. 熟练掌握几类锐化滤波器

2. 利用MATLAB 程序进行图像锐化增强

3. 了解边缘检测的概念以及和图像边缘增强锐化的关系

4. 熟练掌握边缘检测方法

5. 利用MATLAB 程序进行图像边缘检测

二、实验设备

计算机

、实验内容

1. 调入数字图像,分别用robert laplacian prewitt sobel算子进行计算机图像锐化处理

2. 显示原图像及经过锐化处理过的图像

3. 调入数字图像,并用差分、梯度、拉普拉斯算子及各种高通滤波算子对图像的边缘进行检测处理

4. 学习MATLABedge函数

5. 打开MATLAB ToolBox Image Processing中的Analysis and Morphology Segmentation。运行Image Analysis中的Edge Detecion

6. 使用edge函数对图像进行边缘检测

7. 显示原图像及检测出的边缘图像

8. 记录和整理实验报告

、实验要求

1. 根据实验内容正确运用MATLAB编程

2. 写出实验报告

五、实验结果与分析

1.rui_hua_chu_li.m文件包含了robert laplacian prewitt sobel 算子进行计算机图像锐化处理,并显示原图像及经过锐化处理过的图像结果;

rui_hua_chu_li.m

clear all;
close all;
clc;

a=imread('lena.jpg');
a=rgb2gray(a);
subplot(231);imshow(a);title('原图');

%然而并没有robert算子的类型,所以要自己写
%h1=fspecial('robert');       %选择robert算子
%j1=filter2(h1,a);            %卷积运算
[H,W]=size(a);
M=double(a);
j1=a;
for i=1:H-1
    for j=1:W-1
        j1(i,j)=abs(M(i,j)-M(i+1,j+1))+abs(M(i+1,j)-M(i,j+1));
    end;
end;
subplot(232);imshow(j1);title('robert锐化处理结果');

h2=fspecial('laplacian');        %选择laplacian算子
j2=filter2(h2,a);            %卷积运算
subplot(233);imshow(j2);title('laplacian锐化处理结果');

h3=fspecial('prewitt');     %选择prewitt算子
j3=filter2(h3,a);            %卷积运算
subplot(235);imshow(j3);title('prewitt锐化处理结果');

h4=fspecial('sobel');     %选择sobel算子
j4=filter2(h4,a);            %卷积运算
subplot(236);imshow(j4);title('sobel锐化处理结果');

  

2.bian_yuan_jian_ce.m文件edge函数,通过差分、梯度、拉普拉斯算子及各种高通滤波算子对图像的边缘进行检测处理,最后显示原图像及检测出的边缘图像

bian_yuan_jian_ce.m

clear all;
close all;
clc;

a=imread('lena.jpg');
a=rgb2gray(a);
subplot(231);imshow(a);title('原图');

b1=edge(a,'Canny');
subplot(232);imshow(b1);title('canny算子边缘检测');

b2=edge(a,'Sobel');
subplot(233);imshow(b2);title('sobel算子边缘检测');

b3=edge(a,'log');
subplot(234);imshow(b3);title('log算子边缘检测');

b4=edge(a,'Prewitt');
subplot(235);imshow(b4);title('prewitt算子边缘检测');

b5=edge(a,'Roberts');
subplot(236);imshow(b5);title('Roberts算子边缘检测');

  

猜你喜欢

转载自www.cnblogs.com/lyxyhhxbk/p/10760140.html
今日推荐