diff options
Diffstat (limited to 'examples/snavely_reprojection_error.h')
-rw-r--r-- | examples/snavely_reprojection_error.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/snavely_reprojection_error.h b/examples/snavely_reprojection_error.h index 0704217..d3263f3 100644 --- a/examples/snavely_reprojection_error.h +++ b/examples/snavely_reprojection_error.h @@ -91,6 +91,14 @@ struct SnavelyReprojectionError { return true; } + // Factory to hide the construction of the CostFunction object from + // the client code. + static ceres::CostFunction* Create(const double observed_x, + const double observed_y) { + return (new ceres::AutoDiffCostFunction<SnavelyReprojectionError, 2, 9, 3>( + new SnavelyReprojectionError(observed_x, observed_y))); + } + double observed_x; double observed_y; }; @@ -146,6 +154,16 @@ struct SnavelyReprojectionErrorWithQuaternions { return true; } + // Factory to hide the construction of the CostFunction object from + // the client code. + static ceres::CostFunction* Create(const double observed_x, + const double observed_y) { + return (new ceres::AutoDiffCostFunction< + SnavelyReprojectionErrorWithQuaternions, 2, 4, 6, 3>( + new SnavelyReprojectionErrorWithQuaternions(observed_x, + observed_y))); + } + double observed_x; double observed_y; }; |