raulmur / ORB_SLAM2

Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilities
Other
9.33k stars 4.69k forks source link

[Doc] Explanation of principles to select key frames desired #872

Open yiakwy opened 4 years ago

yiakwy commented 4 years ago

System environment: Monocular Camera with structures estimated from motion

The system says will keep features extracted from "key frames". Despite "initial frame" and "the current frame", how we choose key frames from.

It seems that frames in between is only used for camera motion and pose estimation (see implementation in "MonocularInitialization" module).

Hence, is there any principles to keep frames?

AlejandroSilvestri commented 4 years ago

@yiakwy

You are right. Frames are mainly used to track position and then discarded, only a few of them are upgraded to Keyframe and kept in map.

Tracking::NeedNewKeyFrame() is the one responsible to decide when to make a keyframe. In the code you can see the decision process.

In these lines you can read the criteria. Here's a copy:

// Condition 1a: More than "MaxFrames" have passed from last keyframe insertion
// Condition 1b: More than "MinFrames" have passed and Local Mapping is idle
// Condition 1c: tracking is weak
// Condition 2: Few tracked points compared to reference keyframe. Lots of visual odometry compared to map matches.

if((c1a||c1b||c1c)&&c2) lets insert a new keyframe
yiakwy commented 4 years ago

@AlejandroSilvestri Thank you! It helps me.