pyrBandIndices.m 589 B

123456789101112131415161718192021222324
  1. % RES = pyrBandIndices(INDICES, BAND_NUM)
  2. %
  3. % Return indices for accessing a subband from a pyramid
  4. % (gaussian, laplacian, QMF/wavelet, steerable).
  5. % Eero Simoncelli, 6/96.
  6. function indices = pyrBandIndices(pind,band)
  7. if ((band > size(pind,1)) | (band < 1))
  8. error(sprintf('BAND_NUM must be between 1 and number of pyramid bands (%d).', ...
  9. size(pind,1)));
  10. end
  11. if (size(pind,2) ~= 2)
  12. error('INDICES must be an Nx2 matrix indicating the size of the pyramid subbands');
  13. end
  14. ind = 1;
  15. for l=1:band-1
  16. ind = ind + prod(pind(l,:));
  17. end
  18. indices = ind:ind+prod(pind(band,:))-1;