From d84ae6b0c16581e9dc745131b289127db5fd25b4 Mon Sep 17 00:00:00 2001 From: Fan Jiang Date: Wed, 1 Dec 2021 14:46:20 -0500 Subject: [PATCH] Fix the template substitution --- gtsam/geometry/tests/testTriangulation.cpp | 4 +--- gtsam/geometry/triangulation.h | 15 +++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/gtsam/geometry/tests/testTriangulation.cpp b/gtsam/geometry/tests/testTriangulation.cpp index b93baa18e..7314ae227 100644 --- a/gtsam/geometry/tests/testTriangulation.cpp +++ b/gtsam/geometry/tests/testTriangulation.cpp @@ -468,9 +468,7 @@ TEST(triangulation, twoPoses_sphericalCamera) { double rank_tol = 1e-9; // 1. Test linear triangulation via DLT - std::vector> - projection_matrices = - getCameraProjectionMatrices(cameras); + auto projection_matrices = projectionMatricesFromCameras(cameras); Point3 point = triangulateDLT(projection_matrices, measurements, rank_tol); EXPECT(assert_equal(landmark, point, 1e-7)); diff --git a/gtsam/geometry/triangulation.h b/gtsam/geometry/triangulation.h index 12e9892fc..683435ed3 100644 --- a/gtsam/geometry/triangulation.h +++ b/gtsam/geometry/triangulation.h @@ -202,9 +202,10 @@ Point3 triangulateNonlinear( } template -std::vector> getCameraProjectionMatrices(const CameraSet& cameras) { +std::vector> +projectionMatricesFromCameras(const CameraSet &cameras) { std::vector> projection_matrices; - for(const CAMERA& camera: cameras){ + for (const CAMERA &camera: cameras) { projection_matrices.push_back(camera.getCameraProjectionMatrix()); } return projection_matrices; @@ -212,8 +213,8 @@ std::vector> getCameraProjectionMat // overload, assuming pinholePose template -std::vector> getCameraProjectionMatrices( - const std::vector& poses, boost::shared_ptr sharedCal) { +std::vector> projectionMatricesFromPoses( + const std::vector &poses, boost::shared_ptr sharedCal) { std::vector> projection_matrices; for (size_t i = 0; i < poses.size(); i++) { PinholePose camera(poses.at(i), sharedCal); @@ -245,8 +246,7 @@ Point3 triangulatePoint3(const std::vector& poses, throw(TriangulationUnderconstrainedException()); // construct projection matrices from poses & calibration - std::vector> projection_matrices = - getCameraProjectionMatrices< CALIBRATION >(poses, sharedCal); + auto projection_matrices = projectionMatricesFromPoses(poses, sharedCal); // Triangulate linearly Point3 point = triangulateDLT(projection_matrices, measurements, rank_tol); @@ -293,8 +293,7 @@ Point3 triangulatePoint3( throw(TriangulationUnderconstrainedException()); // construct projection matrices from poses & calibration - std::vector> projection_matrices = - getCameraProjectionMatrices(cameras); + auto projection_matrices = projectionMatricesFromCameras(cameras); Point3 point = triangulateDLT(projection_matrices, measurements, rank_tol); // The n refine using non-linear optimization