diff options
Diffstat (limited to 'SD-VBS/common/toolbox/MultiNcut/doog2.m')
| -rwxr-xr-x | SD-VBS/common/toolbox/MultiNcut/doog2.m | 38 |
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 @@ | |||
| 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 | % by Serge Belongie | ||
| 12 | |||
| 13 | no_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 | |||
| 17 | phi=pi*th/180; | ||
| 18 | sigy=sig; | ||
| 19 | sigx=r*sig; | ||
| 20 | R=[cos(phi) -sin(phi); sin(phi) cos(phi)]; | ||
| 21 | C=R*diag([sigx,sigy])*R'; | ||
| 22 | |||
| 23 | X=[x(:) y(:)]; | ||
| 24 | |||
| 25 | Gb=gaussian(X,[0 0]',C); | ||
| 26 | Gb=reshape(Gb,N,N); | ||
| 27 | |||
| 28 | m=R*[0 sig]'; | ||
| 29 | Ga=gaussian(X,m,C); | ||
| 30 | Ga=reshape(Ga,N,N); | ||
| 31 | Gc=rot90(Ga,2); | ||
| 32 | |||
| 33 | a=-1; | ||
| 34 | b=2; | ||
| 35 | c=-1; | ||
| 36 | |||
| 37 | G = a*Ga + b*Gb + c*Gc; | ||
| 38 | |||
