Browse Source

添加置信度画图

leon 1 month ago
parent
commit
0017e4bd0a
2 changed files with 2 additions and 1 deletions
  1. 1 1
      src/main.cpp
  2. 1 0
      src/nodes/draw/drawNode.cpp

+ 1 - 1
src/main.cpp

@@ -23,7 +23,7 @@ int main()
     //     "toothbrush"
     // }; 
 
-    std::vector<std::string> names = {"person", "clothes", "vest" };
+    std::vector<std::string> names = { "person", "clothes", "vest" };
 
     std::shared_ptr<Node::StreamNode> src_node0   = std::make_shared<Node::StreamNode>("src0", "rtsp://admin:lww123456@172.16.22.16:554/Streaming/Channels/101", 0, Node::DecodeType::GPU);
     src_node0->set_skip_frame(10);

+ 1 - 0
src/nodes/draw/drawNode.cpp

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