title: Implementing wrist-cropping procedure for hand-forearm segmentation (Matlab)
body: <p>I'm trying to create a gesture recognition system for static poses. I'm currently trying to implement a wrist-cropping procedure, before moving onto feature extraction.<br>
  I came across an algorithm (referenced here: <a href="http://admin.csie.ntust.edu.tw/IEET/syllabus/course/961_CS5014702_65_aGlnaDIucGRm.pdf" rel="nofollow noreferrer">http://admin.csie.ntust.edu.tw/IEET/syllabus/course/961_CS5014702_65_aGlnaDIucGRm.pdf</a>), but I'm not sure of it's technical implementation (the paper referenced another source which I could not locate). 2 methods were described, demonstrated in the image below:
  <a href="https://i.stack.imgur.com/FzOw3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FzOw3.jpg" alt="enter image description here"></a>
  The first is based on the wrist length, the 2nd on changes in the contour of the image. I'm not really sure how to implement this and would appreciate any help.</p>
  
  <p>I have a simple idea (for the 1st method) where you would scan through the pixels (starting from the bottom of the image), counting the no. of pixels on each row, until you encounter a row which has more pixels than the previous row (indicating the start of the palm area). However, this would assume that the positioning of the hand is always vertical. Any ideas to improve upon that so that the hand doesn't always have to be vertical or how to implement the contour-based approach (where you would detect a sharp turn in the contour, indicating the wrist)? I'm quite new to Matlab. Thanks. </p>
  
  <p>An example input:</p>
  
  <p><a href="https://i.stack.imgur.com/6LE2Z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6LE2Z.jpg" alt="enter image description here"></a></p>
  
  <p>Using Miki's solution, some outputs on more test images:</p>
  
  <p><a href="https://i.stack.imgur.com/Usk9B.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Usk9B.jpg" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/Z4IGM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z4IGM.jpg" alt="enter image description here"></a></p>
  
  <p>Original images:</p>
  
  <p><a href="https://i.stack.imgur.com/8IPZg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8IPZg.jpg" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/o027Y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o027Y.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/Ja911.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ja911.jpg" alt="enter image description here"></a></p>