regionpros gives 0 area for a simple binary figure?

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!

 Risposta accettata

Matt J
Matt J il 8 Ott 2020
Modificato: Matt J il 8 Ott 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

Più risposte (0)

Categorie

Scopri di più su Images in Centro assistenza e File Exchange

Prodotti

Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by