Stick blob results into a flatbuffer
subscibed to this in viewer
Signed-off-by: Henry Speiser <henry@speiser.net>
Change-Id: I5ea9a3b8ab31ea7c8e9351469ba80de9c6cc3d2a
Signed-off-by: Henry Speiser <henry@speiser.net>
diff --git a/y2022/vision/blob_detector.cc b/y2022/vision/blob_detector.cc
index 8ac96cd..aba3550 100644
--- a/y2022/vision/blob_detector.cc
+++ b/y2022/vision/blob_detector.cc
@@ -65,9 +65,10 @@
const double aspect_ratio =
static_cast<double>(blob_size.width) / blob_size.height;
const double area = moments.m00;
- const size_t points = blob.size();
+ const size_t num_points = blob.size();
- blob_stats.emplace_back(BlobStats{centroid, aspect_ratio, area, points});
+ blob_stats.emplace_back(
+ BlobStats{centroid, aspect_ratio, area, num_points});
}
return blob_stats;
}
@@ -185,7 +186,7 @@
if ((stats_it->centroid.y <= kMaxY) &&
(std::abs(kTapeAspectRatio - stats_it->aspect_ratio) <
kAspectRatioThreshold) &&
- (stats_it->area >= kMinArea) && (stats_it->points >= kMinPoints)) {
+ (stats_it->area >= kMinArea) && (stats_it->num_points >= kMinPoints)) {
filtered_blobs.push_back(*blob_it);
filtered_stats.push_back(*stats_it);
}
@@ -293,7 +294,7 @@
}
void BlobDetector::ExtractBlobs(
- cv::Mat rgb_image, cv::Mat &binarized_image, cv::Mat blob_image,
+ cv::Mat rgb_image, cv::Mat &binarized_image,
std::vector<std::vector<cv::Point>> &filtered_blobs,
std::vector<std::vector<cv::Point>> &unfiltered_blobs,
std::vector<BlobStats> &blob_stats, cv::Point ¢roid) {
@@ -308,7 +309,6 @@
LOG(INFO) << "Blob detection elapsed time: "
<< std::chrono::duration<double, std::milli>(end - start).count()
<< " ms";
- DrawBlobs(blob_image, unfiltered_blobs, filtered_blobs, blob_stats, centroid);
}
} // namespace vision