12#ifndef BOUNDING_BOX_TRACKING_H
13#define BOUNDING_BOX_TRACKING_H
16#include <opencv2/opencv.hpp>
31 enum class TrackerType
55 MultiTracker(
const double dTrackingLostTimeout = 1.0,
const double dMaxTrackingTime = 3.0,
const double dIOUThreshold = 0.3);
57 bool InitTracker(
const cv::Mat& cvFrame,
const std::shared_ptr<cv::Rect2d> cvBoundingBox,
const TrackerType eTrackerType = TrackerType::eKCF);
84 std::map<int, cv::Ptr<cv::Tracker>> m_mTrackers;
85 std::map<int, std::shared_ptr<cv::Rect2d>> m_mBoundingBoxes;
86 std::map<int, std::chrono::system_clock::time_point> m_mLastUpdateTime;
87 std::map<int, std::chrono::system_clock::time_point> m_mTimeSinceLastGroundTruthDetection;
88 double m_dTrackingLostThreshold;
89 double m_dMaxTrackingTime;
90 double m_dIOUThreshold;
Class for tracking multiple bounding boxes in images using OpenCV. This class supports all OpenCV tra...
Definition BoundingBoxTracking.h:49
cv::Ptr< cv::Tracker > CreateTracker(const TrackerType eType)
Create a tracker based on the specified type.
Definition BoundingBoxTracking.cpp:324
double GetTrackerLostTimeout() const
Get the timeout for when a tracker is considered lost.
Definition BoundingBoxTracking.cpp:277
double CalculateIOU(const cv::Rect2d &cvBoxA, const cv::Rect2d &cvBoxB)
Calculate the Intersection over Union (IoU) of two bounding boxes.
Definition BoundingBoxTracking.cpp:305
~MultiTracker()
Destroy the Multi Tracker object.
Definition BoundingBoxTracking.cpp:54
void SetTrackerLostTimeout(const double dTimeout)
Set the timeout for when a tracker is considered lost.
Definition BoundingBoxTracking.cpp:251
void SetMaxTrackingTime(const double dMaxTime)
Set the maximum tracking time for a tracker.
Definition BoundingBoxTracking.cpp:264
void Update(const cv::Mat &cvFrame)
Initialize the MultiTracker with a new frame and a vector of bounding boxes.
Definition BoundingBoxTracking.cpp:147
void ClearTrackers()
Clear all trackers and bounding boxes from the MultiTracker.
Definition BoundingBoxTracking.cpp:225
double GetMaxTrackingTime() const
Get the maximum tracking time for a tracker.
Definition BoundingBoxTracking.cpp:290
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.
Definition BoundingBoxTracking.cpp:71
std::shared_ptr< _Tp > Ptr
Namespace containing classes and functions for tracking bounding boxes in images.
Definition BoundingBoxTracking.cpp:27