flowlib.py 文件源码

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

项目:flownet2-tf 作者: sampepose 项目源码 文件源码
def read_disp_png(file_name):
    """
    Read optical flow from KITTI .png file
    :param file_name: name of the flow file
    :return: optical flow data in matrix
    """
    image_object = png.Reader(filename=file_name)
    image_direct = image_object.asDirect()
    image_data = list(image_direct[2])
    (w, h) = image_direct[3]['size']
    channel = len(image_data[0]) / w
    flow = np.zeros((h, w, channel), dtype=np.uint16)
    for i in range(len(image_data)):
        for j in range(channel):
            flow[i, :, j] = image_data[i][j::channel]
    return flow[:, :, 0] / 256
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号