Home > SaliencyToolbox > fastSegmentMap.m

fastSegmentMap

PURPOSE ^

fastSegmentMap - segment map around a seedPoint.

SYNOPSIS ^

function resultMap = fastSegmentMap(map,seedPoint,varargin)

DESCRIPTION ^

 fastSegmentMap - segment map around a seedPoint.

 resultMap = fastSegmentMap(map,seedPoint)
    Segment the map around the seedPoint, returns a binary
    resultMap. This function is A LOT faster than LTUsegmentMap!

 resultMap = fastSegmentMap(map,seedPoint,thresh)
    Use threshold thresh for segmentation (default: 0.1).
    This threshold is relative to the map activity at
    the seedPoint.

 This function corresponds to eqs. 13 and 14 in:
      Walther, D., and Koch, C. (2006). Modeling attention to salient 
      proto-objects. Neural Networks 19, pp. 1395-1407.

 See also LTUsegmentMap, estimateShape, dataStructures.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % fastSegmentMap - segment map around a seedPoint.
0002 %
0003 % resultMap = fastSegmentMap(map,seedPoint)
0004 %    Segment the map around the seedPoint, returns a binary
0005 %    resultMap. This function is A LOT faster than LTUsegmentMap!
0006 %
0007 % resultMap = fastSegmentMap(map,seedPoint,thresh)
0008 %    Use threshold thresh for segmentation (default: 0.1).
0009 %    This threshold is relative to the map activity at
0010 %    the seedPoint.
0011 %
0012 % This function corresponds to eqs. 13 and 14 in:
0013 %      Walther, D., and Koch, C. (2006). Modeling attention to salient
0014 %      proto-objects. Neural Networks 19, pp. 1395-1407.
0015 %
0016 % See also LTUsegmentMap, estimateShape, dataStructures.
0017 
0018 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2013
0019 % by Dirk B. Walther and the California Institute of Technology.
0020 % See the enclosed LICENSE.TXT document for the license agreement.
0021 % More information about this project is available at:
0022 % http://www.saliencytoolbox.net
0023 
0024 function resultMap = fastSegmentMap(map,seedPoint,varargin)
0025 
0026 if isempty(varargin) thresh = 0.05;
0027 else thresh = varargin{1}; end
0028 
0029 eps = 0.001;
0030 
0031 resultMap.origImage = map.origImage;
0032 resultMap.label = ['seg: ' map.label];
0033 resultMap.parameters = map.parameters;
0034 
0035 seedVal = map.data(seedPoint(1),seedPoint(2));
0036 if (seedVal < eps)
0037   debugMsg(sprintf('seedVal = %g',seedVal));
0038   resultMap.origImage = map.origImage;
0039   resultMap.label = ['seg-0: ' map.label];
0040   resultMap.data = zeros(size(map.data));
0041   resultMap.date = clock;
0042   resultMap.parameters = map.parameters;
0043   segMaps = [];
0044   return;
0045 end
0046   
0047 bw = im2bw(map.data/seedVal,thresh);
0048 labels = bwlabel(bw,4);
0049 sVal = labels(seedPoint(1),seedPoint(2));
0050 if (sVal > 0)
0051   resultMap.data = double(labels == sVal);
0052 else
0053   resultMap.data = zeros(size(map.data));
0054 end
0055 
0056 resultMap.date = clock;

Generated on Thu 18-Jul-2013 06:10:46 by m2html © 2005