Public Member Functions | Protected Attributes | List of all members
ov_core::FeatureDatabase Class Reference

Database containing features we are currently tracking. More...

#include <FeatureDatabase.h>

Public Member Functions

void append_new_measurements (const std::shared_ptr< FeatureDatabase > &database)
 Will update the passed database with this database's latest feature information. More...
 
void cleanup ()
 This function will delete all features that have been used up. More...
 
void cleanup_measurements (double timestamp)
 This function will delete all feature measurements that are older then the specified timestamp. More...
 
void cleanup_measurements_exact (double timestamp)
 This function will delete all feature measurements that are at the specified timestamp. More...
 
 FeatureDatabase ()
 Default constructor. More...
 
std::vector< std::shared_ptr< Feature > > features_containing (double timestamp, bool remove=false, bool skip_deleted=false)
 Get features that has measurements at the specified time. More...
 
std::vector< std::shared_ptr< Feature > > features_containing_older (double timestamp, bool remove=false, bool skip_deleted=false)
 Get features that has measurements older then the specified time. More...
 
std::vector< std::shared_ptr< Feature > > features_not_containing_newer (double timestamp, bool remove=false, bool skip_deleted=false)
 Get features that do not have newer measurement then the specified time. More...
 
std::shared_ptr< Featureget_feature (size_t id, bool remove=false)
 Get a specified feature. More...
 
bool get_feature_clone (size_t id, Feature &feat)
 Get a specified feature clone (pointer is thread safe) More...
 
std::unordered_map< size_t, std::shared_ptr< Feature > > get_internal_data ()
 Returns the internal data (should not normally be used) More...
 
double get_oldest_timestamp ()
 Gets the oldest time in the database. More...
 
size_t size ()
 Returns the size of the feature database. More...
 
void update_feature (size_t id, double timestamp, size_t cam_id, float u, float v, float u_n, float v_n)
 Update a feature object. More...
 

Protected Attributes

std::unordered_map< size_t, std::shared_ptr< Feature > > features_idlookup
 Our lookup array that allow use to query based on ID. More...
 
std::mutex mtx
 Mutex lock for our map. More...
 

Detailed Description

Database containing features we are currently tracking.

Each visual tracker has this database in it and it contains all features that we are tracking. The trackers will insert information into this database when they get new measurements from doing tracking. A user would then query this database for features that can be used for update and remove them after they have been processed.

@m_class{m-note m-warning}

A Note on Multi-Threading Support
There is some support for asynchronous multi-threaded access. Since each feature is a pointer just directly returning and using them is not thread safe. Thus, to be thread safe, use the "remove" flag for each function which will remove it from this feature database. This prevents the trackers from adding new measurements and editing the feature information. For example, if you are asynchronous tracking cameras and you chose to update the state, then remove all features you will use in update. The feature trackers will continue to add features while you update, whose measurements can be used in the next update step!

Definition at line 54 of file FeatureDatabase.h.

Constructor & Destructor Documentation

◆ FeatureDatabase()

ov_core::FeatureDatabase::FeatureDatabase ( )
inline

Default constructor.

Definition at line 60 of file FeatureDatabase.h.

Member Function Documentation

◆ append_new_measurements()

void FeatureDatabase::append_new_measurements ( const std::shared_ptr< FeatureDatabase > &  database)

Will update the passed database with this database's latest feature information.

Definition at line 278 of file FeatureDatabase.cpp.

◆ cleanup()

void FeatureDatabase::cleanup ( )

This function will delete all features that have been used up.

If a feature was unable to be used, it will still remain since it will not have a delete flag set

Definition at line 211 of file FeatureDatabase.cpp.

◆ cleanup_measurements()

void FeatureDatabase::cleanup_measurements ( double  timestamp)

This function will delete all feature measurements that are older then the specified timestamp.

Definition at line 226 of file FeatureDatabase.cpp.

◆ cleanup_measurements_exact()

void FeatureDatabase::cleanup_measurements_exact ( double  timestamp)

