11.1 Convolution functions

boxcar( data, boxshape, output=None, mode='nearest', cval=0.0)
boxcar computes a 1D or 2D boxcar filter on every 1D or 2D subarray of data. boxshape is a tuple of integers specifying the dimensions of the filter, e.g. (3,3) If output is specified, it should be the same shape as data and the result will be stored in it. In that case None will be returned.

Supported modes include:

nearest:
Elements beyond boundary come from nearest edge pixel.
wrap:
Elements beyond boundary come from the opposite array edge.
reflect:
Elements beyond boundary come from reflection on same array edge.
constant:
Elements beyond boundary are set to 'cval', an optional numerical parameter; the default value is 0.0.

convolve( data, kernel, mode=FULL)
Returns the discrete, linear convolution of 1-D sequences data and kernel. mode can be VALID, SAME, or FULL to specify the size of the resulting sequence. See section 11.2.

convolve2d( data, kernel, output=None, fft=0, mode='nearest', cval=0.0)
Return the 2-dimensional convolution of Data and kernel. If output is not None, the result is stored in output and None is returned. fft is used to switch between FFT based convolution and the naiive algorithm, defaulting to naiive. fft mode becomes beneficial as the size of the kernel grows; for small kernels, the naiive algorithm is more efficient. modes are identical to those of boxcar.

correlate( data, kernel, mode=FULL)
Return the cross-correlation of data and kernel. mode can be VALID, SAME, or FULL to specify the size of the resulting sequence. See section 11.2.

correlate2d( data, kernel, output=None, fft=0, mode='nearest', cval=0.0)
Return the 2-dimensional correlation of Data and kernel. If output is not None, the result is stored in output and None is returned. fft is used to switch between FFT based correlation and the naiive algorithm, defaulting to naiive. fft mode becomes beneficial as the size of the kernel grows; for small kernels, the naiive algorithm is more efficient. modes are identical to those of boxcar.

Note: cross_correlate is deprecated and should not be used.

Send comments to the NumArray community.