From f618466c25d43f3bae9e40920273bf77de1e1149 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Mon, 19 Oct 2020 23:09:30 -0400 Subject: initial sd-vbs initial sd-vbs add sd-vbs sd-vbs --- .../texture_synthesis/src/matlabPyrTools/mkDisc.m | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkDisc.m (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkDisc.m') diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkDisc.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkDisc.m new file mode 100755 index 0000000..33e7d6d --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkDisc.m @@ -0,0 +1,61 @@ +% IM = mkDisc(SIZE, RADIUS, ORIGIN, TWIDTH, VALS) +% +% Make a "disk" image. SIZE specifies the matrix size, as for +% zeros(). RADIUS (default = min(size)/4) specifies the radius of +% the disk. ORIGIN (default = (size+1)/2) specifies the +% location of the disk center. TWIDTH (in pixels, default = 2) +% specifies the width over which a soft threshold transition is made. +% VALS (default = [0,1]) should be a 2-vector containing the +% intensity value inside and outside the disk. + +% Eero Simoncelli, 6/96. + +function [res] = mkDisc(sz, rad, origin, twidth, vals) + +if (nargin < 1) + error('Must pass at least a size argument'); +end + +sz = sz(:); +if (size(sz,1) == 1) + sz = [sz sz]; +end + +%------------------------------------------------------------ +% OPTIONAL ARGS: + +if (exist('rad') ~= 1) + rad = min(sz(1),sz(2))/4; +end + +if (exist('origin') ~= 1) + origin = (sz+1)./2; +end + +if (exist('twidth') ~= 1) + twidth = 2; +end + +if (exist('vals') ~= 1) + vals = [1,0]; +end + +%------------------------------------------------------------ + +res = mkR(sz,1,origin); + +if (abs(twidth) < realmin) + res = vals(2) + (vals(1) - vals(2)) * (res <= rad); +else + [Xtbl,Ytbl] = rcosFn(twidth, rad, [vals(1), vals(2)]); + res = pointOp(res, Ytbl, Xtbl(1), Xtbl(2)-Xtbl(1), 0); +% +% OLD interp1 VERSION: +% res = res(:); +% Xtbl(1) = min(res); +% Xtbl(size(Xtbl,2)) = max(res); +% res = reshape(interp1(Xtbl,Ytbl,res), sz(1), sz(2)); +% +end + + -- cgit v1.2.2