This function will delete all feature measurements that are at the specified timestamp.

Definition at line 245 of file FeatureDatabase.cpp.

◆ features_containing()

std::vector< std::shared_ptr< Feature > > FeatureDatabase::features_containing ( double  timestamp,
bool  remove = false,
bool  skip_deleted = false 
)

Get features that has measurements at the specified time.

This function will return all features that have the specified time in them. This would be used to get all features that occurred at a specific clone/state.

Definition at line 169 of file FeatureDatabase.cpp.

◆ features_containing_older()

std::vector< std::shared_ptr< Feature > > FeatureDatabase::features_containing_older ( double  timestamp,
bool  remove = false,
bool  skip_deleted = false 
)

Get features that has measurements older then the specified time.

This will collect all features that have measurements occurring before the specified timestamp. For example, we would want to remove all features older then the last clone/state in our sliding window.

Definition at line 128 of file FeatureDatabase.cpp.

◆ features_not_containing_newer()

std::vector< std::shared_ptr< Feature > > FeatureDatabase::features_not_containing_newer ( double  timestamp,
bool  remove = false,
bool  skip_deleted = false 
)

Get features that do not have newer measurement then the specified time.

This function will return all features that do not a measurement at a time greater than the specified time. For example this could be used to get features that have not been successfully tracked into the newest frame. All features returned will not have any measurements occurring at a time greater then the specified.

Definition at line 87 of file FeatureDatabase.cpp.

◆ get_feature()

std::shared_ptr< Feature > FeatureDatabase::get_feature ( size_t  id,
bool  remove = false 
)

Get a specified feature.

Parameters
idWhat feature we want to get
removeSet to true if you want to remove the feature from the database (you will need to handle the freeing of memory)
Returns
Either a feature object, or null if it is not in the database.

Definition at line 29 of file FeatureDatabase.cpp.

◆ get_feature_clone()

bool FeatureDatabase::get_feature_clone ( size_t  id,
Feature feat 
)

Get a specified feature clone (pointer is thread safe)

Parameters
idWhat feature we want to get
featFeature with data in it
Returns
True if the feature was found

Definition at line 41 of file FeatureDatabase.cpp.

◆ get_internal_data()

std::unordered_map<size_t, std::shared_ptr<Feature> > ov_core::FeatureDatabase::get_internal_data ( )
inline

Returns the internal data (should not normally be used)

Definition at line 146 of file FeatureDatabase.h.

◆ get_oldest_timestamp()

double FeatureDatabase::get_oldest_timestamp ( )

Gets the oldest time in the database.

Definition at line 265 of file FeatureDatabase.cpp.

◆ size()

size_t ov_core::FeatureDatabase::size ( )
inline

Returns the size of the feature database.

Definition at line 138 of file FeatureDatabase.h.

◆ update_feature()

void FeatureDatabase::update_feature ( size_t  id,
double  timestamp,
size_t  cam_id,
float  u,
float  v,
float  u_n,
float  v_n 
)

Update a feature object.

Parameters
idID of the feature we will update
timestamptime that this measurement occured at
cam_idwhich camera this measurement was from
uraw u coordinate
vraw v coordinate
u_nundistorted/normalized u coordinate
v_nundistorted/normalized v coordinate

This will update a given feature based on the passed ID it has. It will create a new feature, if it is an ID that we have not seen before.

Definition at line 59 of file FeatureDatabase.cpp.

Member Data Documentation

◆ features_idlookup

std::unordered_map<size_t, std::shared_ptr<Feature> > ov_core::FeatureDatabase::features_idlookup
protected

Our lookup array that allow use to query based on ID.

Definition at line 166 of file FeatureDatabase.h.

◆ mtx

std::mutex ov_core::FeatureDatabase::mtx
protected

Mutex lock for our map.

Definition at line 163 of file FeatureDatabase.h.


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


ov_core
Author(s): Patrick Geneva , Kevin Eckenhoff , Guoquan Huang
autogenerated on Mon Dec 16 2024 03:06:46