From d572a1b99c19aebc1e25a89f1f37d2cceccc99d0 Mon Sep 17 00:00:00 2001 From: Myron Rodrigues Date: Fri, 27 Sep 2024 19:02:51 +0000 Subject: [PATCH] allow setting input height --- .../depthai_ros_driver/dai_nodes/nn/detection.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/depthai_ros_driver/include/depthai_ros_driver/dai_nodes/nn/detection.hpp b/depthai_ros_driver/include/depthai_ros_driver/dai_nodes/nn/detection.hpp index 3986f6c4..306f2a82 100644 --- a/depthai_ros_driver/include/depthai_ros_driver/dai_nodes/nn/detection.hpp +++ b/depthai_ros_driver/include/depthai_ros_driver/dai_nodes/nn/detection.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "depthai-shared/common/CameraBoardSocket.hpp" #include "depthai/device/DataQueue.hpp" @@ -65,6 +66,9 @@ class Detection : public BaseNode { if(ph->getParam("i_disable_resize")) { width = ph->getOtherNodeParam(socketName, "i_preview_width"); height = ph->getOtherNodeParam(socketName, "i_preview_height"); + } else if(inputWidth.has_value() && inputHeight.has_value()) { + width = inputWidth.value(); + height = inputHeight.value(); } else { width = imageManip->initialConfig.getResizeConfig().width; height = imageManip->initialConfig.getResizeConfig().height; @@ -132,6 +136,12 @@ class Detection : public BaseNode { ptPub = setupOutput(pipeline, ptQName, [&](dai::Node::Input input) { detectionNode->passthrough.link(input); }); } }; + + void setInputDimensions(int width, int height) + { + inputWidth = width; + inputHeight = height; + } /** * @brief Closes the queues for the DetectionNetwork node and the passthrough. */ @@ -173,6 +183,7 @@ class Detection : public BaseNode { std::shared_ptr nnQ, ptQ; std::shared_ptr xoutNN; std::string nnQName, ptQName; + std::optional inputWidth, inputHeight; }; } // namespace nn