plotSalientLocation - plots the attended location into an existing figure. plotSalientLocation(winner,lastWinner,salParams,shapeData) Plots the winning location into the current figure. Depending on the settings in salParams, the contour of the attended region or a circle centered at the attended location is drawn in yellow. If there is a valid lastWinner, a red line connects lastWinner with winner. winner: the attended location in image coordinates. lastWinner: the previously attended location (-1 for none). salParams: structure with saliency parameters. shapeData: structure array with information on the attended region from estimateShape. plotSalientLocation(winner,lastWinner,salParams) If no shapeData are passed, a circle is drawn at the attended location. See also estimateShape, winnerToImgCoords, runSaliency, drawDisk, contrastModulate, emptyMap, defaultSaliencyParams.
0001 % plotSalientLocation - plots the attended location into an existing figure. 0002 % 0003 % plotSalientLocation(winner,lastWinner,salParams,shapeData) 0004 % Plots the winning location into the current figure. 0005 % Depending on the settings in salParams, the contour of the 0006 % attended region or a circle centered at the attended location 0007 % is drawn in yellow. If there is a valid lastWinner, 0008 % a red line connects lastWinner with winner. 0009 % winner: the attended location in image coordinates. 0010 % lastWinner: the previously attended location (-1 for none). 0011 % salParams: structure with saliency parameters. 0012 % shapeData: structure array with information on the attended 0013 % region from estimateShape. 0014 % 0015 % plotSalientLocation(winner,lastWinner,salParams) 0016 % If no shapeData are passed, a circle is drawn at the attended 0017 % location. 0018 % 0019 % See also estimateShape, winnerToImgCoords, runSaliency, drawDisk, 0020 % contrastModulate, emptyMap, defaultSaliencyParams. 0021 0022 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2007 0023 % by Dirk B. Walther and the California Institute of Technology. 0024 % See the enclosed LICENSE.TXT document for the license agreement. 0025 % More information about this project is available at: 0026 % http://www.saliencytoolbox.net 0027 0028 function plotSalientLocation(winner,lastWinner,img,params,varargin) 0029 0030 % first some logic to figure out what we have to draw 0031 switch params.shapeMode 0032 case {'shapeSM','shapeCM','shapeFM','shapePyr'} 0033 if isempty(varargin) 0034 shape = 'Circle'; 0035 elseif isempty(varargin{1}) 0036 shape = 'Circle'; 0037 elseif (max(varargin{1}.binaryMap.data(:)) == 0) 0038 shape = 'Circle'; 0039 else 0040 shape = 'Outline'; 0041 end 0042 case {'None','none'} 0043 shape = 'Circle'; 0044 otherwise 0045 fatal(['Unknown shapeMode: ' params.shapeMode]); 0046 end 0047 0048 % now draw everything that we need 0049 switch params.visualizationStyle 0050 % drawing contours 0051 case 'Contour' 0052 hold on; 0053 switch shape 0054 case {'Circle','circle'} 0055 modMap = drawDisk(emptyMap(img.size(1:2)),winner,round(params.foaSize/2),1); 0056 %plot(winner(2),winner(1),'yo','MarkerSize',params.foaSize); 0057 case {'Outline','outline'} 0058 %contour(varargin{1}.shapeMap.data,[0.5 0.5],'y-'); 0059 modMap = varargin{1}.shapeMap; 0060 otherwise 0061 fatal(['Unknown shape: ' shape]); 0062 end 0063 contour(modMap.data,[0.5 0.5],'y-'); 0064 doLine = (lastWinner(1) ~= -1); 0065 if (doLine) 0066 plot([lastWinner(2),winner(2)],[lastWinner(1),winner(1)],'r-'); 0067 end 0068 hold off; 0069 0070 % using contrast modulation 0071 case 'ContrastModulate' 0072 switch shape 0073 case {'Circle','circle'} 0074 modMap = drawDisk(emptyMap(img.size(1:2)),winner,round(params.foaSize/2),1); 0075 case {'Outline','outline'} 0076 modMap = varargin{1}.shapeMap; 0077 otherwise 0078 fatal(['Unknown shape: ' shape]); 0079 end 0080 baseColor = [0.9 0.9 0.9]; % light grey 0081 baseContrast = 0.1; 0082 modImg = contrastModulate(img,modMap,baseContrast,baseColor); 0083 hold off; 0084 displayImage(modImg); 0085 0086 case {'None','none'} 0087 displayImage(img); 0088 0089 otherwise 0090 fatal(['Unknown visualizationMode: ' params.visualizationMode]); 0091 end 0092 0093