python - scipy.ndimage.interpolate 卷积和关联之间的区别

标签 python scipy

我只是想熟悉 scipy.ndimage,我无法弄清楚 interpolate.convolve 和 interpolate.correlate 有何不同。

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

它们完全一样吗?

最佳答案

卷积 [f(x), g(x)] = 相关性 [f(x), g(-x)]

Correlation当您简单地将内核移动到图像上时,就会发生这种情况。

Convolution是一个数学概念(也用于物理学),例如在 Fourier Transformation 中发挥作用或者在计算 probability density of quantum mechanical particles/wave 时.

关于python - scipy.ndimage.interpolate 卷积和关联之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18518974/

相关文章:

python - Spark 数据框添加带有随机数据的新列

python - scipy.minimize 如何处理 NaN?

scipy - 安装 MXNet 框架。在 Raspberry Pi 上 - SciPy 挂

python - celery 预定列表返回无

python - BeautifulSoup:从叶到根搜索首先获取 "deepest"元素?

python - 如何在 Tkinter 中将框架居中?

python - 当类实现 PEP 3118 时,Python 2.7 中 PyBufferProcs 的定义

python - 如何在 Debian 的 virtualenv 中安装 numpy?

python - 在 SciPy 中多核上运行 SVM 代码?

python - 如何使用 SciPy 以不同的采样率读取 .wav 文件?