![]() |
Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
|
Class for tracking multiple bounding boxes in images using OpenCV. This class supports all OpenCV tracking algorithms and can be used to track multiple objects in a single image or video stream. More...
#include <BoundingBoxTracking.h>
Public Member Functions | |
MultiTracker (const double dTrackingLostTimeout=1.0, const double dMaxTrackingTime=3.0, const double dIOUThreshold=0.3) | |
Construct a new Multi Tracker object. | |
~MultiTracker () | |
Destroy the Multi Tracker object. | |
bool | InitTracker (const cv::Mat &cvFrame, const std::shared_ptr< cv::Rect2d > cvBoundingBox, const TrackerType eTrackerType=TrackerType::eKCF) |
Add a new tracker for a given frame and bounding box. | |
void | Update (const cv::Mat &cvFrame) |
Initialize the MultiTracker with a new frame and a vector of bounding boxes. | |
void | ClearTrackers () |
Clear all trackers and bounding boxes from the MultiTracker. | |
void | SetTrackerLostTimeout (const double dTimeout) |
Set the timeout for when a tracker is considered lost. | |
void | SetMaxTrackingTime (const double dMaxTime) |
Set the maximum tracking time for a tracker. | |
double | GetTrackerLostTimeout () const |
Get the timeout for when a tracker is considered lost. | |
double | GetMaxTrackingTime () const |
Get the maximum tracking time for a tracker. | |
Private Member Functions | |
double | CalculateIOU (const cv::Rect2d &cvBoxA, const cv::Rect2d &cvBoxB) |
Calculate the Intersection over Union (IoU) of two bounding boxes. | |
cv::Ptr< cv::Tracker > | CreateTracker (const TrackerType eType) |
Create a tracker based on the specified type. | |
Private Attributes | |
std::map< int, cv::Ptr< cv::Tracker > > | m_mTrackers |
std::map< int, std::shared_ptr< cv::Rect2d > > | m_mBoundingBoxes |
std::map< int, std::chrono::system_clock::time_point > | m_mLastUpdateTime |
std::map< int, std::chrono::system_clock::time_point > | m_mTimeSinceLastGroundTruthDetection |
double | m_dTrackingLostThreshold |
double | m_dMaxTrackingTime |
double | m_dIOUThreshold |
int | m_nNextId |
Class for tracking multiple bounding boxes in images using OpenCV. This class supports all OpenCV tracking algorithms and can be used to track multiple objects in a single image or video stream.
tracking::MultiTracker::MultiTracker | ( | const double | dTrackingLostThreshold = 1.0 , |
const double | dMaxTrackingTime = 3.0 , |
||
const double | dIOUThreshold = 0.3 |
||
) |
Construct a new Multi Tracker object.
dTrackingLostThreshold | - The time in seconds after which a tracker is considered lost (default is 1.0). |
dMaxTrackingTime | - The maximum time in seconds a tracker can be lost before being removed (default is 3.0). |
dIOUThreshold | - The minimum Intersection over Union (IoU) required to associate a new detection with an existing tracker (default is 0.3). |
tracking::MultiTracker::~MultiTracker | ( | ) |
Destroy the Multi Tracker object.
bool tracking::MultiTracker::InitTracker | ( | const cv::Mat & | cvFrame, |
const std::shared_ptr< cv::Rect2d > | cvBoundingBox, | ||
const TrackerType | eTrackerType = TrackerType::eKCF |
||
) |
Add a new tracker for a given frame and bounding box.
cvFrame | - The frame to initialize the tracker with. |
cvBoundingBox | - The bounding box (cv::Rect2d) for the object to track. |
eTrackerType | - The type of tracker to use (default is KCF). |
void tracking::MultiTracker::Update | ( | const cv::Mat & | cvFrame | ) |
Initialize the MultiTracker with a new frame and a vector of bounding boxes.
cvFrame | - The initial frame to track objects in. |
void tracking::MultiTracker::ClearTrackers | ( | ) |
Clear all trackers and bounding boxes from the MultiTracker.
void tracking::MultiTracker::SetTrackerLostTimeout | ( | const double | dTimeout | ) |
Set the timeout for when a tracker is considered lost.
dTimeout | - The time in seconds after which a tracker is considered lost. |
void tracking::MultiTracker::SetMaxTrackingTime | ( | const double | dMaxTime | ) |
Set the maximum tracking time for a tracker.
dMaxTime | - The maximum time in seconds a tracker can be lost before being removed. |
double tracking::MultiTracker::GetTrackerLostTimeout | ( | ) | const |
Get the timeout for when a tracker is considered lost.
double tracking::MultiTracker::GetMaxTrackingTime | ( | ) | const |
Get the maximum tracking time for a tracker.
|
private |
Calculate the Intersection over Union (IoU) of two bounding boxes.
cvBoxA | - The first bounding box (cv::Rect2d). |
cvBoxB | - The second bounding box (cv::Rect2d). |
|
private |
Create a tracker based on the specified type.
eType | - The type of tracker to create (eMIL, eKCF, eGOTURN, eCSRT). |