diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyr.m')
-rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyr.m | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyr.m deleted file mode 100755 index 101b6d2..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildSCFpyr.m +++ /dev/null | |||
@@ -1,90 +0,0 @@ | |||
1 | % [PYR, INDICES, STEERMTX, HARMONICS] = buildSCFpyr(IM, HEIGHT, ORDER, TWIDTH) | ||
2 | % | ||
3 | % This is a modified version of buildSFpyr, that constructs a | ||
4 | % complex-valued steerable pyramid using Hilbert-transform pairs | ||
5 | % of filters. Note that the imaginary parts will *not* be steerable. | ||
6 | % | ||
7 | % To reconstruct from this representation, either call reconSFpyr | ||
8 | % on the real part of the pyramid, *or* call reconSCFpyr which will | ||
9 | % use both real and imaginary parts (forcing analyticity). | ||
10 | % | ||
11 | % Description of this transform appears in: Portilla & Simoncelli, | ||
12 | % Int'l Journal of Computer Vision, 40(1):49-71, Oct 2000. | ||
13 | % Further information: http://www.cns.nyu.edu/~eero/STEERPYR/ | ||
14 | |||
15 | % Original code: Eero Simoncelli, 5/97. | ||
16 | % Modified by Javier Portilla to return complex (quadrature pair) channels, | ||
17 | % 9/97. | ||
18 | |||
19 | function [pyr,pind,steermtx,harmonics] = buildSCFpyr(im, ht, order, twidth) | ||
20 | |||
21 | %----------------------------------------------------------------- | ||
22 | %% DEFAULTS: | ||
23 | |||
24 | max_ht = floor(log2(min(size(im)))) - 2; | ||
25 | |||
26 | if (exist('ht') ~= 1) | ||
27 | ht = max_ht; | ||
28 | else | ||
29 | if (ht > max_ht) | ||
30 | error(sprintf('Cannot build pyramid higher than %d levels.',max_ht)); | ||
31 | end | ||
32 | end | ||
33 | |||
34 | if (exist('order') ~= 1) | ||
35 | order = 3; | ||
36 | elseif ((order > 15) | (order < 0)) | ||
37 | fprintf(1,'Warning: ORDER must be an integer in the range [0,15]. Truncating.\n'); | ||
38 | order = min(max(order,0),15); | ||
39 | else | ||
40 | order = round(order); | ||
41 | end | ||
42 | nbands = order+1; | ||
43 | |||
44 | if (exist('twidth') ~= 1) | ||
45 | twidth = 1; | ||
46 | elseif (twidth <= 0) | ||
47 | fprintf(1,'Warning: TWIDTH must be positive. Setting to 1.\n'); | ||
48 | twidth = 1; | ||
49 | end | ||
50 | |||
51 | %----------------------------------------------------------------- | ||
52 | %% Steering stuff: | ||
53 | |||
54 | if (mod((nbands),2) == 0) | ||
55 | harmonics = [0:(nbands/2)-1]'*2 + 1; | ||
56 | else | ||
57 | harmonics = [0:(nbands-1)/2]'*2; | ||
58 | end | ||
59 | |||
60 | steermtx = steer2HarmMtx(harmonics, pi*[0:nbands-1]/nbands, 'even'); | ||
61 | |||
62 | %----------------------------------------------------------------- | ||
63 | |||
64 | dims = size(im); | ||
65 | ctr = ceil((dims+0.5)/2); | ||
66 | |||
67 | [xramp,yramp] = meshgrid( ([1:dims(2)]-ctr(2))./(dims(2)/2), ... | ||
68 | ([1:dims(1)]-ctr(1))./(dims(1)/2) ); | ||
69 | angle = atan2(yramp,xramp); | ||
70 | log_rad = sqrt(xramp.^2 + yramp.^2); | ||
71 | log_rad(ctr(1),ctr(2)) = log_rad(ctr(1),ctr(2)-1); | ||
72 | log_rad = log2(log_rad); | ||
73 | |||
74 | %% Radial transition function (a raised cosine in log-frequency): | ||
75 | [Xrcos,Yrcos] = rcosFn(twidth,(-twidth/2),[0 1]); | ||
76 | Yrcos = sqrt(Yrcos); | ||
77 | |||
78 | YIrcos = sqrt(1.0 - Yrcos.^2); | ||
79 | lo0mask = pointOp(log_rad, YIrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0); | ||
80 | imdft = fftshift(fft2(im)); | ||
81 | lo0dft = imdft .* lo0mask; | ||
82 | |||
83 | [pyr,pind] = buildSCFpyrLevs(lo0dft, log_rad, Xrcos, Yrcos, angle, ht, nbands); | ||
84 | |||
85 | hi0mask = pointOp(log_rad, Yrcos, Xrcos(1), Xrcos(2)-Xrcos(1), 0); | ||
86 | hi0dft = imdft .* hi0mask; | ||
87 | hi0 = ifft2(ifftshift(hi0dft)); | ||
88 | |||
89 | pyr = [real(hi0(:)) ; pyr]; | ||
90 | pind = [size(hi0); pind]; | ||