How to detect the movement of the two tapping fingers in a video?

5 visualizzazioni (ultimi 30 giorni)
Please, I'm trying to detect the fingers' movement in a video. Firstly, I'd like to apply a skin color detection to separate the hand from the background and then I'll find the hand counter followed by calculating the convex points to detect the fingers. What I want now from this video is a new video showing only the movement of the two tapping fingers (or their contour), as shown in this figure.
Please, I'm trying to detect the fingers' movement in a video. Firstly, I'd like to apply a skin color detection to separate the hand from the background and then I'll find the hand counter followed by calculating the convex points to detect the fingers. What I want now from this video is a new video showing only the movement of the two tapping fingers (or their contour), as shown in this figure.
enter image description here
I used this code to detect the skin color:
function OutImg=Skin_Detect(I)
% clear
% I=imread('D:\New Project\Movie Frames from RLC_L_FTM_IP60\Frame
0002.png');
I=double(I);
[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 138<=cr(i,j) && cr(i,j)<=169 && 136<=cb(i,j) && cb(i,j)<=200 &&
0.01<=hue(i,j) && hue(i,j)<=0.2
segment(i,j)=1;
else
segment(i,j)=0;
end
end
end
% imshow(segment);
OutImg(:,:,1)=I(:,:,1).*segment;
OutImg(:,:,2)=I(:,:,2).*segment;
OutImg(:,:,3)=I(:,:,3).*segment;
% figure,imshow(uint8(im));
The same code is working perfectly when I apply it to an image, but I detect nothing when I apply it to a video, as follows:
videoFReader = vision.VideoFileReader('RLC_L_FT_IP60.m4v');
% Create a video player object for displaying video frames.
videoPlayer = vision.DeployableVideoPlayer;
% Display the original video
while ~isDone(videoFReader)
videoFrame = step(videoFReader);
% Track using the Hue channel data
Out=Skin_Detect(videoFrame);
step(videoPlayer,Out);
end
Please, any suggestion and idea to solve this problem?
I'll be so grateful if anyone can help with this even with different codes. Thank you in advance.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by