MCPcopy Create free account
hub / github.com/UZ-SLAMLab/ORB_SLAM3 / KeyFrameCulling

Method KeyFrameCulling

src/LocalMapping.cc:902–1054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

900}
901
902void LocalMapping::KeyFrameCulling()
903{
904 // Check redundant keyframes (only local keyframes)
905 // A keyframe is considered redundant if the 90% of the MapPoints it sees, are seen
906 // in at least other 3 keyframes (in the same or finer scale)
907 // We only consider close stereo points
908 const int Nd = 21;
909 mpCurrentKeyFrame->UpdateBestCovisibles();
910 vector<KeyFrame*> vpLocalKeyFrames = mpCurrentKeyFrame->GetVectorCovisibleKeyFrames();
911
912 float redundant_th;
913 if(!mbInertial)
914 redundant_th = 0.9;
915 else if (mbMonocular)
916 redundant_th = 0.9;
917 else
918 redundant_th = 0.5;
919
920 const bool bInitImu = mpAtlas->isImuInitialized();
921 int count=0;
922
923 // Compoute last KF from optimizable window:
924 unsigned int last_ID;
925 if (mbInertial)
926 {
927 int count = 0;
928 KeyFrame* aux_KF = mpCurrentKeyFrame;
929 while(count<Nd && aux_KF->mPrevKF)
930 {
931 aux_KF = aux_KF->mPrevKF;
932 count++;
933 }
934 last_ID = aux_KF->mnId;
935 }
936
937
938
939 for(vector<KeyFrame*>::iterator vit=vpLocalKeyFrames.begin(), vend=vpLocalKeyFrames.end(); vit!=vend; vit++)
940 {
941 count++;
942 KeyFrame* pKF = *vit;
943
944 if((pKF->mnId==pKF->GetMap()->GetInitKFid()) || pKF->isBad())
945 continue;
946 const vector<MapPoint*> vpMapPoints = pKF->GetMapPointMatches();
947
948 int nObs = 3;
949 const int thObs=nObs;
950 int nRedundantObservations=0;
951 int nMPs=0;
952 for(size_t i=0, iend=vpMapPoints.size(); i<iend; i++)
953 {
954 MapPoint* pMP = vpMapPoints[i];
955 if(pMP)
956 {
957 if(!pMP->isBad())
958 {
959 if(!mbMonocular)

Callers

nothing calls this directly

Calls 15

UpdateBestCovisiblesMethod · 0.80
GetInitKFidMethod · 0.80
GetMapPointMatchesMethod · 0.80
ObservationsMethod · 0.80
GetObservationsMethod · 0.80
MergePreviousMethod · 0.80
GetIniertialBA2Method · 0.80
isImuInitializedMethod · 0.45
GetMapMethod · 0.45
isBadMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected