I have a question. I need to calculate the computational complexity of image segmentation algorithms. Can anyone please help me? For example, I have a screen-size picture with white background containing k randomly-positioned black objects with random sizes (between 90*90 to 110*110) in it. I am going to calculate how long it takes for a rapid current computer to segment all black items in my image. For example, use connected component labeling to segment the components: 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