ref: ee097c75ce15cbcf6603e1a47a7da36ce16185ce
parent: d69584261d90abe4430fc4ae70d95ad0b5219f5f
author: Dan Zhu <zxdan@google.com>
date: Fri Jun 28 10:07:44 EDT 2019
add flags for empty blocks Change-Id: Iedf3bdd87d203db5163d3cc47fcbef1fd002218f
--- a/tools/3D-Reconstruction/sketch_3D_reconstruction/MotionField.pde
+++ b/tools/3D-Reconstruction/sketch_3D_reconstruction/MotionField.pde
@@ -61,6 +61,9 @@
PVector mv = motion_field.get(i);
if (mv.z > 0) {
motion_field.set(i, new PVector(mv.x / mv.z, mv.y / mv.z, 0));
+ } else // there is nothing in the block, use -1 to mark it.
+ {
+ motion_field.set(i, new PVector(0.0, 0.0, -1));
}
}
}
@@ -85,7 +88,12 @@
mvs[i] = "";
for (int j = 0; j < c_num; j++) {
PVector mv = motion_field.get(i * c_num + j);
- mvs[i] += str(mv.x) + "," + str(mv.y);
+ if (mv.z != -1) {
+ mvs[i] += str(mv.x) + "," + str(mv.y);
+ } else // there is nothing
+ {
+ mvs[i] += "-,-";
+ }
if (j != c_num - 1) mvs[i] += ";";
}
}