MATLAB Answers

Largest rectangle inscribed inside multiple blobs

1 view (last 30 days)
I have few blobs where I need to fit the largest area rectangle inside. I used the matlab function LargestRectangle to find the rectangle and it works well for a single blob.
a = imread('blob.png');
But how to get rectangles for multiple blobs in the same image?
I have gone through regionprops. What I understood is, I need to seperate each blob and then calculate the highest rectangle for each one as I can't use LargestRectangle with regionprops. Now my question is how to separate each blob so that I can get the largest rectangle for each one?

Accepted Answer

Simon Chan
Simon Chan on 15 Jul 2021
Edited: Simon Chan on 15 Jul 2021
How about separate them into 6 different images and put into the function?
The images are stored in BW(:,:,1) to BW(:,:,6).
A = imread('Matlab output of blob seq.png');
for k=1:n
Sunetra Banerjee
Sunetra Banerjee on 15 Jul 2021
Now it's working fine. Thanks a lot for your help.

Sign in to comment.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!