问题
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