def flow_read_png(fpath):
"""
Read KITTI optical flow, returns u,v,valid mask
"""
if not has_png:
print('Error. Please install the PyPNG library')
return
R = png.Reader(fpath)
width,height,data,_ = R.asDirect()
I = np.array(map(lambda x:x,data)).reshape((height,width,3))
u_ = I[:,:,0]
v_ = I[:,:,1]
valid = I[:,:,2]
u = (u_.astype('float64')-2**15)/64.0
v = (v_.astype('float64')-2**15)/64.0
return u,v,valid
评论列表
文章目录