Perform the distance map between an object and its contour.
[D] = NL_V_DistanceMapObject(I,C)
Binary matrix.
Countour matrix.
Distance Map.
NL_V_DistanceMapObject performs the distance map D between the binary object I and its contour C. For each vertex of the object I(i,j)=1, we find the contour vertex C(ci,cj) that minimizes the distance {D:(i,j)--(ci,cj)}. This distance is stored in D(i,j).
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)); w3=3;//window index scf(w3); clf(w3); [Dim]=NL_V_DistanceMapObject(Pz,Cont);//application of NL_V_DistanceMapObject [Dimx,Dimy]=size(Dim);//image size grayplot(1:Dimx,1:Dimy,Dim);//graph visualization xset("colormap",graycolormap(128)); | ![]() | ![]() |