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< Feature > | get_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... | |
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}
Definition at line 54 of file FeatureDatabase.h.
|
inline |
Default constructor.
Definition at line 60 of file FeatureDatabase.h.
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.
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.
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.
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.
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.
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.
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.
std::shared_ptr< Feature > FeatureDatabase::get_feature | ( | size_t | id, |
bool | remove = false |
||
) |
Get a specified feature.
id | What feature we want to get |
remove | Set to true if you want to remove the feature from the database (you will need to handle the freeing of memory) |
Definition at line 29 of file FeatureDatabase.cpp.
bool FeatureDatabase::get_feature_clone | ( | size_t | id, |
Feature & | feat | ||
) |
Get a specified feature clone (pointer is thread safe)
id | What feature we want to get |
feat | Feature with data in it |
Definition at line 41 of file FeatureDatabase.cpp.
|
inline |
Returns the internal data (should not normally be used)
Definition at line 146 of file FeatureDatabase.h.
double FeatureDatabase::get_oldest_timestamp | ( | ) |
Gets the oldest time in the database.
Definition at line 265 of file FeatureDatabase.cpp.
|
inline |
Returns the size of the feature database.
Definition at line 138 of file FeatureDatabase.h.
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.
id | ID of the feature we will update |
timestamp | time that this measurement occured at |
cam_id | which camera this measurement was from |
u | raw u coordinate |
v | raw v coordinate |
u_n | undistorted/normalized u coordinate |
v_n | undistorted/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.
|
protected |
Our lookup array that allow use to query based on ID.
Definition at line 166 of file FeatureDatabase.h.
|
protected |
Mutex lock for our map.
Definition at line 163 of file FeatureDatabase.h.