00001 // -*- c++ -*- 00002 // Copyright 2008 Isis Innovation Limited 00003 // 00004 // This file declares the MapPoint class 00005 // 00006 // The map is made up of a bunch of mappoints. 00007 // Each one is just a 3D point in the world; 00008 // it also includes information on where and in which key-frame the point was 00009 // originally made from, so that pixels from that keyframe can be used 00010 // to search for that point. 00011 // Also stores stuff like inlier/outlier counts, and privat information for 00012 // both Tracker and MapMaker. 00013 00014 #ifndef __MAP_POINT_H 00015 #define __MAP_POINT_H 00016 #include <TooN/TooN.h> 00017 using namespace TooN; 00018 #include <cvd/image_ref.h> 00019 #include <cvd/timer.h> 00020 #include <set> 00021 00022 class KeyFrame; 00023 class TrackerData; 00024 class MapMakerData; 00025 00026 struct MapPoint 00027 { 00028 // Constructor inserts sensible defaults and zeros pointers. 00029 inline MapPoint() 00030 { 00031 bBad = false; 00032 pTData = NULL; 00033 pMMData = NULL; 00034 nMEstimatorOutlierCount = 0; 00035 nMEstimatorInlierCount = 0; 00036 dCreationTime = CVD::timer.get_time(); 00037 }; 00038 00039 // Where in the world is this point? The main bit of information, really. 00040 Vector<3> v3WorldPos; 00041 // Is it a dud? In that case it'll be moved to the trash soon. 00042 bool bBad; 00043 00044 // What pixels should be used to search for this point? 00045 KeyFrame *pPatchSourceKF; // The KeyFrame the point was originally made in 00046 int nSourceLevel; // Pyramid level in source KeyFrame 00047 CVD::ImageRef irCenter; // This is in level-coords in the source pyramid level 00048 00049 // What follows next is a bunch of intermediate vectors - they all lead up 00050 // to being able to calculate v3Pixel{Down,Right}_W, which the PatchFinder 00051 // needs for patch warping! 00052 00053 Vector<3> v3Center_NC; // Unit vector in Source-KF coords pointing at the patch center 00054 Vector<3> v3OneDownFromCenter_NC; // Unit vector in Source-KF coords pointing towards one pixel down of the patch center 00055 Vector<3> v3OneRightFromCenter_NC; // Unit vector in Source-KF coords pointing towards one pixel right of the patch center 00056 Vector<3> v3Normal_NC; // Unit vector in Source-KF coords indicating patch normal 00057 00058 Vector<3> v3PixelDown_W; // 3-Vector in World coords corresponding to a one-pixel move down the source image 00059 Vector<3> v3PixelRight_W; // 3-Vector in World coords corresponding to a one-pixel move right the source image 00060 void RefreshPixelVectors(); // Calculates above two vectors 00061 00062 // Info for the Mapmaker (not to be trashed by the tracker:) 00063 MapMakerData *pMMData; 00064 00065 // Info for the Tracker (not to be trashed by the MapMaker:) 00066 TrackerData *pTData; 00067 00068 // Info provided by the tracker for the mapmaker: 00069 int nMEstimatorOutlierCount; 00070 int nMEstimatorInlierCount; 00071 00072 // Random junk (e.g. for visualisation) 00073 double dCreationTime; //timer.get_time() time of creation 00074 }; 00075 00076 #endif