I have some particles that I\'ve identified in a larger image, and need to parse into smaller images for each particle. I\'ve used the regionprops \'BoundingBox\' function,
The parameters returned by regionprops are [y,x,width,height] in matrix coordinates (see also "unexpected Matlab".
Thus, to extract the rectangle, you write:
subImage = I(round(s(1).BoundingBox(2):s(1).BoundingBox(2)+s(1).BoundingBox(4)),...
round(s(1).BoundingBox(1):s(1).BoundingBox(1)+s(1).BoundingBox(3)));