Exemple #1
0
 void MapPoint::Replace(MapPoint* pMP)
 {
     if(pMP->mnId==this->mnId)
         return;
     
     map<KeyFrame*,size_t> obs;
     {
         boost::mutex::scoped_lock lock1(mMutexFeatures);
         boost::mutex::scoped_lock lock2(mMutexPos);
         obs=mObservations;
         mObservations.clear();
         mbBad=true;
     }
     
     for(map<KeyFrame*,size_t>::iterator mit=obs.begin(), mend=obs.end(); mit!=mend; mit++)
     {
         // Replace measurement in keyframe
         KeyFrame* pKF = mit->first;
         
         if(!pMP->IsInKeyFrame(pKF))
         {
             pKF->ReplaceMapPointMatch(mit->second, pMP);
             pMP->AddObservation(pKF,mit->second);
         }
         else
         {
             pKF->EraseMapPointMatch(mit->second);
         }
     }
     
     pMP->ComputeDistinctiveDescriptors();
     
     mpMap->EraseMapPoint(this);
     
 }
Exemple #2
0
 void MapPoint::SetBadFlag()
 {
     map<KeyFrame*,size_t> obs;
     {
         boost::mutex::scoped_lock lock1(mMutexFeatures);
         boost::mutex::scoped_lock lock2(mMutexPos);
         mbBad=true;
         obs = mObservations;
         mObservations.clear();
     }
     for(map<KeyFrame*,size_t>::iterator mit=obs.begin(), mend=obs.end(); mit!=mend; mit++)
     {
         KeyFrame* pKF = mit->first;
         pKF->EraseMapPointMatch(mit->second);
     }
     
     mpMap->EraseMapPoint(this);
 }