<< NL_V_Dilation NL_V: Vision NL_V_DilationW >>

NARVAL >> NL_V: Vision > NL_V_DilationH

NL_V_DilationH

Perform the morphological dilation operation on a binary image in respect with a defined neighborhood matrix.

Calling Sequence

[D] = NL_V_DilationH(I,H)

Arguments

I :

Binary matrix.

H :

Neighborhood matrix.

D :

Dilation matrix.

Description

NL_V_DilationH performs the morphological erosion operation on the binary image I (WIKIPEDIA). The output matrix is stored in D. For each vertex I(i,j), its direct neighborhood defined by the squared matrix H with odd size enters into consideration during the calculation. For each position (i,j), the neighborhood N is extracted (H(l,m) different from 0). D(i,j) is equal to the maximal of I(N).

Examples

dt=getdate();
seed=dt(10);
rand('seed',seed);//initialization of the random values generator
no=4;//quantity of obstacles (rectangle)
L=1000;//squared area side
hm=100;//minimal height
hM=250;//maximal height
wm=100;//minimal width
wM=250;//maximal width
Al=[0 %pi/2 %pi -%pi/2];//available angles for obstacles
[Xs,Ys,X,Y,H,W,A]=NL_V_RectanglesCorners(no,L,hm,hM,wm,wM);//generation of obstacles
[P]=NL_V_PotentialRectangles(X,Y,H,W,A,L);//generation of obstacle matrix
z=10;//zoom factor
o=2;// 1=mean, 2=max, 3=min, 4=median
Pz=NL_V_MRA(P,z,o);//scale modification
[Pzx,Pzy]=size(Pz);//image size
w1=1;//window index
w2=2;//window index
scf(w1);
clf(w1);
grayplot(1:Pzx,1:Pzy,Pz);
xset("colormap",graycolormap(128));
scf(w2);
clf(w2);
[PEz]=NL_V_Dilation(Pz);//application of NL_V_Dilation
w=5;//kernel width
[PEzw]=NL_V_DilationW(Pz,w);//application of NL_V_DilationW
Hero=[0 1 0;1 1 1;0 1 0];//neighborhood
[PEzH]=NL_V_DilationH(Pz,Hero);//application of NL_V_DilationH
Cont=PEz-Pz;//contour 1
[Contx,Conty]=size(Cont);//image size
Contw=PEzw-Pz;
[Contwx,Contwy]=size(Contw);//image size
Conth=PEzH-Pz;
[Conthx,Conthy]=size(Conth);//image size
grayplot(1:Contx,1:Conty,Cont);
xset("colormap",graycolormap(128));
w3=3;//window index
scf(w3);
clf(w3);
grayplot(1:Contwx,1:Contwy,Contw);//graph visualization
xset("colormap",graycolormap(128));
w4=4;//window index
scf(w4);
clf(w4);
grayplot(1:Conthx,1:Conthy,Conth);//graph visualization
xset("colormap",graycolormap(128));

Report an issue
<< NL_V_Dilation NL_V: Vision NL_V_DilationW >>