<< gaussn Other integ >>

Time Frequency Toolbox >> Time Frequency Toolbox > Other > imextrac

imextrac

imextrac(Image) extract and isolate dots in a binary image

Calling Sequence

I=imextrac(Image)
I=imextrac(Image,trace)

Parameters

Image :

a boolean array: then black and white image.

TRACE :

A boolean (or a real scalar) if true (or nonzero),the progression of the algorithm is shown (default : %f).

I:

A matrix with same sizes as Image with integer elements: the resulting image with cluster indexed.

Description

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.

Examples

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)

See also

Authors


Report an issue
<< gaussn Other integ >>