MapPoint.h
Go to the documentation of this file.
1 
21 #ifndef MAPPOINT_H
22 #define MAPPOINT_H
23 
24 #include"KeyFrame.h"
25 #include"Frame.h"
26 #include"Map.h"
27 
28 #include<opencv2/core/core.hpp>
29 #include<mutex>
30 
31 namespace ORB_SLAM2
32 {
33 
34 class KeyFrame;
35 class Map;
36 class Frame;
37 
38 
39 class MapPoint
40 {
41 public:
42  MapPoint(const cv::Mat &Pos, KeyFrame* pRefKF, Map* pMap);
43  MapPoint(const cv::Mat &Pos, Map* pMap, Frame* pFrame, const int &idxF);
44 
45  void SetWorldPos(const cv::Mat &Pos);
46  cv::Mat GetWorldPos();
47 
48  cv::Mat GetNormal();
50  std::map<KeyFrame*,size_t> GetObservations();
51  int Observations();
52 
53  void AddObservation(KeyFrame* pKF,size_t idx);
54  void EraseObservation(KeyFrame* pKF);
55 
56  int GetIndexInKeyFrame(KeyFrame* pKF);
57  bool IsInKeyFrame(KeyFrame* pKF);
58 
59  void SetBadFlag();
60  bool isBad();
61 
62  void Replace(MapPoint* pMP);
64 
65  void IncreaseVisible(int n=1);
66  void IncreaseFound(int n=1);
67  float GetFoundRatio();
68  inline int GetFound(){
69  return mnFound;
70  }
71 
73 
74  cv::Mat GetDescriptor();
75 
76  void UpdateNormalAndDepth();
77 
80  int PredictScale(const float &currentDist, KeyFrame*pKF);
81  int PredictScale(const float &currentDist, Frame* pF);
82 
83 public:
84  long unsigned int mnId;
85  static long unsigned int nNextId;
86  long int mnFirstKFid;
87  long int mnFirstFrame;
88  int nObs;
89 
90  // Variables used by the tracking
91  float mTrackProjX;
92  float mTrackProjY;
93  float mTrackProjXR;
97  long unsigned int mnTrackReferenceForFrame;
98  long unsigned int mnLastFrameSeen;
99 
100  // Variables used by local mapping
101  long unsigned int mnBALocalForKF;
102  long unsigned int mnFuseCandidateForKF;
103 
104  // Variables used by loop closing
105  long unsigned int mnLoopPointForKF;
106  long unsigned int mnCorrectedByKF;
107  long unsigned int mnCorrectedReference;
108  cv::Mat mPosGBA;
109  long unsigned int mnBAGlobalForKF;
110 
111 
112  static std::mutex mGlobalMutex;
113 
114 protected:
115 
116  // Position in absolute coordinates
117  cv::Mat mWorldPos;
118 
119  // Keyframes observing the point and associated index in keyframe
120  std::map<KeyFrame*,size_t> mObservations;
121 
122  // Mean viewing direction
123  cv::Mat mNormalVector;
124 
125  // Best descriptor to fast matching
126  cv::Mat mDescriptor;
127 
128  // Reference KeyFrame
130 
131  // Tracking counters
133  int mnFound;
134 
135  // Bad flag (we do not currently erase MapPoint from memory)
136  bool mbBad;
138 
139  // Scale invariance distances
142 
144 
145  std::mutex mMutexPos;
146  std::mutex mMutexFeatures;
147 };
148 
149 } //namespace ORB_SLAM
150 
151 #endif // MAPPOINT_H
MapPoint(const cv::Mat &Pos, KeyFrame *pRefKF, Map *pMap)
float GetMinDistanceInvariance()
long unsigned int mnBALocalForKF
Definition: MapPoint.h:101
long unsigned int mnBAGlobalForKF
Definition: MapPoint.h:109
KeyFrame * GetReferenceKeyFrame()
std::mutex mMutexFeatures
Definition: MapPoint.h:146
long unsigned int mnLoopPointForKF
Definition: MapPoint.h:105
static long unsigned int nNextId
Definition: MapPoint.h:85
long int mnFirstKFid
Definition: MapPoint.h:86
cv::Mat mNormalVector
Definition: MapPoint.h:123
long unsigned int mnCorrectedByKF
Definition: MapPoint.h:106
KeyFrame * mpRefKF
Definition: MapPoint.h:129
void IncreaseVisible(int n=1)
void AddObservation(KeyFrame *pKF, size_t idx)
cv::Mat GetDescriptor()
std::map< KeyFrame *, size_t > GetObservations()
cv::Mat mDescriptor
Definition: MapPoint.h:126
void IncreaseFound(int n=1)
void Replace(MapPoint *pMP)
std::mutex mMutexPos
Definition: MapPoint.h:145
std::map< KeyFrame *, size_t > mObservations
Definition: MapPoint.h:120
void SetWorldPos(const cv::Mat &Pos)
float GetMaxDistanceInvariance()
long unsigned int mnLastFrameSeen
Definition: MapPoint.h:98
MapPoint * mpReplaced
Definition: MapPoint.h:137
long int mnFirstFrame
Definition: MapPoint.h:87
int GetIndexInKeyFrame(KeyFrame *pKF)
static std::mutex mGlobalMutex
Definition: MapPoint.h:112
long unsigned int mnTrackReferenceForFrame
Definition: MapPoint.h:97
long unsigned int mnCorrectedReference
Definition: MapPoint.h:107
void ComputeDistinctiveDescriptors()
MapPoint * GetReplaced()
long unsigned int mnId
Definition: MapPoint.h:84
bool IsInKeyFrame(KeyFrame *pKF)
int PredictScale(const float &currentDist, KeyFrame *pKF)
long unsigned int mnFuseCandidateForKF
Definition: MapPoint.h:102
void EraseObservation(KeyFrame *pKF)


orb_slam2_with_maps_odom
Author(s): teng zhang
autogenerated on Fri Sep 25 2020 03:24:47