26 using namespace gtsam;
38 set.push_back(camera);
39 set.push_back(camera);
43 set2.push_back(camera);
48 ZZ
z =
set.project2(p);
57 camera.project2(p, F1, E1);
65 set.project2(p, Fs, E);
73 measured.push_back(
Point2(1, 2));
74 measured.push_back(
Point2(3, 4));
78 expectedV << -1, -2, -3, -4;
79 Vector actualV =
set.reprojectionError(p, measured);
84 F <<
F1, Matrix29::Zero(), Matrix29::Zero(),
F1;
86 Matrix34 Et = E.transpose();
90 Vector v = Ft * (b - E * P * Et *
b);
91 schur << Ft * F - Ft * E * P * Et *
F,
v, v.transpose(), 30;
97 Set::UpdateSchurComplement<3>(Fs,
E,
P,
b, allKeys,
keys, actualReduced);
102 Set::UpdateSchurComplement<3>(Fs,
E,
P,
b, allKeys, keys2, actualReduced);
104 reverse_b << b.tail<2>(), b.head<2>();
105 Vector reverse_v = Ft * (reverse_b - E * P * Et * reverse_b);
107 A << Ft * F - Ft * E * P * Et *
F, reverse_v, reverse_v.transpose(), 30;
114 camera.backprojectPointAtInfinity(
Point2(0,0))));
115 actualV =
set.reprojectionError(pointAtInfinity, measured, Fs, E);
120 camera.project2(pointAtInfinity, F1, E1);
135 std::vector<Eigen::Matrix<double, 2, 12>,
137 Fs.push_back(1 * Matrix::Ones(2, 12));
138 Fs.push_back(2 * Matrix::Ones(2, 12));
139 Fs.push_back(3 * Matrix::Ones(2, 12));
140 Matrix E = 4 * Matrix::Identity(6, 3) + Matrix::Ones(6, 3);
144 Matrix Et = E.transpose();
146 Vector b = 5 * Vector::Ones(6);
155 Matrix F = Matrix::Zero(6, 3 * 12);
156 F.block<2, 12>(0, 0) = 1 * Matrix::Ones(2, 12);
157 F.block<2, 12>(2, 12) = 2 * Matrix::Ones(2, 12);
158 F.block<2, 12>(4, 24) = 3 * Matrix::Ones(2, 12);
160 Matrix Ft = F.transpose();
161 Matrix H = Ft * F - Ft * E * P * Et *
F;
162 Vector v = Ft * (b - E * P * Et *
b);
163 Matrix expectedAugmentedHessian = Matrix::Zero(3 * 12 + 1, 3 * 12 + 1);
164 expectedAugmentedHessian.block<36, 36>(0, 0) = H;
165 expectedAugmentedHessian.block<36, 1>(0, 36) = v;
166 expectedAugmentedHessian.block<1, 36>(36, 0) = v.transpose();
167 expectedAugmentedHessian(36, 36) = b.squaredNorm();
174 nonuniqueKeys.push_back(0);
175 nonuniqueKeys.push_back(1);
176 nonuniqueKeys.push_back(1);
177 nonuniqueKeys.push_back(2);
178 nonuniqueKeys.push_back(2);
179 nonuniqueKeys.push_back(0);
182 uniqueKeys.push_back(0);
183 uniqueKeys.push_back(1);
184 uniqueKeys.push_back(2);
188 Set::SchurComplementAndRearrangeBlocks<3, 12, 6>(
189 Fs,
E,
P,
b, nonuniqueKeys, uniqueKeys);
194 Matrix F = Matrix::Zero(6, 18);
195 F.block<2, 6>(0, 0) = Fs[0].block<2, 6>(0, 0);
196 F.block<2, 6>(0, 6) = Fs[0].block<2, 6>(0, 6);
197 F.block<2, 6>(2, 6) = Fs[1].block<2, 6>(0, 0);
198 F.block<2, 6>(2, 12) = Fs[1].block<2, 6>(0, 6);
199 F.block<2, 6>(4, 12) = Fs[2].block<2, 6>(0, 0);
200 F.block<2, 6>(4, 0) = Fs[2].block<2, 6>(0, 6);
202 Matrix Ft = F.transpose();
203 Vector v = Ft * (b - E * P * Et *
b);
204 Matrix H = Ft * F - Ft * E * P * Et *
F;
205 Matrix expectedAugmentedHessian(19, 19);
206 expectedAugmentedHessian <<
H,
v, v.transpose(), b.squaredNorm();
218 set.push_back(camera);
219 set.push_back(camera);
225 ZZ
z =
set.project2(p);
241 set.project2(p, Fs, E);
ComplexSchur< MatrixXcf > schur(4)
static int runAllTests(TestResult &result)
Base class to create smart factors on poses or cameras.
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Some functions to compute numerical derivatives.
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange [*:*] noreverse nowriteback set trange [*:*] noreverse nowriteback set urange [*:*] noreverse nowriteback set vrange [*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
A set of cameras, all with their own calibration.
EIGEN_DEVICE_FUNC const InverseReturnType inverse() const
StereoPoint2Vector MeasurementVector
Represents a 3D point on a unit sphere.
Base class for all pinhole cameras.
Eigen::SelfAdjointView< constBlock, Eigen::Upper > selfadjointView(DenseIndex I, DenseIndex J) const
Return the square sub-matrix that contains blocks(i:j, i:j).
STL compatible allocator to use with types requiring a non standrad alignment.
#define EXPECT(condition)
Array< int, Dynamic, 1 > v
std::vector< MatrixZD, Eigen::aligned_allocator< MatrixZD > > FBlocks
#define LONGS_EQUAL(expected, actual)
std::vector< MatrixZD, Eigen::aligned_allocator< MatrixZD > > FBlocks
A Stereo Camera based on two Simple Cameras.
#define EXPECT_LONGS_EQUAL(expected, actual)
Unit3 pointAtInfinity(0, 0, -1000)
std::vector< Point2, Eigen::aligned_allocator< Point2 > > Point2Vector
PinholePose< Cal3_S2 > Camera
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
static const CalibratedCamera camera(kDefaultPose)
Calibration used by Bundler.
The most common 5DOF 3D->2D calibration.
StereoPoint2 project2(const Point3 &point, OptionalJacobian< 3, 6 > H1={}, OptionalJacobian< 3, 3 > H2={}) const