我有个问题。我需要计算图像分割算法的计算复杂度。谁能帮帮我吗?例如,我有一张屏幕大小的白色背景图片,其中包含 k 个随机定位的黑色对象,这些对象具有随机大小(在 90*90 到 110*110 之间)。我将计算一台快速的当前计算机需要多长时间来分割我图像中的所有黑色项目。例如,使用连接组件标签来分割组件:http ://en.wikipedia.org/wiki/Connected-component_labeling
One-Pass(Image)
[M, N]=size(Image);
Connected = zeros(M,N);
Mark = Value;
Difference = Increment;
Offsets = [-1; M; 1; -M];
Index = [];
No_of_Objects = 0;
for i: 1:M :
for j: 1:N:
if(Image(i,j)==1)
No_of_Objects = No_of_Objects +1;
Index = [((j-1)*M + i)];
Connected(Index)=Mark;
while ~isempty(Index)
Image(Index)=0;
Neighbors = bsxfun(@plus, Index, Offsets');
Neighbors = unique(Neighbors(:));
Index = Neighbors(find(Image(Neighbors)));
Connected(Index)=Mark;
end
Mark = Mark + Difference;
end
end
end