FFT-based 2D convolution and correlation in Python

后端 未结 6 1405
一个人的身影
一个人的身影 2020-12-01 04:50

Is there a FFT-based 2D cross-correlation or convolution function built into scipy (or another popular library)?

There are functions like these:

6条回答
  •  臣服心动
    2020-12-01 05:07

    I wrote a cross-correlation/convolution wrapper that takes care of padding & nans and includes a simple smooth wrapper here. It's not a popular package, but it also has no dependencies besides numpy (or fftw for faster ffts).

    I've also implemented an FFT speed testing code here in case anyone's interested. It shows - surprisingly - that numpy's fft is faster than scipy's, at least on my machine.

    EDIT: moved code to N-dimensional version here

提交回复
热议问题