From d17b33131c14864bd1eae275f49a3f148e21cf29 Mon Sep 17 00:00:00 2001 From: Leo Chan Date: Thu, 22 Oct 2020 01:53:21 -0400 Subject: Squashed commit of the sb-vbs branch. Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT. --- SD-VBS/common/toolbox/MultiNcut/doog2.m | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 SD-VBS/common/toolbox/MultiNcut/doog2.m (limited to 'SD-VBS/common/toolbox/MultiNcut/doog2.m') 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 @@ +function G=doog2(sig,r,th,N); +% G=doog2(sig,r,th,N); +% Make difference of offset gaussians kernel +% theta is in degrees +% (see Malik & Perona, J. Opt. Soc. Amer., 1990) +% +% Example: +% >> imagesc(doog2(1,12,0,64,1)) +% >> colormap(gray) + +% by Serge Belongie + +no_pts=N; % no. of points in x,y grid + +[x,y]=meshgrid(-(N/2)+1/2:(N/2)-1/2,-(N/2)+1/2:(N/2)-1/2); + +phi=pi*th/180; +sigy=sig; +sigx=r*sig; +R=[cos(phi) -sin(phi); sin(phi) cos(phi)]; +C=R*diag([sigx,sigy])*R'; + +X=[x(:) y(:)]; + +Gb=gaussian(X,[0 0]',C); +Gb=reshape(Gb,N,N); + +m=R*[0 sig]'; +Ga=gaussian(X,m,C); +Ga=reshape(Ga,N,N); +Gc=rot90(Ga,2); + +a=-1; +b=2; +c=-1; + +G = a*Ga + b*Gb + c*Gc; + -- cgit v1.2.2