NDEVR
API Documentation
MapPoint.h
1#pragma once
2#include "DLLInfo.h"
3#include "Base/Headers/Set.h"
4#include "Base/Headers/Dictionary.h"
5#include "GraphOptimization/Headers/GeometricCamera.h"
6#include <Eigen/Core>
7#include <NDEVR/RWLock.h>
8#include <opencv2/core/core.hpp>
9#include <mutex>
10namespace NDEVR
11{
12
13 class KeyFrame;
14 class Map;
15 class Frame;
16
23 class ORBSLAM_API MapPoint
24 {
25 public:
26 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
32 MapPoint(const Eigen::Vector3<g_type>& Pos, KeyFrame* pRefKF, Map* pMap);
39 MapPoint(const Eigen::Vector3<g_type>& Pos, Map* pMap, Frame* pFrame, uint04 idxF);
43 void SetWorldPos(const Eigen::Vector3<g_type>& Pos);
44 Eigen::Vector3<g_type> worldPos() const
45 {
46 //std::unique_lock<std::mutex> lock(mMutexPos);
47 return m_world_pos;
48 }
49 Eigen::Vector3f GetNormal() const
50 {
51 //std::unique_lock<std::mutex> lock(mMutexPos);
52 return mNormalVector;
53 }
54 void SetNormalVector(const Eigen::Vector3f& normal);
55
56 KeyFrame* GetReferenceKeyFrame();
57
58 const Dictionary<KeyFrame*, Vector<2, uint04>>& observationsRef();
59 uint04 observationCount() const;
60
61 void AddObservation(KeyFrame* pKF, uint04 idx);
62 void eraseObservation(KeyFrame* pKF);
63
64 Vector<2, uint04> GetIndexInKeyFrame(KeyFrame* pKF);
65 bool IsInKeyFrame(KeyFrame* pKF);
66
67 void setBadFlag();
68 bool isBad();
69
70 void Replace(MapPoint* pMP);
71 MapPoint* GetReplaced();
72
73 void increaseVisible(uint04 n = 1U);
74 void increaseFound(uint04 n = 1U);
75 float GetFoundRatio();
76 inline int GetFound() {
77 return mnFound;
78 }
79
80 void ComputeDistinctiveDescriptors();
81 RWLock& featureLockPtr() { return m_feature_lock; };
82 const cv::Mat& distinctDescriptor() const;
83
84 void UpdateNormalAndDepth();
85
86 float GetMinDistanceInvariance();
87 float GetMaxDistanceInvariance();
88 uint04 predictScale(const Frame& kF) const;
89 uint04 predictScale(float currentDist, const Frame& kF) const;
90
91 Map* GetMap();
92 void UpdateMap(Map* pMap);
93 uint04 id() const { return m_id; }
94 void setLocalTrackedFrame(uint04 frame_idx) { m_last_frame_locally_tracked = frame_idx; };
95 uint04 getLocalTrackedFrame() const { return m_last_frame_locally_tracked; };
96 protected:
97 static volatile uint04 s_id_increment;
98 public:
99 static std::mutex mGlobalMutex;
100
101 protected:// Mutex
102 // Keyframes observing the point and associated index in keyframe
103 Dictionary<KeyFrame*, Vector<2, uint04>> m_observations;
104 RWLock m_feature_lock;
105 // Best descriptor to fast matching
106 cv::Mat m_descriptor;
107 public:
108 uint04 mnFirstKFid = 0U;
109
110 // Variables used by local mapping
111 uint04 mnBALocalForKF = Constant<uint04>::Invalid;
112
113 // Variables used by loop closing
114 uint04 mnCorrectedByKF = Constant<uint04>::Invalid;
115 uint04 mnCorrectedReference = Constant<uint04>::Invalid;
116 Eigen::Vector3f mPosGBA;
117 uint04 mnBAGlobalForKF = Constant<uint04>::Invalid;
118 uint04 mnBALocalForMerge = Constant<uint04>::Invalid;
119
120 // Variable used by merging
121 Eigen::Vector3f mPosMerge;
122 Eigen::Vector3f mNormalVectorMerge;
123
124 uint04 m_observation_count = 0U;
125 protected:
126 uint04 m_id;
127 uint04 m_last_frame_locally_tracked = Constant<uint04>::Invalid;
128 // Position in absolute coordinates
129 Eigen::Vector3<g_type> m_world_pos;
130
131
132
133 // Mean viewing direction
134 Eigen::Vector3<g_type> mNormalVector;
135
136
137
138 // Reference KeyFrame
139 KeyFrame* mpRefKF = nullptr;
140
141 // Tracking counters
142 uint04 mnVisible = 0;
143 uint04 mnFound = 0;
144 MapPoint* mpReplaced = nullptr;
145
146 // Scale invariance distances
147 float mfMinDistance = 0.0f;
148 float mfMaxDistance = 0.0f;
149
150 Map* mpMap = nullptr;
151 bool mbBad = false;
152
153
154 };
155
156}
Represents a single image frame with extracted features and pose information.
Definition Frame.h:111
A keyframe in the SLAM map, derived from Frame.
Definition KeyFrame.h:31
MapPoint(const Eigen::Vector3< g_type > &Pos, Map *pMap, Frame *pFrame, uint04 idxF)
Constructs a map point from a frame observation.
void SetWorldPos(const Eigen::Vector3< g_type > &Pos)
Sets the 3D world position.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW MapPoint(const Eigen::Vector3< g_type > &Pos, KeyFrame *pRefKF, Map *pMap)
Constructs a map point from a keyframe observation.
Represents a single SLAM map containing keyframes and map points.
Definition Map.h:22
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...