title: Minimal Rectangle Bounding box around a region if an image using matlab
body: <p>Hi i am working with matlab and trying to select a region using a bounding box. The code is as shown below</p>
  
  <pre><code>BW=bwconncomp(I1);
  STATS = regionprops(BW, 'FilledArea','BoundingBox','Image');
  </code></pre>
  
  <p>The result is as shown below</p>
  
  <p><img src="https://i.stack.imgur.com/KrcJD.png" alt="enter image description here"></p>
  
  <p>I am trying to obtain an output as shown below. Is it possible?</p>
  
  <p><img src="https://i.stack.imgur.com/hgjkN.png" alt="enter image description here"></p>