makeDyadicPyramid - creates a dyadic Gaussian pyramid. pyr = makeDyadicPyramid(map) Creates a Gaussian pyramid by blurring and subsampling map by a factor of 2 repeatedly, as long as both width and height are larger than 1. pyr = makeDyadicPyramid(map,depth) Creates at most depth levels. See also mexGaussianSubsample, makeGaussianPyramid, makeSqrt2Pyramid, dataStructures.
0001 % makeDyadicPyramid - creates a dyadic Gaussian pyramid. 0002 % 0003 % pyr = makeDyadicPyramid(map) 0004 % Creates a Gaussian pyramid by blurring and subsampling 0005 % map by a factor of 2 repeatedly, as long as both width 0006 % and height are larger than 1. 0007 % 0008 % pyr = makeDyadicPyramid(map,depth) 0009 % Creates at most depth levels. 0010 % 0011 % See also mexGaussianSubsample, makeGaussianPyramid, makeSqrt2Pyramid, 0012 % dataStructures. 0013 0014 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2007 0015 % by Dirk B. Walther and the California Institute of Technology. 0016 % See the enclosed LICENSE.TXT document for the license agreement. 0017 % More information about this project is available at: 0018 % http://www.saliencytoolbox.net 0019 0020 function pyr = makeDyadicPyramid(map,varargin) 0021 0022 if (isempty(varargin)) depth = -1; 0023 else depth = varargin{1}; end 0024 0025 lab = map.label; 0026 0027 pyr.origImage = map.origImage; 0028 pyr.label = lab; 0029 pyr.type = 'dyadic'; 0030 map.label = [lab '-1']; 0031 map.parameters.type = 'dyadic'; 0032 0033 pyr.levels(1) = map; 0034 0035 n = 1; 0036 while (min(size(pyr.levels(n).data)) > 1) 0037 if ((depth > 0) & (n >= depth)) break; end 0038 n = n + 1; 0039 newMap = []; 0040 newMap.origImage = map.origImage; 0041 newMap.label = sprintf('%s-%d',lab,n); 0042 newMap.data = mexGaussianSubsample(pyr.levels(n-1).data); 0043 newMap.date = timeString; 0044 newMap.parameters.type = 'dyadic'; 0045 pyr.levels(n) = newMap; 0046 end 0047 0048 pyr.date = timeString;