MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB图像处理] 求助!为什么下面运行结果不是数组啊? (https://www.labfans.com/bbs/showthread.php?t=18736)

kanjipeng 2013-03-18 19:46

求助!为什么下面运行结果不是数组啊?
 
>> a=[1 1 0 0 0
1 1 0 0 0
0 0 0 1 1
0 0 0 1 1];
b=bwlabel(a,4);
regionprops(b)

ans =

2x1 struct array with fields:
Area
Centroid
BoundingBox

>>

ChinaSun888 2013-06-07 09:52

回复: 求助!为什么下面运行结果不是数组啊?
 
[QUOTE=kanjipeng;58798]>> a=[1 1 0 0 0
1 1 0 0 0
0 0 0 1 1
0 0 0 1 1];
b=bwlabel(a,4);
regionprops(b)

ans =

2x1 struct array with fields:
Area
Centroid
BoundingBox

>>[/QUOTE]
regionprops(b)生成的是一个结构数组
如果写成
>> f=regionprops(b)
f =
4x1 struct array with fields:
Area
Centroid
BoundingBox

>> f.Area
ans =
2
ans =
2
ans =
2
ans =
2
>> f.Centroid
ans =
1.5000 1.0000
ans =
6.5000 1.0000
ans =
14.5000 1.0000
ans =
19.5000 1.0000


所有时间均为北京时间。现在的时间是 13:38

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.