build_cost_volume.py 文件源码

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

项目:mrflow 作者: jswulff 项目源码 文件源码
def flow2parallax(u,v,q):
    """
    Given the flow fields (after correction!) and the epipole,
    return:
    - The normalized parallax (HxW array)
    - The vectors pointing to the epipoles (HxWx2 array)
    - The distances of all points to the epipole (HxW array)
    """
    h,w = u.shape
    y,x = np.mgrid[:h,:w]

    u_f = q[0] - x
    v_f = q[1] - y

    dists = np.sqrt(u_f**2 + v_f**2)
    u_f_n = u_f / np.maximum(dists,1e-3)
    v_f_n = v_f / np.maximum(dists,1e-3)

    parallax = u * u_f_n + v * v_f_n

    return parallax, np.dstack((u_f_n, v_f_n)), dists
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号