Home > SaliencyToolbox > getLocalMaxima.m

getLocalMaxima

PURPOSE ^

getLocalMaxima - returns statistics over local maxima.

SYNOPSIS ^

function [lm_avg, lm_num, lm_sum] = getLocalMaxima(data, thresh)

DESCRIPTION ^

 getLocalMaxima - returns statistics over local maxima.

 [lm_avg,lm_num,lm_sum] = getLocalMaxima(data,thresh)
    Returns the average value (lm_avg), the number (lm_num),
    and the sum (lm_sum) of local maxima in data that exceed thresh.

 See also maxNormalizeStd.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % getLocalMaxima - returns statistics over local maxima.
0002 %
0003 % [lm_avg,lm_num,lm_sum] = getLocalMaxima(data,thresh)
0004 %    Returns the average value (lm_avg), the number (lm_num),
0005 %    and the sum (lm_sum) of local maxima in data that exceed thresh.
0006 %
0007 % See also maxNormalizeStd.
0008 
0009 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2013
0010 % by Dirk B. Walther and the California Institute of Technology.
0011 % See the enclosed LICENSE.TXT document for the license agreement.
0012 % More information about this project is available at:
0013 % http://www.saliencytoolbox.net
0014 
0015 function [lm_avg, lm_num, lm_sum] = getLocalMaxima(data, thresh)
0016 
0017     refData = data(2:end-1,2:end-1);
0018     localMax = (refData >= data(1:end-2,2:end-1)) & ...
0019                (refData >= data(3:end,2:end-1)) & ...
0020                (refData >= data(2:end-1,1:end-2)) & ...
0021                (refData >= data(2:end-1,3:end)) & ...
0022                (refData >= thresh);
0023     maxData = refData(localMax(:));
0024     lm_avg = mean(maxData);
0025     lm_sum = sum(maxData);
0026     lm_num = numel(maxData);
0027 end

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