regionpros gives 0 area for a simple binary figure?

1 次查看(过去 30 天)
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!

采纳的回答

Matt J
Matt J 2020-10-8
编辑:Matt J 2020-10-8
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

更多回答(0 个)

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by