Created expressions.h header
parent
254f8c5f75
commit
0d94eeb480
|
@ -20,6 +20,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gtsam/nonlinear/Values.h>
|
#include <gtsam/nonlinear/Values.h>
|
||||||
|
#include <gtsam/base/Matrix.h>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
|
@ -17,10 +17,11 @@
|
||||||
* @brief unit tests for Block Automatic Differentiation
|
* @brief unit tests for Block Automatic Differentiation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <gtsam_unstable/slam/expressions.h>
|
||||||
|
#include <gtsam_unstable/nonlinear/BADFactor.h>
|
||||||
#include <gtsam/slam/GeneralSFMFactor.h>
|
#include <gtsam/slam/GeneralSFMFactor.h>
|
||||||
#include <gtsam/geometry/Pose3.h>
|
#include <gtsam/geometry/Pose3.h>
|
||||||
#include <gtsam/geometry/Cal3_S2.h>
|
#include <gtsam/geometry/Cal3_S2.h>
|
||||||
#include <gtsam_unstable/nonlinear/BADFactor.h>
|
|
||||||
#include <gtsam/base/Testable.h>
|
#include <gtsam/base/Testable.h>
|
||||||
|
|
||||||
#include <CppUnitLite/TestHarness.h>
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
@ -28,31 +29,6 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
// Proposed naming convention
|
|
||||||
/* ************************************************************************* */
|
|
||||||
typedef Expression<Point2> Point2_;
|
|
||||||
typedef Expression<Point3> Point3_;
|
|
||||||
typedef Expression<Rot3> Rot3_;
|
|
||||||
typedef Expression<Pose3> Pose3_;
|
|
||||||
typedef Expression<Cal3_S2> Cal3_S2_;
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
// Functions that allow creating concise expressions
|
|
||||||
/* ************************************************************************* */
|
|
||||||
Point3_ transform_to(const Pose3_& x, const Point3_& p) {
|
|
||||||
return Point3_(x, &Pose3::transform_to, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
Point2_ project(const Point3_& p_cam) {
|
|
||||||
return Point2_(PinholeCamera<Cal3_S2>::project_to_camera, p_cam);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class CAL>
|
|
||||||
Point2_ uncalibrate(const Expression<CAL>& K, const Point2_& xy_hat) {
|
|
||||||
return Point2_(K, &CAL::uncalibrate, xy_hat);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
||||||
TEST(BADFactor, test) {
|
TEST(BADFactor, test) {
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/**
|
||||||
|
* @file expressions.h
|
||||||
|
* @brief Common expressions for solving geometry/slam/sfm problems
|
||||||
|
* @date Oct 1, 2014
|
||||||
|
* @author Frank Dellaert
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gtsam_unstable/nonlinear/Expression.h>
|
||||||
|
#include <gtsam/geometry/Cal3_S2.h>
|
||||||
|
#include <gtsam/geometry/PinholeCamera.h>
|
||||||
|
|
||||||
|
namespace gtsam {
|
||||||
|
|
||||||
|
typedef Expression<Point2> Point2_;
|
||||||
|
typedef Expression<Point3> Point3_;
|
||||||
|
typedef Expression<Rot3> Rot3_;
|
||||||
|
typedef Expression<Pose3> Pose3_;
|
||||||
|
typedef Expression<Cal3_S2> Cal3_S2_;
|
||||||
|
|
||||||
|
Point3_ transform_to(const Pose3_& x, const Point3_& p) {
|
||||||
|
return Point3_(x, &Pose3::transform_to, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
Point2_ project(const Point3_& p_cam) {
|
||||||
|
return Point2_(PinholeCamera<Cal3_S2>::project_to_camera, p_cam);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class CAL>
|
||||||
|
Point2_ uncalibrate(const Expression<CAL>& K, const Point2_& xy_hat) {
|
||||||
|
return Point2_(K, &CAL::uncalibrate, xy_hat);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // \namespace gtsam
|
||||||
|
|
Loading…
Reference in New Issue