time_alignment.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:hand_eye_calibration 作者: ethz-asl 项目源码 文件源码
def calculate_time_offset_from_signals(times_A, signal_A,
                                       times_B, signal_B,
                                       plot=False, block=True):
  """ Calculates the time offset between signal A and signal B. """
  convoluted_signals = signal.correlate(signal_B, signal_A)
  dt_A = np.mean(np.diff(times_A))
  offset_indices = np.arange(-len(signal_A) + 1, len(signal_B))
  max_index = np.argmax(convoluted_signals)
  offset_index = offset_indices[max_index]
  time_offset = dt_A * offset_index + times_B[0] - times_A[0]
  if plot:
    plot_results(times_A, times_B, signal_A, signal_B, convoluted_signals,
                 time_offset, block=block)
  return time_offset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号