From 8f76a3190463ed8f6b62288756bfc8d9b45cf382 Mon Sep 17 00:00:00 2001 From: Stefano Woerner Date: Sat, 26 May 2018 15:54:48 +0200 Subject: [PATCH] fixed sign of flow and .flo file format (swapped order of horizontal and vertical flow) --- main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index df09e0f..23a00ba 100644 --- a/main.py +++ b/main.py @@ -47,7 +47,7 @@ def main(_): model = VGG16FlowSearch() im1 = imread(os.path.join(root, FLAGS.image1)) im2 = imread(os.path.join(root, FLAGS.image2)) - flow = model.infer(im1, im2, d_range=[[FLAGS.ymin,FLAGS.ymax],[FLAGS.xmin,FLAGS.xmax]], + flow = -1 * model.infer(im1, im2, d_range=[[FLAGS.ymin,FLAGS.ymax],[FLAGS.xmin,FLAGS.xmax]], step=[FLAGS.ystep,FLAGS.xstep]) if FLAGS.plot: @@ -71,7 +71,8 @@ def main(_): f.write('PIEH'.encode('ascii')) h,w,d = flow.shape np.array([w, h]).astype(np.int32).tofile(f) - np.reshape(flow, -1).astype(np.float32).tofile(f) + # Format flow for .flo file extension + np.reshape(flow[:,:,::-1], -1).astype(np.float32).tofile(f) if __name__ == '__main__': tf.app.run() \ No newline at end of file