camera_utils.py 文件源码

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

项目:pybot 作者: spillai 项目源码 文件源码
def check_visibility(camera, pts_w, zmin=0, zmax=100): 
    """
    Check if points are visible given fov of camera. 
    This method checks for both horizontal and vertical
    fov.     
    camera: type Camera
    """
    # Transform points in to camera's reference
    # Camera: p_cw
    pts_c = camera.c2w(pts_w.reshape(-1, 3))

    # Determine look-at vector, and check angle 
    # subtended with camera's z-vector (3rd column)
    z = pts_c[:,2]
    v = pts_c / np.linalg.norm(pts_c, axis=1).reshape(-1, 1)
    hangle, vangle = np.arctan2(v[:,0], v[:,2]), np.arctan2(-v[:,1], v[:,2])

    # Provides inds mask for all points that are within fov
    return np.fabs(hangle) < camera.fov[0] * 0.5 and \
        np.fabs(vangle) < camera.fov[1] * 0.5 and \
        z >= zmin and z <= zmax
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号