Skip to content

Commit ab50979

Browse files
authored
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.
1 parent 1656554 commit ab50979

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/System.cc

+10
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ void System::Shutdown()
284284
void System::SaveTrajectoryTUM(const string &filename)
285285
{
286286
cout << endl << "Saving camera trajectory to " << filename << " ..." << endl;
287+
if(mSensor==MONOCULAR)
288+
{
289+
cerr << "ERROR: SaveTrajectoryTUM cannot be used for monocular." << endl;
290+
return;
291+
}
287292

288293
vector<KeyFrame*> vpKFs = mpMap->GetAllKeyFrames();
289294
sort(vpKFs.begin(),vpKFs.end(),KeyFrame::lId);
@@ -376,6 +381,11 @@ void System::SaveKeyFrameTrajectoryTUM(const string &filename)
376381
void System::SaveTrajectoryKITTI(const string &filename)
377382
{
378383
cout << endl << "Saving camera trajectory to " << filename << " ..." << endl;
384+
if(mSensor==MONOCULAR)
385+
{
386+
cerr << "ERROR: SaveTrajectoryKITTI cannot be used for monocular." << endl;
387+
return;
388+
}
379389

380390
vector<KeyFrame*> vpKFs = mpMap->GetAllKeyFrames();
381391
sort(vpKFs.begin(),vpKFs.end(),KeyFrame::lId);

0 commit comments

Comments
 (0)