How to apply phase correlation in 1D signal?

牧云@^-^@ 提交于 2021-02-10 23:27:33

问题


Log polar transform is commonly used in image with phase correlation using Fourier transform for estimating rotation and translation etc. However, I am little confusing how to apply it in audio signal. I am trying to estimate time shift between two audio signal through log polar transform (LPT) and phase correlation. I applied LPT using https://en.wikipedia.org/wiki/Log-polar_coordinates in audio signal and plotter using matlab with polar(theta,rho), until here, there is no problem, problem is I am not sure how to apply phase correlation for this transformed signal. Thank you.


回答1:


Phase correlation is not only for 2D. You can use the same thing on the 1D signals. Especially, your two audio signals are already on time domain while you just want to know the time shift between them.

Try phase correlation on the original audio signals without transforming them onto log polar representation.

Here an example in Python:

import numpy as np

# sig1, sig2 = your audio signals
# ...
fft_sig1 = np.fft.fft(sig1)
fft_sig2 = np.fft.fft(sig2)
fft_sig2_conj = np.conj(fft_sig2)

R = (fft_sig1 * fft_sig2_conj) / abs(fft_sig1 * fft_sig2_conj)
r = np.fft.ifft(R)

time_shift = np.argmax(r)
print('time shift = %d' % (time_shift))

Good luck!



来源:https://stackoverflow.com/questions/35567906/how-to-apply-phase-correlation-in-1d-signal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!