23 using namespace gtsam;
28 static
Cal3DS2 K(500, 100, 0.1, 320, 240, 1
e-3, 2.0 * 1e-3, 3.0 * 1e-3,
35 double r = p.x() * p.x() + p.y() * p.y();
36 double g = 1 + k[0] * r + k[1] * r * r;
37 double tx = 2 * k[2] * p.x() * p.y() + k[3] * (r + 2 * p.x() * p.x());
38 double ty = k[2] * (r + 2 * p.y() * p.y()) + 2 * k[3] * p.x() * p.y();
39 Vector v_hat = (
Vector(3) << g * p.x() + tx, g * p.y() + ty, 1.0).finished();
40 Vector v_i = K.K() * v_hat;
41 Point2 p_i(v_i(0) / v_i(2), v_i(1) / v_i(2));
99 2.0 * 1
e-3 + 7, 3.0 * 1
e-3 + 8, 4.0 * 1
e-3 + 9);
105 d << 1, 2, 3, 4, 5, 6, 7, 8, 9;
113 Cal3DS2 cal(1, 2, 3, 4, 5, 6, 7, 8, 9);
114 std::stringstream
os;
115 os <<
"fx: " << cal.
fx() <<
", fy: " << cal.
fy() <<
", s: " << cal.
skew()
116 <<
", px: " << cal.
px() <<
", py: " << cal.
py() <<
", k1: " << cal.
k1()
117 <<
", k2: " << cal.
k2() <<
", p1: " << cal.
p1() <<
", p2: " << cal.
p2();
Vector localCoordinates(const Cal3DS2 &T2) const
Given a different calibration, calculate update to obtain it.
bool assert_stdout_equal(const std::string &expected, const V &actual)
double p2() const
Second tangential distortion coefficient.
double fy() const
focal length y
Provides additional testing facilities for common data structures.
Matrix2 D2d_intrinsic(const Point2 &p) const
Derivative of uncalibrate wrpt intrinsic coordinates.
Point2 calibrate_(const Cal3DS2 &k, const Point2 &pt)
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
static Cal3DS2 K(500, 100, 0.1, 320, 240, 1e-3, 2.0 *1e-3, 3.0 *1e-3, 4.0 *1e-3)
Calibration of a camera with radial distortion, calculations in base class Cal3DS2_Base.
Some functions to compute numerical derivatives.
internal::FixedSizeMatrix< Y, X1 >::type numericalDerivative21(const boost::function< Y(const X1 &, const X2 &)> &h, const X1 &x1, const X2 &x2, double delta=1e-5)
static const Point3 pt(1.0, 2.0, 3.0)
double p1() const
First tangential distortion coefficient.
Matrix29 D2d_calibration(const Point2 &p) const
Derivative of uncalibrate wrpt the calibration parameters.
void g(const string &key, int i)
size_t dim() const override
Return dimensions of calibration manifold object.
Point2 calibrate(const Point2 &p, OptionalJacobian< 2, 9 > Dcal=boost::none, OptionalJacobian< 2, 2 > Dp=boost::none) const
Convert (distorted) image coordinates uv to intrinsic coordinates xy.
Point2 uncalibrate_(const Cal3DS2 &k, const Point2 &pt)
internal::FixedSizeMatrix< Y, X2 >::type numericalDerivative22(boost::function< Y(const X1 &, const X2 &)> h, const X1 &x1, const X2 &x2, double delta=1e-5)
double py() const
image center in y
#define EXPECT(condition)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
EIGEN_DEVICE_FUNC const Scalar & q
Cal3DS2 retract(const Vector &d) const
Given delta vector, update calibration.
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
double k1() const
First distortion coefficient.
static size_t Dim()
Return dimensions of calibration manifold object.
Point2 uncalibrate(const Point2 &p, OptionalJacobian< 2, 9 > Dcal=boost::none, OptionalJacobian< 2, 2 > Dp=boost::none) const
#define GTSAM_CONCEPT_MANIFOLD_INST(T)
#define EXPECT_LONGS_EQUAL(expected, actual)
ofstream os("timeSchurFactors.csv")
double k2() const
Second distortion coefficient.
TEST(LPInitSolver, InfiniteLoopSingleVar)
double px() const
image center in x
double fx() const
focal length x
void Print(const CONTAINER &keys, const string &s, const KeyFormatter &keyFormatter)
#define GTSAM_CONCEPT_TESTABLE_INST(T)