buildSpyrLevs.m 861 B

12345678910111213141516171819202122232425262728293031323334353637
  1. % [PYR, INDICES] = buildSpyrLevs(LOIM, HEIGHT, LOFILT, BFILTS, EDGES)
  2. %
  3. % Recursive function for constructing levels of a steerable pyramid. This
  4. % is called by buildSpyr, and is not usually called directly.
  5. % Eero Simoncelli, 6/96.
  6. function [pyr,pind] = buildSpyrLevs(lo0,ht,lofilt,bfilts,edges);
  7. if (ht <= 0)
  8. pyr = lo0(:);
  9. pind = size(lo0);
  10. else
  11. % Assume square filters:
  12. bfiltsz = round(sqrt(size(bfilts,1)));
  13. bands = zeros(prod(size(lo0)),size(bfilts,2));
  14. bind = zeros(size(bfilts,2),2);
  15. for b = 1:size(bfilts,2)
  16. filt = reshape(bfilts(:,b),bfiltsz,bfiltsz);
  17. band = corrDn(lo0, filt, edges);
  18. bands(:,b) = band(:);
  19. bind(b,:) = size(band);
  20. end
  21. lo = corrDn(lo0, lofilt, edges, [2 2], [1 1]);
  22. [npyr,nind] = buildSpyrLevs(lo, ht-1, lofilt, bfilts, edges);
  23. pyr = [bands(:); npyr];
  24. pind = [bind; nind];
  25. end