Detect ArUco tags in the provided image using a YOLO DNN model.
49 {
50
52 {
53
54 LOG_ERROR(logging::g_qSharedLogger, "Detect() requires a RGB image.");
55 return {};
56 }
57
58
59 std::vector<tagdetectutils::ArucoTag> vDetectedTags;
60
61
63 {
64
65 std::vector<yolomodel::Detection> vOutputTensorTags = trPyTorchDetector.
Inference(cvFrame, fMinObjectConfidence, fNMSThreshold);
66
67
69 {
70
72 stDetectedTag.dConfidence = stTagDetection.fConfidence;
73 stDetectedTag.pBoundingBox = std::make_shared<cv::Rect2d>(stTagDetection.cvBoundingBox);
74 stDetectedTag.nID = stTagDetection.nClassID;
75 stDetectedTag.szClassName = stTagDetection.szClassName;
76 stDetectedTag.eDetectionMethod = tagdetectutils::TagDetectionMethod::eTorch;
77 stDetectedTag.cvImageResolution = cvFrame.
size();
78
79
80 vDetectedTags.emplace_back(stDetectedTag);
81 }
82 }
83 else
84 {
85
86 LOG_WARNING(logging::g_qSharedLogger,
87 "TorchDetect: Unable to detect tags using YOLO torch detection because hardware is not opened or model is not initialized.");
88 }
89
90
91 return vDetectedTags;
92 }
bool IsReadyForInference() const
Check if the model is ready for inference.
Definition YOLOModel.hpp:946
std::vector< Detection > Inference(const cv::Mat &cvInputFrame, const float fMinObjectConfidence=0.85, const float fNMSThreshold=0.6)
Given an input image forward the image through the YOLO model to run inference on the PyTorch model,...
Definition YOLOModel.hpp:859
Represents a single ArUco tag. Combines attributes from TorchTag, TensorflowTag, and the original Aru...
Definition TagDetectionUtilty.hpp:59
This struct is used to.
Definition YOLOModel.hpp:45