def disparity_interpolate(disp, fill_zeros=True):
# Determine valid positive disparity pixels
xyd = valid_pixels(disp, disp > 0)
# Nearest neighbor interpolator
nn = LinearNDInterpolator(xyd[:,:2], xyd[:,2])
# Interpolate all pixels
xyd = valid_pixels(disp, np.ones(shape=disp.shape, dtype=np.bool))
return nn(xyd[:,:2]).reshape(disp.shape[:2])
评论列表
文章目录