location_wrapper.py 文件源码

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

项目:human-rl 作者: gsastry 项目源码 文件源码
def median_color(obs, color, frame_coordinates=None):
    color = np.array(color)

    if frame_coordinates is not None:
        (r1, r2), (c1, c2) = frame_coordinates
        obs = obs[r1:r2, c1:c2]

    indices = (obs == color).all(2).nonzero()
    indices = np.array(indices)

    if indices.size:
        med = np.median(indices, axis=1)
        return med.astype(np.int32)

    return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号