Skip to content

Commit 0e6d19c

Browse files
authored
Rescale detections to input image (luxonis#606)
1 parent 97d9854 commit 0e6d19c

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

depthai_ros_driver/include/depthai_ros_driver/dai_nodes/nn/detection.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ class Detection : public BaseNode {
6565
if(ph->getParam<bool>("i_disable_resize")) {
6666
width = ph->getOtherNodeParam<int>(socketName, "i_preview_width");
6767
height = ph->getOtherNodeParam<int>(socketName, "i_preview_height");
68+
} else if(ph->getParam<bool>("i_desqueeze_output")) {
69+
width = ph->getOtherNodeParam<int>(socketName, "i_width");
70+
height = ph->getOtherNodeParam<int>(socketName, "i_height");
6871
} else {
6972
width = imageManip->initialConfig.getResizeConfig().width;
7073
height = imageManip->initialConfig.getResizeConfig().height;
@@ -132,6 +135,7 @@ class Detection : public BaseNode {
132135
ptPub = setupOutput(pipeline, ptQName, [&](dai::Node::Input input) { detectionNode->passthrough.link(input); });
133136
}
134137
};
138+
135139
/**
136140
* @brief Closes the queues for the DetectionNetwork node and the passthrough.
137141
*/

depthai_ros_driver/include/depthai_ros_driver/param_handlers/nn_param_handler.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class NNParamHandler : public BaseParamHandler {
4040
template <typename T>
4141
void declareParams(std::shared_ptr<T> nn, std::shared_ptr<dai::node::ImageManip> imageManip) {
4242
declareAndLogParam<bool>("i_disable_resize", false);
43+
declareAndLogParam<bool>("i_desqueeze_output", false);
4344
declareAndLogParam<bool>("i_enable_passthrough", false);
4445
declareAndLogParam<bool>("i_enable_passthrough_depth", false);
4546
declareAndLogParam<bool>("i_get_base_device_timestamp", false);

depthai_ros_driver/src/dai_nodes/nn/nn_wrapper.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ NNWrapper::NNWrapper(const std::string& daiNodeName,
2020
auto family = ph->getNNFamily();
2121
switch(family) {
2222
case param_handlers::nn::NNFamily::Yolo: {
23-
nnNode = std::make_unique<dai_nodes::nn::Detection<dai::node::YoloDetectionNetwork>>(getName(), getROSNode(), pipeline);
23+
nnNode = std::make_unique<dai_nodes::nn::Detection<dai::node::YoloDetectionNetwork>>(getName(), getROSNode(), pipeline, socket);
2424
break;
2525
}
2626
case param_handlers::nn::NNFamily::Mobilenet: {
27-
nnNode = std::make_unique<dai_nodes::nn::Detection<dai::node::MobileNetDetectionNetwork>>(getName(), getROSNode(), pipeline);
27+
nnNode = std::make_unique<dai_nodes::nn::Detection<dai::node::MobileNetDetectionNetwork>>(getName(), getROSNode(), pipeline, socket);
2828
break;
2929
}
3030
case param_handlers::nn::NNFamily::Segmentation: {
31-
nnNode = std::make_unique<dai_nodes::nn::Segmentation>(getName(), getROSNode(), pipeline);
31+
nnNode = std::make_unique<dai_nodes::nn::Segmentation>(getName(), getROSNode(), pipeline, socket);
3232
break;
3333
}
3434
}

0 commit comments

Comments
 (0)