Clear Filters
Clear Filters

regionpros gives 0 area for a simple binary figure?

1 view (last 30 days)
I have a very simple bw as shown below. But the regionprops gives me lots of 0 area. Code is here
bwnew = imread('oribw.tif');
r_ori = regionprops(bwnew,'boundingbox','area');
The results are shown above. I have all zeros except for the final one. Does any one know why this happens? The original BW is attached as a zip since I could not upload TIF file. Thanks!

Accepted Answer

Matt J
Matt J on 8 Oct 2020
Edited: Matt J on 8 Oct 2020
Your bwnew needs to be of type logical, otherwise it gets treated as a label image.
>> T = regionprops('table',logical(bwnew),'boundingbox','area')
T =
2×2 table
Area BoundingBox
____ ________________________________
2583 312.5 509.5 58 56
2579 812.5 501.5 57 58

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!