fastsegmentmap.m

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

M
57
字号
% 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.% 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 = fastSegmentMap(map,seedPoint,varargin)if isempty(varargin) thresh = 0.05;else thresh = varargin{1}; endeps = 0.001;resultMap.origImage = map.origImage;resultMap.label = ['seg: ' map.label];resultMap.parameters = map.parameters;seedVal = map.data(seedPoint(1),seedPoint(2));if (seedVal < eps)  debugMsg(sprintf('seedVal = %g',seedVal));  resultMap.origImage = map.origImage;  resultMap.label = ['seg-0: ' map.label];  resultMap.data = zeros(size(map.data));  resultMap.date = timeString;  resultMap.parameters = map.parameters;  segMaps = [];  return;end  bw = im2bw(map.data/seedVal,thresh);labels = bwlabel(bw,4);sVal = labels(seedPoint(1),seedPoint(2));if (sVal > 0)  resultMap.data = double(labels == sVal);else  resultMap.data = zeros(size(map.data));endresultMap.date = timeString;

⌨️ 快捷键说明

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