Friday, 14 October 2016

Image Processing :- Object Detection Code



f=imread('d:\rabit.jpg');
grayf = rgb2gray(f);
whiterabit= S2>180;
imwrite(whiterabit,'D:\rabitthres.jpg','jpg');
fmask=imread('d:\rabitthres.jpg');
fmask=im2bw(fmask);
fr=f(:,:,1);
fg=f(:,:,2);
fb=f(:,:,3);
frm=immultiply(fr,fmask);
fgm=immultiply(fg,fmask);
fgb=immultiply(fb,fmask);
fout=cat(3,fr,fg,fgb);
background=cat(3,frm,fgm,fgb);
figure,imshow(f),figure,imshow(fout),figure,imshow(background)

No comments:

Post a Comment