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 #include "BoostArchiver.h"
28 
29 #include<opencv2/core/core.hpp>
30 #include<mutex>
31 
32 namespace ORB_SLAM2
33 {
34 
35 class KeyFrame;
36 class Map;
37 class Frame;
38 
39 
40 class MapPoint
41 {
42 public:
43  MapPoint(const cv::Mat &Pos, KeyFrame* pRefKF, Map* pMap);
44  MapPoint(const cv::Mat &Pos, Map* pMap, Frame* pFrame, const int &idxF);
45 
46  void SetWorldPos(const cv::Mat &Pos);
47  cv::Mat GetWorldPos();
48 
49  cv::Mat GetNormal();
51 
52  std::map<KeyFrame*,size_t> GetObservations();
53  int Observations();
54 
55  void AddObservation(KeyFrame* pKF,size_t idx);
56  void EraseObservation(KeyFrame* pKF);
57 
58  int GetIndexInKeyFrame(KeyFrame* pKF);
59  bool IsInKeyFrame(KeyFrame* pKF);
60 
61  void SetBadFlag();
62  bool isBad();
63 
64  void Replace(MapPoint* pMP);
66 
67  void IncreaseVisible(int n=1);
68  void IncreaseFound(int n=1);
69  float GetFoundRatio();
70  inline int GetFound(){
71  return mnFound;
72  }
73 
75 
76  cv::Mat GetDescriptor();
77 
78  void UpdateNormalAndDepth();
79 
82  int PredictScale(const float &currentDist, KeyFrame*pKF);
83  int PredictScale(const float &currentDist, Frame* pF);
84 
85 public:
86  long unsigned int mnId;
87  static long unsigned int nNextId;
88  long int mnFirstKFid;
89  long int mnFirstFrame;
90  int nObs;
91 
92  // Variables used by the tracking
93  float mTrackProjX;
94  float mTrackProjY;
95  float mTrackProjXR;
99  long unsigned int mnTrackReferenceForFrame;
100  long unsigned int mnLastFrameSeen;
101 
102  // Variables used by local mapping
103  long unsigned int mnBALocalForKF;
104  long unsigned int mnFuseCandidateForKF;
105 
106  // Variables used by loop closing
107  long unsigned int mnLoopPointForKF;
108  long unsigned int mnCorrectedByKF;
109  long unsigned int mnCorrectedReference;
110  cv::Mat mPosGBA;
111  long unsigned int mnBAGlobalForKF;
112 
113 
114  static std::mutex mGlobalMutex;
115 
116 protected:
117 
118  // Position in absolute coordinates
119  cv::Mat mWorldPos;
120 
121  // Keyframes observing the point and associated index in keyframe
122  std::map<KeyFrame*,size_t> mObservations;
123 
124  // Mean viewing direction
125  cv::Mat mNormalVector;
126 
127  // Best descriptor to fast matching
128  cv::Mat mDescriptor;
129 
130  // Reference KeyFrame
132 
133  // Tracking counters
135  int mnFound;
136 
137  // Bad flag (we do not currently erase MapPoint from memory)
138  bool mbBad;
140 
141  // Scale invariance distances
144 
146 
147  std::mutex mMutexPos;
148  std::mutex mMutexFeatures;
149 
150 // map serialization addition
151 public:
152  // for serialization
153  MapPoint();
154 private:
155  // serialize is recommended to be private
157  template<class Archive>
158  void serialize(Archive &ar, const unsigned int version);
159 };
160 
161 } //namespace ORB_SLAM
162 
163 #endif // MAPPOINT_H
float GetMinDistanceInvariance()
Definition: MapPoint.cc:373
long unsigned int mnBALocalForKF
Definition: MapPoint.h:103
long unsigned int mnBAGlobalForKF
Definition: MapPoint.h:111
std::mutex mMutexFeatures
Definition: MapPoint.h:148
float GetFoundRatio()
Definition: MapPoint.cc:236
long unsigned int mnLoopPointForKF
Definition: MapPoint.h:107
static long unsigned int nNextId
Definition: MapPoint.h:87
long int mnFirstKFid
Definition: MapPoint.h:88
cv::Mat mNormalVector
Definition: MapPoint.h:125
long unsigned int mnCorrectedByKF
Definition: MapPoint.h:108
cv::Mat GetWorldPos()
Definition: MapPoint.cc:80
KeyFrame * mpRefKF
Definition: MapPoint.h:131
void IncreaseVisible(int n=1)
Definition: MapPoint.cc:224
void AddObservation(KeyFrame *pKF, size_t idx)
Definition: MapPoint.cc:98
cv::Mat GetDescriptor()
Definition: MapPoint.cc:309
void UpdateNormalAndDepth()
Definition: MapPoint.cc:330
cv::Mat mDescriptor
Definition: MapPoint.h:128
static std::mutex mGlobalMutex
Definition: MapPoint.h:114
std::map< KeyFrame *, size_t > GetObservations()
Definition: MapPoint.cc:139
void IncreaseFound(int n=1)
Definition: MapPoint.cc:230
KeyFrame * GetReferenceKeyFrame()
Definition: MapPoint.cc:92
friend class boost::serialization::access
Definition: MapPoint.h:156
void Replace(MapPoint *pMP)
Definition: MapPoint.cc:177
std::mutex mMutexPos
Definition: MapPoint.h:147
std::map< KeyFrame *, size_t > mObservations
Definition: MapPoint.h:122
void SetWorldPos(const cv::Mat &Pos)
Definition: MapPoint.cc:73
MapPoint * GetReplaced()
Definition: MapPoint.cc:170
float GetMaxDistanceInvariance()
Definition: MapPoint.cc:379
cv::Mat GetNormal()
Definition: MapPoint.cc:86
long unsigned int mnLastFrameSeen
Definition: MapPoint.h:100
MapPoint * mpReplaced
Definition: MapPoint.h:139
long int mnFirstFrame
Definition: MapPoint.h:89
int GetIndexInKeyFrame(KeyFrame *pKF)
Definition: MapPoint.cc:315
void serialize(Archive &ar, const unsigned int version)
Definition: MapPoint.cc:427
long unsigned int mnTrackReferenceForFrame
Definition: MapPoint.h:99
long unsigned int mnCorrectedReference
Definition: MapPoint.h:109
void ComputeDistinctiveDescriptors()
Definition: MapPoint.cc:242
long unsigned int mnId
Definition: MapPoint.h:86
bool IsInKeyFrame(KeyFrame *pKF)
Definition: MapPoint.cc:324
int PredictScale(const float &currentDist, KeyFrame *pKF)
Definition: MapPoint.cc:385
long unsigned int mnFuseCandidateForKF
Definition: MapPoint.h:104
void EraseObservation(KeyFrame *pKF)
Definition: MapPoint.cc:111


orb_slam2_ros
Author(s):
autogenerated on Wed Apr 21 2021 02:53:05