summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-19 23:09:30 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-20 02:40:39 -0400
commitf618466c25d43f3bae9e40920273bf77de1e1149 (patch)
tree460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m')
-rwxr-xr-xSD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m83
1 files changed, 83 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m
new file mode 100755
index 0000000..cddcc12
--- /dev/null
+++ b/SD-VBS/benchmarks/texture_synthesis/src/matlab/reconLpyr.m
@@ -0,0 +1,83 @@
1% RES = reconLpyr(PYR, INDICES, LEVS, FILT2, EDGES)
2%
3% Reconstruct image from Laplacian pyramid, as created by buildLpyr.
4%
5% PYR is a vector containing the N pyramid subbands, ordered from fine
6% to coarse. INDICES is an Nx2 matrix containing the sizes of
7% each subband. This is compatible with the MatLab Wavelet toolbox.
8%
9% LEVS (optional) should be a list of levels to include, or the string
10% 'all' (default). The finest scale is number 1. The lowpass band
11% corresponds to lpyrHt(INDICES)+1.
12%
13% FILT2 (optional) can be a string naming a standard filter (see
14% namedFilter), or a vector which will be used for (separable)
15% convolution. Default = 'binom5'. EDGES specifies edge-handling,
16% and defaults to 'reflect1' (see corrDn).
17
18% Eero Simoncelli, 6/96
19
20function res = reconLpyr(pyr, ind, levs, filt2, edges)
21
22if (nargin < 2)
23 error('First two arguments (PYR, INDICES) are required');
24end
25
26%%------------------------------------------------------------
27%% DEFAULTS:
28
29if (exist('levs') ~= 1)
30 levs = 'all';
31end
32
33if (exist('filt2') ~= 1)
34 filt2 = 'binom5';
35end
36
37if (exist('edges') ~= 1)
38 edges= 'reflect1';
39end
40%%------------------------------------------------------------
41
42maxLev = 1+lpyrHt(ind);
43if strcmp(levs,'all')
44 levs = [1:maxLev]';
45else
46 if (any(levs > maxLev))
47 error(sprintf('Level numbers must be in the range [1, %d].', maxLev));
48 end
49 levs = levs(:);
50end
51
52if isstr(filt2)
53 filt2 = namedFilter(filt2);
54end
55
56filt2 = filt2(:);
57res_sz = ind(1,:);
58
59if any(levs > 1)
60
61 int_sz = [ind(1,1), ind(2,2)];
62
63 nres = reconLpyr( pyr(prod(res_sz)+1:size(pyr,1)), ...
64 ind(2:size(ind,1),:), levs-1, filt2, edges);
65
66 if (res_sz(1) == 1)
67 res = upConv(nres, filt2', edges, [1 2], [1 1], res_sz);
68 elseif (res_sz(2) == 1)
69 res = upConv(nres, filt2, edges, [2 1], [1 1], res_sz);
70 else
71 hi = upConv(nres, filt2, edges, [2 1], [1 1], int_sz);
72 res = upConv(hi, filt2', edges, [1 2], [1 1], res_sz);
73 end
74
75else
76
77 res = zeros(res_sz);
78
79end
80
81if any(levs == 1)
82 res = res + pyrBand(pyr,ind,1);
83end