]> AND Private Git Repository - these_gilles.git/blob - THESE/codes/graphe/Ncut_9/doog2.m
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
3 sep
[these_gilles.git] / THESE / codes / graphe / Ncut_9 / doog2.m
1 function G=doog2(sig,r,th,N);
2 % G=doog2(sig,r,th,N);
3 % Make difference of offset gaussians kernel
4 % theta is in degrees
5 % (see Malik & Perona, J. Opt. Soc. Amer., 1990)
6 %
7 % Example:
8 % >> imagesc(doog2(1,12,0,64,1))
9 % >> colormap(gray)
10 %
11 % Serge Belongie
12
13
14 no_pts=N;  % no. of points in x,y grid
15
16 [x,y]=meshgrid(-(N/2)+1/2:(N/2)-1/2,-(N/2)+1/2:(N/2)-1/2);
17
18 phi=pi*th/180;
19 sigy=sig;
20 sigx=r*sig;
21 R=[cos(phi) -sin(phi); sin(phi) cos(phi)];
22 C=R*diag([sigx,sigy])*R';
23
24 X=[x(:) y(:)];
25
26 Gb=gaussian(X,[0 0]',C);
27 Gb=reshape(Gb,N,N);
28
29 m=R*[0 sig]';
30 Ga=gaussian(X,m,C);
31 Ga=reshape(Ga,N,N);
32 Gc=rot90(Ga,2);
33
34 a=-1;
35 b=2;
36 c=-1;
37
38 G = a*Ga + b*Gb + c*Gc;
39