Tracore
Public Member Functions | List of all members
core::Tracklet Class Reference

#include <Tracklet.h>

Inheritance diagram for core::Tracklet:
core::ObjectData

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
 
- Public Member Functions inherited from core::ObjectData
 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
 

Detailed Description

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.

Constructor & Destructor Documentation

core::Tracklet::Tracklet ( )

Creates a empty tracklet to store path object in. This is NOT a virtual object.

Member Function Documentation

void core::Tracklet::AddPathObject ( ObjectDataPtr  obj,
bool  overwrite = false 
)

Adds the path object sorted into the tracklet.

Parameters
objThe path object to add
overwriteIf 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

Parameters
otherThe tracklet to copy the detections from
double core::Tracklet::CompareTo ( ObjectDataPtr  obj) const
overridevirtual

Compares this object with the given object.

Parameters
objA pointer to the object to compare this object to
Returns
A double value indicating the comparison result

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.

Returns
The lowest frame index
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.

Parameters
frame_indexThe index of the frame to take the detection from
Returns
A pointer to the detection in the given frame
size_t core::Tracklet::GetLastFrameIndex ( ) const

Gets the highest frame index of all path objects.

Returns
The highest frame index
ObjectDataPtr core::Tracklet::GetPathObject ( size_t  i)

Gets the path object at the given index. The index is NOT the frame index

Returns
A pointer to the path object
size_t core::Tracklet::GetPathObjectCount ( ) const

Gets the count of all path objects.

Returns
The path object count
ObjectDataPtr core::Tracklet::Interpolate ( ObjectDataPtr  obj,
double  fraction 
) const
overridevirtual

Linearly interpolates between this and the given object. Creates a new object to fit between the two objects.

Parameters
objA pointer to the target object
fractionDescribes 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.
Returns
The interpolated 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.

Parameters
imageThe image to write into
colorThe color to use
frameThe frame index to visualize the path objects from
predecessor_countThe number of path objects to visualize before the given frame
successor_countThe number of path objects to visualize after the given frame
void core::Tracklet::Visualize ( cv::Mat &  image,
cv::Scalar &  color 
) const
overridevirtual

Visualizes the object in the given image with the given color. This method does nothing, it needs to be overwritten to visualize something.

Parameters
imageThe image to write into
colorThe color to use

Reimplemented from core::ObjectData.


The documentation for this class was generated from the following files: