Skip to content

Commit f576da3

Browse files
authored
Add files via upload
1 parent 6119efb commit f576da3

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/orb_slam/src/System.cc

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ void System::SaveTrajectoryKITTI(const string &filename)
474474
f.close();
475475
cout << endl << "trajectory saved!" << endl;
476476
}
477-
void System::GetKeyFramePoses(std::vector<cv::Mat> &vKFTwc, std::vector<std::size_t> &vKFFrameId){
477+
void System::GetKeyFramePoses(std::vector<cv::Mat> &vKFTwc, std::vector<std::size_t> &vKFFrameId) const{
478478
vector<KeyFrame*> vpKFs = mpMap->GetAllKeyFrames(true);
479479
sort(vpKFs.begin(), vpKFs.end(), KeyFrame::lId);
480480
for(size_t i=0;i<vpKFs.size();i++)
@@ -483,6 +483,22 @@ void System::GetKeyFramePoses(std::vector<cv::Mat> &vKFTwc, std::vector<std::siz
483483
vKFFrameId.push_back(vpKFs[i]->mnFrameId);
484484
}
485485
}
486+
487+
cv::Mat System::GetKeyFramePose(const std::size_t &KFId) const{
488+
489+
vector<KeyFrame*> vpKFs = mpMap->GetAllKeyFrames(true);
490+
assert(KFId>=0 && KFId < vpKFs.size());
491+
sort(vpKFs.begin(), vpKFs.end(), KeyFrame::lId);
492+
return vpKFs[KFId]->GetPose();
493+
}
494+
495+
cv::Mat System::GetKeyFrameInvPose(const std::size_t &KFId) const{
496+
497+
vector<KeyFrame*> vpKFs = mpMap->GetAllKeyFrames(true);
498+
assert(KFId>=0 && KFId < vpKFs.size());
499+
sort(vpKFs.begin(), vpKFs.end(), KeyFrame::lId);
500+
return vpKFs[KFId]->GetPoseInverse();
501+
}
486502
//add by chy
487503
int System::OptimizeExtrinsicLocal(const vector<Eigen::Isometry3d> &vTwl, Eigen::Isometry3d &Tcl, double &scale, bool verbose)
488504
{
@@ -515,6 +531,12 @@ vector<cv::KeyPoint> System::GetTrackedKeyPointsUn()
515531
return mTrackedKeyPointsUn;
516532
}
517533

534+
std::vector<MapPoint*> System::GetAllMapPoints(bool only_good)
535+
{
536+
unique_lock<mutex> lock(mMutexState);
537+
return mpMap->GetAllMapPoints(only_good);
538+
}
539+
518540
size_t System::GetLastLoopKFid()
519541
{
520542
return mpLoopCloser->GetLastLoopKFid();

0 commit comments

Comments
 (0)