summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildLpyr.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/buildLpyr.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/buildLpyr.m109
1 files changed, 0 insertions, 109 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildLpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildLpyr.m
deleted file mode 100755
index facb0f3..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildLpyr.m
+++ /dev/null
@@ -1,109 +0,0 @@
1% [PYR, INDICES] = buildLpyr(IM, HEIGHT, FILT1, FILT2, EDGES)
2%
3% Construct a Laplacian pyramid on matrix (or vector) IM.
4%
5% HEIGHT (optional) specifies the number of pyramid levels to build. Default
6% is 1+maxPyrHt(size(IM),size(FILT)). You can also specify 'auto' to
7% use this value.
8%
9% FILT1 (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'. FILT2 specifies the "expansion"
12% filter (default = filt1). EDGES specifies edge-handling, and
13% defaults to 'reflect1' (see corrDn).
14%
15% PYR is a vector containing the N pyramid subbands, ordered from fine
16% to coarse. INDICES is an Nx2 matrix containing the sizes of
17% each subband. This is compatible with the MatLab Wavelet toolbox.
18
19% Eero Simoncelli, 6/96.
20
21function [pyr,pind] = buildLpyr(im, ht, filt1, filt2, edges)
22
23if (nargin < 1)
24 error('First argument (IM) is required');
25end
26
27im_sz = size(im);
28
29%------------------------------------------------------------
30%% OPTIONAL ARGS:
31
32if (exist('filt1') ~= 1)
33 filt1 = 'binom5';
34end
35
36if isstr(filt1)
37 filt1 = namedFilter(filt1);
38end
39
40if ( (size(filt1,1) > 1) & (size(filt1,2) > 1) )
41 error('FILT1 should be a 1D filter (i.e., a vector)');
42else
43 filt1 = filt1(:);
44end
45
46if (exist('filt2') ~= 1)
47 filt2 = filt1;
48end
49
50if isstr(filt2)
51 filt2 = namedFilter(filt2);
52end
53
54if ( (size(filt2,1) > 1) & (size(filt2,2) > 1) )
55 error('FILT2 should be a 1D filter (i.e., a vector)');
56else
57 filt2 = filt2(:);
58end
59
60max_ht = 1 + maxPyrHt(im_sz, max(size(filt1,1), size(filt2,1)));
61if ( (exist('ht') ~= 1) | (ht == 'auto') )
62 ht = max_ht;
63else
64 if (ht > max_ht)
65 error(sprintf('Cannot build pyramid higher than %d levels.',max_ht));
66 end
67end
68
69if (exist('edges') ~= 1)
70 edges= 'reflect1';
71end
72
73%------------------------------------------------------------
74
75if (ht <= 1)
76
77 pyr = im(:);
78 pind = im_sz;
79
80else
81
82 if (im_sz(2) == 1)
83 lo2 = corrDn(im, filt1, edges, [2 1], [1 1]);
84 elseif (im_sz(1) == 1)
85 lo2 = corrDn(im, filt1', edges, [1 2], [1 1]);
86 else
87 lo = corrDn(im, filt1', edges, [1 2], [1 1]);
88 int_sz = size(lo);
89 lo2 = corrDn(lo, filt1, edges, [2 1], [1 1]);
90 end
91
92 [npyr,nind] = buildLpyr(lo2, ht-1, filt1, filt2, edges);
93
94 if (im_sz(1) == 1)
95 hi2 = upConv(lo2, filt2', edges, [1 2], [1 1], im_sz);
96 elseif (im_sz(2) == 1)
97 hi2 = upConv(lo2, filt2, edges, [2 1], [1 1], im_sz);
98 else
99 hi = upConv(lo2, filt2, edges, [2 1], [1 1], int_sz);
100 hi2 = upConv(hi, filt2', edges, [1 2], [1 1], im_sz);
101 end
102
103 hi2 = im - hi2;
104
105 pyr = [hi2(:); npyr];
106 pind = [im_sz; nind];
107
108end
109