Blogger Widgets

Search This Blog

Tuesday, 1 May 2012

MATLAB PROGRAM FOR OBJECT DETECTION USING COLOUR INFORMATION

    Here for object detection we uses the color of the object.Using this method we can identify the object more accurately than correlation method. Here also the Background intensity cause some problem for accurate detection

 clc
vid=videoinput('winvideo',1,'YUY2_640x480');
preview(vid)
pause(5)
q=getsnapshot(vid);
a=ycbcr2rgb(q);


for i=1:480
    for j=1:640
       if (a(i,j,1)<=221&&a(i,j,1)>=38)&&
(a(i,j,2)<=243&&a(i,j,2)>=95)&&(a(i,j,3)<=141&&a(i,j,3)<=46)
          a(i,j,1)=255; a(i,j,2)=255;a(i,j,3)=255;
       else a(i,j,1)=0; a(i,j,2)=0;a(i,j,3)=0;
       end
    end
end
imshow(a);
stoppreview(vid)


PROGRAM FOR OBJECT DETECTION USING COLOR INFORMATION AND FILTERING

s=imread('sib 004.jpg');
fr=s(:,:,1);
fg=s(:,:,2);
fb=s(:,:,3);
i=((fr<=104)&(fg<=90)&(fb>=80));
f=strel('square',13);
d=imopen(i,f);
imshow(d)



1 comment:

Blogger Widgets