how can i obtain only hand after skin detection?

3 views (last 30 days)
hi; im working on the hand detection, firstly i used skin detection algorithm but i dont know how can i obtain hand after skin detection, here my code;
vid = videoinput('winvideo', 1, 'YUY2_640x480');
set(vid, 'FramesPerTrigger', Inf);
set(vid, 'ReturnedColorspace', 'rgb')
vid.FrameGrabInterval =5;
start(vid)
while(vid.FramesAcquired<=50)
I = getsnapshot(vid);
I=double(I);
%%skin detection
[hue,s,v]=rgb2hsv(I);
cb = 0.148* I(:,:,1) - 0.291* I(:,:,2) + 0.439 * I(:,:,3) + 128;
cr = 0.439 * I(:,:,1) - 0.368 * I(:,:,2) -0.071 * I(:,:,3) + 128;
[w h]=size(I(:,:,1));
for i=1:w
for j=1:h
if 140<=cr(i,j) && cr(i,j)<=165 && 140<=cb(i,j) && cb(i,j)<=195 && 0.01<=hue(i,j) && hue(i,j)<=0.1
segment(i,j)=1;
else
segment(i,j)=0;
end
end
end
im(:,:,1)=I(:,:,1).*segment;
im(:,:,2)=I(:,:,2).*segment;
im(:,:,3)=I(:,:,3).*segment;
subplot(1,1,1);imshow(uint8(im));title('My Edge Detection')
end
stop(vid);
flushdata(vid);
clear all

Answers (2)

Image Analyst
Image Analyst on 20 Mar 2014
segment is your mask. Assuming your algorithm for creating that skin mask is good, then you multiply segment by your original image to blacken outside the mask. So what's the problem? That is "only the hand", I mean other than the black surround. Do you want to crop to the bounding rectangle, or what?

YUNUS
YUNUS on 20 Mar 2014
my fundemental problem is to obtain hand, im new at image processing and i dont know how can i obtain hand
  5 Comments
intissar khalifa
intissar khalifa on 13 Feb 2017
hi mr i need to detect only hand in a video so can you help me and thanks.

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!