raulmur / ORB_SLAM2

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

Why not do `mpCurrentKeyFrame->AddMapPoint(pMP, i)` after `pMP->AddObservation(mpCurrentKeyFrame, i)` during LocalMapping::ProcessNewKeyframe ? #1090

Open ChetanPatil28 opened 11 months ago

ChetanPatil28 commented 11 months ago

So every time there is a new keyframe that's supposed to be added to the map, I believe goes into ProcessNewKeyFrame(). This is when the mutual information between a map-point and the keyframe gets updated.

      if(!pMP->IsInKeyFrame(mpCurrentKeyFrame))
      {
          pMP->AddObservation(mpCurrentKeyFrame, i);
          pMP->UpdateNormalAndDepth();
          pMP->ComputeDistinctiveDescriptors();
      }

I was wondering why don't we do mpCurrentKeyFrame->AddMapPoint(pMP, i) as well?

Everywhere else pMP->AddObservation() and mpCurrentKeyFrame->AddMapPoint() are used commonly.. I believe both these lines should be written to maintain the consistency of the graph (a graph that connects keyframes and mappoints).

It is only in LocalMapping::ProcessNewKeyFrame() I see some problem.

Can you guys please explain why mpCurrentKeyFrame->AddMapPoint(pMP, i) is skipped in ProcessNewKeyFrame() ?