31 size_t m = projection_matrices.size();
34 Matrix A = Matrix::Zero(m * 2, 4);
36 for (
size_t i = 0;
i <
m;
i++) {
38 const Matrix34&
projection = projection_matrices.at(
i);
39 const Point2&
p = measurements.at(
i);
42 A.row(row) = p.x() * projection.row(2) - projection.row(0);
43 A.row(row + 1) = p.y() * projection.row(2) - projection.row(1);
48 boost::tie(rank, error, v) =
DLT(A, rank_tol);
62 return Point3(v.head<3>() / v[3]);
90 return result.
at<
Point3>(landmarkKey);
boost::tuple< int, double, Vector > DLT(const Matrix &A, double rank_tol)
const MATRIX::ConstRowXpr row(const MATRIX &A, size_t j)
Vector4 triangulateHomogeneousDLT(const std::vector< Matrix34, Eigen::aligned_allocator< Matrix34 >> &projection_matrices, const Point2Vector &measurements, double rank_tol)
virtual const Values & optimize()
double lambdaFactor
The amount by which to multiply or divide lambda when adjusting lambda (default: 10.0)
Verbosity verbosity
The printing verbosity during optimization (default SILENT)
NonlinearFactorGraph graph
double absoluteErrorTol
The maximum absolute error decrease to stop iterating (default 1e-5)
Base class for all pinhole cameras.
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
const ValueType at(Key j) const
STL compatible allocator to use with types requiring a non standrad alignment.
std::vector< Point2, Eigen::aligned_allocator< Point2 > > Point2Vector
Functions for triangulation.
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Exception thrown by triangulateDLT when SVD returns rank < 3.
static SmartStereoProjectionParams params
Point3 triangulateDLT(const std::vector< Matrix34, Eigen::aligned_allocator< Matrix34 >> &projection_matrices, const Point2Vector &measurements, double rank_tol)
Expression< Point2 > projection(f, p_cam)
VerbosityLM verbosityLM
The verbosity level for Levenberg-Marquardt (default: SILENT), see also NonlinearOptimizerParams::ver...
std::uint64_t Key
Integer nonlinear key type.
LinearSolverType linearSolverType
The type of linear solver to use in the nonlinear optimizer.
size_t maxIterations
The maximum iterations to stop iterating (default 100)
double lambdaInitial
The initial Levenberg-Marquardt damping term (default: 1e-5)