ref: 4c6e284dc5726117893b113e0664d80f1443322d
parent: 6bf5b9bf635d0e580938e630acb016f822e545cb
author: Angie Chiang <[email protected]>
date: Thu Sep 20 12:42:14 EDT 2018
Use different corner detection score This corner detection score is better at measuring the level of details in each block. Change-Id: I16327a7664144ddc463c29babd11d0ca2fbb54a0
--- a/tools/non_greedy_mv/non_greedy_mv.py
+++ b/tools/non_greedy_mv/non_greedy_mv.py
@@ -87,7 +87,7 @@
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 = np.array([math.log(float(v) + 1, 2) for v in word_ls])
feature_score = feature_score.reshape(mv_rows, mv_cols)
return feature_score
@@ -141,24 +141,30 @@
filename = sys.argv[1]
data_ls = read_dpl_stats_file(filename, frame_num=5)
for frame_idx, mv_ls, img, ref, bs, feature_score in data_ls:
- fig, axes = plt.subplots(1, 3)
+ fig, axes = plt.subplots(2, 2)
- axes[0].imshow(img)
- draw_mv_ls(axes[0], mv_ls)
- draw_pred_block_ls(axes[0], mv_ls, bs, mode=0)
+ axes[0][0].imshow(img)
+ draw_mv_ls(axes[0][0], mv_ls)
+ draw_pred_block_ls(axes[0][0], mv_ls, bs, mode=0)
#axes[0].grid(color='k', linestyle='-')
- axes[0].set_ylim(img.shape[0], 0)
- axes[0].set_xlim(0, img.shape[1])
+ axes[0][0].set_ylim(img.shape[0], 0)
+ axes[0][0].set_xlim(0, img.shape[1])
if ref is not None:
- axes[1].imshow(ref)
- draw_mv_ls(axes[1], mv_ls, mode=1)
- draw_pred_block_ls(axes[1], mv_ls, bs, mode=1)
+ axes[0][1].imshow(ref)
+ draw_mv_ls(axes[0][1], mv_ls, mode=1)
+ draw_pred_block_ls(axes[0][1], mv_ls, bs, mode=1)
#axes[1].grid(color='k', linestyle='-')
- axes[1].set_ylim(ref.shape[0], 0)
- axes[1].set_xlim(0, ref.shape[1])
+ axes[0][1].set_ylim(ref.shape[0], 0)
+ axes[0][1].set_xlim(0, ref.shape[1])
- axes[2].imshow(feature_score)
+ axes[1][0].imshow(feature_score)
+ feature_score_arr = feature_score.flatten()
+ feature_score_max = feature_score_arr.max()
+ feature_score_min = feature_score_arr.min()
+ step = (feature_score_max - feature_score_min) / 20.
+ feature_score_bins = np.arange(feature_score_min, feature_score_max, step)
+ axes[1][1].hist(feature_score_arr, bins=feature_score_bins)
plt.show()
print frame_idx, len(mv_ls)
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -5689,7 +5689,7 @@
IxIx /= (rows - 1) * (cols - 1);
IxIy /= (rows - 1) * (cols - 1);
IyIy /= (rows - 1) * (cols - 1);
- score = IxIx * IyIy - IxIy * IxIy - 0.04 * (IxIx + IyIy) * (IxIx + IyIy);
+ score = (IxIx * IyIy - IxIy * IxIy + 0.0001) / (IxIx + IyIy + 0.0001);
return score;
}
#endif