How can I separate hand from forearm after skin segmentation?

2 views (last 30 days)
I'm working on a gesture recognition project. I've carried out skin segmentation and I'm now trying to separate the hand from the forearm before the feature extraction phase. I'm wondering how I would go about achieving this? I've attached an image for reference.
Thanks.

Answers (2)

Cedric
Cedric on 2 Aug 2015
This could be a start. This is not as solid/stable as what ImageAnalyst proposes though. In French we would call that "bricolage" ;-)
I = im2bw( imread( 'hand.jpg' )) ;
% - Crop white frame.
I = I(~all(I,2),~all(I,1)) ;
% - Crop 10px border to eliminate glitches at the border.
I = I(10:end-10,10:end-10) ;
[nRow, nCol] = size( I ) ;
% - Find first horizontal transition 0->1 from left.
D = diff( I, 1, 2 ) == 1 ;
% - Find first column per row where D is 1.
[~, colId] = max( D, [], 2 ) ;
% - Smoothen colId.
kerSize = round( nCol /10 ) ;
colId_smz = conv( colId, ones( 1, kerSize )/kerSize, 'same' ) ;
figure() ;
set( gcf, 'Units', 'normalized', 'Position', [0.1,0.1,0.8,0.8] ) ;
% - Plot cropped image.
subplot( 2, 2, 1 ) ;
imshow( I ) ;
title( 'Cropped image' ) ;
% - Plot left profile.
subplot( 2, 2, 2 ) ;
imshow( D ) ;
title( 'Left profile' ) ;
% - Plot left profile + smoothen.
subplot( 2, 2, 3 ) ;
y_colId = colId ; y_colId(colId==1) = NaN ;
y_smz = colId_smz ; y_smz(colId==1) = NaN ;
plot( 1:nRow, y_colId, 'b', 1:nRow, y_smz, 'r' ) ;
grid on ; title( 'Profile + smoothen' ) ;
% - Plot difference + smoothen.
subplot( 2, 2, 4 ) ;
dif = diff( y_smz ) ;
dif_smz = conv( dif, ones( 1, kerSize )/kerSize, 'same' ) ;
plot( 1:nRow-1, dif, 'b', 1:nRow-1, dif_smz, 'r' ) ;
ylim( prctile( dif_smz, [5, 95] )) ;
grid on ; title( 'Diff + smoothen' ) ;
With that you get:
Then you have to detect the from the right the point where the smoothen derivative changes significantly.
  3 Comments
Cedric
Cedric on 2 Aug 2015
I will really have to dig in this Image Processing Toolbox! I am currently doing a lot of operations using a combination of MATLAB and ArcGIS for GIS operations, and I am pretty sure that a lot of these operations could be done with the Image Proc. Tbx only.
M
M on 5 Aug 2015
Thank you for your help. I have decided to make things simple and avoid forearm skin detection.

Sign in to comment.


Image Analyst
Image Analyst on 27 Jul 2015
  4 Comments
M
M on 4 Aug 2015
Thanks for the ideas, but implementing it is probably out of my reach. I have decided to just eliminate the forearm skin detection (by wearing long sleeve shirts).

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!