Require target side and top edges to be perpendicular
Weird target from the sun wasn't rectangular. We can reject things that
aren't rectangular ish now, and that fixes it.
Change-Id: Iac1218c0fc1286758ec7602c29ac5c38c24ab831
diff --git a/y2019/vision/target_finder.cc b/y2019/vision/target_finder.cc
index 77806d5..5860e5c 100644
--- a/y2019/vision/target_finder.cc
+++ b/y2019/vision/target_finder.cc
@@ -518,7 +518,12 @@
// Closer targets can have a higher error because they are bigger.
const double acceptable_error =
std::max(2 * (75 - 12 * result->extrinsics.z), 75.0);
- if (result->solver_error < acceptable_error) {
+ if (!result->good_corners) {
+ if (verbose) {
+ printf("Rejecting a target with bad corners: (%f, %f)\n",
+ result->solver_error, result->backup_solver_error);
+ }
+ } else if (result->solver_error < acceptable_error) {
if (verbose) {
printf("Using an 8 point solve: %f < %f \n", result->solver_error,
acceptable_error);