removed redundant shared_ptr typedefs in Cal3_S2 and Cal3_S2Stereo

release/4.3a0
Chris Beall 2013-05-08 19:21:00 +00:00
parent ea1f374930
commit 32b3eebf07
6 changed files with 15 additions and 21 deletions

View File

@ -32,15 +32,15 @@ using symbol_shorthand::X;
class ResectioningFactor: public NoiseModelFactor1<Pose3> { class ResectioningFactor: public NoiseModelFactor1<Pose3> {
typedef NoiseModelFactor1<Pose3> Base; typedef NoiseModelFactor1<Pose3> Base;
shared_ptrK K_; // camera's intrinsic parameters Cal3_S2::shared_ptr K_; ///< camera's intrinsic parameters
Point3 P_; // 3D point on the calibration rig Point3 P_; ///< 3D point on the calibration rig
Point2 p_; // 2D measurement of the 3D point Point2 p_; ///< 2D measurement of the 3D point
public: public:
/// Construct factor given known point P and its projection p /// Construct factor given known point P and its projection p
ResectioningFactor(const SharedNoiseModel& model, const Key& key, ResectioningFactor(const SharedNoiseModel& model, const Key& key,
const shared_ptrK& calib, const Point2& p, const Point3& P) : const Cal3_S2::shared_ptr& calib, const Point2& p, const Point3& P) :
Base(model, key), K_(calib), P_(P), p_(p) { Base(model, key), K_(calib), P_(P), p_(p) {
} }
@ -63,7 +63,7 @@ public:
*******************************************************************************/ *******************************************************************************/
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
/* read camera intrinsic parameters */ /* read camera intrinsic parameters */
shared_ptrK calib(new Cal3_S2(1, 1, 0, 50, 50)); Cal3_S2::shared_ptr calib(new Cal3_S2(1, 1, 0, 50, 50));
/* 1. create graph */ /* 1. create graph */
NonlinearFactorGraph graph; NonlinearFactorGraph graph;

View File

@ -187,8 +187,4 @@ namespace gtsam {
}; };
} // \ namespace gtsam
typedef boost::shared_ptr<Cal3_S2> shared_ptrK; ///< shared pointer to calibration object
} // gtsam

View File

@ -111,7 +111,4 @@ namespace gtsam {
/// @} /// @}
}; };
} // \ namespace gtsam
typedef boost::shared_ptr<Cal3_S2Stereo> shared_ptrKStereo; ///< shared pointer to stereo calibration object
}

View File

@ -33,7 +33,7 @@ private:
// Keep a copy of measurement and calibration for I/O // Keep a copy of measurement and calibration for I/O
StereoPoint2 measured_; ///< the measurement StereoPoint2 measured_; ///< the measurement
boost::shared_ptr<Cal3_S2Stereo> K_; ///< shared pointer to calibration Cal3_S2Stereo::shared_ptr K_; ///< shared pointer to calibration
boost::optional<POSE> body_P_sensor_; ///< The pose of the sensor in the body frame boost::optional<POSE> body_P_sensor_; ///< The pose of the sensor in the body frame
public: public:
@ -58,7 +58,7 @@ public:
* @param K the constant calibration * @param K the constant calibration
*/ */
GenericStereoFactor(const StereoPoint2& measured, const SharedNoiseModel& model, GenericStereoFactor(const StereoPoint2& measured, const SharedNoiseModel& model,
Key poseKey, Key landmarkKey, const shared_ptrKStereo& K, Key poseKey, Key landmarkKey, const Cal3_S2Stereo::shared_ptr& K,
boost::optional<POSE> body_P_sensor = boost::none) : boost::optional<POSE> body_P_sensor = boost::none) :
Base(model, poseKey, landmarkKey), measured_(measured), K_(K), body_P_sensor_(body_P_sensor) { Base(model, poseKey, landmarkKey), measured_(measured), K_(K), body_P_sensor_(body_P_sensor) {
} }

View File

@ -56,7 +56,7 @@ public:
* @param K shared pointer to the constant calibration * @param K shared pointer to the constant calibration
*/ */
InvDepthFactor3(const gtsam::Point2& measured, const gtsam::SharedNoiseModel& model, InvDepthFactor3(const gtsam::Point2& measured, const gtsam::SharedNoiseModel& model,
const gtsam::Key poseKey, gtsam::Key pointKey, gtsam::Key invDepthKey, const gtsam::shared_ptrK& K) : const gtsam::Key poseKey, gtsam::Key pointKey, gtsam::Key invDepthKey, const Cal3_S2::shared_ptr& K) :
Base(model, poseKey, pointKey, invDepthKey), measured_(measured), K_(K) {} Base(model, poseKey, pointKey, invDepthKey), measured_(measured), K_(K) {}
/** Virtual destructor */ /** Virtual destructor */

View File

@ -25,6 +25,7 @@
#include <gtsam/geometry/Point3.h> #include <gtsam/geometry/Point3.h>
#include <gtsam/geometry/Pose2.h> #include <gtsam/geometry/Pose2.h>
#include <gtsam/geometry/Pose3.h> #include <gtsam/geometry/Pose3.h>
#include <gtsam/geometry/Cal3_S2.h>
#include <gtsam/geometry/SimpleCamera.h> #include <gtsam/geometry/SimpleCamera.h>
#include <exception> #include <exception>
@ -114,7 +115,7 @@ namespace gtsam {
/// insert multiple projection factors for a single pose key /// insert multiple projection factors for a single pose key
void insertProjectionFactors(NonlinearFactorGraph& graph, Key i, const Vector& J, const Matrix& Z, void insertProjectionFactors(NonlinearFactorGraph& graph, Key i, const Vector& J, const Matrix& Z,
const SharedNoiseModel& model, const shared_ptrK K, const Pose3& body_P_sensor = Pose3()) { const SharedNoiseModel& model, const Cal3_S2::shared_ptr K, const Pose3& body_P_sensor = Pose3()) {
if (Z.rows() != 2) throw std::invalid_argument("addMeasurements: Z must be 2*K"); if (Z.rows() != 2) throw std::invalid_argument("addMeasurements: Z must be 2*K");
if (Z.cols() != J.size()) throw std::invalid_argument( if (Z.cols() != J.size()) throw std::invalid_argument(
"addMeasurements: J and Z must have same number of entries"); "addMeasurements: J and Z must have same number of entries");