KeyFrame.h
Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Copyright 2008 Isis Innovation Limited
00003 
00004 //
00005 // This header declares the data structures to do with keyframes:
00006 // structs KeyFrame, Level, Measurement, Candidate.
00007 // 
00008 // A KeyFrame contains an image pyramid stored as array of Level;
00009 // A KeyFrame also has associated map-point mesurements stored as a vector of Measurment;
00010 // Each individual Level contains an image, corner points, and special corner points
00011 // which are promoted to Candidate status (the mapmaker tries to make new map points from those.)
00012 //
00013 // KeyFrames are stored in the Map class and manipulated by the MapMaker.
00014 // However, the tracker also stores its current frame as a half-populated
00015 // KeyFrame struct.
00016 
00017 
00018 #ifndef __KEYFRAME_H
00019 #define __KEYFRAME_H
00020 #include <TooN/TooN.h>
00021 using namespace TooN;
00022 #include <TooN/se3.h>
00023 #include <cvd/image.h>
00024 #include <cvd/byte.h>
00025 #include <vector>
00026 #include <set>
00027 #include <map>
00028 
00029 class MapPoint;
00030 class SmallBlurryImage;
00031 
00032 #define LEVELS 4
00033 
00034 // Candidate: a feature in an image which could be made into a map point
00035 struct Candidate
00036 {
00037   CVD::ImageRef irLevelPos;
00038   Vector<2> v2RootPos;
00039   double dSTScore;
00040 };
00041 
00042 // Measurement: A 2D image measurement of a map point. Each keyframe stores a bunch of these.
00043 struct Measurement
00044 {
00045   int nLevel;   // Which image level?
00046   bool bSubPix; // Has this measurement been refined to sub-pixel level?
00047   Vector<2> v2RootPos;  // Position of the measurement, REFERED TO PYRAMID LEVEL ZERO
00048   enum {SRC_TRACKER, SRC_REFIND, SRC_ROOT, SRC_TRAIL, SRC_EPIPOLAR} Source; // Where has this measurement come frome?
00049 };
00050 
00051 // Each keyframe is made of LEVELS pyramid levels, stored in struct Level.
00052 // This contains image data and corner points.
00053 struct Level
00054 {
00055   inline Level()
00056   {
00057     bImplaneCornersCached = false;
00058   };
00059   
00060   CVD::Image<CVD::byte> im;                // The pyramid level pixels
00061   std::vector<CVD::ImageRef> vCorners;     // All FAST corners on this level
00062   std::vector<int> vCornerRowLUT;          // Row-index into the FAST corners, speeds up access
00063   std::vector<CVD::ImageRef> vMaxCorners;  // The maximal FAST corners
00064   Level& operator=(const Level &rhs);
00065   
00066   std::vector<Candidate> vCandidates;   // Potential locations of new map points
00067   
00068   bool bImplaneCornersCached;           // Also keep image-plane (z=1) positions of FAST corners to speed up epipolar search
00069   std::vector<Vector<2> > vImplaneCorners; // Corner points un-projected into z=1-plane coordinates
00070 };
00071 
00072 // The actual KeyFrame struct. The map contains of a bunch of these. However, the tracker uses this
00073 // struct as well: every incoming frame is turned into a keyframe before tracking; most of these 
00074 // are then simply discarded, but sometimes they're then just added to the map.
00075 struct KeyFrame
00076 {
00077   inline KeyFrame()
00078   {
00079     pSBI = NULL;
00080   }
00081   SE3<> se3CfromW;    // The coordinate frame of this key-frame as a Camera-From-World transformation
00082   bool bFixed;      // Is the coordinate frame of this keyframe fixed? (only true for first KF!)
00083   Level aLevels[LEVELS];  // Images, corners, etc lives in this array of pyramid levels
00084   std::map<MapPoint*, Measurement> mMeasurements;           // All the measurements associated with the keyframe
00085   
00086   void MakeKeyFrame_Lite(CVD::BasicImage<CVD::byte> &im);   // This takes an image and calculates pyramid levels etc to fill the 
00087                                                             // keyframe data structures with everything that's needed by the tracker..
00088   void MakeKeyFrame_Rest();                                 // ... while this calculates the rest of the data which the mapmaker needs.
00089   
00090   double dSceneDepthMean;      // Hacky hueristics to improve epipolar search.
00091   double dSceneDepthSigma;
00092   
00093   SmallBlurryImage *pSBI; // The relocaliser uses this
00094 };
00095 
00096 typedef std::map<MapPoint*, Measurement>::iterator meas_it;  // For convenience, and to work around an emacs paren-matching bug
00097 
00098 
00099 #endif
00100 


tum_ardrone
Author(s):
autogenerated on Sat Jun 8 2019 20:27:23