|
@@ -42,8 +42,17 @@ void DrawNode::work()
|
|
|
|
|
|
std::tuple<int, int, int, int> pbox = std::make_tuple(box.left, box.top, box.right, box.bottom);
|
|
std::tuple<int, int, int, int> pbox = std::make_tuple(box.left, box.top, box.right, box.bottom);
|
|
int x, y;
|
|
int x, y;
|
|
- std::tie(x, y) = pm.selectOptimalPosition(pbox, image_width, image_height, box.label);
|
|
|
|
- std::string text = str_format("%s %.2f id=%d", box.label.c_str(), box.score, box.track_id);
|
|
|
|
|
|
+ std::string text;
|
|
|
|
+ if (box.track_id != -1)
|
|
|
|
+ {
|
|
|
|
+ text = str_format("%s %.2f id=%d", box.label.c_str(), box.score, box.track_id);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ text = str_format("%s %.2f", box.label.c_str(), box.score);
|
|
|
|
+ }
|
|
|
|
+ std::tie(x, y) = pm.selectOptimalPosition(pbox, image_width, image_height, text);
|
|
|
|
+
|
|
cv::putText(image, text, cv::Point(x, y), cv::FONT_HERSHEY_SIMPLEX, 1, cv::Scalar(0, 255, 0), 2);
|
|
cv::putText(image, text, cv::Point(x, y), cv::FONT_HERSHEY_SIMPLEX, 1, cv::Scalar(0, 255, 0), 2);
|
|
}
|
|
}
|
|
metaData->draw_image = image;
|
|
metaData->draw_image = image;
|