Difference Between Scipy. Ndimage. Interpolate Convolve and Correlate

I'm just trying to get familiar with scipy.ndimage and I can't figure out how interpolate.convolve and interpolate.correlate are different.

In [24]: a
Out[24]: 
array([[  0.,   1.,   2.],
       [  3.,   4.,   5.],
       [  6.,   7.,   8.],
       [  9.,  10.,  11.]])
In [25]: filt=array([[0,1,0],[1,2,1],[0,1,0]])
In [26]: convolve(a,weights=filt)
Out[26]: 
array([[  4.,   9.,  14.],
       [ 19.,  24.,  29.],
       [ 37.,  42.,  47.],
       [ 52.,  57.,  62.]])
In [27]: correlate(a,weights=filt)
Out[27]: 
array([[  4.,   9.,  14.],
       [ 19.,  24.,  29.],
       [ 37.,  42.,  47.],
       [ 52.,  57.,  62.]])
In [28]: correlate == convolve
Out[28]: False

Are they exactly the same?

3

1 Answer

convolution [f(x), g(x)] = correlation [f(x), g(-x)]

Correlation is happens when you simply move a kernel over an image.

Convolution is a mathematical concept (also used in physics), playing a role for instance in Fourier Transformation or when calculating the probability density of quantum mechanical particles/wave.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest