Professional Documents
Culture Documents
Real Time Edge Detector of Objects Using Matlab PDF
Real Time Edge Detector of Objects Using Matlab PDF
Alright, at this time we’ll talk about how to detect edge of objects in real time video using matlab. In this
article, i’m gonna show you that there is nothing difficult algorithm we have to use. But there is
prerequisites, all articles i wrote related to video processing using matlab (article 1st to 3rd) must have been
read and understood. Because most of syntax i use here, taken from those articles.
Piece of program above shows how to acquire webcam information installed in your computer. This
adaptor will be used as object that matlab recognized as peripheral to acquire image frames to process.
Meanwhile, piece below shows you how to set attributs for our webcam.
We set grayscale because this kind of format will be used as input for processing, rather than rgb. Because
if we set rgb format, we will need 1 more step which is grayscaling images. Also, you have to notice that
framegrabinterval used in this program is the best smallest value. If you have plan to change it smaller, it
makes program will not give best result. In case you dont agree with me, you have right to make any
changes.
1
[Jans Hendry / EE&IT UGM Indonesia] August 23, 2011
You must notice that we use single frame or image in processing. This grayscale image is converted to
binary image because we will threshold its intensity to separate objects from its background. Many
thresholding method we can use instead of one used above. Please make some experiment yourself.
bw=bwareaopen(bw, 45);
bw=edge(bw,'roberts'); % please choose other edge filter
se=strel('disk',5); % to solid line edge
bw=imclose(bw,se);
bw=~bw;
imshow(bw)
title('Object Edge Detection Real Time','fontsize',14);
xlabel('Jans Hendry - EE&IT Gadjah Mada University, Indonesia');
flushdata(vid); % to clear memory
end
stop(vid); % stop process
Ok, above piece is easy to understand. We use imshow because the data is an image in sequences. After
processing data, we must erase it from memory for each. Its important not to burden your memory. For
this purpose, we use flushdata.
%% clearing
delete(vid);
imaqreset;
%%
Please dont forget to delete object and reset all variabel regarding object by using imaqreset.
2
[Jans Hendry / EE&IT UGM Indonesia] August 23, 2011
After reading this article and probably simulating the codes, i wish you will be able to modify it and make
some powerfull program.
Thats all dude, we’ll continue to discuss about object detection based on its color in next session... CU.