imextrac(Image) extract and isolate dots in a binary image
I = imextrac(Image) I = imextrac(Image, trace)
a boolean array: then black and white image.
A boolean (or a real scalar) if true (or nonzero),the progression of the algorithm is shown (default : %f).
A matrix with same sizes as Image with integer elements: the resulting image with cluster indexed.
imextrac extracts and isolates dots in a binary image. it finds and indexes the cluster of true value. a cluster is a set of true values image(i,j) such image(i-1,j)==%t or image(i,j-1)==%t.
Small example
Image=[5 0 0 0 0 0 5 0 0 0 5 0 ; 5 5 0 0 0 5 5 0 0 0 5 5 ; 5 0 0 0 5 0 5 0 0 0 0 5 ; 0 0 0 0 5 5 5 0 0 0 0 0 ; 0 0 0 0 0 0 0 0 0 0 0 0 ]; clf subplot(211); Matplot(Image) I = imextrac(Image>0); subplot(212); Matplot(I) c_ind = unique(I(I>0)) //the cluster indices | ![]() | ![]() |
Big ones
rand("seed",0) N = 32; Image = 10*rand(N,N); Image(Image<5)=0; clf; gcf().color_map = jetcolormap(150); Image(Image>0) = color("red"); subplot(211); Matplot(Image) I = imextrac(Image>0); subplot(212); Matplot(I) | ![]() | ![]() |