diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/mkFract.m')
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/mkFract.m | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkFract.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkFract.m deleted file mode 100755 index af95cd5..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/mkFract.m +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | % IM = mkFract(SIZE, FRACT_DIM) | ||
| 2 | % | ||
| 3 | % Make a matrix of dimensions SIZE (a [Y X] 2-vector, or a scalar) | ||
| 4 | % containing fractal (pink) noise with power spectral density of the | ||
| 5 | % form: 1/f^(5-2*FRACT_DIM). Image variance is normalized to 1.0. | ||
| 6 | % FRACT_DIM defaults to 1.0 | ||
| 7 | |||
| 8 | % Eero Simoncelli, 6/96. | ||
| 9 | |||
| 10 | %% TODO: Verify that this matches Mandelbrot defn of fractal dimension. | ||
| 11 | %% Make this more efficient! | ||
| 12 | |||
| 13 | function res = mkFract(dims, fract_dim) | ||
| 14 | |||
| 15 | if (exist('fract_dim') ~= 1) | ||
| 16 | fract_dim = 1.0; | ||
| 17 | end | ||
| 18 | |||
| 19 | res = randn(dims); | ||
| 20 | fres = fft2(res); | ||
| 21 | |||
| 22 | sz = size(res); | ||
| 23 | ctr = ceil((sz+1)./2); | ||
| 24 | |||
| 25 | shape = ifftshift(mkR(sz, -(2.5-fract_dim), ctr)); | ||
| 26 | shape(1,1) = 1; %%DC term | ||
| 27 | |||
| 28 | fres = shape .* fres; | ||
| 29 | fres = ifft2(fres); | ||
| 30 | |||
| 31 | if (max(max(abs(imag(fres)))) > 1e-10) | ||
| 32 | error('Symmetry error in creating fractal'); | ||
| 33 | else | ||
| 34 | res = real(fres); | ||
| 35 | res = res / sqrt(var2(res)); | ||
| 36 | end | ||
