ORB-SLAM:Tracking线程
1.Tracking::StereoInitialization()
2.Tracking::TrackWithMotionModel()函数调用的UpdateLastFrame()
3.Tracking::CreateNewKeyFrame()
上面这个三个函数里面在生成新的关键帧,为每个特征点构造MapPoints时都会通过下面的代码程序生成MapPoints点,代码之间大同小异,大体都是创建MapPoints点的属性,将地图点加入到关键帧.
if(bCreateNew)
{
通过反投影得到该特征点的3D坐标
cv::Mat x3D = mCurrentFrame.UnprojectStereo(i);
MapPoint* pNewMP = new MapPoint(x3D,pKF,mpMap);
pNewMP->AddObservation(pKF,i);MapPoints是被关键帧检测到的
pKF->AddMapPoint(pNewMP,i); KF检测到MapPoints---双向检测
pNewMP->AddObservation(pKF,i);
pKF->AddMapPoint(pNewMP,i);
pNewMP->ComputeDistinctiveDescriptors();
pNewMP->UpdateNormalAndDepth();
mpMap->AddMapPoint(pNewMP);
mCurrentFrame.mvpMapPoints[i]=pNewMP;
nPoints++;
}