-
Notifications
You must be signed in to change notification settings - Fork 8
/
setPyrBand.m
executable file
·32 lines (26 loc) · 1.02 KB
/
setPyrBand.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
% NEWPYR = setPyrBand(PYR, INDICES, NEWBAND, BAND_NUM)
%
% Insert an image (BAND) into a pyramid (gaussian, laplacian, QMF/wavelet,
% or steerable). Subbands are numbered consecutively, from finest
% (highest spatial frequency) to coarsest (lowest spatial frequency).
% Eero Simoncelli, 1/03.
function pyr = setPyrBand(pyr, pind, band, bandNum)
%% Check: PIND a valid index matrix?
if ( ~(ndims(pind) == 2) | ~(size(pind,2) == 2) | ~all(pind==round(pind)) )
pind
error('pyrTools:badArg',...
'PIND argument is not an Nbands X 2 matrix of integers');
end
%% Check: PIND consistent with size of PYR?
if ( length(pyr) ~= sum(prod(pind,2)) )
error('pyrTools:badPyr',...
'Pyramid data vector length is inconsistent with index matrix PIND');
end
%% Check: size of BAND consistent with desired BANDNUM?
if (~all(size(band) == pind(bandNum,:)))
size(band)
pind(bandNum,:)
error('pyrTools:badArg',...
'size of BAND to be inserted is inconsistent with BAND_NUM');
end
pyr(pyrBandIndices(pind,bandNum)) = vectify(band);