<< NL_V_OpeningW NL_V: Vision NL_V_Polar >>

NARVAL >> NL_V: Vision > NL_V_PixelNeighborCont

NL_V_PixelNeighborCont

Extract the neighborhood of a contour pixel of an obstacle.

Calling Sequence

[M,N,D] = NL_V_PixelNeighborCont(X,Y,I,C)

Arguments

X :

Line index.

Y :

Column index.

I :

Binary image.

C :

Contour matrix.

M :

Image neighborhood of defined pixel.

N :

Contour neighborhood of defined pixel.

D :

Number of modifications along the linear neighborhood.

Description

NL_V_PixelNeighborCont extracts the neighborhood of the pixel [X,Y] from the contour C of the obstacle I. For each pixel in the neighborhood of [X,Y], we have 8 neighbors represented by their relative coordinates [-1 -1 0 1 1 1 0 -1 ; 0 1 1 1 0 -1 -1 -1 ]. For each successive neighbors, we add the absolute values of their difference I(N(i))-I(N(i+1)) (cycle) to D that gives an idea about the number of changes of the image along the linear neighborhood N of the pixel [X,Y].

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);//graph visualization
xset("colormap",graycolormap(128));
scf(w2);
clf(w2);
[PEz]=NL_V_Erosion(Pz);//contour performance
Cont=Pz-PEz;//contour 1
[Contx,Conty]=size(Cont);//image size
grayplot(1:Contx,1:Conty,Cont);//graph visualization
xset("colormap",graycolormap(128));
[Indx Indy]=find(Cont==1);//coordinates of contour points
[mat,nei,dch]=NL_V_PixelNeighborCont(Indx(1),Indy(1),Pz,Cont)//application of NL_V_PixelNeighborCont

Report an issue
<< NL_V_OpeningW NL_V: Vision NL_V_Polar >>