18 using namespace gtsam;
32 EssentialMatrix actual(trueRotation, trueDirection),
expected(trueRotation, trueDirection);
44 std::function<EssentialMatrix(const Rot3&)> fn = [](
const Rot3&
R) {
45 return EssentialMatrix::FromRotationAndDirection(
R,
trueDirection);
52 std::function<EssentialMatrix(const Unit3&)> fn = [](
const Unit3&
t) {
53 return EssentialMatrix::FromRotationAndDirection(
trueRotation,
t);
86 d << 0.1, 0.2, 0.3, 0, 0, 0;
88 EssentialMatrix::FromPose3(pose.
retract(d)));
116 d << 0.1, 0.2, 0.3, 0.4, 0.5;
128 Rot3 aRb2 = Rot3::Yaw(
M_PI / 3.0) * Rot3::Pitch(M_PI_4)
129 * Rot3::Roll(
M_PI / 6.0);
130 Point3 aTb2(19.2, 3.7, 5.9);
167 bodyE.rotate(cRb, actH1, actH2);
168 }
catch (exception&
e) {
181 std::function<EssentialMatrix(const Pose3&)> fn = [](
const Pose3&
pose) {
182 return EssentialMatrix::FromPose3(pose);
184 Matrix expectedH = numericalDerivative11<EssentialMatrix, Pose3>(fn,
pose);
196 std::function<EssentialMatrix(const Pose3&)> fn = [](
const Pose3&
pose) {
197 return EssentialMatrix::FromPose3(pose);
199 Matrix expectedH = numericalDerivative11<EssentialMatrix, Pose3>(fn,
pose);
239 Unit3 e1(-
U(0, 2), -
U(1, 2), -
U(2, 2));
250 Unit3 e2(
V(0, 2),
V(1, 2),
V(2, 2));
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
const Unit3 & epipole_a() const
Return epipole in image_a , as Unit3 to allow for infinity.
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
gtsam::Point3 bX(1, 0, 0)
gtsam::Point3 bY(0, 1, 0)
Rot2 R(Rot2::fromAngle(0.1))
GTSAM_EXPORT Point3 transformTo(const Point3 &p, OptionalJacobian< 3, 5 > DE={}, OptionalJacobian< 3, 3 > Dpoint={}) const
takes point in world coordinates and transforms it to pose with |t|==1
EssentialMatrix trueE(trueRotation, trueDirection)
Some functions to compute numerical derivatives.
Unit3 epipole_b() const
Return epipole in image_b, as Unit3 to allow for infinity.
Point3 trueTranslation(0.1, 0, 0)
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
internal::FixedSizeMatrix< Y, X1 >::type numericalDerivative21(const std::function< Y(const X1 &, const X2 &)> &h, const X1 &x1, const X2 &x2, double delta=1e-5)
Rot3 inverse() const
inverse of a rotation
EssentialMatrix retract(const Vector5 &xi) const
Retract delta to manifold.
Represents a 3D point on a unit sphere.
#define EXPECT(condition)
P rotate(const T &r, const P &pt)
EssentialMatrix rotate_(const EssentialMatrix &E, const Rot3 &cRb)
Vector5 localCoordinates(const EssentialMatrix &other) const
Compute the coordinates in the tangent space.
GTSAM_EXPORT EssentialMatrix rotate(const Rot3 &cRb, OptionalJacobian< 5, 5 > HE={}, OptionalJacobian< 5, 3 > HR={}) const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
gtsam::Point3 bZ(0, 0, 1)
void svd(const Matrix &A, Matrix &U, Vector &S, Matrix &V)
static std::stringstream ss
Calibrated camera for which only pose is unknown.
Unit3 trueDirection(trueTranslation)
static const Pose3 pose(Rot3(Vector3(1, -1, -1).asDiagonal()), Point3(0, 0, 0.5))
#define GTSAM_CONCEPT_MANIFOLD_INST(T)
Class retract(const TangentVector &v) const
retract as required by manifold concept: applies v at *this
Point3 transform_to_(const EssentialMatrix &E, const Point3 &point)
const Matrix3 & matrix() const
Return 3*3 matrix representation.
Unit3 retract(const Vector2 &v, OptionalJacobian< 2, 2 > H={}) const
The retract function.
internal::FixedSizeMatrix< Y, X2 >::type numericalDerivative22(std::function< Y(const X1 &, const X2 &)> h, const X1 &x1, const X2 &x2, double delta=1e-5)
bool equality(const Errors &actual, const Errors &expected, double tol)
Line3 transformTo(const Pose3 &wTc, const Line3 &wL, OptionalJacobian< 4, 6 > Dpose, OptionalJacobian< 4, 4 > Dline)
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
#define GTSAM_CONCEPT_TESTABLE_INST(T)
TEST(EssentialMatrix, equality)