localsum

PURPOSE ^

Fast routine for box filtering.

SYNOPSIS ^

function I = localsum( I, dims, shape )

DESCRIPTION ^

 Fast routine for box filtering.

 Same effect as calling 'C=convn( I, ones(dims), shape)', except more efficient.
 Computes local sums by using running sums.

 INPUTS
   I       - matrix to compute sum over
   dims    - size of volume to compute sum over 
   shape   - [optional] 'valid', 'full', or 'same', see conv2 help

 OUTPUTS
   C       - matrix of sums

 EXAMPLE
   A = rand(20); dim=31; shape='valid'; 
   B = localsum(A,dim,shape); 
   C = conv2(A,ones(dim),shape); 
   diff=B-C; sum(abs(diff(:)))

 DATESTAMP
   29-Sep-2005  2:00pm

 See also LOCALSUM_BLOCK

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 03-May-2006 23:48:50 by m2html © 2003