Limit blob debug output in 2022 camera_reader
If we got a huge number of blobs, camera reader would crash because of
trying to allocate too large of a flatbuffer message.
Also, the TargetEstimate message does need to make it across the network
without too high of latency, so excessive debug information in it would
be sub-optimal.
Change-Id: I394c909b4c66940451b3ea2b90f6dc8d383420f6
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/y2022/vision/blob_detector.cc b/y2022/vision/blob_detector.cc
index 6949dd0..2d5ae63 100644
--- a/y2022/vision/blob_detector.cc
+++ b/y2022/vision/blob_detector.cc
@@ -221,8 +221,10 @@
cv::Scalar(0, 0, 255), 0);
}
- cv::drawContours(view_image, blob_result.filtered_blobs, -1,
- cv::Scalar(0, 100, 0), cv::FILLED);
+ if (blob_result.filtered_blobs.size() > 0) {
+ cv::drawContours(view_image, blob_result.filtered_blobs, -1,
+ cv::Scalar(0, 100, 0), cv::FILLED);
+ }
static constexpr double kCircleRadius = 2.0;
// Draw blob centroids