Method and apparatus for segmenting hand gestures