diff --git a/gtsam/geometry/PinholeCamera.h b/gtsam/geometry/PinholeCamera.h index ecfbca057..61e9f0909 100644 --- a/gtsam/geometry/PinholeCamera.h +++ b/gtsam/geometry/PinholeCamera.h @@ -313,9 +313,8 @@ public: } /// for Linear Triangulation - Matrix34 getCameraProjectionMatrix() const { - Matrix34 P = Matrix34(PinholeBase::pose().inverse().matrix().block(0, 0, 3, 4)); - return K_.K() * P; + Matrix34 cameraProjectionMatrix() const { + return K_.K() * PinholeBase::pose().inverse().matrix().block(0, 0, 3, 4); } /// for Nonlinear Triangulation diff --git a/gtsam/geometry/PinholePose.h b/gtsam/geometry/PinholePose.h index f364828a1..b4999af7c 100644 --- a/gtsam/geometry/PinholePose.h +++ b/gtsam/geometry/PinholePose.h @@ -417,7 +417,7 @@ public: } /// for Linear Triangulation - Matrix34 getCameraProjectionMatrix() const { + Matrix34 cameraProjectionMatrix() const { Matrix34 P = Matrix34(PinholeBase::pose().inverse().matrix().block(0, 0, 3, 4)); return K_->K() * P; } diff --git a/gtsam/geometry/SphericalCamera.h b/gtsam/geometry/SphericalCamera.h index 4e4e9db61..59658f3ce 100644 --- a/gtsam/geometry/SphericalCamera.h +++ b/gtsam/geometry/SphericalCamera.h @@ -30,6 +30,13 @@ namespace gtsam { +/** + * Empty calibration. Only needed to play well with other cameras + * (e.g., when templating functions wrt cameras), since other cameras + * have constuctors in the form ‘camera(pose,calibration)’ + * @addtogroup geometry + * \nosubgrouping + */ class GTSAM_EXPORT EmptyCal { public: enum { dimension = 0 }; @@ -42,7 +49,8 @@ class GTSAM_EXPORT EmptyCal { }; /** - * A spherical camera class that has a Pose3 and measures bearing vectors + * A spherical camera class that has a Pose3 and measures bearing vectors. + * The camera has an ‘Empty’ calibration and the only 6 dof are the pose * @addtogroup geometry * \nosubgrouping */ @@ -183,7 +191,7 @@ class GTSAM_EXPORT SphericalCamera { } /// for Linear Triangulation - Matrix34 getCameraProjectionMatrix() const { + Matrix34 cameraProjectionMatrix() const { return Matrix34(pose_.inverse().matrix().block(0, 0, 3, 4)); } diff --git a/gtsam/geometry/triangulation.h b/gtsam/geometry/triangulation.h index 683435ed3..aaa8d1a26 100644 --- a/gtsam/geometry/triangulation.h +++ b/gtsam/geometry/triangulation.h @@ -206,7 +206,7 @@ std::vector> projectionMatricesFromCameras(const CameraSet &cameras) { std::vector> projection_matrices; for (const CAMERA &camera: cameras) { - projection_matrices.push_back(camera.getCameraProjectionMatrix()); + projection_matrices.push_back(camera.cameraProjectionMatrix()); } return projection_matrices; } @@ -218,7 +218,7 @@ std::vector> projectionMatricesFrom std::vector> projection_matrices; for (size_t i = 0; i < poses.size(); i++) { PinholePose camera(poses.at(i), sharedCal); - projection_matrices.push_back(camera.getCameraProjectionMatrix()); + projection_matrices.push_back(camera.cameraProjectionMatrix()); } return projection_matrices; }