<< NL_V_ContourCornersFiltA NL_V: Vision NL_V_Dilation >>

NARVAL >> NL_V: Vision > NL_V_Convolution2D

NL_V_Convolution2D

Perform the 2D convolution of a kernel on an image.

Calling Sequence

[X] = NL_V_Convolution2D(I,H)

Arguments

I :

Binary matrix.

H :

Kernel matrix.

X :

Convolution matrix.

Description

NL_V_Convolution2D performs the 2D convolution of the squared kernel H of size 2*n+1 on the binary image I (WIKIPEDIA). The result is stored in X.

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
w1=1;//window index
w2=2;//window index
scf(w1);
clf(w1);
[Pzx,Pzy]=size(Pz);//image size
grayplot(1:Pzx,1:Pzy,Pz);//graph visualization
xset("colormap",graycolormap(128));
scf(w2);
clf(w2);
[PEz]=NL_V_Erosion(Pz);//contour performance
Cont=Pz-PEz;//contour 1
grayplot(1:Pzx,1:Pzy,Cont);//graph visualization
xset("colormap",graycolormap(128));
w3=3;//window index
scf(w3);
clf(w3);
[Dim]=NL_V_DistanceMapObject(Pz,Cont);//creation of the distance map
[Dimx,Dimy]=size(Dim);//image size
grayplot(1:Dimx,1:Dimy,Dim);//graph visualization
xset("colormap",graycolormap(128));
HL1=[0 -1 0;-1 4 -1;0 -1 0];//kernel 1
HL2=[-1 -1 -1;-1 8 -1;-1 -1 -1];//kernel 2
[Dim1]=NL_V_Convolution2D(Dim,HL1);//application of NL_V_Convolution2D
[Dim2]=NL_V_Convolution2D(Dim,HL2);
[Dim1x,Dim1y]=size(Dim1);
[Dim2x,Dim2y]=size(Dim2);
w4=4;//window index
scf(w4);
clf(w4);
grayplot(1:Dim1x,1:Dim1y,Dim1);
xset("colormap",graycolormap(128));
w5=5;//window index
scf(w5);
clf(w5);
grayplot(1:Dim2x,1:Dim2y,Dim2);//graph visualization
xset("colormap",graycolormap(128));

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