spyrLev.m 668 B

123456789101112131415161718192021222324
  1. % [LEV,IND] = spyrLev(PYR,INDICES,LEVEL)
  2. %
  3. % Access a level from a steerable pyramid.
  4. % Return as an SxB matrix, B = number of bands, S = total size of a band.
  5. % Also returns an Bx2 matrix containing dimensions of the subbands.
  6. % Eero Simoncelli, 6/96.
  7. function [lev,ind] = spyrLev(pyr,pind,level)
  8. nbands = spyrNumBands(pind);
  9. if ((level > spyrHt(pind)) | (level < 1))
  10. error(sprintf('Level number must be in the range [1, %d].', spyrHt(pind)));
  11. end
  12. firstband = 2 + nbands*(level-1);
  13. firstind = 1;
  14. for l=1:firstband-1
  15. firstind = firstind + prod(pind(l,:));
  16. end
  17. ind = pind(firstband:firstband+nbands-1,:);
  18. lev = pyr(firstind:firstind+sum(prod(ind'))-1);