-
Notifications
You must be signed in to change notification settings - Fork 8
/
reconSpyrLevs.m
executable file
·46 lines (35 loc) · 1.1 KB
/
reconSpyrLevs.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% RES = reconSpyrLevs(PYR,INDICES,LOFILT,BFILTS,EDGES,LEVS,BANDS)
%
% Recursive function for reconstructing levels of a steerable pyramid
% representation. This is called by reconSpyr, and is not usually
% called directly.
% Eero Simoncelli, 6/96.
function res = reconSpyrLevs(pyr,pind,lofilt,bfilts,edges,levs,bands);
nbands = size(bfilts,2);
lo_ind = nbands+1;
res_sz = pind(1,:);
% Assume square filters:
bfiltsz = round(sqrt(size(bfilts,1)));
if any(levs > 1)
if (size(pind,1) > lo_ind)
nres = reconSpyrLevs( pyr(1+sum(prod(pind(1:lo_ind-1,:)')):size(pyr,1)), ...
pind(lo_ind:size(pind,1),:), ...
lofilt, bfilts, edges, levs-1, bands);
else
nres = pyrBand(pyr,pind,lo_ind); % lowpass subband
end
res = upConv(nres, lofilt, edges, [2 2], [1 1], res_sz);
else
res = zeros(res_sz);
end
if any(levs == 1)
ind = 1;
for b = 1:nbands
if any(bands == b)
bfilt = reshape(bfilts(:,b), bfiltsz, bfiltsz);
res = upConv(reshape(pyr(ind:ind+prod(res_sz)-1), res_sz(1), res_sz(2)), ...
bfilt, edges, [1 1], [1 1], res_sz, res);
end
ind = ind + prod(res_sz);
end
end