MATLAB: How to describing all enclosed white areas using rectangle box in binary images and get the coordinates

boundary

Hi everyone,
Assume I have an binary image as follows,
abc.png
And I want to descrribe enclosed white areas using rectangle box as follows,
abc.jpg
May I asak how can I get the red rectangles in the image (do not have to display it) and get the coordinates of rectangles?
Thanks in advance!

Best Answer

Please consult Walter's comment using "regionprops" function and set the "properties" to "BoundingBox".