HomographyInit.h
Go to the documentation of this file.
00001 // -*- c++ -*- 
00002 // Copyright 2008 Isis Innovation Limited
00003 
00004 // HomographyInit.h 
00005 // Declares the HomographyInit class and a few helper functions. 
00006 //
00007 // This class is used by MapMaker to bootstrap the map, and implements
00008 // the homography decomposition of Faugeras and Lustman's 1988 tech
00009 // report.
00010 //
00011 // Implementation according to Faugeras and Lustman
00012 
00013 #ifndef __HOMOGRAPHY_INIT_H
00014 #define __HOMOGRAPHY_INIT_H
00015 #include <TooN/TooN.h>
00016 using namespace TooN;
00017 #include <TooN/se3.h>
00018 #include <vector>
00019 
00020 // Homography matches are 2D-2D matches in a stereo pair, unprojected
00021 // to the Z=1 plane.
00022 struct HomographyMatch
00023 {
00024   // To be filled in by MapMaker:
00025   Vector<2> v2CamPlaneFirst;
00026   Vector<2> v2CamPlaneSecond;
00027   Matrix<2> m2PixelProjectionJac;
00028 };
00029 
00030 // Storage for each homography decomposition
00031 struct HomographyDecomposition
00032 {
00033   Vector<3> v3Tp;
00034   Matrix<3> m3Rp;
00035   double d;
00036   Vector<3> v3n;
00037 
00038   // The resolved composition..
00039   SE3<> se3SecondFromFirst;
00040   int nScore;
00041 };
00042 
00043 class HomographyInit
00044 {
00045 public:
00046   bool Compute(std::vector<HomographyMatch> vMatches, double dMaxPixelError, SE3<> &se3SecondCameraPose);
00047 protected:
00048   Matrix<3> HomographyFromMatches(std::vector<HomographyMatch> vMatches);
00049   void BestHomographyFromMatches_MLESAC();
00050   void DecomposeHomography();
00051   void ChooseBestDecomposition();
00052   void RefineHomographyWithInliers();
00053 
00054   bool IsHomographyInlier(Matrix<3> m3Homography, HomographyMatch match);
00055   double MLESACScore(Matrix<3> m3Homography, HomographyMatch match);
00056 
00057   double mdMaxPixelErrorSquared;
00058   Matrix<3> mm3BestHomography;
00059   std::vector<HomographyMatch> mvMatches;
00060   std::vector<HomographyMatch> mvHomographyInliers;
00061   std::vector<HomographyDecomposition> mvDecompositions;
00062 };
00063 
00064 
00065 
00066 #endif


ptam
Author(s): Stephan Weiss, Markus Achtelik, Simon Lynen
autogenerated on Tue Jan 7 2014 11:12:22