summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDan Zhu <zxdan@google.com>2019-07-17 19:36:32 -0700
committerDan Zhu <zxdan@google.com>2019-07-23 09:55:03 -0700
commite4096639ff0e034cb59c13760727b2e6d4fbe831 (patch)
tree3bc1be66763253319447473d6cae57b95e4814d1 /tools
parent3244f4738d16cfef982ebf94e70dadd95d4c47b8 (diff)
downloadlibvpx-e4096639ff0e034cb59c13760727b2e6d4fbe831.tar.gz
libvpx-e4096639ff0e034cb59c13760727b2e6d4fbe831.tar.bz2
libvpx-e4096639ff0e034cb59c13760727b2e6d4fbe831.zip
Add Ground Truth Estimator
Change-Id: Iec6c7e49a64610e33a77c7d5d772e6b063a0f1e0
Diffstat (limited to 'tools')
-rw-r--r--tools/3D-Reconstruction/MotionEST/GroundTruth.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/3D-Reconstruction/MotionEST/GroundTruth.py b/tools/3D-Reconstruction/MotionEST/GroundTruth.py
new file mode 100644
index 000000000..61b4bef42
--- /dev/null
+++ b/tools/3D-Reconstruction/MotionEST/GroundTruth.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+# coding: utf-8
+import numpy as np
+import numpy.linalg as LA
+from MotionEST import MotionEST
+"""Ground Truth:
+
+ Load in ground truth motion field and mask
+"""
+
+
+class GroundTruth(MotionEST):
+ """
+ constructor:
+ cur_f: current frame
+ ref_f: reference frame
+ blk_sz: block size
+ gt_path: ground truth motion field file path
+ """
+
+ def __init__(self, cur_f, ref_f, blk_sz, gt_path):
+ self.name = 'ground truth'
+ super(GroundTruth, self).__init__(cur_f, ref_f, blk_sz)
+ self.mask = np.zeros((self.num_row, self.num_col), dtype=np.bool)
+ with open(gt_path) as gt_file:
+ lines = gt_file.readlines()
+ for i in xrange(len(lines)):
+ info = lines[i].split(';')
+ for j in xrange(len(info)):
+ x, y = info[j].split(',')
+ #-,- stands for nothing
+ if x == '-' or y == '-':
+ self.mask[i, -j - 1] = True
+ continue
+ #the order of original file is flipped on the x axis
+ self.mf[i, -j - 1] = np.array([float(y), -float(x)], dtype=np.int)