class
FeatureDatabaseDatabase containing features we are currently tracking.
Contents
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.
Constructors, destructors, conversion operators
- FeatureDatabase()
- Default constructor.
Public functions
- auto get_feature(size_t id, bool remove = false) -> std::shared_ptr<Feature>
- Get a specified feature.
- auto get_feature_clone(size_t id, Feature& feat) -> bool
- Get a specified feature clone (pointer is thread safe)
- 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.
- auto features_not_containing_newer(double timestamp, bool remove = false, bool skip_deleted = false) -> std::vector<std::shared_ptr<Feature>>
- Get features that do not have newer measurement then the specified time.
- auto features_containing_older(double timestamp, bool remove = false, bool skip_deleted = false) -> std::vector<std::shared_ptr<Feature>>
- Get features that has measurements older then the specified time.
- auto features_containing(double timestamp, bool remove = false, bool skip_deleted = false) -> std::vector<std::shared_ptr<Feature>>
- Get features that has measurements at the specified time.
- void cleanup()
- This function will delete all features that have been used up.
- void cleanup_measurements(double timestamp)
- This function will delete all feature measurements that are older then the specified timestamp.
- void cleanup_measurements_exact(double timestamp)
- This function will delete all feature measurements that are at the specified timestamp.
- auto size() -> size_t
- Returns the size of the feature database.
- auto get_internal_data() -> std::unordered_map<size_t, std::shared_ptr<Feature>>
- Returns the internal data (should not normally be used)
- auto get_oldest_timestamp() -> double
- Gets the oldest time in the database.
- void append_new_measurements(const std::shared_ptr<FeatureDatabase>& database)
- Will update the passed database with this database's latest feature information.
Protected variables
- std::mutex mtx
- Mutex lock for our map.
- std::unordered_map<size_t, std::shared_ptr<Feature>> features_idlookup
- Our lookup array that allow use to query based on ID.
Function documentation
std::shared_ptr<Feature> ov_core:: FeatureDatabase:: get_feature(size_t id,
bool remove = false)
Get a specified feature.
Parameters | |
---|---|
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) |
Returns | Either a feature object, or null if it is not in the database. |
bool ov_core:: FeatureDatabase:: get_feature_clone(size_t id,
Feature& feat)
Get a specified feature clone (pointer is thread safe)
Parameters | |
---|---|
id | What feature we want to get |
feat | Feature with data in it |
Returns | True if the feature was found |
void ov_core:: 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 | |
---|---|
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.
std::vector<std::shared_ptr<Feature>> ov_core:: 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.
std::vector<std::shared_ptr<Feature>> ov_core:: 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.
std::vector<std::shared_ptr<Feature>> ov_core:: 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.
void ov_core:: 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