summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildGpyr.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/buildGpyr.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildGpyr.m82
1 files changed, 0 insertions, 82 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildGpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildGpyr.m
deleted file mode 100755
index 3f3d07b..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildGpyr.m
+++ /dev/null
@@ -1,82 +0,0 @@
1% [PYR, INDICES] = buildGpyr(IM, HEIGHT, FILT, EDGES)
2%
3% Construct a Gaussian pyramid on matrix IM.
4%
5% HEIGHT (optional) specifies the number of pyramid levels to build. Default
6% is 1+maxPyrHt(size(IM),size(FILT)).
7% You can also specify 'auto' to use this value.
8%
9% FILT (optional) can be a string naming a standard filter (see
10% namedFilter), or a vector which will be used for (separable)
11% convolution. Default = 'binom5'. EDGES specifies edge-handling, and
12% defaults to 'reflect1' (see corrDn).
13%
14% PYR is a vector containing the N pyramid subbands, ordered from fine
15% to coarse. INDICES is an Nx2 matrix containing the sizes of
16% each subband. This is compatible with the MatLab Wavelet toolbox.
17
18% Eero Simoncelli, 6/96.
19
20function [pyr,pind] = buildGpyr(im, ht, filt, edges)
21
22if (nargin < 1)
23 error('First argument (IM) is required');
24end
25
26im_sz = size(im);
27
28%------------------------------------------------------------
29%% OPTIONAL ARGS:
30
31if (exist('filt') ~= 1)
32 filt = 'binom5';
33end
34
35if isstr(filt)
36 filt = namedFilter(filt);
37end
38
39if ( (size(filt,1) > 1) & (size(filt,2) > 1) )
40 error('FILT should be a 1D filter (i.e., a vector)');
41else
42 filt = filt(:);
43end
44
45max_ht = 1 + maxPyrHt(im_sz, size(filt,1));
46if ( (exist('ht') ~= 1) | (ht == 'auto') )
47 ht = max_ht;
48else
49 if (ht > max_ht)
50 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
51 end
52end
53
54if (exist('edges') ~= 1)
55 edges= 'reflect1';
56end
57
58%------------------------------------------------------------
59
60if (ht <= 1)
61
62 pyr = im(:);
63 pind = im_sz;
64
65else
66
67 if (im_sz(2) == 1)
68 lo2 = corrDn(im, filt, edges, [2 1], [1 1]);
69 elseif (im_sz(1) == 1)
70 lo2 = corrDn(im, filt', edges, [1 2], [1 1]);
71 else
72 lo = corrDn(im, filt', edges, [1 2], [1 1]);
73 lo2 = corrDn(lo, filt, edges, [2 1], [1 1]);
74 end
75
76 [npyr,nind] = buildGpyr(lo2, ht-1, filt, edges);
77
78 pyr = [im(:); npyr];
79 pind = [im_sz; nind];
80
81end
82