电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

Experiment 3:Edge Detection电子专业课堂教案VIP免费

Experiment 3:Edge Detection电子专业课堂教案_第1页
1/5
Experiment 3:Edge Detection电子专业课堂教案_第2页
2/5
Experiment 3:Edge Detection电子专业课堂教案_第3页
3/5
Experiment3:EdgeDetectionⅠ.AimTheaimofthislaboratorysessionistolearntodealwithimagedatabyMatlab.Bytheendofthissession,youshouldbeabletoperformimagepreprocessingofedgedetectioninspatialdomainandfrequencydomain.Ⅱ.KnowledgerequiredintheExperimentⅰ.YouaresupposedtohavelearnedthebasicskillsofusingMatlab;ⅱ.YouneedtoreviewMatlabprogramminglanguageandM-fileformat.ⅲ.Youshouldhavestudiededgedetectionmethods.Ⅲ.ExperimentContentsDemand:Pleaseshowthefigureontheleftandlistthecodesontherightrespectivelybelloweachquestion.(请将运行结果(图片)和程序代码贴在每题下方)ⅰ.Read“car.jpg”file(todothisbyimreadfunction),convertthecolorimageintograyscaleimage,andthenperformedgedetectionusingRoterts,Prewitt,SobeloperatorseparatelyinspatialdomainanddisplaytheresultsinaMatlabwindow.程序:clear;im=imread('car.jpg');I=rgb2gray(im);subplot(3,2,1);imshow(I);title('Grayimage');[Y,X]=size(I);im_edge=zeros(Y,X);T=30;fork=2:Y-1forkk=2:X-1im_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;elseim_edge(k,kk)=0;endendendsubplot(3,2,2);imshow(im_edge,[]);%[]ÈÃÊý¾Ý×Ô¶¯Ëõ·Åµ½0~255µÄ·¶Î§ÄÚ¡£title('Robertimage');[YX]=size(I);imedge=zeros(Y,X);fork=2:Y-1forkk=2:X-1imedge(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('Prewitimage');[YX]=size(I);im_edge=zeros(Y,X);fork=2:Y-1forkk=2:X-1im_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('Sobelimage');图像如下:ⅱ.Read“car.jpg”file(todothisbyimreadfunction),convertthecolorimageintograyscaleimage,thenperformedgedetectioninfrequencydomainusingGaussianHighpassfilteranddisplaytheresultinaMatlabwindow.第二题程序:%频域边缘检测,利用Gassian高通滤波器进行滤波,进行边缘检测%频域边缘检测,利用Gassian高通滤波器进行滤波,进行边缘检测clear;im=imread('car.jpg');I=rgb2gray(im);subplot(1,2,1);imshow(I);title('grayimage');%shiftingimage(multiplytheimageby(-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('Fourierspectrum');%creathighpassfilterD=zeros(row,col);u0=floor(row/2);%傅立叶变换中心v0=floor(col/2);D0=40;%截止频率n=2;fori=1:rowforj=1:cold=((i-u0)^2+(j-v0)^2)^0.5;%D(i,j)=1/(1+(D0/d)^(2*n));D(i,j)=1-exp((-d^2)/(2*(D0)^2));endend%filteringG=F.*D;%Inverttheresultandshiftingg=real(ifft2(G));im=g.*(-1).^(X+Y);im=im>40;%阈值确定edgesubplot(1,2,2);imshow(im);title('theimageafterGassianhighpassfilter');图像如下:

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

Experiment 3:Edge Detection电子专业课堂教案

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部