Skip to content
Snippets Groups Projects
Commit cde60244 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Merge branch...

Merge branch '309-processortrackerfeature-compatible-with-preprocessing-and-other-processors' into 'devel'

Resolve "ProcessorTracker compatible with preprocessing and other processors"

Closes #309

See merge request !356
parents af61bf40 4f7080c8
No related branches found
No related tags found
1 merge request!356Resolve "ProcessorTracker compatible with preprocessing and other processors"
Pipeline #5148 passed
...@@ -103,6 +103,7 @@ class ProcessorTracker : public ProcessorBase ...@@ -103,6 +103,7 @@ class ProcessorTracker : public ProcessorBase
CaptureBasePtr incoming_ptr_; ///< Pointer to the incoming capture being processed. CaptureBasePtr incoming_ptr_; ///< Pointer to the incoming capture being processed.
FeatureBasePtrList new_features_last_; ///< List of new features in \b last for landmark initialization and new key-frame creation. FeatureBasePtrList new_features_last_; ///< List of new features in \b last for landmark initialization and new key-frame creation.
FeatureBasePtrList new_features_incoming_; ///< list of the new features of \b last successfully tracked in \b incoming FeatureBasePtrList new_features_incoming_; ///< list of the new features of \b last successfully tracked in \b incoming
FeatureBasePtrList known_features_last_; ///< list of the known features in previous captures successfully tracked in \b last
FeatureBasePtrList known_features_incoming_; ///< list of the known features in \b last successfully tracked in \b incoming FeatureBasePtrList known_features_incoming_; ///< list of the known features in \b last successfully tracked in \b incoming
int _dim; int _dim;
......
...@@ -150,8 +150,8 @@ class ProcessorTrackerFeature : public ProcessorTracker ...@@ -150,8 +150,8 @@ class ProcessorTrackerFeature : public ProcessorTracker
virtual bool voteForKeyFrame() const = 0; virtual bool voteForKeyFrame() const = 0;
// We overload the advance and reset functions to update the lists of matches // We overload the advance and reset functions to update the lists of matches
void advanceDerived(); virtual void advanceDerived() override;
void resetDerived(); virtual void resetDerived() override;
/**\brief Process new Features /**\brief Process new Features
* *
......
...@@ -170,7 +170,7 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr) ...@@ -170,7 +170,7 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr)
// process // process
processNew(params_tracker_->max_new_features); processNew(params_tracker_->max_new_features);
//TODO abort KF if last_ptr_->getFeatureList().size() < params_tracker_->min_features_for_keyframe //TODO abort KF if known_features_last_.size() < params_tracker_->min_features_for_keyframe
// We create a KF // We create a KF
// set KF on last // set KF on last
......
...@@ -79,14 +79,14 @@ unsigned int ProcessorTrackerFeature::processKnown() ...@@ -79,14 +79,14 @@ unsigned int ProcessorTrackerFeature::processKnown()
matches_last_from_incoming_.clear(); matches_last_from_incoming_.clear();
known_features_incoming_.clear(); known_features_incoming_.clear();
if (!last_ptr_ || last_ptr_->getFeatureList().empty()) if (!last_ptr_ || known_features_last_.empty())
{ {
WOLF_TRACE("Empty last feature list, returning..."); WOLF_TRACE("Empty last feature list, returning...");
return 0; return 0;
} }
// Track features from last_ptr_ to incoming_ptr_ // Track features from last_ptr_ to incoming_ptr_
trackFeatures(last_ptr_->getFeatureList(), trackFeatures(known_features_last_,
incoming_ptr_, incoming_ptr_,
known_features_incoming_, known_features_incoming_,
matches_last_from_incoming_); matches_last_from_incoming_);
...@@ -132,6 +132,9 @@ void ProcessorTrackerFeature::advanceDerived() ...@@ -132,6 +132,9 @@ void ProcessorTrackerFeature::advanceDerived()
{ {
// Reset here the list of correspondences. // Reset here the list of correspondences.
matches_last_from_incoming_.clear(); matches_last_from_incoming_.clear();
known_features_last_ = std::move(known_features_incoming_);
//new_features_incoming should be zero!
//known_features_last_.splice(new_features_incoming_);
// // remove last from track matrix in case you want to have only KF in the track matrix // // remove last from track matrix in case you want to have only KF in the track matrix
// track_matrix_.remove(last_ptr_); // track_matrix_.remove(last_ptr_);
...@@ -141,6 +144,8 @@ void ProcessorTrackerFeature::resetDerived() ...@@ -141,6 +144,8 @@ void ProcessorTrackerFeature::resetDerived()
{ {
// Reset here the list of correspondences. // Reset here the list of correspondences.
matches_last_from_incoming_.clear(); matches_last_from_incoming_.clear();
known_features_last_ = std::move(known_features_incoming_);
known_features_last_.splice(known_features_last_.end(), new_features_incoming_);
// Debug // Debug
//for (auto const & pair_trkid_pair : track_matrix_.matches(origin_ptr_, last_ptr_)) //for (auto const & pair_trkid_pair : track_matrix_.matches(origin_ptr_, last_ptr_))
......
...@@ -30,6 +30,8 @@ void ProcessorTrackerLandmark::advanceDerived() ...@@ -30,6 +30,8 @@ void ProcessorTrackerLandmark::advanceDerived()
{ {
matches_landmark_from_last_ = std::move(matches_landmark_from_incoming_); matches_landmark_from_last_ = std::move(matches_landmark_from_incoming_);
new_features_last_ = std::move(new_features_incoming_); new_features_last_ = std::move(new_features_incoming_);
known_features_last_ = std::move(known_features_incoming_);
known_features_last_.splice(known_features_last_.end(), new_features_incoming_);
matches_landmark_from_incoming_.clear(); matches_landmark_from_incoming_.clear();
new_features_incoming_.clear(); new_features_incoming_.clear();
...@@ -40,6 +42,8 @@ void ProcessorTrackerLandmark::resetDerived() ...@@ -40,6 +42,8 @@ void ProcessorTrackerLandmark::resetDerived()
{ {
matches_landmark_from_last_ = std::move(matches_landmark_from_incoming_); matches_landmark_from_last_ = std::move(matches_landmark_from_incoming_);
new_features_last_ = std::move(new_features_incoming_); new_features_last_ = std::move(new_features_incoming_);
known_features_last_ = std::move(known_features_incoming_);
known_features_last_.splice(known_features_last_.end(), new_features_incoming_);
matches_landmark_from_incoming_.clear(); matches_landmark_from_incoming_.clear();
new_features_incoming_.clear(); new_features_incoming_.clear();
...@@ -129,15 +133,17 @@ void ProcessorTrackerLandmark::emplaceNewLandmarks() ...@@ -129,15 +133,17 @@ void ProcessorTrackerLandmark::emplaceNewLandmarks()
void ProcessorTrackerLandmark::establishFactors() void ProcessorTrackerLandmark::establishFactors()
{ {
// Loop all features in last_ptr_ // Loop all features tracked in last_ptr_ (two lists known_features_last_ and new_features_last_)
for (auto last_feature : last_ptr_->getFeatureList()) std::list<FeatureBasePtrList> both_lists{known_features_last_, new_features_last_};
{ for (auto feature_list : both_lists)
assert(matches_landmark_from_last_.count(last_feature) == 1); for (auto last_feature : feature_list)
{
assert(matches_landmark_from_last_.count(last_feature) == 1);
FactorBasePtr fac_ptr = emplaceFactor(last_feature, matches_landmark_from_last_[last_feature]->landmark_ptr_); FactorBasePtr fac_ptr = emplaceFactor(last_feature, matches_landmark_from_last_[last_feature]->landmark_ptr_);
assert(fac_ptr->getFeature() != nullptr && "not linked factor returned by emplaceFactor()"); assert(fac_ptr->getFeature() != nullptr && "not linked factor returned by emplaceFactor()");
} }
} }
} // namespace wolf } // namespace wolf
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment