Tracore
|
#include <Tracklet.h>
Public Member Functions | |
Tracklet () | |
void | AddPathObject (ObjectDataPtr obj, bool overwrite=false) |
size_t | GetFirstFrameIndex () const |
size_t | GetLastFrameIndex () const |
ObjectDataPtr | GetPathObject (size_t i) |
size_t | GetPathObjectCount () const |
void | InterpolateMissingFrames () |
void | Visualize (cv::Mat &image, cv::Scalar &color, size_t frame, size_t predecessor_count, size_t successor_count) const |
void | Flatten () |
void | Combine (TrackletPtr other) |
ObjectDataPtr | GetFrameObject (size_t frame_index) |
virtual double | CompareTo (ObjectDataPtr obj) const override |
virtual ObjectDataPtr | Interpolate (ObjectDataPtr obj, double fraction) const override |
virtual void | Visualize (cv::Mat &image, cv::Scalar &color) const override |
![]() | |
ObjectData () | |
ObjectData (std::size_t frame_index) | |
std::size_t | GetFrameIndex () const |
void | SetFrameIndex (size_t index) |
void | SetDetectionScore (double score) |
double | GetDetectionScore () const |
bool | IsVirtual () const |
virtual bool | IsWithinConstraints (ObjectDataPtr obj, std::unordered_map< std::string, double > &constraints) const |
virtual std::string | ToString (char delimiter) const |
A class for storing multiple object data objects. The object data objects are handled as a path. All objects are stored sorted ascending by their frame index.
core::Tracklet::Tracklet | ( | ) |
Creates a empty tracklet to store path object in. This is NOT a virtual object.
void core::Tracklet::AddPathObject | ( | ObjectDataPtr | obj, |
bool | overwrite = false |
||
) |
Adds the path object sorted into the tracklet.
obj | The path object to add |
overwrite | If true and an object in the same frame as the given object already exists, the old one will be replaced by the new one |
void core::Tracklet::Combine | ( | TrackletPtr | other | ) |
Copies all detections from the specified tracklet to this tracklet
other | The tracklet to copy the detections from |
|
overridevirtual |
Compares this object with the given object.
obj | A pointer to the object to compare this object to |
Reimplemented from core::ObjectData.
void core::Tracklet::Flatten | ( | ) |
Flattens the current tracklet one level. That means, that if this tracklet contains other tracklets as path objects, their path objects are all extracted and used as the new path objects of this tracklet. The old tracklet path objects are removed.
size_t core::Tracklet::GetFirstFrameIndex | ( | ) | const |
Gets the lowest frame index of all path objects.
ObjectDataPtr core::Tracklet::GetFrameObject | ( | size_t | frame_index | ) |
Gets the detected object at the given frame index or a nullptr if there is not detection.
frame_index | The index of the frame to take the detection from |
size_t core::Tracklet::GetLastFrameIndex | ( | ) | const |
Gets the highest frame index of all path objects.
ObjectDataPtr core::Tracklet::GetPathObject | ( | size_t | i | ) |
Gets the path object at the given index. The index is NOT the frame index
size_t core::Tracklet::GetPathObjectCount | ( | ) | const |
Gets the count of all path objects.
|
overridevirtual |
Linearly interpolates between this and the given object. Creates a new object to fit between the two objects.
obj | A pointer to the target object |
fraction | Describes where the interpolation should be done. A fraction of zero is a clone of this object, a fraction of one is a clone of the target object. |
Reimplemented from core::ObjectData.
void core::Tracklet::InterpolateMissingFrames | ( | ) |
Interpolates between the current path objects until every missing frame has an object. Only frames between the first frame index and the last frame index are interpolated.
void core::Tracklet::Visualize | ( | cv::Mat & | image, |
cv::Scalar & | color, | ||
size_t | frame, | ||
size_t | predecessor_count, | ||
size_t | successor_count | ||
) | const |
Visualizes the tracklet by visualizing the path object in the given frame and the number of path objects in the given range before and after the given frame.
image | The image to write into |
color | The color to use |
frame | The frame index to visualize the path objects from |
predecessor_count | The number of path objects to visualize before the given frame |
successor_count | The number of path objects to visualize after the given frame |
|
overridevirtual |
Visualizes the object in the given image with the given color. This method does nothing, it needs to be overwritten to visualize something.
image | The image to write into |
color | The color to use |
Reimplemented from core::ObjectData.