capture_data.py 文件源码

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

项目:deeptracking 作者: lvsn 项目源码 文件源码
def show_occlusion(detection, rgb, depth, camera, bb_width):
    pixels = compute_2Dboundingbox(detection, camera, bb_width)
    depth_crop = depth[pixels[0, 0]:pixels[1, 0], pixels[0, 1]:pixels[2, 1]].astype(np.float)
    mask = np.bitwise_and(depth_crop < 880, depth_crop != 0)
    mask = cv2.erode(mask.astype(np.uint8), np.ones((3, 3)))
    print("Occlusion level : {}".format(np.sum(mask) / (mask.shape[0] * mask.shape[1])))
    cv2.imshow("object crop mask", (mask * 255))
    cv2.imshow("object crop depth", ((depth_crop / np.max(depth_crop) * 255).astype(np.uint8)))
    cv2.rectangle(rgb, tuple(pixels[0][::-1]), tuple(pixels[3][::-1]), (0, 0, 255), 2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号