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 #include <boost/shared_ptr.hpp> 00022 00023 struct KeyFrame; 00024 struct TrackerData; 00025 struct MapMakerData; 00026 00027 struct MapPoint 00028 { 00029 typedef boost::shared_ptr<MapPoint> Ptr; 00030 00031 // Constructor inserts sensible defaults and zeros pointers. 00032 inline MapPoint() 00033 { 00034 bBad = false; 00035 pTData = NULL; 00036 pMMData = NULL; 00037 nMEstimatorOutlierCount = 0; 00038 nMEstimatorInlierCount = 0; 00039 dCreationTime = CVD::timer.get_time(); 00040 //{slynen reprojection 00041 bAlreadyProjected=false; 00042 //} 00043 nSourceLevel = 0; 00044 //slynen pcl interface{ 00045 static size_t ID = 0; 00046 bID = ID++; 00047 //} 00048 }; 00049 00050 00051 // Where in the world is this point? The main bit of information, really. 00052 Vector<3> v3WorldPos; 00053 // Is it a dud? In that case it'll be moved to the trash soon. 00054 bool bBad; 00055 //{slynen reprojection 00056 bool bAlreadyProjected; 00057 //} 00058 //slynen pcl interface{ 00059 int bID; 00060 //} 00061 // What pixels should be used to search for this point? 00062 boost::shared_ptr<KeyFrame> pPatchSourceKF; // The KeyFrame the point was originally made in 00063 int nSourceLevel; // Pyramid level in source KeyFrame 00064 CVD::ImageRef irCenter; // This is in level-coords in the source pyramid level 00065 00066 // What follows next is a bunch of intermediate vectors - they all lead up 00067 // to being able to calculate v3Pixel{Down,Right}_W, which the PatchFinder 00068 // needs for patch warping! 00069 00070 Vector<3> v3Center_NC; // Unit vector in Source-KF coords pointing at the patch center 00071 Vector<3> v3OneDownFromCenter_NC; // Unit vector in Source-KF coords pointing towards one pixel down of the patch center 00072 Vector<3> v3OneRightFromCenter_NC; // Unit vector in Source-KF coords pointing towards one pixel right of the patch center 00073 Vector<3> v3Normal_NC; // Unit vector in Source-KF coords indicating patch normal 00074 00075 Vector<3> v3PixelDown_W; // 3-Vector in World coords corresponding to a one-pixel move down the source image 00076 Vector<3> v3PixelRight_W; // 3-Vector in World coords corresponding to a one-pixel move right the source image 00077 void RefreshPixelVectors(); // Calculates above two vectors 00078 00079 // Info for the Mapmaker (not to be trashed by the tracker:) 00080 MapMakerData *pMMData; 00081 00082 // Info for the Tracker (not to be trashed by the MapMaker:) 00083 TrackerData *pTData; 00084 00085 // Info provided by the tracker for the mapmaker: 00086 int nMEstimatorOutlierCount; 00087 int nMEstimatorInlierCount; 00088 00089 // Random junk (e.g. for visualisation) 00090 double dCreationTime; //timer.get_time() time of creation 00091 }; 00092 00093 #endif