maxPyrHt.m 603 B

12345678910111213141516171819202122232425
  1. % HEIGHT = maxPyrHt(IMSIZE, FILTSIZE)
  2. %
  3. % Compute maximum pyramid height for given image and filter sizes.
  4. % Specifically: the number of corrDn operations that can be sequentially
  5. % performed when subsampling by a factor of 2.
  6. % Eero Simoncelli, 6/96.
  7. function height = maxPyrHt(imsz, filtsz)
  8. imsz = imsz(:);
  9. filtsz = filtsz(:);
  10. if any(imsz == 1) % 1D image
  11. imsz = prod(imsz);
  12. filtsz = prod(filtsz);
  13. elseif any(filtsz == 1) % 2D image, 1D filter
  14. filtsz = [filtsz(1); filtsz(1)];
  15. end
  16. if any(imsz < filtsz)
  17. height = 0;
  18. else
  19. height = 1 + maxPyrHt( floor(imsz/2), filtsz );
  20. end