summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyrLevs.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyrLevs.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyrLevs.m63
1 files changed, 0 insertions, 63 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyrLevs.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyrLevs.m
deleted file mode 100755
index 472d861..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSFpyrLevs.m
+++ /dev/null
@@ -1,63 +0,0 @@
1% [PYR, INDICES] = buildSFpyrLevs(LODFT, LOGRAD, XRCOS, YRCOS, ANGLE, HEIGHT, NBANDS)
2%
3% Recursive function for constructing levels of a steerable pyramid. This
4% is called by buildSFpyr, and is not usually called directly.
5
6% Eero Simoncelli, 5/97.
7
8function [pyr,pind] = buildSFpyrLevs(lodft,log_rad,Xrcos,Yrcos,angle,ht,nbands);
9
10if (ht <= 0)
11
12 lo0 = ifft2(ifftshift(lodft));
13 pyr = real(lo0(:));
14 pind = size(lo0);
15
16else
17
18 bands = zeros(prod(size(lodft)), nbands);
19 bind = zeros(nbands,2);
20
21% log_rad = log_rad + 1;
22 Xrcos = Xrcos - log2(2); % shift origin of lut by 1 octave.
23
24 lutsize = 1024;
25 Xcosn = pi*[-(2*lutsize+1):(lutsize+1)]/lutsize; % [-2*pi:pi]
26 order = nbands-1;
27 %% divide by sqrt(sum_(n=0)^(N-1) cos(pi*n/N)^(2(N-1)) )
28 %% Thanks to Patrick Teo for writing this out :)
29 const = (2^(2*order))*(factorial(order)^2)/(nbands*factorial(2*order));
30 Ycosn = sqrt(const) * (cos(Xcosn)).^order;
31 himask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
32
33 for b = 1:nbands
34 anglemask = pointOp(angle, Ycosn, Xcosn(1)+pi*(b-1)/nbands, Xcosn(2)-Xcosn(1));
35 banddft = ((-sqrt(-1))^(nbands-1)) .* lodft .* anglemask .* himask;
36 band = ifft2(ifftshift(banddft));
37
38 bands(:,b) = real(band(:));
39 bind(b,:) = size(band);
40 end
41
42 dims = size(lodft);
43 ctr = ceil((dims+0.5)/2);
44 lodims = ceil((dims-0.5)/2);
45 loctr = ceil((lodims+0.5)/2);
46 lostart = ctr-loctr+1;
47 loend = lostart+lodims-1;
48
49 log_rad = log_rad(lostart(1):loend(1),lostart(2):loend(2));
50 angle = angle(lostart(1):loend(1),lostart(2):loend(2));
51 lodft = lodft(lostart(1):loend(1),lostart(2):loend(2));
52 YIrcos = abs(sqrt(1.0 - Yrcos.^2));
53 lomask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0);
54
55 lodft = lomask .* lodft;
56
57 [npyr,nind] = buildSFpyrLevs(lodft, log_rad, Xrcos, Yrcos, angle, ht-1, nbands);
58
59 pyr = [bands(:); npyr];
60 pind = [bind; nind];
61
62end
63