Put all the thresholding code in the same place
This will make it easier to write tests validating the fast version.
Change-Id: I27cc372cc848c495d10a138b3c149d550dc0dad9
diff --git a/y2017/vision/target_finder.cc b/y2017/vision/target_finder.cc
index a6b049c..91e801e 100644
--- a/y2017/vision/target_finder.cc
+++ b/y2017/vision/target_finder.cc
@@ -103,17 +103,18 @@
}
aos::vision::RangeImage TargetFinder::Threshold(aos::vision::ImagePtr image) {
- return aos::vision::DoThreshold(image, [&](aos::vision::PixelRef &px) {
- if (px.g > 88) {
- uint8_t min = std::min(px.b, px.r);
- uint8_t max = std::max(px.b, px.r);
- if (min >= px.g || max >= px.g) return false;
- uint8_t a = px.g - min;
- uint8_t b = px.g - max;
- return (a > 10 && b > 10);
- }
- return false;
- });
+ return aos::vision::ThresholdImageWithFunction(
+ image, [&](aos::vision::PixelRef px) {
+ if (px.g > 88) {
+ uint8_t min = std::min(px.b, px.r);
+ uint8_t max = std::max(px.b, px.r);
+ if (min >= px.g || max >= px.g) return false;
+ uint8_t a = px.g - min;
+ uint8_t b = px.g - max;
+ return (a > 10 && b > 10);
+ }
+ return false;
+ });
}
void TargetFinder::PreFilter(BlobList &imgs) {