计算机视觉技术的基本应用实验报告,计算机视觉实验报告Experiment3.docx

该实验旨在通过Matlab学习图像数据处理,特别是边缘检测技术。学生将使用Roberts,Prewitt和Sobel算子在空间域和频率域中对'car.jpg'图像进行灰度化和边缘检测,并显示结果。实验要求学生熟悉Matlab编程和边缘检测方法。
摘要由CSDN通过智能技术生成

专业

专业word可编辑

Experiment 3 : Edge Detection

Class:电子 1203 班Student ID:1210910322 Name:王影

I . Aim

The aim of this laboratory sessi on is to lear n to deal with image data by Matlab. By the

end of this session, you should be able to perform image preprocessing of edge detect ion in spatial doma in and freque ncy doma in.

n . Knowledge required in the Experiment

.You are supposed to have learned the basic skills of using Matlab;

.You need to review Matlab programming Ianguage and M-file format.

iii. You should have studied edge detect ion methods.

川.Experiment Contents

Dema nd: Please show the figure on the left and list the codes on the right respectively

bellow each question.(请将运行结果(图片)和程序代码贴在每题下方)

i .Read “ar.jpg ” file (to do this by imread function), convert the color image into grayscale image, and the n perform edge detect ion using Roterts, Prewitt, Sobel operator separately in spatial doma in and display the results in a Matlab win dow.

程序:

clear;

im=imread( 'car.jpg');

I=rgb2gray(im);

subplot(3,2,1);imshow(l);

title( 'Gray image');

[Y,X]=size(l);

im_edge=zeros(Y,X);

T=30;

for k=2:Y-1

for kk=2:X-1

im_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;

else

im_edge(k,kk)=0;

end

end

end

subplot(3,2,2);

imshow(im_edge,[]); %[] e ? e y?Y x ?? - ?? ? ?卩?0~255 卩? ? ?? § ? u ? £

title( 'Robert image');

-Y xHsN'e (三

imedgeHzeros(Y-x「

for k"2Y—1

for kk"2x—1

imedge(k-kkHabs(-?1 -kk+1)'(k?kk—1))+abs(-(Kkk+1)」m(Kkk—1)) abs (一 (k+1 - kk+1 )'(k+1 - kka)+ ■■- abs (一 (k+1-kka'?1-kka)+abs (一 (k+1- kk)'(k?

kk))+abs (一 (k+1 - kk+1 )'?1 - kk+1)二

end

end subp_2.(3-2-3)- imshow(imedge-s s-e( -prewifimage-=

-Y xHsN'e (三 imledgeHzeros(Y-x=

for k"2Y—1

for kk"2x—1

-4妄 word 凹>#

专业

专业word可编辑

im_edge(k,kk)=abs(l(k-1,kk+1)-l(k-1,kk-1))+2*abs(l(k,kk+1)-l(k,kk-1)) +

abs(l(k+1,kk+1)-l(k+1,kk-1))+...

abs(l(k+1,kk -1)-l(k-1,kk-1))+2*abs(l(k+1, kk)-l(k-1,

kk))+abs(l(k+1,kk+1)-l(k-1,kk+1));

end end subplot(3,2,4);

imshow(im_edge,[]);

title( 'S

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值