Applies nonmaximal suppression on an image of arbitrary dimension. nonmaxsupr( I, ... ) returns the pixel location and values of local maximums - that is a location is returned only if it has a value greater then or equal to all pixels in the surrounding window of size radii. I can be smoothed first to make method more robust. The first output is an array of the subscript locations of maximal values in I and the second output contains the corresponding maximal values. One can convert subs/vals back to an array representation using imsubs2array. Note that values are suppressed iff there are strictly greater values in the neighborhood. Hences nonmaxsupr(ones(10),5) would not suppress any values. INPUTS I - matrix to apply nonmaxsupr to radii - suppression window dimensions thresh - [optional] minimum value below which not to look for maxes maxn: - [optional] return at most maxn of the largest vals OUTPUTS subs - subscripts of non-suppressed point locations (n x d) vals - values at non-suppressed point locations (n x 1) EXAMPLE % example 1 G = filter_gauss_nD( [25 25], [13,13], 3*eye(2), 1 ); siz=[11 11]; G = filter_gauss_nD( siz, (siz+1)/2, eye(2), 1 ); [subs,vals] = nonmaxsupr( G, 1, eps ); figure(2); im( imsubs2array( subs, vals, siz ) ); [subs,vals] = nonmaxsupr_list( ind2sub2(siz,(1:prod(siz))'), G(:)',1 ); figure(3); im( imsubs2array( subs, vals, siz ) ); % example 2 siz=[30 30]; I=ones(siz); I(22,23)=I(22,23)+3; I(12,23)=I(12,23)+5; I(7,1)=I(7,1)-.5; figure(1); im(I); r=3; supr_eq = 1; maxn=[]; thresh=eps; [subs,vals] = nonmaxsupr(I,r,thresh,maxn); figure(2); im( imsubs2array( subs, vals, siz ) ); [subs,vals] = nonmaxsupr_window(subs,vals,[1 1]+6,siz-6); figure(3); im( imsubs2array( subs, vals, siz ) ); [subs2,vals2] = nonmaxsupr_list( ind2sub2(siz,(1:prod(siz))'), ... I(:)',r,thresh,maxn,supr_eq ); figure(4); im( imsubs2array( subs2, vals2, siz ) ); DATESTAMP 05-May-2006 2:00pm See also IMSUBS2ARRAY, NONMAXSUPR_LIST, NONMAXSUPR_WINDOW