15#include "../../interfaces/BasicCamera.hpp"
16#include "../../interfaces/ZEDCamera.hpp"
17#include "../../util/vision/BoundingBoxTracking.h"
18#include "../../util/vision/TagDetectionUtilty.hpp"
19#include "../../util/vision/YOLOModel.hpp"
23#include <shared_mutex>
52 const int nArucoCornerRefinementMaxIterations = 30,
54 const int nArucoMarkerBorderBits = 1,
55 const bool bArucoDetectInvertedMarkers =
false,
56 const bool bUseAruco3Detection =
false,
57 const bool bEnableTracking =
false,
58 const int nDetectorMaxFPS = 30,
59 const bool bEnableRecordingFlag =
false,
60 const int nNumDetectedTagsRetrievalThreads = 5,
61 const bool bUsingGpuMats =
false);
63 const int nArucoCornerRefinementMaxIterations = 30,
65 const int nArucoMarkerBorderBits = 1,
66 const bool bArucoDetectInvertedMarkers =
false,
67 const bool bUseAruco3Detection =
false,
68 const bool bEnableTracking =
false,
69 const int nDetectorMaxFPS = 30,
70 const bool bEnableRecordingFlag =
false,
71 const int nNumDetectedTagsRetrievalThreads = 5,
72 const bool bUsingGpuMats =
false);
77 yolomodel::pytorch::PyTorchInterpreter::HardwareDevices eDevice = yolomodel::pytorch::PyTorchInterpreter::HardwareDevices::eCUDA);
83 void EnableTorchDetection(
const float fMinObjectConfidence = 0.4f,
const float fNMSThreshold = 0.6f);
112 std::shared_ptr<Camera<cv::Mat>> m_pCamera;
116 std::shared_ptr<yolomodel::pytorch::PyTorchInterpreter> m_pTorchDetector;
117 std::atomic<float> m_fTorchMinObjectConfidence;
118 std::atomic<float> m_fTorchNMSThreshold;
119 std::atomic_bool m_bTorchInitialized;
120 std::atomic_bool m_bTorchEnabled;
121 std::shared_ptr<tracking::MultiTracker> m_pMultiTracker;
122 bool m_bUsingZedCamera;
123 bool m_bUsingGpuMats;
124 bool m_bCameraIsOpened;
125 bool m_bEnableTracking;
126 int m_nNumDetectedTagsRetrievalThreads;
127 std::string m_szCameraName;
128 std::atomic_bool m_bEnableRecordingFlag;
132 std::vector<tagdetectutils::ArucoTag> m_vNewlyDetectedTags;
133 std::vector<tagdetectutils::ArucoTag> m_vDetectedArucoTags;
148 std::queue<containers::FrameFetchContainer<cv::Mat>> m_qDetectedTagDrawnOverlayFramesCopySchedule;
149 std::queue<containers::DataFetchContainer<std::vector<tagdetectutils::ArucoTag>>> m_qDetectedArucoTagCopySchedule;
150 std::shared_mutex m_muPoolScheduleMutex;
151 std::shared_mutex m_muFrameCopyMutex;
152 std::shared_mutex m_muArucoDataCopyMutex;
Interface class used to easily multithread a child class.
Definition AutonomyThread.hpp:38
Run's Aruco detection & camera pose estimation in a multithreading environment. Given a camera,...
Definition TagDetector.h:46
bool GetEnableRecordingFlag() const
Accessor for the Enable Recording Flag private member.
Definition TagDetector.cpp:645
int GetDetectorMaxFPS() const
Accessor for the desired max FPS for this detector.
Definition TagDetector.cpp:630
void SetDetectorMaxFPS(const int nRecordingFPS)
Mutator for the desired max FPS for this detector.
Definition TagDetector.cpp:561
std::future< bool > RequestDetectionOverlayFrame(cv::Mat &cvFrame)
Request a copy of a frame containing the tag detection overlays from the aruco and tensorflow library...
Definition TagDetector.cpp:431
void SetEnableRecordingFlag(const bool bEnableRecordingFlag)
Mutator for the Enable Recording Flag private member.
Definition TagDetector.cpp:575
void EnableTorchDetection(const float fMinObjectConfidence=0.4f, const float fNMSThreshold=0.6f)
Turn on torch detection with given parameters.
Definition TagDetector.cpp:519
std::future< bool > RequestDetectedArucoTags(std::vector< tagdetectutils::ArucoTag > &vArucoTags)
Request the most up to date vector of detected tags from OpenCV's Aruco algorithm.
Definition TagDetector.cpp:458
~TagDetector()
Destroy the Tag Detector:: Tag Detector object.
Definition TagDetector.cpp:157
bool InitTorchDetection(const std::string &szModelPath, yolomodel::pytorch::PyTorchInterpreter::HardwareDevices eDevice=yolomodel::pytorch::PyTorchInterpreter::HardwareDevices::eCUDA)
Attempt to open the next available Torch hardware and load model at the given path onto the device.
Definition TagDetector.cpp:486
std::string GetCameraName()
Accessor for the camera name or path that this TagDetector is tied to.
Definition TagDetector.cpp:658
cv::Size GetProcessFrameResolution() const
Accessor for the resolution of the process image used for tag detection.
Definition TagDetector.cpp:671
void UpdateDetectedTags(std::vector< tagdetectutils::ArucoTag > &vNewlyDetectedTags)
Updates the detected torch tags including tracking the detected tags over time and removing tags that...
Definition TagDetector.cpp:695
void DisableTorchDetection()
Set flag to stop tag detection with the torch model.
Definition TagDetector.cpp:547
void ThreadedContinuousCode() override
This code will run continuously in a separate thread. New frames from the given camera are grabbed an...
Definition TagDetector.cpp:176
void PooledLinearCode() override
This method holds the code that is ran in the thread pool started by the ThreadedLinearCode() method....
Definition TagDetector.cpp:369
bool GetIsReady()
Accessor for the status of this TagDetector.
Definition TagDetector.cpp:589
This struct is used by the WaypointHandler to provide an easy way to store all pose data about the ro...
Definition GeospatialOperations.hpp:677