From ab509791f12edead8fbff1f000565af90e8f27ad Mon Sep 17 00:00:00 2001 From: Raul Mur-Artal Date: Thu, 27 Oct 2016 15:37:42 +0200 Subject: [PATCH] Update System.cc SaveTrajectory functions retrieve full frame trajectory using relative rigid body transformations between each frame and its reference keyframe. This relative transform is computed when the frame was tracked. This is inaccurate in the monocular case, as each relative transformation is computed at the particular scale when each frame was tracked. A global scale change will make all relative transformations invalid, and this can happen in two cases: 1) At loop closure 2) When the map is small and all keyframes are optimized in the Local BA. In that case the scale is not fixed and can change. --- src/System.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/System.cc b/src/System.cc index 739f541bc1..fce8b65b80 100644 --- a/src/System.cc +++ b/src/System.cc @@ -284,6 +284,11 @@ void System::Shutdown() void System::SaveTrajectoryTUM(const string &filename) { cout << endl << "Saving camera trajectory to " << filename << " ..." << endl; + if(mSensor==MONOCULAR) + { + cerr << "ERROR: SaveTrajectoryTUM cannot be used for monocular." << endl; + return; + } vector vpKFs = mpMap->GetAllKeyFrames(); sort(vpKFs.begin(),vpKFs.end(),KeyFrame::lId); @@ -376,6 +381,11 @@ void System::SaveKeyFrameTrajectoryTUM(const string &filename) void System::SaveTrajectoryKITTI(const string &filename) { cout << endl << "Saving camera trajectory to " << filename << " ..." << endl; + if(mSensor==MONOCULAR) + { + cerr << "ERROR: SaveTrajectoryKITTI cannot be used for monocular." << endl; + return; + } vector vpKFs = mpMap->GetAllKeyFrames(); sort(vpKFs.begin(),vpKFs.end(),KeyFrame::lId);