def get_bounded_projection(camera, pts, subsample=10):
""" Project points and only return points that are within image bounds """
# Project points
pts2d = camera.project(pts[::subsample].astype(np.float32))
# Only return points within-image bounds
valid = np.bitwise_and(np.bitwise_and(pts2d[:,0] >= 0, pts2d[:,0] < camera.shape[1]), \
np.bitwise_and(pts2d[:,1] >= 0, pts2d[:,1] < camera.shape[0]))
return pts2d[valid], valid
评论列表
文章目录