De-warp contours before starting the polygon finding.
Change-Id: I7889c8e5e9f826bef2317f4e7f3306bd65dc32f9
diff --git a/y2019/vision/target_sender.cc b/y2019/vision/target_sender.cc
index 2617d33..0afeb47 100644
--- a/y2019/vision/target_sender.cc
+++ b/y2019/vision/target_sender.cc
@@ -309,9 +309,11 @@
bool verbose = false;
std::vector<std::vector<Segment<2>>> raw_polys;
for (const RangeImage &blob : imgs) {
- std::vector<Segment<2>> polygon = finder_.FillPolygon(blob, verbose);
- if (polygon.empty()) {
- } else {
+ // Convert blobs to contours in the corrected space.
+ ContourNode* contour = finder_.GetContour(blob);
+ finder_.UnWarpContour(contour);
+ std::vector<Segment<2>> polygon = finder_.FillPolygon(contour, verbose);
+ if (!polygon.empty()) {
raw_polys.push_back(polygon);
}
}