-
Notifications
You must be signed in to change notification settings - Fork 0
/
ba_demo.cpp
45 lines (38 loc) · 1.31 KB
/
ba_demo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "baproblem.h"
#include "baproblem_inverse_depth.h"
#include "baproblem_marginalization.h"
using namespace Eigen;
using namespace std;
const int USE_POSE_SIZE = 7;
int main(int argc, const char *argv[])
{
if (argc < 2)
{
cout << endl;
cout << "Please type: " << endl;
cout << "ba_demo [PIXEL_NOISE] " << endl;
cout << endl;
cout << "PIXEL_NOISE: noise in image space (E.g.: 1)" << endl;
cout << endl;
exit(0);
}
google::InitGoogleLogging(argv[0]);
double PIXEL_NOISE = atof(argv[1]);
cout << "PIXEL_NOISE: " << PIXEL_NOISE << endl;
//bundle adjustment
//BAProblem<USE_POSE_SIZE> baProblem(15, 300, PIXEL_NOISE);
//bundle adjustment with inverse depth model
//BAProblemIDP<USE_POSE_SIZE> baProblem(15, 300, PIXEL_NOISE);
//bundle adjustment with inverse depth model and marginalization
BAProblemMarg<USE_POSE_SIZE> baProblem(7, 1000, PIXEL_NOISE);
ceres::Solver::Options options;
options.linear_solver_type = ceres::SPARSE_SCHUR;
options.minimizer_progress_to_stdout = true;
options.max_num_iterations = 50;
ceres::Solver::Summary summary;
baProblem.validate();
baProblem.solveMarg(options, &summary);
baProblem.validate();
std::cout << summary.BriefReport() << "\n";
return 0;
}