频域滤波与图像恢复解答.doc

  1. 1、本文档共15页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
实验目的 1.1 学习如何根据观察使用一个启发式方法选择一个阈值。 1.2 探究函数graythresh以进行自动阈值选取。 1.3 学习如何实现自适应阈值化。 二、实验内容 2.1 使用prewitt算子进行边缘检测 2.1.1 对lena.tif进行分别使用imfilter函数和edge函数进行三种算子的边缘检测 Imfilter函数实现代码: clc,clear all,close all roberts1=[1,0;0,-1]; roberts2=[0,1;-1,0]; prewitt1=[-1,0,1;-1,0,1;-1,0,1]; prewitt2=[1,1,1;0,0,0;-1,-1,-1]; sobel1=[-1,0,1;-2,0,2;-1,0,1]; sobel2=[1,2,1;0,0,0;-1,-2,-1]; g=imread(C:\Documents and Settings\Administrator\桌面\images\Lena.tif); f=double(g); f1=imfilter(f,roberts1);f2=imfilter(f,roberts2); roberts_f=max(abs(f1),abs(f2)); f1=imfilter(f,prewitt1);f2=imfilter(f,prewitt2); prewitt_f=max(abs(f1),abs(f2)); f1=imfilter(f,sobel1);f2=imfilter(f,sobel2); sobel_f=max(abs(f1),abs(f2)); figure,subplot(2,2,1),imshow(g),title(原图像); subplot(2,2,2),imshow(roberts_f,[]),title(Roberts 边缘检测图像); subplot(2,2,3),imshow(prewitt_f,[]),title(Prewitt 边缘检测图像); subplot(2,2,4),imshow(sobel_f,[]),title(Sobel 边缘检测图像’); Imfilter函数操作结果显示如下: Edge函数代码如下: clc,clear all,close all; f=imread(C:\Documents and Settings\Administrator\桌面\images\lena.tif); sobel_f=edge(f,sobel); roberts_f=edge(f,roberts); prewitt_f=edge(f,prewitt); figure,subplot(2,2,1),imshow(f),title(原图像); subplot(2,2,2),imshow(roberts_f),title(Roberts边缘图像); subplot(2,2,3),imshow(prewitt_f),title(Prewitt边缘图像); subplot(2,2,4),imshow(sobel_f),title(Sobel边缘图像); Edge函数实现结果如下: 思考:[I_prw1,t1]=edge(I,’prewitt’);中t1表示什么? 答:t1表示阈值,可如下使用: [I_prw1,t1]=edge(I,’prewitt’); t1=[‘prewitt边缘检测,阈值=’num2str(t1)]; imshow(I_prw1); title(t1); 2.1.2加高斯噪声并提取边缘 代码如下: prewitt1=[-1,0,1;-1,0,1;-1,0,1]; prewitt2=[1,1,1;0,0,0;-1,-1,-1]; f=imread(C:\Documents and Settings\Administrator\桌面\images\lena.tif); noisy=imnoise(f,gaussian,0.07); noise=double(noisy); g=double(f); f1=imfilter(g,prewitt1);f2=imfilter(g,prewitt2); prewitt_g=max(abs(f1),abs(f2)); f1=imfilter(noise,prewitt1);f2=imfilter(noise,prewitt2); prewitt_f=max(abs(f1),abs(f2)); figure,subplot(2,2,1),imshow(f),title(原图像); subplot(2,2,2),imshow(noisy),title(含高斯噪声图像); subplot(2,2,3),imshow(pre

文档评论(0)

希望之星 + 关注
实名认证
内容提供者

我是一名原创力文库的爱好者!从事自由职业!

1亿VIP精品文档

相关文档