summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/MultiNcut/doog2.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/common/toolbox/MultiNcut/doog2.m')
-rwxr-xr-xSD-VBS/common/toolbox/MultiNcut/doog2.m38
1 files changed, 38 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/MultiNcut/doog2.m b/SD-VBS/common/toolbox/MultiNcut/doog2.m
new file mode 100755
index 0000000..a0511cb
--- /dev/null
+++ b/SD-VBS/common/toolbox/MultiNcut/doog2.m
@@ -0,0 +1,38 @@
1function 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% by Serge Belongie
12
13no_pts=N; % no. of points in x,y grid
14
15[x,y]=meshgrid(-(N/2)+1/2:(N/2)-1/2,-(N/2)+1/2:(N/2)-1/2);
16
17phi=pi*th/180;
18sigy=sig;
19sigx=r*sig;
20R=[cos(phi) -sin(phi); sin(phi) cos(phi)];
21C=R*diag([sigx,sigy])*R';
22
23X=[x(:) y(:)];
24
25Gb=gaussian(X,[0 0]',C);
26Gb=reshape(Gb,N,N);
27
28m=R*[0 sig]';
29Ga=gaussian(X,m,C);
30Ga=reshape(Ga,N,N);
31Gc=rot90(Ga,2);
32
33a=-1;
34b=2;
35c=-1;
36
37G = a*Ga + b*Gb + c*Gc;
38