Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs in loop detection #745

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
23 changes: 11 additions & 12 deletions src/KeyFrameDatabase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -709,20 +709,19 @@ void KeyFrameDatabase::DetectNBestCandidates(KeyFrame *pKF, vector<KeyFrame*> &v
while(i < lAccScoreAndMatch.size() && (vpLoopCand.size() < nNumCandidates || vpMergeCand.size() < nNumCandidates))
{
KeyFrame* pKFi = it->second;
if(pKFi->isBad())
continue;

if(!spAlreadyAddedKF.count(pKFi))
{
if(pKF->GetMap() == pKFi->GetMap() && vpLoopCand.size() < nNumCandidates)
{
vpLoopCand.push_back(pKFi);
}
else if(pKF->GetMap() != pKFi->GetMap() && vpMergeCand.size() < nNumCandidates && !pKFi->GetMap()->IsBad())
if(pKFi->isBad()){
fishmarch marked this conversation as resolved.
Show resolved Hide resolved
if(!spAlreadyAddedKF.count(pKFi))
{
vpMergeCand.push_back(pKFi);
if(pKF->GetMap() == pKFi->GetMap() && vpLoopCand.size() < nNumCandidates)
{
vpLoopCand.push_back(pKFi);
}
else if(pKF->GetMap() != pKFi->GetMap() && vpMergeCand.size() < nNumCandidates && !pKFi->GetMap()->IsBad())
{
vpMergeCand.push_back(pKFi);
}
spAlreadyAddedKF.insert(pKFi);
}
spAlreadyAddedKF.insert(pKFi);
}
i++;
it++;
Expand Down