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/mkFract.m | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkFract.m (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkFract.m') diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkFract.m b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkFract.m new file mode 100755 index 0000000..af95cd5 --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/mkFract.m @@ -0,0 +1,36 @@ +% IM = mkFract(SIZE, FRACT_DIM) +% +% Make a matrix of dimensions SIZE (a [Y X] 2-vector, or a scalar) +% containing fractal (pink) noise with power spectral density of the +% form: 1/f^(5-2*FRACT_DIM). Image variance is normalized to 1.0. +% FRACT_DIM defaults to 1.0 + +% Eero Simoncelli, 6/96. + +%% TODO: Verify that this matches Mandelbrot defn of fractal dimension. +%% Make this more efficient! + +function res = mkFract(dims, fract_dim) + +if (exist('fract_dim') ~= 1) + fract_dim = 1.0; +end + +res = randn(dims); +fres = fft2(res); + +sz = size(res); +ctr = ceil((sz+1)./2); + +shape = ifftshift(mkR(sz, -(2.5-fract_dim), ctr)); +shape(1,1) = 1; %%DC term + +fres = shape .* fres; +fres = ifft2(fres); + +if (max(max(abs(imag(fres)))) > 1e-10) + error('Symmetry error in creating fractal'); +else + res = real(fres); + res = res / sqrt(var2(res)); +end -- cgit v1.2.2