summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-20 03:47:33 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-20 03:47:33 -0400
commita32f220f06cc463e5b56e7fa0b1b1334d94d08f3 (patch)
tree4af4caa60074465d85fc2ef5cc1b23e74c064329 /SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m
parent79f30887129145e15e5172e36a7d7602859fc932 (diff)
matlab removed
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m102
1 files changed, 0 insertions, 102 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m
deleted file mode 100755
index ae67206..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyr.m
+++ /dev/null
@@ -1,102 +0,0 @@
1% [PYR, INDICES, STEERMTX, HARMONICS] = buildSFpyr(IM, HEIGHT, ORDER, TWIDTH)
2%
3% Construct a steerable pyramid on matrix IM, in the Fourier domain.
4% This is similar to buildSpyr, except that:
5%
6% + Reconstruction is exact (within floating point errors)
7% + It can produce any number of orientation bands.
8% - Typically slower, especially for non-power-of-two sizes.
9% - Boundary-handling is circular.
10%
11% HEIGHT (optional) specifies the number of pyramid levels to build. Default
12% is maxPyrHt(size(IM),size(FILT));
13%
14% The squared radial functions tile the Fourier plane, with a raised-cosine
15% falloff. Angular functions are cos(theta-k\pi/(K+1))^K, where K is
16% the ORDER (one less than the number of orientation bands, default= 3).
17%
18% TWIDTH is the width of the transition region of the radial lowpass
19% function, in octaves (default = 1, which gives a raised cosine for
20% the bandpass filters).
21%
22% PYR is a vector containing the N pyramid subbands, ordered from fine
23% to coarse. INDICES is an Nx2 matrix containing the sizes of
24% each subband. This is compatible with the MatLab Wavelet toolbox.
25% See the function STEER for a description of STEERMTX and HARMONICS.
26
27% Eero Simoncelli, 5/97.
28% See http://www.cns.nyu.edu/~eero/STEERPYR/ for more
29% information about the Steerable Pyramid image decomposition.
30
31function [pyr,pind,steermtx,harmonics] = buildSFpyr(im, ht, order, twidth)
32
33%-----------------------------------------------------------------
34%% DEFAULTS:
35
36max_ht = floor(log2(min(size(im)))) - 2;
37
38if (exist('ht') ~= 1)
39 ht = max_ht;
40else
41 if (ht > max_ht)
42 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
43 end
44end
45
46if (exist('order') ~= 1)
47 order = 3;
48elseif ((order > 15) | (order < 0))
49 fprintf(1,'Warning: ORDER must be an integer in the range [0,15]. Truncating.\n');
50 order = min(max(order,0),15);
51else
52 order = round(order);
53end
54nbands = order+1;
55
56if (exist('twidth') ~= 1)
57 twidth = 1;
58elseif (twidth <= 0)
59 fprintf(1,'Warning: TWIDTH must be positive. Setting to 1.\n');
60 twidth = 1;
61end
62
63%-----------------------------------------------------------------
64%% Steering stuff:
65
66if (mod((nbands),2) == 0)
67 harmonics = [0:(nbands/2)-1]'*2 + 1;
68else
69 harmonics = [0:(nbands-1)/2]'*2;
70end
71
72steermtx = steer2HarmMtx(harmonics, pi*[0:nbands-1]/nbands, 'even');
73
74%-----------------------------------------------------------------
75
76dims = size(im);
77ctr = ceil((dims+0.5)/2);
78
79[xramp,yramp] = meshgrid( ([1:dims(2)]-ctr(2))./(dims(2)/2), ...
80 ([1:dims(1)]-ctr(1))./(dims(1)/2) );
81angle = atan2(yramp,xramp);
82log_rad = sqrt(xramp.^2 + yramp.^2);
83log_rad(ctr(1),ctr(2)) = log_rad(ctr(1),ctr(2)-1);
84log_rad = log2(log_rad);
85
86%% Radial transition function (a raised cosine in log-frequency):
87[Xrcos,Yrcos] = rcosFn(twidth,(-twidth/2),[0 1]);
88Yrcos = sqrt(Yrcos);
89
90YIrcos = sqrt(1.0 - Yrcos.^2);
91lo0mask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
92imdft = fftshift(fft2(im));
93lo0dft = imdft .* lo0mask;
94
95[pyr,pind] = buildSFpyrLevs(lo0dft, log_rad, Xrcos, Yrcos, angle, ht, nbands);
96
97hi0mask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
98hi0dft = imdft .* hi0mask;
99hi0 = ifft2(ifftshift(hi0dft));
100
101pyr = [real(hi0(:)) ; pyr];
102pind = [size(hi0); pind];