summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAngie Chiang <angiebird@google.com>2018-09-19 16:44:40 -0700
committerAngie Chiang <angiebird@google.com>2018-09-19 17:41:16 -0700
commit4c1434e88c875544a83ca6b2cc6d18ac6ba4ffc8 (patch)
tree8f3378c92ea76373a8a82a6bd364ec975276e363 /tools
parentbb0e75463cf7ac1fd58711f0c54724261011f9aa (diff)
downloadlibvpx-4c1434e88c875544a83ca6b2cc6d18ac6ba4ffc8.tar.gz
libvpx-4c1434e88c875544a83ca6b2cc6d18ac6ba4ffc8.tar.bz2
libvpx-4c1434e88c875544a83ca6b2cc6d18ac6ba4ffc8.zip
Add feature score for each block
The feature score is used to indicate whether a block's mv is reliable or not. Now we use Harris Corner Detector method to compute the score. Change-Id: Ibbe7a1c1f3391d0bf4b03307eaabb5cc3cfb1360
Diffstat (limited to 'tools')
-rw-r--r--tools/non_greedy_mv/non_greedy_mv.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/non_greedy_mv/non_greedy_mv.py b/tools/non_greedy_mv/non_greedy_mv.py
index 87b46e065..c49c789f3 100644
--- a/tools/non_greedy_mv/non_greedy_mv.py
+++ b/tools/non_greedy_mv/non_greedy_mv.py
@@ -84,6 +84,14 @@ def yuv_to_rgb(yuv):
return rgb / 255.
+def read_feature_score(fp, mv_rows, mv_cols):
+ line = fp.readline()
+ word_ls = line.split()
+ feature_score = np.array([float(v) for v in word_ls])
+ feature_score = feature_score.reshape(mv_rows, mv_cols)
+ return feature_score
+
+
def read_frame_dpl_stats(fp):
line = fp.readline()
word_ls = line.split()
@@ -105,12 +113,13 @@ def read_frame_dpl_stats(fp):
mv_ls.append([col, row, mv_col, mv_row])
mv_ls = np.array(mv_ls)
img = yuv_to_rgb(read_frame(fp))
+ feature_score = read_feature_score(fp, mv_rows, mv_cols)
ref = None
line = fp.readline()
word_ls = line.split()
if int(word_ls[1]):
ref = yuv_to_rgb(read_frame(fp))
- return frame_idx, mv_ls, img, ref, bs
+ return frame_idx, mv_ls, img, ref, bs, feature_score
def read_dpl_stats_file(filename, frame_num=0):
@@ -131,8 +140,8 @@ def read_dpl_stats_file(filename, frame_num=0):
if __name__ == '__main__':
filename = sys.argv[1]
data_ls = read_dpl_stats_file(filename, frame_num=5)
- for frame_idx, mv_ls, img, ref, bs in data_ls:
- fig, axes = plt.subplots(1, 2)
+ for frame_idx, mv_ls, img, ref, bs, feature_score in data_ls:
+ fig, axes = plt.subplots(1, 3)
axes[0].imshow(img)
draw_mv_ls(axes[0], mv_ls)
@@ -149,5 +158,7 @@ if __name__ == '__main__':
axes[1].set_ylim(ref.shape[0], 0)
axes[1].set_xlim(0, ref.shape[1])
+ axes[2].imshow(feature_score)
+
plt.show()
print frame_idx, len(mv_ls)