ref: 97cd0bd5dbe2ad4f64fcaedaeb48d60d7874bfde
parent: 4f69df9969745c3bec295edbb5514a2cc04c7e26
author: Jerome Jiang <jianj@google.com>
date: Fri Sep 27 13:11:51 EDT 2019
Fix python3 format issue Change-Id: If0fed04c8682baee82efbdf5b4f90bcc8e8ac102
--- a/tools/3D-Reconstruction/MotionEST/GroundTruth.py
+++ b/tools/3D-Reconstruction/MotionEST/GroundTruth.py
@@ -22,7 +22,7 @@
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)
- if not gt_path is None:
+ if gt_path:
with open(gt_path) as gt_file:
lines = gt_file.readlines()
for i in xrange(len(lines)):
--- a/tools/3D-Reconstruction/MotionEST/MotionEST.py
+++ b/tools/3D-Reconstruction/MotionEST/MotionEST.py
@@ -67,7 +67,7 @@
count = 0
for i in xrange(self.num_row):
for j in xrange(self.num_col):
- if not mask is None and mask[i, j]:
+ if mask is not None and mask[i, j]:
continue
loss += self.block_dist(i, j, self.mf[i, j], metric)
count += 1
@@ -82,7 +82,7 @@
mask = ground_truth.mask
for i in xrange(self.num_row):
for j in xrange(self.num_col):
- if not mask is None and mask[i][j]:
+ if mask is not None and mask[i][j]:
continue
loss += LA.norm(gt[i, j] - self.mf[i, j])
count += 1
@@ -101,7 +101,7 @@
plt.subplot(1, n_row, 1)
plt.imshow(cur_mf)
plt.title('Estimated Motion Field')
- if not ground_truth is None:
+ if ground_truth is not None:
plt.subplot(1, n_row, 2)
plt.imshow(gt_mf)
plt.title('Ground Truth')
--- a/tools/3D-Reconstruction/genY4M/genY4M.py
+++ b/tools/3D-Reconstruction/genY4M/genY4M.py
@@ -57,7 +57,7 @@
else:
frames.append((idx, img))
if len(frames) == 0:
- print "No frames in directory: " + args.frame_path
+ print("No frames in directory: " + args.frame_path)
sys.exit()
print("----------------------Y4M Info----------------------")
print("width: %d" % frames[0][1].width)