0
我的图像阵列:C_filled = 256x256x3270更新用新值的结构体在for循环中
我想要做的是计算每个图像的质心,并存储对应于每个“片”每个质心和/或图像成阵列。然而,当我尝试更新的阵列,像一个普通的数组,我得到这个错误:
"Undefined operator '+' for input arguments of type 'struct'."
我有以下代码:
for i=1:3270;
cen(i) = regionprops(C_filled(:,:,i),'centroid');
centroids = cat(1, cen.Centroid);% convert the cen struct into a regular array.
cen(i+1) = cen(i) + 1; <- this is the problem line
end
如何更新阵列存储每个新心?
在此先感谢。
谢谢!完美地工作,有没有办法将一个1-3270的额外列添加到质心,例如[x,y,z],因为这对应于所讨论的对象的长度。 – Idrawthings
是的,请看我编辑 –
嗯,所有的索引值似乎是2,我也在寻找3x3270类型的数组,类似于3D坐标系统。基本上我会有[x,y]质心坐标,添加1:3270的额外矩阵。 – Idrawthings