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

该实验报告详细介绍了使用MATLAB进行图像处理,包括读取'car.jpg'图像,将其转换为灰度图像,并分别应用Roberts、Prewitt和Sobel算子在空间域和频率域进行边缘检测。实验结果展示了不同算子处理后的图像效果。
摘要由CSDN通过智能技术生成

计算机视觉实验报告Experiment3

Experiment 3:Edge Detection

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

Ⅰ. Aim

The 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 Contents

Demand: 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

end

end

subplot(3,2,2);

imshow(im_edge,[]);% []è?êy?Y×??ˉ??·?μ?0~255μ?·??§?ú?£

title('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)) ;

end

end

subplot(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)-

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值