全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Experiment 3:Edge DetectionClass: 电子1203班 Student ID: 1210910322 Name: 王影 . AimThe aim of this laboratory session is to learn to deal with image data by Matlab. By the end of this session, you should be able to perform image preprocessing of edge detection in spatial domain and frequency domain. Knowledge required in the Experiment.You are supposed to have learned the basic skills of using Matlab;.You need to review Matlab programming language and M-file format. You should have studied edge detection methods. Experiment ContentsDemand: Please show the figure on the left and list the codes on the right respectively bellow each question.(请将运行结果(图片)和程序代码贴在每题下方).Read “car.jpg” file (to do this by imread function), convert the color image into grayscale image, and then perform edge detection using Roterts, Prewitt, Sobel operator separately in spatial domain and display the results in a Matlab window.程序:clear;im=imread(car.jpg); I=rgb2gray(im);subplot(3,2,1);imshow(I); title(Gray image); Y,X=size(I);im_edge=zeros(Y,X);T=30;for k=2:Y-1 for kk=2:X-1 im_edge(k,kk)=abs(I(k+1,kk+1)-I(k,kk)+abs(I(k,kk+1)-I(k+1,kk); if (im_edge(k,kk)T) im_edge(k,kk)=1; else im_edge(k,kk)=0; end endendsubplot(3,2,2);imshow(im_edge,);% 0255title(Robert image); Y X=size(I);imedge=zeros(Y,X); for k=2:Y-1 for kk=2:X-1 imedge(k,kk)=abs(I(k-1,kk+1)-I(k-1,kk-1)+abs(I(k,kk+1)-im(k,kk-1) + abs(I(k+1,kk+1)-I(k+1,kk-1)+. abs(I(k+1,kk -1)-I(k-1,kk-1)+abs(I(k+1, kk)-I(k-1, kk)+abs(I(k+1,kk+1)-I(k-1,kk+1) ; endendsubplot(3,2,3);imshow(imedge,);title(Prewit image); Y X=size(I);im_edge=zeros(Y,X); for k=2:Y-1 for kk=2:X-1 im_edge(k,kk)=abs(I(k-1,kk+1)-I(k-1,kk-1)+2*abs(I(k,kk+1)-I(k,kk-1) + abs(I(k+1,kk+1)-I(k+1,kk-1)+. abs(I(k+1,kk -1)-I(k-1,kk-1)+2*abs(I(k+1, kk)-I(k-1, kk)+abs(I(k+1,kk+1)-I(k-1,kk+1) ; endendsubplot(3,2,4);imshow(im_edge,);title(Sobel image);图像如下: . Read “car.jpg” file (to do this by imread function), convert the color image into grayscale image, then perform edge detection in frequency domain using Gaussian Highpass filter and display the result in a Matlab window.第二题程序:%频域边缘检测,利用Gassian高通滤波器进行滤波,进行边缘检测%频域边缘检测,利用Gassian高通滤波器进行滤波,进行边缘检测clear;im=imread(car.jpg);I=rgb2gray(im);subplot(1,2,1);imshow(I);title(gray image);%shifting image (multiply the image by (-1)x+y)row,col=size(I);Y,X=meshgrid(1:col,1:row);II=double(I).*(-1).(X+Y);F=fft2(II);%subplot(2,2,2);%title(Fourier spectrum);%creat highpass filterD=zeros(row,col);u0=floor(row/2); %傅立叶变换中心v0=floor(col/2); D0=40; %截止频率n=2;for i=1:row for j=1:col d=(i-u0)2+(j-v0)2)0.5; % D(i,j)=1/(1+(D0/d)(2*n); D(i,j)=1-exp(-d2)/(2*(D0)2); endend%filteringG=F.*D;%Invert the result an
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025福建泉州城建集团城建地产集团招聘营销总监岗位1人笔试考试备考题库及答案解析
- 2025首都师范大学第二附属中学招聘笔试考试备考题库及答案解析
- 德安县市政工程公司招聘考试笔试参考题库附答案解析
- 古典概型+课件2025-2026学年高一下学期数学人教A版必修第二册
- 2025江西吉安吉水县城控人力资源服务有限公司招聘2人笔试考试参考题库及答案解析
- 2025年哈尔滨市香坊第二幼儿园招聘保育员1人笔试考试备考试题及答案解析
- 2026甘肃嘉峪关市教育系统招聘公费师范毕业生和小学全科型教师37人考试笔试参考题库附答案解析
- 2025年新能源物流车辆续航能力与选型研究报告
- 2025山东省黄河三角洲发展集团有限公司及所属企业招聘7人笔试考试参考试题及答案解析
- 2025湖北黄冈武穴市农水集团招聘工作人员8人笔试考试备考题库及答案解析
- 肺癌科普知识讲座
- 2026年北京中考英语听力口语高频516词
- 集材作业工班组评比测试考核试卷含答案
- 了不起的狐狸爸爸-全文打印
- 拼多多商家协议
- 内蒙古铅锌矿分布
- JJF 1318-2011 影像测量仪校准规范-(高清现行)
- DBJ50∕T-342-2019 工程建设对既有建(构)筑物安全影响评估标准
- 陀螺历史小手抄报
- 六年级语文上册部编版第七单元教材分析(定稿)
- 2022年中考物理二轮复习专题-电功率动态电路计算专题(Word版含答案)
评论
0/150
提交评论