Skip to content
Snippets Groups Projects
Commit 295f6657 authored by Mederic Fourmy's avatar Mederic Fourmy
Browse files

Fix too many keyframe creation

parent fab5d18a
No related branches found
No related tags found
No related merge requests found
...@@ -5,11 +5,11 @@ time_tolerance: 0.1222 ...@@ -5,11 +5,11 @@ time_tolerance: 0.1222
vote: vote:
voting_active: true voting_active: true
min_time_vote: 0 # s min_time_vote: 0 # s
max_time_vote: 0.9999 # s max_time_vote: 1.001 # s
min_features_for_keyframe: 1 min_features_for_keyframe: 1
nb_vote_for_every_first: 0 nb_vote_for_every_first: 0
reestimate_last_frame: true # for a better prior on the new keyframe: use only if no motion processor reestimate_last_frame: false # for a better prior on the new keyframe: use only if no motion processor
add_3d_cstr: false # add 3D constraints between the KF so that they do not jump when using apriltag only add_3d_cstr: false # add 3D constraints between the KF so that they do not jump when using apriltag only
max_new_features: -1 max_new_features: -1
apply_loss_function: true apply_loss_function: true
\ No newline at end of file
...@@ -102,8 +102,8 @@ LandmarkBasePtr ProcessorTrackerLandmarkObject::emplaceLandmark(FeatureBasePtr _ ...@@ -102,8 +102,8 @@ LandmarkBasePtr ProcessorTrackerLandmarkObject::emplaceLandmark(FeatureBasePtr _
} }
unsigned int ProcessorTrackerLandmarkObject::detectNewFeatures(const int& _max_new_features, unsigned int ProcessorTrackerLandmarkObject::detectNewFeatures(const int& _max_new_features,
const CaptureBasePtr& _capture, const CaptureBasePtr& _capture,
FeatureBasePtrList& _features_out) FeatureBasePtrList& _features_out)
{ {
// list of landmarks in the map // list of landmarks in the map
auto lmk_lst = getProblem()->getMap()->getLandmarkList(); auto lmk_lst = getProblem()->getMap()->getLandmarkList();
...@@ -148,15 +148,22 @@ bool ProcessorTrackerLandmarkObject::voteForKeyFrame() const ...@@ -148,15 +148,22 @@ bool ProcessorTrackerLandmarkObject::voteForKeyFrame() const
if (detections_last_.empty()) if (detections_last_.empty())
return false; return false;
auto origin = getOrigin();
auto incoming = getIncoming();
std::cout << "voteForKeyFrame" << std::endl;
std::cout << origin->id() << " " << getOrigin()->getTimeStamp().get() << std::endl;
std::cout << incoming->id() << " " <<getIncoming()->getTimeStamp().get() << std::endl;
double dt_incoming_origin = getIncoming()->getTimeStamp().get() - getOrigin()->getTimeStamp().get(); double dt_incoming_origin = getIncoming()->getTimeStamp().get() - getOrigin()->getTimeStamp().get();
bool more_than_min_time_vote = dt_incoming_origin > min_time_vote_; bool enough_time_vote = dt_incoming_origin > min_time_vote_;
bool too_long_since_last_KF = dt_incoming_origin > max_time_vote_; bool too_long_since_last_KF = dt_incoming_origin > max_time_vote_;
// the elapsed time since last KF is too long // the elapsed time since last KF is too long
if (too_long_since_last_KF){ if (too_long_since_last_KF){
return true; return true;
} }
// no detection in incoming capture and a minimum time since last KF has past // no detection in incoming capture and a minimum time since last KF has past
if ((detections_incoming_.size() > min_features_for_keyframe_) and more_than_min_time_vote) if ((detections_incoming_.size() < min_features_for_keyframe_) and enough_time_vote)
return true; return true;
// Vote for every image processed at the beginning if possible // Vote for every image processed at the beginning if possible
......
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