Home > mfiles > centerSurround.m

centerSurround

PURPOSE ^

centerSurround - computes center-surround difference maps.

SYNOPSIS ^

function [featureMaps,csLevels] = centerSurround(pyr,params)

DESCRIPTION ^

 centerSurround - computes center-surround difference maps.

 [featureMaps,csLevels] = centerSurround(pyramid,salParams)
    computes the center-surround maps in the pyramid
    according to the parameters in salParams.

    featureMaps is a vector of maps with the results.
    csLevels returns the center and surround levels in
       pyramid for later reference.

 See also defaultSaliencyParams, defaultLevelParams, makeSaliencyMap,
          centerSurroundTopDown, dataStructures.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % centerSurround - computes center-surround difference maps.
0002 %
0003 % [featureMaps,csLevels] = centerSurround(pyramid,salParams)
0004 %    computes the center-surround maps in the pyramid
0005 %    according to the parameters in salParams.
0006 %
0007 %    featureMaps is a vector of maps with the results.
0008 %    csLevels returns the center and surround levels in
0009 %       pyramid for later reference.
0010 %
0011 % See also defaultSaliencyParams, defaultLevelParams, makeSaliencyMap,
0012 %          centerSurroundTopDown, 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 [featureMaps,csLevels] = centerSurround(pyr,params)
0021 
0022 debugMsg('',pyr);
0023 
0024 % resize everything that needs to be resized
0025 lp = params.levelParams;
0026 siz = size(pyr.levels(lp.mapLevel).data);
0027 numLevels = length(pyr.levels);
0028 c = 1;
0029 for l = lp.minLevel:(lp.maxLevel + lp.maxDelta)
0030   if (l > numLevels) break; end
0031   maps(c).origImage = pyr.levels(l).origImage;
0032   maps(c).label = pyr.levels(l).label;
0033   maps(c).data = imresize(pyr.levels(l).data,siz,'nearest');
0034   maps(c).date = timeString;
0035   idx(l) = c;
0036   c = c + 1;
0037 end
0038 
0039 % compute all the c-s differences
0040 cc = 1;
0041 borderSize = round(max(siz)/20);
0042 lab = pyr.label;
0043 for l = lp.minLevel:lp.maxLevel;
0044   for d = lp.minDelta:lp.maxDelta
0045     l2 = l + d;
0046     if (l2 > numLevels) continue; end
0047     featureMaps(cc).origImage = maps(idx(l)).origImage;
0048     featureMaps(cc).label = sprintf('%s (%d-%d)',lab,l2,l);
0049     featureMaps(cc).data = attenuateBorders(abs(maps(idx(l)).data - maps(idx(l2)).data),...
0050                                             borderSize);
0051     csLevels(cc).centerLevel = l2;
0052     csLevels(cc).surroundLevel = l;
0053     featureMaps(cc).date = timeString;
0054     featureMaps(cc).parameters = params;
0055     cc = cc + 1;
0056   end
0057 end

Generated on Fri 07-Sep-2007 14:42:18 by m2html © 2003