def convert_wrapper(path, outpath, Debug=False):
for filename in sorted(os.listdir(path)):
if filename.endswith('.flo'):
filename = filename.replace('.flo','')
flow = read_flow(path, filename)
flow_img = convert_flow(flow, 2.0)
# NOTE: Change from BGR (OpenCV format) to RGB (Matlab format) to fit Matlab output
flow_img = cv2.cvtColor(flow_img, cv2.COLOR_BGR2RGB)
#print "Saving {}.png with shape: {}".format(filename, flow_img.shape)
cv2.imwrite(outpath + filename + '.png', flow_img)
if Debug:
ret = imchecker(outpath + filename)
# Sanity check and comparison if we have matlab version image
评论列表
文章目录