Extract and sort size of matrix where in the cell

1 次查看(过去 30 天)
clc;clear;close all
im= [0 0 0 0 0 0 0 0 0 0
0 0 1 1 1 1 1 1 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0];
cc=bwconncomp(im);
for i=1:cc.NumObjects
CC{i}=cc.PixelIdxList{i}
end
Size=zeros(1,cc.NumObjects);
for j=1:cc.NumObjects
Size(:,i)=size(cell2mat(CC(j)))
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by