23 #include <boost/make_shared.hpp> 25 using namespace gtsam;
45 Base(model, key), K_(calib), P_(P), p_(p) {
50 boost::none)
const override {
52 return camera.
project(P_,
H, boost::none, boost::none) - p_;
64 int main(
int argc,
char* argv[]) {
74 boost::shared_ptr<ResectioningFactor> factor;
87 Pose3(
Rot3(1, 0, 0, 0, -1, 0, 0, 0, -1),
Point3(0, 0, 2)));
91 result.
print(
"Final result:\n");
int main(int argc, char *argv[])
virtual const Values & optimize()
Cal3_S2::shared_ptr K_
camera's intrinsic parameters
NoiseModelFactor1< Pose3 > Base
noiseModel::Diagonal::shared_ptr model
void insert(Key j, const Value &val)
Point2 p_
2D measurement of the 3D point
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
NonlinearFactorGraph graph
Base class for all pinhole cameras.
Vector evaluateError(const Pose3 &pose, boost::optional< Matrix & > H=boost::none) const override
evaluate the error
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&...args)
Emplace a shared pointer to factor of given type.
static const Pose3 pose(Rot3(Vector3(1,-1,-1).asDiagonal()), Point3(0, 0, 0.5))
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
noiseModel::Diagonal::shared_ptr SharedDiagonal
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
ResectioningFactor(const SharedNoiseModel &model, const Key &key, const Cal3_S2::shared_ptr &calib, const Point2 &p, const Point3 &P)
Construct factor given known point P and its projection p.
static shared_ptr Sigmas(const Vector &sigmas, bool smart=true)
Point3 P_
3D point on the calibration rig
Point2 project(const Point3 &pw, OptionalJacobian< 2, 6 > Dpose=boost::none, OptionalJacobian< 2, 3 > Dpoint=boost::none, OptionalJacobian< 2, DimK > Dcal=boost::none) const
project a 3D point from world coordinates into the image
static const CalibratedCamera camera(kDefaultPose)
boost::shared_ptr< Cal3_S2 > shared_ptr
std::uint64_t Key
Integer nonlinear key type.
noiseModel::Base::shared_ptr SharedNoiseModel
The most common 5DOF 3D->2D calibration.
All noise models live in the noiseModel namespace.