如何在一维信号中应用相位相关? [英] How to apply phase correlation in 1D signal?

查看:50
本文介绍了如何在一维信号中应用相位相关?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对数极坐标变换通常在具有相位相关性的图像中使用傅里叶变换来估计旋转和平移等.但是,我很少混淆如何将其应用于音频信号.我正在尝试通过对数极坐标变换(LPT)和相位相关来估计两个音频信号之间的时移.我使用 https://en.wikipedia.org/wiki/Log-polar_coordinates 应用了LPT在音频信号和绘图仪中使用带有polar(theta,rho)的matlab,直到这里都没有问题,问题是我不确定如何对该变换后的信号应用相位相关性.谢谢.

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.

推荐答案

相位相关不仅适用于2D.您可以在1D信号上使用相同的东西.尤其是您的两个音频信号已经在时域上,而您只想知道它们之间的时移.

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.

以下是Python中的示例:

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))

祝你好运!

这篇关于如何在一维信号中应用相位相关?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