Extract the corners of an obstacle contour (false detection removal and angle threshold).
[Xs,Ys,Ns] = NL_V_ContourCornersFiltA(X,Y,N,A)
X-coordinate of corners.
Y-coordinate of corners.
Length vector.
Angle threshold.
Updated x-coordinate of corners.
Updated y-coordinate of corners.
Updated length vector.
NL_V_ContourCornersFiltA extracts the real corners of the obstacle contour defined by the current corners performed by NL_V_ContourCornersFilt (false detection removal and angle threshold A). Corners coordinates are stored in [X,Y] (updated to ). N (updated to
) provides the number of corners for each obstacle.
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)); [x,y,direction,n]=NL_V_ContourCorners(Cont);//Corners detection lc=2;//correlation mode DT=3;//minimum distance between two corners Tcorel=1;//threshold Tgrad=1;//threshold [xs,ys,ns]=NL_V_ContourCornersFilt(x,y,direction,n,lc,Tcorel,Tgrad,DT);//False detection removal a=0.3;//angle threshold [xsd,ysd,nsd]=NL_V_ContourCornersFiltA(xs,ys,ns,a);//application of NL_V_ContourCornersFiltA [g]=NL_V_VisibilityGraph(xs,ys,ns,Pz);//creation of the visibility graph for [xs,ys] w3=3; g.node_x=g.node_x*z; g.node_y=g.node_y*z; NL_G_ShowGraph(g,w3);//graph visualization [gs]=NL_V_VisibilityGraph(xsd,ysd,nsd,Pz);//creation of the visibility graph for [xsd,ysd] w4=4; gs.node_x=gs.node_x*z; gs.node_y=gs.node_y*z; NL_G_ShowGraph(gs,w4);//graph visualization | ![]() | ![]() |