I'm currently performing matrix cross correlation in python using :

C = scipy.signal.correlate2d(A,A)

where A is a 2D matrix, typically a picture. As you can imagine, it gets very long for large array, such that I'm looking for something faster.

Any hint ? I also heard about scipy.signal.fftconvolve. Despite that it's much more rapid, it rarely give me the same result at the end.

  • $\begingroup$ my incantation is to ask why do you want to form a large rank 1 matrix? $\endgroup$ – user28715 Jul 17 '18 at 14:36
  • $\begingroup$ Could you say what's A? Is it a 1D signal? Is a Random Vector Process? $\endgroup$ – Royi Jul 17 '18 at 14:57
  • $\begingroup$ A is a 2D - matrix. Typically, it can be an picture. $\endgroup$ – Liris Jul 17 '18 at 17:02

scipy.signal.correlate2d(A,A) and scipy.signal.fftconvolve(A,A[::-1, ::-1]) will give the same result. The second one is much, much faster.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.