From eb28d0ffa89c04235b21e47d6bdaf7f0b74b9dc6 Mon Sep 17 00:00:00 2001 From: dellaert Date: Tue, 24 Feb 2015 14:09:35 +0100 Subject: [PATCH] Restored reprojectionErrors -> reprojectionError --- gtsam/geometry/CameraSet.h | 4 ++-- gtsam/geometry/tests/testCameraSet.cpp | 8 ++++---- gtsam/slam/SmartFactorBase.h | 16 ++++++++-------- gtsam/slam/SmartProjectionFactor.h | 2 +- .../slam/tests/testSmartProjectionPoseFactor.cpp | 8 ++++---- .../slam/SmartStereoProjectionFactor.h | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gtsam/geometry/CameraSet.h b/gtsam/geometry/CameraSet.h index eb58d1658..2192c38b9 100644 --- a/gtsam/geometry/CameraSet.h +++ b/gtsam/geometry/CameraSet.h @@ -140,7 +140,7 @@ public: } /// Calculate vector of re-projection errors - Vector reprojectionErrors(const Point3& point, const std::vector& measured, + Vector reprojectionError(const Point3& point, const std::vector& measured, boost::optional F = boost::none, // boost::optional E = boost::none) const { return ErrorVector(project2(point,F,E), measured); @@ -148,7 +148,7 @@ public: /// Calculate vector of re-projection errors, from point at infinity // TODO: take Unit3 instead - Vector reprojectionErrorsAtInfinity(const Point3& point, + Vector reprojectionErrorAtInfinity(const Point3& point, const std::vector& measured) const { return ErrorVector(projectAtInfinity(point), measured); } diff --git a/gtsam/geometry/tests/testCameraSet.cpp b/gtsam/geometry/tests/testCameraSet.cpp index a003b6bce..25a6da5b2 100644 --- a/gtsam/geometry/tests/testCameraSet.cpp +++ b/gtsam/geometry/tests/testCameraSet.cpp @@ -73,16 +73,16 @@ TEST(CameraSet, Pinhole) { measured.push_back(Point2(3, 4)); Vector4 expectedV; - // reprojectionErrors + // reprojectionError expectedV << -1, -2, -3, -4; - Vector actualV = set.reprojectionErrors(p, measured); + Vector actualV = set.reprojectionError(p, measured); EXPECT(assert_equal(expectedV, actualV)); - // reprojectionErrorsAtInfinity + // reprojectionErrorAtInfinity EXPECT( assert_equal(Point3(0, 0, 1), camera.backprojectPointAtInfinity(Point2()))); - actualV = set.reprojectionErrorsAtInfinity(p, measured); + actualV = set.reprojectionErrorAtInfinity(p, measured); EXPECT(assert_equal(expectedV, actualV)); } diff --git a/gtsam/slam/SmartFactorBase.h b/gtsam/slam/SmartFactorBase.h index 6a33eeb6e..9554b7c4a 100644 --- a/gtsam/slam/SmartFactorBase.h +++ b/gtsam/slam/SmartFactorBase.h @@ -215,7 +215,7 @@ public: /// Calculate vector of re-projection errors, noise model applied Vector whitenedErrors(const Cameras& cameras, const Point3& point) const { - Vector b = cameras.reprojectionErrors(point, measured_); + Vector b = cameras.reprojectionError(point, measured_); if (noiseModel_) noiseModel_->whitenInPlace(b); return b; @@ -225,7 +225,7 @@ public: // TODO: Unit3 Vector whitenedErrorsAtInfinity(const Cameras& cameras, const Point3& point) const { - Vector b = cameras.reprojectionErrorsAtInfinity(point, measured_); + Vector b = cameras.reprojectionErrorAtInfinity(point, measured_); if (noiseModel_) noiseModel_->whitenInPlace(b); return b; @@ -252,8 +252,8 @@ public: } /// Compute reprojection errors - Vector reprojectionErrors(const Cameras& cameras, const Point3& point) const { - return cameras.reprojectionErrors(point, measured_); + Vector reprojectionError(const Cameras& cameras, const Point3& point) const { + return cameras.reprojectionError(point, measured_); } /** @@ -261,10 +261,10 @@ public: * TODO: the treatment of body_P_sensor_ is weird: the transformation * is applied in the caller, but the derivatives are computed here. */ - Vector reprojectionErrors(const Cameras& cameras, const Point3& point, + Vector reprojectionError(const Cameras& cameras, const Point3& point, typename Cameras::FBlocks& F, Matrix& E) const { - Vector b = cameras.reprojectionErrors(point, measured_, F, E); + Vector b = cameras.reprojectionError(point, measured_, F, E); // Apply sensor chain rule if needed TODO: no simpler way ?? if (body_P_sensor_) { @@ -308,7 +308,7 @@ public: /// Assumes non-degenerate ! void computeEP(Matrix& E, Matrix& P, const Cameras& cameras, const Point3& point) const { - cameras.reprojectionErrors(point, measured_, boost::none, E); + cameras.reprojectionError(point, measured_, boost::none, E); P = PointCov(E); } @@ -322,7 +322,7 @@ public: // Project into Camera set and calculate derivatives typename Cameras::FBlocks F; - b = reprojectionErrors(cameras, point, F, E); + b = reprojectionError(cameras, point, F, E); // Now calculate f and divide up the F derivatives into Fblocks double f = 0.0; diff --git a/gtsam/slam/SmartProjectionFactor.h b/gtsam/slam/SmartProjectionFactor.h index 4a9caf0b0..3a996918f 100644 --- a/gtsam/slam/SmartProjectionFactor.h +++ b/gtsam/slam/SmartProjectionFactor.h @@ -573,7 +573,7 @@ public: /// Calculate vector of re-projection errors, before applying noise model /// Assumes triangulation was done and degeneracy handled Vector reprojectionError(const Cameras& cameras) const { - return cameras.reprojectionErrors(point_,this->measured_); + return cameras.reprojectionError(point_,this->measured_); } /// Calculate vector of re-projection errors, before applying noise model diff --git a/gtsam/slam/tests/testSmartProjectionPoseFactor.cpp b/gtsam/slam/tests/testSmartProjectionPoseFactor.cpp index 671fb771f..41c0fac0a 100644 --- a/gtsam/slam/tests/testSmartProjectionPoseFactor.cpp +++ b/gtsam/slam/tests/testSmartProjectionPoseFactor.cpp @@ -142,10 +142,10 @@ TEST_UNSAFE( SmartProjectionPoseFactor, noiseless ) { factor.computeEP(actualE, PointCov, values); EXPECT(assert_equal(expectedE, actualE, 1e-7)); - // Calculate using reprojectionErrors, note not yet divided by sigma ! + // Calculate using reprojectionError, note not yet divided by sigma ! SmartFactor::Cameras::FBlocks F; Matrix E; - Vector actualErrors = factor.reprojectionErrors(cameras, *point, F, E); + Vector actualErrors = factor.reprojectionError(cameras, *point, F, E); EXPECT(assert_equal(expectedE, E, 1e-7)); EXPECT(assert_equal(zero(4), actualErrors, 1e-7)); @@ -379,10 +379,10 @@ TEST( SmartProjectionPoseFactor, smartFactorWithSensorBodyTransform ) { // Calculate using whitenedError Matrix E; SmartFactor::Cameras::FBlocks F; - Vector actualErrors = smartFactor1->reprojectionErrors(cameras, *point, F, E); + Vector actualErrors = smartFactor1->reprojectionError(cameras, *point, F, E); EXPECT(assert_equal(expectedE, E, 1e-7)); - // Success ! The derivatives of reprojectionErrors now agree with f ! + // Success ! The derivatives of reprojectionError now agree with f ! EXPECT(assert_equal(f(*point) * sigma, actualErrors, 1e-7)); } diff --git a/gtsam_unstable/slam/SmartStereoProjectionFactor.h b/gtsam_unstable/slam/SmartStereoProjectionFactor.h index 0e70add9f..04383839f 100644 --- a/gtsam_unstable/slam/SmartStereoProjectionFactor.h +++ b/gtsam_unstable/slam/SmartStereoProjectionFactor.h @@ -629,7 +629,7 @@ public: Cameras cameras; bool nonDegenerate = computeCamerasAndTriangulate(values, cameras); if (nonDegenerate) - return cameras.reprojectionErrors(point_); + return cameras.reprojectionError(point_); else return zero(cameras.size() * 3); }