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

#include <ObjectDataMap.h>

Inheritance diagram for core::ObjectDataMap:
core::ObjectData

Public Member Functions

 ObjectDataMap (size_t frame_index)
 
 ObjectDataMap (size_t frame_index, std::vector< std::string > keys, std::vector< double > value_list)
 
 ObjectDataMap (size_t frame_index, std::vector< std::string > keys, std::vector< double > value_list, std::vector< double > weight_list)
 
 ObjectDataMap (size_t frame_index, std::vector< std::string > keys, std::vector< std::pair< double, double >> value_weight_list)
 
double GetValue (std::string key)
 
double GetWeight (std::string key)
 
void Put (std::string key, double value, double weight)
 
void Put (std::string key, std::pair< double, double > value_weight)
 
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 ()
 
bool IsVirtual () const
 

Detailed Description

Stores a map of key-value-weight pairs. The weight is used to compare this object with other objects.

Constructor & Destructor Documentation

core::ObjectDataMap::ObjectDataMap ( size_t  frame_index)

Creates a new empty object data map.

Parameters
frame_indexThe index of the frame this object was detected in
core::ObjectDataMap::ObjectDataMap ( size_t  frame_index,
std::vector< std::string >  keys,
std::vector< double >  value_list 
)

Creates a object data map with the given keys and values and an equal weight for every value.

Parameters
frame_indexThe index of the frame this object was detected in
keysThe keys for the values to store
value_listThe values to store with the given keys
core::ObjectDataMap::ObjectDataMap ( size_t  frame_index,
std::vector< std::string >  keys,
std::vector< double >  value_list,
std::vector< double >  weight_list 
)

Creates a object data map with the given keys and values and an given weight for the corresponding key-value pair.

Parameters
frame_indexThe index of the frame this object was detected in
keysThe keys for the values to store
value_listThe values to store with the given keys
weight_listThe weights to store with the given key-value pairs
core::ObjectDataMap::ObjectDataMap ( size_t  frame_index,
std::vector< std::string >  keys,
std::vector< std::pair< double, double >>  value_weight_list 
)

Creates a object data map with the given keys and value-weight pairs.

Parameters
frame_indexThe index of the frame this object was detected in
keysThe keys for the values to store
value_weight_listThe value-weight-pairs to store with the keys

Member Function Documentation

double core::ObjectDataMap::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.

double core::ObjectDataMap::GetValue ( std::string  key)

Gets the value of the given key.

Parameters
keyThe key for the value
Returns
The value
double core::ObjectDataMap::GetWeight ( std::string  key)

Gets the weight of the given key.

Parameters
keyThe key for the value
Returns
The weight
ObjectDataPtr core::ObjectDataMap::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::ObjectDataMap::Put ( std::string  key,
double  value,
double  weight 
)

Stores the given value-weight pair with the given key. If the key is already stored it will be overridden with the new pair.

Parameters
keyThe key to store the value-weight pair at
valueThe value of the value-weight pair
weightThe weight of the value-weight pair
void core::ObjectDataMap::Put ( std::string  key,
std::pair< double, double >  value_weight 
)

Stores the given value-weight pair with the given key. If the key is already stored it will be overridden with the new pair.

Parameters
keyThe key to store the value-weight pair at
value_weightThe value-weight pair
void core::ObjectDataMap::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: