leon 1 月之前
父节点
当前提交
95d3c37648
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/nodes/draw/drawNode.cpp

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

@@ -41,6 +41,8 @@ void DrawNode::work()
             printf("Node %s get data from %s\n", name_.c_str(), input_buffer.first.c_str());
             // do something
             cv::Mat image = metaData->image.clone();
+            int image_width = image.cols;
+            int image_height = image.rows;
             PositionManager<float> pm(getFontSize);
             for (auto& box : metaData->boxes)
             {
@@ -48,7 +50,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, 1920, 1080, box.label);
+                std::tie(x, y) = pm.selectOptimalPosition(pbox, image_width, image_height, box.label);
                 cv::putText(image, box.label, cv::Point(x, y), cv::FONT_HERSHEY_SIMPLEX, 1, cv::Scalar(0, 255, 0), 2);
             }
             metaData->draw_image = image;