Add confidence to game piece detector's visualization
Signed-off-by: Filip Kujawa <filip.j.kujawa@gmail.com>
Change-Id: I30490979a5ec03b25443aaa0ebbd55333a61ef98
diff --git a/y2023/vision/yolov5.cc b/y2023/vision/yolov5.cc
index 473437c..7df4ffb 100644
--- a/y2023/vision/yolov5.cc
+++ b/y2023/vision/yolov5.cc
@@ -285,10 +285,13 @@
<< " H: " << filtered_detections[i].box.height;
cv::rectangle(frame, filtered_detections[i].box, cv::Scalar(255, 0, 0),
2);
+
cv::putText(
- frame, std::to_string(filtered_detections[i].class_id),
+ frame,
+ "#" + std::to_string(filtered_detections[i].class_id) + " at " +
+ std::to_string(filtered_detections[i].confidence) + " confidence",
cv::Point(filtered_detections[i].box.x, filtered_detections[i].box.y),
- cv::FONT_HERSHEY_COMPLEX, 1.0, cv::Scalar(0, 0, 255), 1, cv::LINE_AA);
+ cv::FONT_HERSHEY_COMPLEX, 1.0, cv::Scalar(0, 0, 255), 2, cv::LINE_AA);
}
cv::cvtColor(frame, frame, cv::COLOR_BGR2RGB);
cv::imshow("yolo", frame);