2012-06-06 17:41:06 +08:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2012-06-07 13:19:43 +08:00
|
|
|
% GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
2012-06-06 17:41:06 +08:00
|
|
|
% Atlanta, Georgia 30332-0415
|
|
|
|
% All Rights Reserved
|
|
|
|
% Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
2012-06-07 13:19:43 +08:00
|
|
|
%
|
2012-06-06 17:41:06 +08:00
|
|
|
% See LICENSE for the license information
|
|
|
|
%
|
|
|
|
% @brief A simple visual SLAM example for structure from motion
|
|
|
|
% @author Duy-Nguyen Ta
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
2012-08-06 03:31:27 +08:00
|
|
|
import gtsam.*
|
|
|
|
|
2012-06-10 23:26:59 +08:00
|
|
|
% Data Options
|
|
|
|
options.triangle = false;
|
|
|
|
options.nrCameras = 20;
|
|
|
|
options.showImages = false;
|
|
|
|
|
|
|
|
% iSAM Options
|
|
|
|
options.hardConstraint = false;
|
|
|
|
options.pointPriors = false;
|
|
|
|
options.batchInitialization = true;
|
|
|
|
options.reorderInterval = 10;
|
|
|
|
options.alwaysRelinearize = false;
|
2012-06-09 12:01:37 +08:00
|
|
|
|
2012-06-10 23:26:59 +08:00
|
|
|
% Display Options
|
|
|
|
options.saveDotFile = false;
|
|
|
|
options.printStats = false;
|
|
|
|
options.drawInterval = 5;
|
|
|
|
options.cameraInterval = 1;
|
|
|
|
options.drawTruePoses = false;
|
|
|
|
options.saveFigures = false;
|
|
|
|
options.saveDotFiles = false;
|
2012-06-09 12:01:37 +08:00
|
|
|
|
2012-06-10 12:25:05 +08:00
|
|
|
%% Generate data
|
2012-08-06 03:31:27 +08:00
|
|
|
[data,truth] = VisualISAMGenerateData(options);
|
2012-06-10 12:25:05 +08:00
|
|
|
|
|
|
|
%% Initialize iSAM with the first pose and points
|
2012-08-06 03:31:27 +08:00
|
|
|
[noiseModels,isam,result,nextPose] = VisualISAMInitialize(data,truth,options);
|
2012-06-12 12:46:51 +08:00
|
|
|
cla;
|
2012-08-06 03:31:27 +08:00
|
|
|
VisualISAMPlot(truth, data, isam, result, options)
|
2012-06-09 12:01:37 +08:00
|
|
|
|
|
|
|
%% Main loop for iSAM: stepping through all poses
|
2012-06-10 13:00:42 +08:00
|
|
|
for frame_i=3:options.nrCameras
|
2012-08-06 03:31:27 +08:00
|
|
|
[isam,result,nextPose] = VisualISAMStep(data,noiseModels,isam,result,truth,nextPose);
|
2012-06-10 23:26:59 +08:00
|
|
|
if mod(frame_i,options.drawInterval)==0
|
2012-08-06 03:31:27 +08:00
|
|
|
VisualISAMPlot(truth, data, isam, result, options)
|
2012-06-06 17:41:06 +08:00
|
|
|
end
|
2012-06-11 02:46:56 +08:00
|
|
|
end
|