MATLAB: How to create a bounding box in webcam preview and capture image in that bounding box

Image Acquisition Toolboxwebcamwebcam preview

This is how I want to do it:
1. Determine positions in webcam preview
2. Create bounding box on that positions in webcam preview
3. Place hand in bounding box
4. Capture it

Best Answer

You can use ginput, rectangle(), imrect() or other functions to determine locations in the image. Then use plot() to create the box. Then call getsnapshot, which will get the full image but you then crop it with imcrop() to limit it to just the bounding box.
Related Question