26 using namespace gtsam;
31 static const
double fx = 250,
fy = 260,
s = 0.1,
u0 = 320,
v0 = 240;
32 static
Cal3Fisheye K(fx, fy, s, u0, v0, -0.013721808247486035,
33 0.020727425669427896, -0.012786476702685545,
34 0.0025242267320687625);
50 d << 1, 2, 3, 4, 5, 6, 7, 8, 9;
60 const double r =
sqrt(xi * xi + yi * yi);
61 const double t =
atan(r);
62 const double tt = t *
t, t4 = tt * tt, t6 = tt * t4, t8 = t4 * t4;
64 t * (1 +
K.
k1() * tt +
K.
k2() * t4 +
K.
k3() * t6 +
K.
k4() * t8);
65 Vector3 pd(td / r * xi, td / r * yi, 1);
68 Point2 uv_sol(v[0] / v[2], v[1] / v[2]);
135 Point2 xi(p3.x() / p3.z(), p3.y() / p3.z());
183 Point2 xi(p3.x() / p3.z(), p3.y() / p3.z());
184 Point2 uv(457.82638130304935, 408.18905848512986);
208 std::stringstream
os;
209 os <<
"fx: " << cal.
fx() <<
", fy: " << cal.
fy() <<
", s: " << cal.
skew()
210 <<
", px: " << cal.
px() <<
", py: " << cal.
py() <<
", k1: " << cal.
k1()
211 <<
", k2: " << cal.
k2() <<
", k3: " << cal.
k3() <<
", k4: " << cal.
k4();
bool assert_stdout_equal(const std::string &expected, const V &actual)
Provides additional testing facilities for common data structures.
Point2 f(const Cal3Fisheye &k, const Point2 &pt)
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
static size_t Dim()
Return dimensions of calibration manifold object.
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Point2 calibrate(const Point2 &p, OptionalJacobian< 2, 9 > Dcal={}, OptionalJacobian< 2, 2 > Dp={}) const
double py() const
image center in y
Some functions to compute numerical derivatives.
Vector localCoordinates(const Cal3Fisheye &T2) const
Given a different calibration, calculate update to obtain it.
static const Point3 pt(1.0, 2.0, 3.0)
static Cal3Fisheye K(fx, fy, s, u0, v0, -0.013721808247486035, 0.020727425669427896, -0.012786476702685545, 0.0025242267320687625)
double k3() const
First tangential distortion coefficient.
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)
EIGEN_DEVICE_FUNC const AtanReturnType atan() const
#define EXPECT(condition)
double fx() const
focal length x
Array< int, Dynamic, 1 > v
Array< double, 1, 3 > e(1./3., 0.5, 2.)
double k2() const
Second distortion coefficient.
Point2 uncalibrate(const Point2 &p, OptionalJacobian< 2, 9 > Dcal={}, OptionalJacobian< 2, 2 > Dp={}) const
convert intrinsic coordinates [x_i; y_i] to (distorted) image coordinates [u; v]
Point2 calibrate_(const Cal3Fisheye &k, const Point2 &pt)
virtual Matrix3 K() const
return calibration matrix K
double k4() const
Second tangential distortion coefficient.
#define GTSAM_CONCEPT_MANIFOLD_INST(T)
#define EXPECT_LONGS_EQUAL(expected, actual)
ofstream os("timeSchurFactors.csv")
double k1() const
First distortion coefficient.
static Point2 kTestPoint2(2, 3)
internal::FixedSizeMatrix< Y, X2 >::type numericalDerivative22(std::function< Y(const X1 &, const X2 &)> h, const X1 &x1, const X2 &x2, double delta=1e-5)
Calibration of a fisheye camera.
Jet< T, N > sqrt(const Jet< T, N > &f)
TEST(SmartFactorBase, Pinhole)
void Print(const CONTAINER &keys, const string &s, const KeyFormatter &keyFormatter)
Cal3Fisheye retract(const Vector &d) const
Given delta vector, update calibration.
Calibration of a fisheye camera.
double fy() const
focal length y
#define GTSAM_CONCEPT_TESTABLE_INST(T)
double px() const
image center in x