Skip to content
Snippets Groups Projects
Commit 758a86dc authored by Andreu Corominas-Murtra's avatar Andreu Corominas-Murtra
Browse files

FeatureMatchMap is now a pair of Ptr. Updated files using that. Check...

FeatureMatchMap is now a pair of Ptr. Updated files using that. Check test_processor_tracker_landmark and test_processor_tracker_feature successfully, also Valgrind passed both tests with 0 errors
parent 637f372f
No related branches found
No related tags found
1 merge request!92Matchers
This commit is part of merge request !92. Comments created here will be created in the context of that merge request.
...@@ -18,7 +18,8 @@ struct FeatureMatch ...@@ -18,7 +18,8 @@ struct FeatureMatch
Scalar normalized_score_; Scalar normalized_score_;
}; };
typedef std::map<FeatureBasePtr, FeatureMatch> FeatureMatchMap; typedef std::shared_ptr<FeatureMatch> FeatureMatchPtr;
typedef std::map<FeatureBasePtr, FeatureMatchPtr> FeatureMatchMap;
}//end namespace }//end namespace
......
...@@ -144,7 +144,7 @@ unsigned int ProcessorImageFeature::trackFeatures(const FeatureBaseList& _featur ...@@ -144,7 +144,7 @@ unsigned int ProcessorImageFeature::trackFeatures(const FeatureBaseList& _featur
incoming_point_ptr->setTrackId(feature_ptr->trackId()); incoming_point_ptr->setTrackId(feature_ptr->trackId());
_feature_matches[incoming_point_ptr] = FeatureMatch({feature_base_ptr, normalized_score}); _feature_matches[incoming_point_ptr] = std::make_shared<FeatureMatch>(FeatureMatch({feature_base_ptr, normalized_score}));
} }
else else
{ {
......
...@@ -39,8 +39,7 @@ unsigned int ProcessorTrackerFeature::processKnown() ...@@ -39,8 +39,7 @@ unsigned int ProcessorTrackerFeature::processKnown()
auto known_incoming_feature_it = known_features_incoming_.begin(); auto known_incoming_feature_it = known_features_incoming_.begin();
while (known_incoming_feature_it != known_features_incoming_.end()) while (known_incoming_feature_it != known_features_incoming_.end())
{ {
if (!correctFeatureDrift(matches_origin_from_last_[matches_last_from_incoming_[*known_incoming_feature_it].feature_ptr_].feature_ptr_, if (!correctFeatureDrift(matches_origin_from_last_[matches_last_from_incoming_[*known_incoming_feature_it]->feature_ptr_]->feature_ptr_, matches_last_from_incoming_[*known_incoming_feature_it]->feature_ptr_,*known_incoming_feature_it))
matches_last_from_incoming_[*known_incoming_feature_it].feature_ptr_,*known_incoming_feature_it))
{ {
// Correspondence not confirmed -> Remove correspondence and destruct incoming feature // Correspondence not confirmed -> Remove correspondence and destruct incoming feature
matches_last_from_incoming_.erase(*known_incoming_feature_it); matches_last_from_incoming_.erase(*known_incoming_feature_it);
......
...@@ -174,10 +174,10 @@ inline void ProcessorTrackerFeature::establishConstraints() ...@@ -174,10 +174,10 @@ inline void ProcessorTrackerFeature::establishConstraints()
{ {
for (auto match : matches_origin_from_last_) for (auto match : matches_origin_from_last_)
{ {
auto ctr = createConstraint(match.first, match.second.feature_ptr_); auto ctr = createConstraint(match.first, match.second->feature_ptr_);
ctr->setFeatureOtherPtr(match.second.feature_ptr_); ctr->setFeatureOtherPtr(match.second->feature_ptr_);
match.first->addConstraint(ctr); match.first->addConstraint(ctr);
match.second.feature_ptr_->addConstrainedBy(ctr); match.second->feature_ptr_->addConstrainedBy(ctr);
} }
} }
...@@ -189,7 +189,7 @@ inline void ProcessorTrackerFeature::advance() ...@@ -189,7 +189,7 @@ inline void ProcessorTrackerFeature::advance()
for (auto match : matches_last_from_incoming_) for (auto match : matches_last_from_incoming_)
{ {
matches_last_from_incoming_[match.first] = matches_last_from_incoming_[match.first] =
matches_origin_from_last_[matches_last_from_incoming_[match.first].feature_ptr_]; matches_origin_from_last_[matches_last_from_incoming_[match.first]->feature_ptr_];
} }
matches_origin_from_last_ = std::move(matches_last_from_incoming_); matches_origin_from_last_ = std::move(matches_last_from_incoming_);
......
...@@ -64,7 +64,8 @@ unsigned int ProcessorTrackerFeatureCorner::trackFeatures(const FeatureBaseList& ...@@ -64,7 +64,8 @@ unsigned int ProcessorTrackerFeatureCorner::trackFeatures(const FeatureBaseList&
if (((*feat_out_it)->getMeasurement().head<3>() - expected_feature_pose).squaredNorm() > position_error_th_*position_error_th_) if (((*feat_out_it)->getMeasurement().head<3>() - expected_feature_pose).squaredNorm() > position_error_th_*position_error_th_)
{ {
// match // match
_feature_correspondences[*feat_out_it] = FeatureMatch({feat_in_ptr,0}); //_feature_correspondences[*feat_out_it] = FeatureMatch({feat_in_ptr,0});
_feature_correspondences[*feat_out_it] = std::make_shared<FeatureMatch>(FeatureMatch({feat_in_ptr,0}));
// move matched feature to list // move matched feature to list
_feature_list_out.splice(_feature_list_out.end(), corners_incoming_, feat_out_it); _feature_list_out.splice(_feature_list_out.end(), corners_incoming_, feat_out_it);
......
...@@ -29,7 +29,9 @@ unsigned int ProcessorTrackerFeatureDummy::trackFeatures(const FeatureBaseList& ...@@ -29,7 +29,9 @@ unsigned int ProcessorTrackerFeatureDummy::trackFeatures(const FeatureBaseList&
else else
{ {
_feature_list_out.push_back(std::make_shared<FeatureBase>(FEATURE_POINT_IMAGE, "POINT IMAGE", feat_in_ptr->getMeasurement(), feat_in_ptr->getMeasurementCovariance())); _feature_list_out.push_back(std::make_shared<FeatureBase>(FEATURE_POINT_IMAGE, "POINT IMAGE", feat_in_ptr->getMeasurement(), feat_in_ptr->getMeasurementCovariance()));
_feature_correspondences[_feature_list_out.back()] = FeatureMatch({feat_in_ptr,0}); //_feature_correspondences[_feature_list_out.back()] = FeatureMatch({feat_in_ptr,0});
//_feature_correspondences[_feature_list_out.back()] = std::make_shared<FeatureMatch>({feat_in_ptr,0});
_feature_correspondences[_feature_list_out.back()] = std::make_shared<FeatureMatch>(FeatureMatch({feat_in_ptr,0}));
std::cout << "feature " << feat_in_ptr->getMeasurement() << " tracked!" << std::endl; std::cout << "feature " << feat_in_ptr->getMeasurement() << " tracked!" << std::endl;
} }
} }
......
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