34 pair<Unit3, bool> SphericalCamera::projectSafe(
const Point3& pw)
const {
36 Unit3 pu = Unit3::FromPoint3(
pc);
37 return make_pair(pu,
pc.norm() > 1
e-8);
46 pose().transformTo(pw, Dpose ? &Dtf_pose : 0, Dpoint ? &Dtf_point : 0);
48 if (
pc.norm() <= 1
e-8)
throw(
"point cannot be at the center of the camera");
51 Unit3 pu = Unit3::FromPoint3(
Point3(
pc), Dpoint ? &Dunit : 0);
53 if (Dpose) *Dpose = Dunit * Dtf_pose;
54 if (Dpoint) *Dpoint = Dunit * Dtf_point;
63 const Unit3 pu =
pose().rotation().unrotate(pwu, Dpose ? &Dtf_rot : 0,
64 Dpoint ? &Dtf_point : 0);
67 *Dpose << Dtf_rot, Matrix::Zero(2, 3);
68 if (Dpoint) *Dpoint = Dtf_point;
78 Unit3 SphericalCamera::backprojectPointAtInfinity(
const Unit3&
p)
const {
79 return pose().rotation().rotate(
p);
90 Vector2 SphericalCamera::reprojectionError(
94 if (Dpose || Dpoint) {
95 Matrix26 H_project_pose;
96 Matrix23 H_project_point;
100 if (Dpose) *Dpose = H_error * H_project_pose;
101 if (Dpoint) *Dpoint = H_error * H_project_point;