From d5a57092629a635dbce29feb747ce8518c84d4a0 Mon Sep 17 00:00:00 2001 From: Pablo Fernandez Alcantarilla Date: Thu, 24 Oct 2013 00:06:39 +0000 Subject: [PATCH] Throws CheiralityException is flag GTSAM_THROW_CHEIRALITY_EXCEPTION is set to true (default behaviour) --- gtsam/geometry/PinholeCamera.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gtsam/geometry/PinholeCamera.h b/gtsam/geometry/PinholeCamera.h index 10a1a2401..15b7715b7 100644 --- a/gtsam/geometry/PinholeCamera.h +++ b/gtsam/geometry/PinholeCamera.h @@ -299,8 +299,11 @@ public: // Transform to camera coordinates and check cheirality const Point3 pc = pose_.transform_to(pw); + +#ifdef GTSAM_THROW_CHEIRALITY_EXCEPTION if (pc.z() <= 0) throw CheiralityException(); +#endif // Project to normalized image coordinates const Point2 pn = project_to_camera(pc); @@ -390,8 +393,11 @@ public: if (!Dcamera && !Dpoint) { const Point3 pc = pose_.transform_to(pw); - if (pc.z() <= 0) - throw CheiralityException(); + +#ifdef GTSAM_THROW_CHEIRALITY_EXCEPTION + if (pc.z() <= 0) + throw CheiralityException(); +#endif const Point2 pn = project_to_camera(pc); return K_.uncalibrate(pn); }