Region of interest extraction in Matlab : I am writing a Matlab code to implement a specific filter on a selected (from auto ROI) grayscale region of a forearm image which consists of veins. I also uploaded the forearm of a subject(after foreground has extracted). I have not been able to find or write a code to do so. Basically, I have NIR camera images of the forearm of different subjects with different orientations. I wrote the code that has extracted the foreground grayscale image of the arm, that gave me the white background with the forearm. I used Sobel edge to find edges. I also found the nonzero indices using 'find' function. I got the row and col indices. I need an idea on how to extract image inside (almost 10 pixels) of the edges detected on both sides of the forearm (black and white edged image-also uploaded). [sobel-edge][1]
[Foreground image][2]
  [1]: https://i.stack.imgur.com/2jpZ8.jpg
  [2]: https://i.stack.imgur.com/iUPXA.jpg