triangulation.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
21 #pragma once
22 
23 #include <gtsam/geometry/Point3.h>
27 #include <gtsam/geometry/Cal3_S2.h>
28 #include <gtsam/geometry/Cal3DS2.h>
32 #include <gtsam/geometry/Pose2.h>
33 #include <gtsam/inference/Symbol.h>
36 
37 #include <optional>
38 
39 namespace gtsam {
40 
42 class GTSAM_EXPORT TriangulationUnderconstrainedException: public std::runtime_error {
43 public:
45  std::runtime_error("Triangulation Underconstrained Exception.") {
46  }
47 };
48 
50 class GTSAM_EXPORT TriangulationCheiralityException: public std::runtime_error {
51 public:
53  std::runtime_error(
54  "Triangulation Cheirality Exception: The resulting landmark is behind one or more cameras.") {
55  }
56 };
57 
65 GTSAM_EXPORT Vector4 triangulateHomogeneousDLT(
66  const std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>>& projection_matrices,
67  const Point2Vector& measurements, double rank_tol = 1e-9);
68 
77 GTSAM_EXPORT Vector4 triangulateHomogeneousDLT(
78  const std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>>& projection_matrices,
79  const std::vector<Unit3>& measurements, double rank_tol = 1e-9);
80 
88 GTSAM_EXPORT Point3 triangulateDLT(
89  const std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>>& projection_matrices,
91  double rank_tol = 1e-9);
92 
96 GTSAM_EXPORT Point3 triangulateDLT(
97  const std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>>& projection_matrices,
98  const std::vector<Unit3>& measurements,
99  double rank_tol = 1e-9);
100 
111 GTSAM_EXPORT Point3 triangulateLOST(const std::vector<Pose3>& poses,
112  const Point3Vector& calibratedMeasurements,
113  const SharedIsotropic& measurementNoise,
114  double rank_tol = 1e-9);
115 
125 template<class CALIBRATION>
126 std::pair<NonlinearFactorGraph, Values> triangulationGraph(
127  const std::vector<Pose3>& poses, std::shared_ptr<CALIBRATION> sharedCal,
128  const Point2Vector& measurements, Key landmarkKey,
129  const Point3& initialEstimate,
131  Values values;
132  values.insert(landmarkKey, initialEstimate); // Initial landmark value
134  for (size_t i = 0; i < measurements.size(); i++) {
135  const Pose3& pose_i = poses[i];
137  Camera camera_i(pose_i, sharedCal);
139  (camera_i, measurements[i], model, landmarkKey);
140  }
141  return {graph, values};
142 }
143 
153 template<class CAMERA>
154 std::pair<NonlinearFactorGraph, Values> triangulationGraph(
155  const CameraSet<CAMERA>& cameras,
156  const typename CAMERA::MeasurementVector& measurements, Key landmarkKey,
157  const Point3& initialEstimate,
158  const SharedNoiseModel& model = nullptr) {
159  Values values;
160  values.insert(landmarkKey, initialEstimate); // Initial landmark value
164  for (size_t i = 0; i < measurements.size(); i++) {
165  const CAMERA& camera_i = cameras[i];
167  (camera_i, measurements[i], model? model : unit, landmarkKey);
168  }
169  return {graph, values};
170 }
171 
179 GTSAM_EXPORT Point3 optimize(const NonlinearFactorGraph& graph,
180  const Values& values, Key landmarkKey);
181 
190 template<class CALIBRATION>
191 Point3 triangulateNonlinear(const std::vector<Pose3>& poses,
192  std::shared_ptr<CALIBRATION> sharedCal,
193  const Point2Vector& measurements, const Point3& initialEstimate,
194  const SharedNoiseModel& model = nullptr) {
195 
196  // Create a factor graph and initial values
197  const auto [graph, values] = triangulationGraph<CALIBRATION> //
198  (poses, sharedCal, measurements, Symbol('p', 0), initialEstimate, model);
199 
200  return optimize(graph, values, Symbol('p', 0));
201 }
202 
210 template<class CAMERA>
212  const CameraSet<CAMERA>& cameras,
213  const typename CAMERA::MeasurementVector& measurements, const Point3& initialEstimate,
214  const SharedNoiseModel& model = nullptr) {
215 
216  // Create a factor graph and initial values
217  const auto [graph, values] = triangulationGraph<CAMERA> //
218  (cameras, measurements, Symbol('p', 0), initialEstimate, model);
219 
220  return optimize(graph, values, Symbol('p', 0));
221 }
222 
223 template<class CAMERA>
224 std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>>
226  std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>> projection_matrices;
227  for (const CAMERA &camera: cameras) {
228  projection_matrices.push_back(camera.cameraProjectionMatrix());
229  }
230  return projection_matrices;
231 }
232 
233 // overload, assuming pinholePose
234 template<class CALIBRATION>
235 std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>> projectionMatricesFromPoses(
236  const std::vector<Pose3> &poses, std::shared_ptr<CALIBRATION> sharedCal) {
237  std::vector<Matrix34, Eigen::aligned_allocator<Matrix34>> projection_matrices;
238  for (size_t i = 0; i < poses.size(); i++) {
240  projection_matrices.push_back(camera.cameraProjectionMatrix());
241  }
242  return projection_matrices;
243 }
244 
252 template <class CALIBRATION>
253 Cal3_S2 createPinholeCalibration(const CALIBRATION& cal) {
254  const auto& K = cal.K();
255  return Cal3_S2(K(0, 0), K(1, 1), K(0, 1), K(0, 2), K(1, 2));
256 }
257 
260 template <class CALIBRATION, class MEASUREMENT>
262  const CALIBRATION& cal, const MEASUREMENT& measurement,
263  std::optional<Cal3_S2> pinholeCal = {}) {
264  if (!pinholeCal) {
265  pinholeCal = createPinholeCalibration(cal);
266  }
267  return pinholeCal->uncalibrate(cal.calibrate(measurement));
268 }
269 
281 template <class CALIBRATION>
283  const Point2Vector& measurements) {
284  Cal3_S2 pinholeCalibration = createPinholeCalibration(cal);
285  Point2Vector undistortedMeasurements;
286  // Calibrate with cal and uncalibrate with pinhole version of cal so that
287  // measurements are undistorted.
289  std::back_inserter(undistortedMeasurements),
290  [&cal, &pinholeCalibration](const Point2& measurement) {
291  return undistortMeasurementInternal<CALIBRATION>(
292  cal, measurement, pinholeCalibration);
293  });
294  return undistortedMeasurements;
295 }
296 
298 template <>
300  const Point2Vector& measurements) {
301  return measurements;
302 }
303 
315 template <class CAMERA>
316 typename CAMERA::MeasurementVector undistortMeasurements(
317  const CameraSet<CAMERA>& cameras,
318  const typename CAMERA::MeasurementVector& measurements) {
319  const size_t nrMeasurements = measurements.size();
320 #ifndef NDEBUG
321  if (nrMeasurements != cameras.size()) {
322  throw;
323  }
324 #endif
325  typename CAMERA::MeasurementVector undistortedMeasurements(nrMeasurements);
326  for (size_t ii = 0; ii < nrMeasurements; ++ii) {
327  // Calibrate with cal and uncalibrate with pinhole version of cal so that
328  // measurements are undistorted.
329  undistortedMeasurements[ii] =
330  undistortMeasurementInternal<typename CAMERA::CalibrationType>(
331  cameras[ii].calibration(), measurements[ii]);
332  }
333  return undistortedMeasurements;
334 }
335 
337 template <class CAMERA = PinholeCamera<Cal3_S2>>
341  return measurements;
342 }
343 
345 template <class CAMERA = SphericalCamera>
349  return measurements;
350 }
351 
360 template <class CALIBRATION>
362  const CALIBRATION& cal, const Point2Vector& measurements) {
363  Point3Vector calibratedMeasurements;
364  // Calibrate with cal and uncalibrate with pinhole version of cal so that
365  // measurements are undistorted.
367  std::back_inserter(calibratedMeasurements),
368  [&cal](const Point2& measurement) {
369  Point3 p;
370  p << cal.calibrate(measurement), 1.0;
371  return p;
372  });
373  return calibratedMeasurements;
374 }
375 
384 template <class CAMERA>
386  const CameraSet<CAMERA>& cameras,
387  const typename CAMERA::MeasurementVector& measurements) {
388  const size_t nrMeasurements = measurements.size();
389  assert(nrMeasurements == cameras.size());
390  Point3Vector calibratedMeasurements(nrMeasurements);
391  for (size_t ii = 0; ii < nrMeasurements; ++ii) {
392  calibratedMeasurements[ii]
393  << cameras[ii].calibration().calibrate(measurements[ii]),
394  1.0;
395  }
396  return calibratedMeasurements;
397 }
398 
400 template <class CAMERA = SphericalCamera>
404  Point3Vector calibratedMeasurements(measurements.size());
405  for (size_t ii = 0; ii < measurements.size(); ++ii) {
406  calibratedMeasurements[ii] << measurements[ii].point3();
407  }
408  return calibratedMeasurements;
409 }
410 
424 template <class CALIBRATION>
425 Point3 triangulatePoint3(const std::vector<Pose3>& poses,
426  std::shared_ptr<CALIBRATION> sharedCal,
427  const Point2Vector& measurements,
428  double rank_tol = 1e-9, bool optimize = false,
429  const SharedNoiseModel& model = nullptr,
430  const bool useLOST = false) {
431  assert(poses.size() == measurements.size());
432  if (poses.size() < 2) throw(TriangulationUnderconstrainedException());
433 
434  // Triangulate linearly
435  Point3 point;
436  if (useLOST) {
437  // Reduce input noise model to an isotropic noise model using the mean of
438  // the diagonal.
439  const double measurementSigma = model ? model->sigmas().mean() : 1e-4;
440  SharedIsotropic measurementNoise =
441  noiseModel::Isotropic::Sigma(2, measurementSigma);
442  // calibrate the measurements to obtain homogenous coordinates in image
443  // plane.
444  auto calibratedMeasurements =
445  calibrateMeasurementsShared<CALIBRATION>(*sharedCal, measurements);
446 
447  point = triangulateLOST(poses, calibratedMeasurements, measurementNoise,
448  rank_tol);
449  } else {
450  // construct projection matrices from poses & calibration
451  auto projection_matrices = projectionMatricesFromPoses(poses, sharedCal);
452 
453  // Undistort the measurements, leaving only the pinhole elements in effect.
454  auto undistortedMeasurements =
455  undistortMeasurements<CALIBRATION>(*sharedCal, measurements);
456 
457  point =
458  triangulateDLT(projection_matrices, undistortedMeasurements, rank_tol);
459  }
460 
461  // Then refine using non-linear optimization
462  if (optimize)
463  point = triangulateNonlinear<CALIBRATION> //
464  (poses, sharedCal, measurements, point, model);
465 
466 #ifdef GTSAM_THROW_CHEIRALITY_EXCEPTION
467  // verify that the triangulated point lies in front of all cameras
468  for (const Pose3& pose : poses) {
469  const Point3& p_local = pose.transformTo(point);
470  if (p_local.z() <= 0) throw(TriangulationCheiralityException());
471  }
472 #endif
473 
474  return point;
475 }
476 
491 template <class CAMERA>
493  const typename CAMERA::MeasurementVector& measurements,
494  double rank_tol = 1e-9, bool optimize = false,
495  const SharedNoiseModel& model = nullptr,
496  const bool useLOST = false) {
497  size_t m = cameras.size();
498  assert(measurements.size() == m);
499 
500  if (m < 2) throw(TriangulationUnderconstrainedException());
501 
502  // Triangulate linearly
503  Point3 point;
504  if (useLOST) {
505  // Reduce input noise model to an isotropic noise model using the mean of
506  // the diagonal.
507  const double measurementSigma = model ? model->sigmas().mean() : 1e-4;
508  SharedIsotropic measurementNoise =
509  noiseModel::Isotropic::Sigma(2, measurementSigma);
510 
511  // construct poses from cameras.
512  std::vector<Pose3> poses;
513  poses.reserve(cameras.size());
514  for (const auto& camera : cameras) poses.push_back(camera.pose());
515 
516  // calibrate the measurements to obtain homogenous coordinates in image
517  // plane.
518  auto calibratedMeasurements =
519  calibrateMeasurements<CAMERA>(cameras, measurements);
520 
521  point = triangulateLOST(poses, calibratedMeasurements, measurementNoise,
522  rank_tol);
523  } else {
524  // construct projection matrices from poses & calibration
525  auto projection_matrices = projectionMatricesFromCameras(cameras);
526 
527  // Undistort the measurements, leaving only the pinhole elements in effect.
528  auto undistortedMeasurements =
529  undistortMeasurements<CAMERA>(cameras, measurements);
530 
531  point =
532  triangulateDLT(projection_matrices, undistortedMeasurements, rank_tol);
533  }
534 
535  // Then refine using non-linear optimization
536  if (optimize) {
537  point = triangulateNonlinear<CAMERA>(cameras, measurements, point, model);
538  }
539 
540 #ifdef GTSAM_THROW_CHEIRALITY_EXCEPTION
541  // verify that the triangulated point lies in front of all cameras
542  for (const CAMERA& camera : cameras) {
543  const Point3& p_local = camera.pose().transformTo(point);
544  if (p_local.z() <= 0) throw(TriangulationCheiralityException());
545  }
546 #endif
547 
548  return point;
549 }
550 
552 template <class CALIBRATION>
554  const Point2Vector& measurements,
555  double rank_tol = 1e-9, bool optimize = false,
556  const SharedNoiseModel& model = nullptr,
557  const bool useLOST = false) {
558  return triangulatePoint3<PinholeCamera<CALIBRATION>> //
559  (cameras, measurements, rank_tol, optimize, model, useLOST);
560 }
561 
562 struct GTSAM_EXPORT TriangulationParameters {
563 
564  double rankTolerance;
565  bool enableEPI;
567 
573 
580 
584  bool useLOST;
585 
587 
597  TriangulationParameters(const double _rankTolerance = 1.0,
598  const bool _enableEPI = false, double _landmarkDistanceThreshold = -1,
599  double _dynamicOutlierRejectionThreshold = -1,
600  const bool _useLOST = false,
601  const SharedNoiseModel& _noiseModel = nullptr) :
602  rankTolerance(_rankTolerance), enableEPI(_enableEPI), //
603  landmarkDistanceThreshold(_landmarkDistanceThreshold), //
604  dynamicOutlierRejectionThreshold(_dynamicOutlierRejectionThreshold),
605  useLOST(_useLOST),
606  noiseModel(_noiseModel){
607  }
608 
609  // stream to output
610  friend std::ostream &operator<<(std::ostream &os,
611  const TriangulationParameters& p) {
612  os << "rankTolerance = " << p.rankTolerance << std::endl;
613  os << "enableEPI = " << p.enableEPI << std::endl;
614  os << "landmarkDistanceThreshold = " << p.landmarkDistanceThreshold
615  << std::endl;
616  os << "dynamicOutlierRejectionThreshold = "
617  << p.dynamicOutlierRejectionThreshold << std::endl;
618  os << "useLOST = " << p.useLOST << std::endl;
619  os << "noise model" << std::endl;
620  return os;
621  }
622 
623 private:
624 
625 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
626  friend class boost::serialization::access;
628  template<class ARCHIVE>
629  void serialize(ARCHIVE & ar, const unsigned int version) {
630  ar & BOOST_SERIALIZATION_NVP(rankTolerance);
631  ar & BOOST_SERIALIZATION_NVP(enableEPI);
632  ar & BOOST_SERIALIZATION_NVP(landmarkDistanceThreshold);
633  ar & BOOST_SERIALIZATION_NVP(dynamicOutlierRejectionThreshold);
634  }
635 #endif
636 };
637 
642 class TriangulationResult : public std::optional<Point3> {
643  public:
646 
647  private:
649 
650  public:
655 
659  TriangulationResult(const Point3& p) : status(VALID) { emplace(p); }
662  }
666  }
669  }
670  bool valid() const { return status == VALID; }
671  bool degenerate() const { return status == DEGENERATE; }
672  bool outlier() const { return status == OUTLIER; }
673  bool farPoint() const { return status == FAR_POINT; }
674  bool behindCamera() const { return status == BEHIND_CAMERA; }
675  const gtsam::Point3& get() const {
676  if (!has_value()) throw std::runtime_error("TriangulationResult has no value");
677  return value();
678  }
679  // stream to output
680  GTSAM_EXPORT friend std::ostream& operator<<(
681  std::ostream& os, const TriangulationResult& result) {
682  if (result)
683  os << "point = " << *result << std::endl;
684  else
685  os << "no point, status = " << result.status << std::endl;
686  return os;
687  }
688 
689  private:
690 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
691  friend class boost::serialization::access;
693  template <class ARCHIVE>
694  void serialize(ARCHIVE& ar, const unsigned int version) {
695  ar& BOOST_SERIALIZATION_NVP(status);
696  }
697 #endif
698 };
699 
701 template<class CAMERA>
703  const typename CAMERA::MeasurementVector& measured,
705 
706  size_t m = cameras.size();
707 
708  // if we have a single pose the corresponding factor is uninformative
709  if (m < 2)
711  else
712  // We triangulate the 3D position of the landmark
713  try {
714  Point3 point =
715  triangulatePoint3<CAMERA>(cameras, measured, params.rankTolerance,
716  params.enableEPI, params.noiseModel, params.useLOST);
717 
718  // Check landmark distance and re-projection errors to avoid outliers
719  size_t i = 0;
720  double maxReprojError = 0.0;
721  for(const CAMERA& camera: cameras) {
722  const Pose3& pose = camera.pose();
723  if (params.landmarkDistanceThreshold > 0
725  > params.landmarkDistanceThreshold)
727 #ifdef GTSAM_THROW_CHEIRALITY_EXCEPTION
728  // verify that the triangulated point lies in front of all cameras
729  // Only needed if this was not yet handled by exception
730  const Point3& p_local = pose.transformTo(point);
731  if (p_local.z() <= 0)
733 #endif
734  // Check reprojection error
735  if (params.dynamicOutlierRejectionThreshold > 0) {
736  const typename CAMERA::Measurement& zi = measured.at(i);
737  Point2 reprojectionError = camera.reprojectionError(point, zi);
738  maxReprojError = std::max(maxReprojError, reprojectionError.norm());
739  }
740  i += 1;
741  }
742  // Flag as degenerate if average reprojection error is too large
743  if (params.dynamicOutlierRejectionThreshold > 0
744  && maxReprojError > params.dynamicOutlierRejectionThreshold)
746 
747  // all good!
748  return TriangulationResult(point);
750  // This exception is thrown if
751  // 1) There is a single pose for triangulation - this should not happen because we checked the number of poses before
752  // 2) The rank of the matrix used for triangulation is < 3: rotation-only, parallel cameras (or motion towards the landmark)
755  // point is behind one of the cameras: can be the case of close-to-parallel cameras or may depend on outliers
757  }
758 }
759 
760 // Vector of Cameras - used by the Python/MATLAB wrapper
767 } // \namespace gtsam
gtsam::calibrateMeasurementsShared
Point3Vector calibrateMeasurementsShared(const CALIBRATION &cal, const Point2Vector &measurements)
Definition: triangulation.h:361
gtsam::projectionMatricesFromCameras
std::vector< Matrix34, Eigen::aligned_allocator< Matrix34 > > projectionMatricesFromCameras(const CameraSet< CAMERA > &cameras)
Definition: triangulation.h:225
Pose2.h
2D Pose
gtsam::TriangulationResult::DEGENERATE
@ DEGENERATE
Definition: triangulation.h:644
gtsam::PinholeCamera::MeasurementVector
Point2Vector MeasurementVector
Definition: PinholeCamera.h:42
pose
static const Pose3 pose(Rot3(Vector3(1, -1, -1).asDiagonal()), Point3(0, 0, 0.5))
CameraSet.h
Base class to create smart factors on poses or cameras.
gtsam::Pose3::transformTo
Point3 transformTo(const Point3 &point, OptionalJacobian< 3, 6 > Hself={}, OptionalJacobian< 3, 3 > Hpoint={}) const
takes point in world coordinates and transforms it to Pose coordinates
Definition: Pose3.cpp:372
fixture::cameras
std::array< PinholeCamera< Cal3_S2 >, 3 > cameras
Definition: testTransferFactor.cpp:59
gtsam::TriangulationFactor
Definition: TriangulationFactor.h:31
s
RealScalar s
Definition: level1_cplx_impl.h:126
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
SphericalCamera.h
Calibrated camera with spherical projection.
gtsam::Cal3_S2::calibrate
Point2 calibrate(const Point2 &p, OptionalJacobian< 2, 5 > Dcal={}, OptionalJacobian< 2, 2 > Dp={}) const
Definition: Cal3_S2.cpp:53
gtsam::undistortMeasurements
Point2Vector undistortMeasurements(const CALIBRATION &cal, const Point2Vector &measurements)
Definition: triangulation.h:282
Cal3_S2.h
The most common 5DOF 3D->2D calibration.
gtsam::TriangulationParameters::dynamicOutlierRejectionThreshold
double dynamicOutlierRejectionThreshold
Definition: triangulation.h:579
gtsam::TriangulationResult::outlier
bool outlier() const
Definition: triangulation.h:672
gtsam::optimize
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Definition: triangulation.cpp:177
gtsam::TriangulationResult::FarPoint
static TriangulationResult FarPoint()
Definition: triangulation.h:664
Values
measured
Point2 measured(-17, 30)
gtsam::TriangulationUnderconstrainedException::TriangulationUnderconstrainedException
TriangulationUnderconstrainedException()
Definition: triangulation.h:44
gtsam::undistortMeasurementInternal
MEASUREMENT undistortMeasurementInternal(const CALIBRATION &cal, const MEASUREMENT &measurement, std::optional< Cal3_S2 > pinholeCal={})
Definition: triangulation.h:261
different_sigmas::values
HybridValues values
Definition: testHybridBayesNet.cpp:245
Point3.h
3D Point
os
ofstream os("timeSchurFactors.csv")
vanilla::params
static const SmartProjectionParams params
Definition: smartFactorScenarios.h:69
result
Values result
Definition: OdometryOptimize.cpp:8
gtsam::CameraSet
A set of cameras, all with their own calibration.
Definition: CameraSet.h:37
fixture::cal
const Cal3_S2 cal(focalLength, focalLength, 0.0, principalPoint.x(), principalPoint.y())
gtsam::TriangulationResult::status
Status status
Definition: triangulation.h:645
gtsam::TriangulationResult::TriangulationResult
TriangulationResult()
Definition: triangulation.h:654
simulated2D::Measurement
GenericMeasurement< Point2, Point2 > Measurement
Definition: simulated2D.h:278
gtsam_unstable.tests.test_ProjectionFactorRollingShutter.point
point
Definition: test_ProjectionFactorRollingShutter.py:25
gtsam::TriangulationResult::Outlier
static TriangulationResult Outlier()
Definition: triangulation.h:663
gtsam::TriangulationParameters::rankTolerance
double rankTolerance
(the rank is the number of singular values of the triangulation matrix which are larger than rankTole...
Definition: triangulation.h:564
gtsam::TriangulationParameters
Definition: triangulation.h:562
Eigen::aligned_allocator
STL compatible allocator to use with types requiring a non standrad alignment.
Definition: Memory.h:878
gtsam::TriangulationResult::TriangulationResult
TriangulationResult(const Point3 &p)
Definition: triangulation.h:659
gtsam::TriangulationResult::get
const gtsam::Point3 & get() const
Definition: triangulation.h:675
gtsam::Pose3
Definition: Pose3.h:37
gtsam::triangulateNonlinear
Point3 triangulateNonlinear(const std::vector< Pose3 > &poses, std::shared_ptr< CALIBRATION > sharedCal, const Point2Vector &measurements, const Point3 &initialEstimate, const SharedNoiseModel &model=nullptr)
Definition: triangulation.h:191
gtsam::PinholeCamera
Definition: PinholeCamera.h:33
gtsam::NonlinearFactorGraph
Definition: NonlinearFactorGraph.h:55
gtsam::TriangulationParameters::useLOST
bool useLOST
Definition: triangulation.h:584
gtsam::noiseModel::Unit::Create
static shared_ptr Create(size_t dim)
Definition: NoiseModel.h:631
gtsam::createPinholeCalibration
Cal3_S2 createPinholeCalibration(const CALIBRATION &cal)
Definition: triangulation.h:253
gtsam::Pose3::translation
const Point3 & translation(OptionalJacobian< 3, 6 > Hself={}) const
get translation
Definition: Pose3.cpp:310
gtsam::TriangulationResult::valid
bool valid() const
Definition: triangulation.h:670
PinholeCamera.h
Base class for all pinhole cameras.
gtsam::TriangulationParameters::noiseModel
SharedNoiseModel noiseModel
used in the nonlinear triangulation
Definition: triangulation.h:586
Symbol.h
gtsam::TriangulationResult::OUTLIER
@ OUTLIER
Definition: triangulation.h:644
gtsam::projectionMatricesFromPoses
std::vector< Matrix34, Eigen::aligned_allocator< Matrix34 > > projectionMatricesFromPoses(const std::vector< Pose3 > &poses, std::shared_ptr< CALIBRATION > sharedCal)
Definition: triangulation.h:235
gtsam::triangulateSafe
TriangulationResult triangulateSafe(const CameraSet< CAMERA > &cameras, const typename CAMERA::MeasurementVector &measured, const TriangulationParameters &params)
triangulateSafe: extensive checking of the outcome
Definition: triangulation.h:702
conf.version
version
Definition: gtsam/3rdparty/GeographicLib/python/doc/conf.py:67
gtsam::HybridValues::insert
void insert(Key j, const Vector &value)
Definition: HybridValues.cpp:85
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
gtsam::Point2
Vector2 Point2
Definition: Point2.h:32
transform
EIGEN_DONT_INLINE void transform(const Transformation &t, Data &data)
Definition: geometry.cpp:25
sharedCal
static const std::shared_ptr< Cal3_S2 > sharedCal
Definition: testTriangulationFactor.cpp:33
gtsam::SharedNoiseModel
noiseModel::Base::shared_ptr SharedNoiseModel
Definition: NoiseModel.h:762
gtsam::TriangulationResult::operator<<
GTSAM_EXPORT friend std::ostream & operator<<(std::ostream &os, const TriangulationResult &result)
Definition: triangulation.h:680
gtsam::Cal3::K
virtual Matrix3 K() const
return calibration matrix K
Definition: Cal3.h:167
gtsam::TriangulationResult::Degenerate
static TriangulationResult Degenerate()
Definition: triangulation.h:660
Cal3Unified.h
Unified Calibration Model, see Mei07icra for details.
model
noiseModel::Diagonal::shared_ptr model
Definition: doc/Code/Pose2SLAMExample.cpp:7
gtsam::calibrateMeasurements
Point3Vector calibrateMeasurements(const CameraSet< CAMERA > &cameras, const typename CAMERA::MeasurementVector &measurements)
Definition: triangulation.h:385
gtsam::triangulatePoint3
Point3 triangulatePoint3(const std::vector< Pose3 > &poses, std::shared_ptr< CALIBRATION > sharedCal, const Point2Vector &measurements, double rank_tol=1e-9, bool optimize=false, const SharedNoiseModel &model=nullptr, const bool useLOST=false)
Definition: triangulation.h:425
gtsam::triangulateDLT
Point3 triangulateDLT(const std::vector< Matrix34, Eigen::aligned_allocator< Matrix34 >> &projection_matrices, const Point2Vector &measurements, double rank_tol)
Definition: triangulation.cpp:149
gtsam::SphericalCamera::MeasurementVector
std::vector< Unit3 > MeasurementVector
Definition: SphericalCamera.h:79
gtsam::TriangulationResult::degenerate
bool degenerate() const
Definition: triangulation.h:671
gtsam::TriangulationParameters::operator<<
friend std::ostream & operator<<(std::ostream &os, const TriangulationParameters &p)
Definition: triangulation.h:610
TriangulationFactor.h
gtsam::triangulationGraph
std::pair< NonlinearFactorGraph, Values > triangulationGraph(const std::vector< Pose3 > &poses, std::shared_ptr< CALIBRATION > sharedCal, const Point2Vector &measurements, Key landmarkKey, const Point3 &initialEstimate, const SharedNoiseModel &model=noiseModel::Unit::Create(2))
Definition: triangulation.h:126
gtsam
traits
Definition: SFMdata.h:40
gtsam::TriangulationResult::BehindCamera
static TriangulationResult BehindCamera()
Definition: triangulation.h:667
gtsam::TriangulationResult::BEHIND_CAMERA
@ BEHIND_CAMERA
Definition: triangulation.h:644
gtsam::TriangulationResult::TriangulationResult
TriangulationResult(Status s)
Definition: triangulation.h:648
gtsam::traits
Definition: Group.h:36
K
#define K
Definition: igam.h:8
estimation_fixture::measurements
std::vector< double > measurements
Definition: testHybridEstimation.cpp:51
gtsam::TriangulationUnderconstrainedException
Exception thrown by triangulateDLT when SVD returns rank < 3.
Definition: triangulation.h:42
NonlinearFactorGraph.h
Factor Graph consisting of non-linear factors.
gtsam::TriangulationParameters::landmarkDistanceThreshold
double landmarkDistanceThreshold
Definition: triangulation.h:572
gtsam::Values
Definition: Values.h:65
gtsam::TriangulationResult::behindCamera
bool behindCamera() const
Definition: triangulation.h:674
Cal3DS2.h
Calibration of a camera with radial distortion, calculations in base class Cal3DS2_Base.
std
Definition: BFloat16.h:88
gtsam::TriangulationCheiralityException::TriangulationCheiralityException
TriangulationCheiralityException()
Definition: triangulation.h:52
p
float * p
Definition: Tutorial_Map_using.cpp:9
gtsam::PinholeBase::pose
const Pose3 & pose() const
return pose, constant version
Definition: CalibratedCamera.h:154
gtsam::Camera
PinholeCamera< Cal3Bundler0 > Camera
Definition: testAdaptAutoDiff.cpp:52
gtsam::Point2Vector
std::vector< Point2, Eigen::aligned_allocator< Point2 > > Point2Vector
Definition: Point2.h:49
gtsam::Cal3_S2
The most common 5DOF 3D->2D calibration.
Definition: Cal3_S2.h:34
gtsam::TriangulationResult
Definition: triangulation.h:642
gtsam::Point3
Vector3 Point3
Definition: Point3.h:38
gtsam::TriangulationResult::FAR_POINT
@ FAR_POINT
Definition: triangulation.h:644
gtsam::SharedIsotropic
noiseModel::Isotropic::shared_ptr SharedIsotropic
Definition: NoiseModel.h:766
gtsam::triangulateHomogeneousDLT
Vector4 triangulateHomogeneousDLT(const std::vector< Matrix34, Eigen::aligned_allocator< Matrix34 >> &projection_matrices, const Point2Vector &measurements, double rank_tol)
Definition: triangulation.cpp:27
gtsam::noiseModel::Isotropic::Sigma
static shared_ptr Sigma(size_t dim, double sigma, bool smart=true)
Definition: NoiseModel.cpp:625
gtsam::TriangulationResult::VALID
@ VALID
Definition: triangulation.h:644
gtsam::triangulateLOST
Point3 triangulateLOST(const std::vector< Pose3 > &poses, const Point3Vector &calibratedMeasurements, const SharedIsotropic &measurementNoise, double rank_tol)
Triangulation using the LOST (Linear Optimal Sine Triangulation) algorithm proposed in https://arxiv....
Definition: triangulation.cpp:86
camera
static const CalibratedCamera camera(kDefaultPose)
gtsam::TriangulationCheiralityException
Exception thrown by triangulateDLT when landmark is behind one or more of the cameras.
Definition: triangulation.h:50
gtsam::PinholePose
Definition: PinholePose.h:239
graph
NonlinearFactorGraph graph
Definition: doc/Code/OdometryExample.cpp:2
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97
max
#define max(a, b)
Definition: datatypes.h:20
gtsam::distance3
double distance3(const Point3 &p1, const Point3 &q, OptionalJacobian< 1, 3 > H1, OptionalJacobian< 1, 3 > H2)
distance between two points
Definition: Point3.cpp:27
gtsam::TriangulationParameters::TriangulationParameters
TriangulationParameters(const double _rankTolerance=1.0, const bool _enableEPI=false, double _landmarkDistanceThreshold=-1, double _dynamicOutlierRejectionThreshold=-1, const bool _useLOST=false, const SharedNoiseModel &_noiseModel=nullptr)
Definition: triangulation.h:597
Cal3Bundler.h
Calibration used by Bundler.
test_callbacks.value
value
Definition: test_callbacks.py:160
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
gtsam::TriangulationResult::farPoint
bool farPoint() const
Definition: triangulation.h:673
measurement
static Point2 measurement(323.0, 240.0)
gtsam::FactorGraph::emplace_shared
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
Definition: FactorGraph.h:153
gtsam::TriangulationResult::Status
Status
Definition: triangulation.h:644
gtsam::Symbol
Definition: inference/Symbol.h:37
gtsam::Point3Vector
std::vector< Point3, Eigen::aligned_allocator< Point3 > > Point3Vector
Definition: Point3.h:39
Cal3Fisheye.h
Calibration of a fisheye camera.


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:18:14