西电计算机视觉实验报告二,计算机视觉实验报告Experiment3

《计算机视觉实验报告Experiment3》由会员分享,可在线阅读,更多相关《计算机视觉实验报告Experiment3(8页珍藏版)》请在人人文库网上搜索。

1、Experiment 3 : Edge DetectionClass: 电子 1203班Student ID: 1210910322 Name: 王影I . AimThe aim of this laboratory sessi on is to lear n to deal with image data by Matlab. By the end of this sessi on, you should be able to perform image preprocess ing of edge detect ion in spatial doma in and freque ncy d。

2、oma in.n . Knowledge required in the Experimenti .You are supposed to have learned the basic skills of using Matlab;ii .You need to review Matlab programming Ianguage and M-file format.iii . You should have studied edge detection methods.川.Experiment ContentsDema nd: Please show the figure on the le。

3、ft and list the codes on the right respectively bellow eachquestion.(请将运行结果(图片)和程序代码贴在每题下方)i .Read “ar.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 disp。

4、lay the results in a Matlab win dow.程序:clear;im=imread( car.jpg);I=rgb2gray(im);subplot(3,2,1);imshow(I);title(Gray image);Y,X=size(l);im_edge=zeros(Y,X);T=30;for k=2:Y-1for kk=2:X-1im_edge(k,kk)=abs(l(k+1,kk+1)-l(k,kk)+abs(l(k,kk+1)-l(k+1,kk);if (im_edge(k,kk)T)im_edge(k,kk)=1;整理范本e-seimledge(k-kkH。

5、qendendendsubp_2.(3-2-2)-imshowumledgeew 口 e 7 e y7Y X 77 77 7 卞 702255 卞 7 77 0 7 口 7 出s-e(-Robell image)-Y xHsNe (三imedgeHzeros(Y-xfor k2Y1for kk2x1imedge(k-kkHabs(-?1 -kk+1)(k?kk1)+abs(-(Kkk+1)m(Kkk1) +abs (一 (k+1 - kk+1 )(k+1 - kka)+ -abs (一 (k+1-kka(k?kka)+abs (一 (k+1- kk)(k?kk)+abs (一 (k+1-kk+。

6、1)(k?kk+1)二 endendsubp_2.(3-2-3)-imshow(imedge-ss-e(-prewifimage)-Y xHsNe (三i mledge zeros (Y-xxfor k2Y1for kk2x1imledge(k-kkllabs(-(k?kk+v-?1 -kka)+2*abs(-(k-kk+1T-(Kkk1) +abs (- (k+1 - kk+1 )(k+1 - kk1)+ : abs(-(k+1-kk1T-(k?kka)+2*abs(-(k+1- kk)?1- kk)+abs(-(k+1-kk+1)?1-kk+1)_endendsubp-2.(3-2-4im。

7、show(imledge-ss-e(-sobe-image)-mJlaMii. Read “ar.jpg” file (to do this by imread function), con vert the color image into grayscale image, then perform edge detect ion in freque ncy doma in using Gaussia n Highpass filter and display the result in a Matlab win dow.第二题程序:%频域边缘检测,利用Gassian高通滤波器进行滤波,进行。

8、边缘检测%频域边缘检测,利用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(l);Y,X=meshgrid(1:col,1:row);ll=double(l).*(-1)A(X+Y);F=fft2(II);%subplot(2,2,2);%title(Fourier spectrum);%creat hig。

9、hpass filter%傅立叶变换中心D=zeros(row,col);u0=floor(row/2);v0=floor(col/2);D0=40;%截止频率n=2;for i=1:rowfor j=1:cold=(i-u0)A2+(j-v0)A2)A0.5;% D(i,j)=1心+(D0/d)A(2* n);D(i,j)=1-exp(-dA2)/(2*(D0)A2);endend%filteringG=F.*D;%Invert the result and shiftingg=real(ifft2(G);im=g.*(-1).A(X+Y);im=im40;% 阈值确定 edgesubplot(1,2,2);imshow(im);title(the image after Gassian highpass filter);图像如下。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值