1 #ifndef TAG_FOURPOINTPOSE_H_
2 #define TAG_FOURPOINTPOSE_H_
30 TooN::SE3<>
fourPointPose(
const std::vector<TooN::Vector<3> > & points,
const std::vector<TooN::Vector<3> > & pixels,
bool & valid,
const double angularError = 0.14 );
46 TooN::SE3<>
fourPointPoseFromCamera(
const std::vector<TooN::Vector<3> > & points,
const std::vector<TooN::Vector<3> > & pixels,
bool & valid,
const double angularError = 0.14 );
59 template <
int ImagePlaneZ = 1>
72 template<
class It>
inline bool estimate(It begin, It end) {
73 assert(std::distance(begin,end) >= 4);
76 std::vector<TooN::Vector<3> > points(4);
77 std::vector<TooN::Vector<3> > pixels(4);
79 for(It match = begin; match != end; match++, i++){
80 pixels[i] = unproject(match->pixel);
81 pixels[i][2] *= ImagePlaneZ;
82 points[i] = match->position;
88 template<
class Obs,
class Tol>
inline bool isInlier(
const Obs& obs,
const Tol& tolerance )
const {
89 return score(obs) < tolerance;
92 template<
class Obs>
inline double score(
const Obs & obs)
const {
94 TooN::Vector<3> pos =
T * obs.position;
95 TooN::Vector<2> diff = project(pos) - obs.pixel / ImagePlaneZ;
96 double disp = diff*diff;
102 template<
class Obs>
inline double getSqError(
const Obs & obs)
const {