Extract hands from a video

1 view (last 30 days)
Marco
Marco on 24 Jan 2014
Hello,
I have a video in which hands perform some gesture and are not always in motion; I have to extract them. Because the first frames are the background I tried with:
readerObj = VideoReader('VideoWithHands.mp4');
nFrames = readerObj.NumberOfFrames;
fr = get(readerObj, 'FrameRate');
writerObj = VideoWriter('Hands.mp4', 'MPEG-4');
set(writerObj, 'FrameRate', fr);
open(writerObj);
bg = read(readerObj, 1); %background
for k = 1 : nFrames
frame = read(readerObj, k);
hands = imabsdiff(frame,bg);
writeVideo(writerObj,hands);
end
close(writerObj);
but in this way, colors are not "real" and opacity level is low (you can see something through the hands). I wonder whether it would be possible to extract the hands keeping real colors and opacity exploiting the background. Thanks

Answers (0)

Community Treasure Hunt

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

Start Hunting!