diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/buildWpyr.m')
-rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/buildWpyr.m | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildWpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildWpyr.m deleted file mode 100755 index 22ae32f..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/buildWpyr.m +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | % [PYR, INDICES] = buildWpyr(IM, HEIGHT, FILT, EDGES) | ||
2 | % | ||
3 | % Construct a separable orthonormal QMF/wavelet pyramid on matrix (or vector) IM. | ||
4 | % | ||
5 | % HEIGHT (optional) specifies the number of pyramid levels to build. Default | ||
6 | % is maxPyrHt(IM,FILT). You can also specify 'auto' to use this value. | ||
7 | % | ||
8 | % FILT (optional) can be a string naming a standard filter (see | ||
9 | % namedFilter), or a vector which will be used for (separable) | ||
10 | % convolution. Filter can be of even or odd length, but should be symmetric. | ||
11 | % Default = 'qmf9'. 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 | |||
20 | function [pyr,pind] = buildWpyr(im, ht, filt, edges) | ||
21 | |||
22 | if (nargin < 1) | ||
23 | error('First argument (IM) is required'); | ||
24 | end | ||
25 | |||
26 | %------------------------------------------------------------ | ||
27 | %% OPTIONAL ARGS: | ||
28 | |||
29 | if (exist('filt') ~= 1) | ||
30 | filt = 'qmf9'; | ||
31 | end | ||
32 | |||
33 | if (exist('edges') ~= 1) | ||
34 | edges= 'reflect1'; | ||
35 | end | ||
36 | |||
37 | if isstr(filt) | ||
38 | filt = namedFilter(filt); | ||
39 | end | ||
40 | |||
41 | if ( (size(filt,1) > 1) & (size(filt,2) > 1) ) | ||
42 | error('FILT should be a 1D filter (i.e., a vector)'); | ||
43 | else | ||
44 | filt = filt(:); | ||
45 | end | ||
46 | |||
47 | hfilt = modulateFlip(filt); | ||
48 | |||
49 | % Stagger sampling if filter is odd-length: | ||
50 | if (mod(size(filt,1),2) == 0) | ||
51 | stag = 2; | ||
52 | else | ||
53 | stag = 1; | ||
54 | end | ||
55 | |||
56 | im_sz = size(im); | ||
57 | |||
58 | max_ht = maxPyrHt(im_sz, size(filt,1)); | ||
59 | if ( (exist('ht') ~= 1) | (ht == 'auto') ) | ||
60 | ht = max_ht; | ||
61 | else | ||
62 | if (ht > max_ht) | ||
63 | error(sprintf('Cannot build pyramid higher than %d levels.',max_ht)); | ||
64 | end | ||
65 | end | ||
66 | |||
67 | if (ht <= 0) | ||
68 | |||
69 | pyr = im(:); | ||
70 | pind = im_sz; | ||
71 | |||
72 | else | ||
73 | |||
74 | if (im_sz(2) == 1) | ||
75 | lolo = corrDn(im, filt, edges, [2 1], [stag 1]); | ||
76 | hihi = corrDn(im, hfilt, edges, [2 1], [2 1]); | ||
77 | elseif (im_sz(1) == 1) | ||
78 | lolo = corrDn(im, filt', edges, [1 2], [1 stag]); | ||
79 | hihi = corrDn(im, hfilt', edges, [1 2], [1 2]); | ||
80 | else | ||
81 | lo = corrDn(im, filt, edges, [2 1], [stag 1]); | ||
82 | hi = corrDn(im, hfilt, edges, [2 1], [2 1]); | ||
83 | lolo = corrDn(lo, filt', edges, [1 2], [1 stag]); | ||
84 | lohi = corrDn(hi, filt', edges, [1 2], [1 stag]); % horizontal | ||
85 | hilo = corrDn(lo, hfilt', edges, [1 2], [1 2]); % vertical | ||
86 | hihi = corrDn(hi, hfilt', edges, [1 2], [1 2]); % diagonal | ||
87 | end | ||
88 | |||
89 | [npyr,nind] = buildWpyr(lolo, ht-1, filt, edges); | ||
90 | |||
91 | if ((im_sz(1) == 1) | (im_sz(2) == 1)) | ||
92 | pyr = [hihi(:); npyr]; | ||
93 | pind = [size(hihi); nind]; | ||
94 | else | ||
95 | pyr = [lohi(:); hilo(:); hihi(:); npyr]; | ||
96 | pind = [size(lohi); size(hilo); size(hihi); nind]; | ||
97 | end | ||
98 | |||
99 | end | ||
100 | |||