raulmur / ORB_SLAM2

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

Forget to check bad keyframe when running bundle adjustment #212

Open randoms opened 8 years ago

randoms commented 8 years ago

In line 995 Keyframes are added without checking if it is bad. You will get a bad bundle ajustment result if there are bad keyframes. Add the following code will help to fix this issue.

if(pKFi == NULL || pKFi->isBad())
    continue;
AlejandroSilvestri commented 7 years ago

You are right! Thank you. Hope Raúl add this fix to orb-slam2 code. I already added it to mine :)

AlejandroSilvestri commented 7 years ago

In that context, pKF1 is never NULL, and is highly improbably Bad.

pKF1 comes from vpKFs, which contains a vector with a copy content from Map::mspKeyFrames.

Keyframes are erased from mspKeyFrames some lines after setting their bad flag.