ltusegmentmap.m

来自「显著区域检测。求的图像中感兴趣区域的位置」· M 代码 · 共 78 行

M
78
字号
% LTUsegmentMap - segment map using a network of linear threshold units.%% [resultMap,segMaps] = LTUsegmentMap(map,seedPoint)%    Segment the map around the seedPoint using a network of linear%    threshold units. Returns a binary map in resultMap and the %    intermediate maps at each time step in segMaps.%    This function is A LOT slower than fastSegmentMap! %    (But it works with model neurons.)%    See section 3 of this paper for details:%      Walther, D., and Koch, C. (2006). Modeling attention to salient %      proto-objects. Neural Networks 19, pp. 1395-1407.%% [resultMap,segMaps] = LTUsegmentMap(map,seedPoint,thresh)%    Use threshold thresh for segmentation (default: 0.1).%    This threshold is relative to the map activity at%    the seedPoint, i.e. the actual threshold is thresh * map(seedPoint).%% See also makeLTUsegmentNetwork, LTUsimulate, fastSegmentMap, estimateShape, dataStructures.  % This file is part of the SaliencyToolbox - Copyright (C) 2006-2007% by Dirk B. Walther and the California Institute of Technology.% See the enclosed LICENSE.TXT document for the license agreement. % More information about this project is available at: % http://www.saliencytoolbox.netfunction [resultMap,segMaps] = LTUsegmentMap(map,seedPoint,varargin)if isempty(varargin) thresh = 0.1;else thresh = varargin{1}; endnumIter = -1;eps = 0.001;% prepare data structures for the resultimSize = size(map.data);lab = map.label;seedVal = map.data(seedPoint(1),seedPoint(2));if (seedVal < eps)  resultMap.origImage = map.origImage;  resultMap.label = ['seg-0: ' lab];  resultMap.data = zeros(imSize);  resultMap.date = timeString;  resultMap.parameters = map.parameters;  segMaps = [];  return;end% create the segmentation networkLTUnetwork = makeLTUsegmentNetwork(imSize,thresh);select = zeros(imSize);select(seedPoint(1),seedPoint(2)) = 1;input = [map.data(:)/seedVal;select(:)];states = zeros(1,LTUnetwork.numCells);keepgoing = 1;iter = 0;while (keepgoing)  iter = iter + 1;  [output,states] = LTUsimulate(LTUnetwork,states,input,2);  segMaps(iter).origImage = map.origImage;  segMaps(iter).label = sprintf('seg-%d: %s',iter,lab);  segMaps(iter).data = reshape(output,imSize);  segMaps(iter).date = timeString;  segMaps(iter).parameters = map.parameters;  if (numIter > 0)    keepgoing = (iter <= numIter);  else    if (iter == 1)      keepgoing = 1;    else      keepgoing = ~isequal(output,old_output);    end    old_output = output;  endendresultMap = segMaps(end);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?