MATLAB: How to draw a bounding box around an edge detected image

drawing bounding box around an edge detected imageImage Processing Toolbox

I have performed edge detection on an image but I have unsuccessful in drawing a single bounding box around the resulting edge detected image using regionprops & BoundingBox() of MATLAB. Also I have tried creating box around blobs having a minimum area (say 50) but that also doesn't work. Help appreciated and thanks in advance

Best Answer

Call bwconvhull()
mask = bwconvhull(mask);
props = regionprops(mask, 'BoundingBox');