|
@@ -9,6 +9,13 @@
|
|
|
namespace GNode
|
|
|
{
|
|
|
|
|
|
+const std::vector<std::pair<int, int>> coco_pairs = {
|
|
|
+ {0, 1}, {0, 2}, {0, 11}, {0, 12}, {1, 3}, {2, 4},
|
|
|
+ {5, 6}, {5, 7}, {7, 9}, {6, 8}, {8, 10},
|
|
|
+ {11, 12}, {5, 11}, {6, 12},
|
|
|
+ {11, 13}, {13, 15}, {12, 14}, {14, 16}
|
|
|
+};
|
|
|
+
|
|
|
static std::tuple<int, int, int> getFontSize(const std::string& text)
|
|
|
{
|
|
|
int baseline = 0;
|
|
@@ -126,6 +133,28 @@ void DrawNode::handle_data(std::shared_ptr<meta::MetaData>& meta_data)
|
|
|
{
|
|
|
overlay_mask(image, box.seg_mask, box.left, box.top, cv::Scalar(b, g, r), 0.6);
|
|
|
}
|
|
|
+ if (!box.keypoints.empty())
|
|
|
+ {
|
|
|
+ for (const auto& point : box.keypoints)
|
|
|
+ {
|
|
|
+ std::tie(b, g, r) = random_color(box.class_id);
|
|
|
+ cv::circle(image, cv::Point(point.x, point.y), 5, cv::Scalar(b, g, r), -1);
|
|
|
+ }
|
|
|
+ for (const auto& pair : coco_pairs)
|
|
|
+ {
|
|
|
+ int startIdx = pair.first;
|
|
|
+ int endIdx = pair.second;
|
|
|
+
|
|
|
+ if (startIdx < obj.keypoints.size() && endIdx < obj.keypoints.size())
|
|
|
+ {
|
|
|
+ int x1 = (int)obj.keypoints[startIdx].x;
|
|
|
+ int y1 = (int)obj.keypoints[startIdx].y;
|
|
|
+ int x2 = (int)obj.keypoints[endIdx].x;
|
|
|
+ int y2 = (int)obj.keypoints[endIdx].y;
|
|
|
+ cv::line(image, cv::Point(x1, y1), cv::Point(x2, y2), cv::Scalar(255, 0, 0), 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
meta_data->draw_image = image;
|
|
|
}
|