我试图确定一个声源的(x,y,z)坐标给定TDOA信息从4个麦克风在Python中。
此pdf非常接近,但与TOA一起工作,然后将其转换为TDOA。
这个答案显示了如何得到4个非线性方程,但我不确定如何解决这个问题。
这篇文章展示了一个有5个传感器的多倍体解决方案。在评论中有一个python版本。有人还在评论中问是否有4个传感器的解决方案,显然有,但不是很可靠。我不确定这是多倍体还是一般的4个传感器的限制。
我还发现了其他2D解决方案:这里和这里
我可以自由地将麦克风移动到任何使计算最简单的地方。理想情况下,我正在寻找一个函数,该函数将4个麦克风位置和每对的TDOA作为参数,并返回x,y,z源位置/s(取决于是否有歧义)
嘿,以防有人需要这个下面是一个基于
公式的线性方程求解器https://www.ece.ucf.edu/seniordesign/sp2019su2019/g04/Docs/CONFERENCEPAPER.pdffrom scipy.optimize import minimize
import numpy
def tdoa_solve(delays_to_stations, stations_coordinates):
# inspired by https://www.ece.ucf.edu/seniordesign/sp2019su2019/g04/Docs/CONFERENCEPAPER.pdf
def error(x, c, d):
value = sum([(numpy.linalg.norm(x - c[i]) - numpy.linalg.norm(x - c[0]) - 331.3 * (d[i] - d[0])) ** 2 for i in range(1, len(d))])
# print((x, value))
return value
x0 = numpy.array([0.3,0.3,0.1])
return minimize(error, x0, args=(stations_coordinates, delays_to_stations), method='Nelder-Mead').x
if __name__ == "__main__":
stations = list(numpy.array([[1,1,0], [0,1,0], [1,0,0], [0,0,1]])) # the four sensors must be non-planar otherwise it won't be able to solve for the third dimension.
delays_to_stations_list = [
[0.00213434, 0.00213434, 0.00213434, 0.003696785], # 0.5,0.5,0
[0.002614022, 0.002614022, 0.002614022, 0.002614022], # 0.5,0.5,0.5
[0.00106717, 0.002386264, 0.002386264, 0.004400054], # 0.75,0.75,0
[0.002502735, 0.003289239, 0.003289239, 0.003289239], # 0.75,0.75,0.75
]
for delays_to_stations in delays_to_stations_list:
print(tdoa_solve(delays_to_stations, stations))