SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
WAISlamTrackPool.h
Go to the documentation of this file.
1 #ifndef WAI_SLAM_TRACKPOOL_H
2 #define WAI_SLAM_TRACKPOOL_H
3 
4 #include <WAISlamTools.h>
5 
7 {
8 public:
9  struct Params
10  {
11  // ensure all new keyframe have enough in common with loaded map
12  bool ensureKFIntegration = false;
13  // wait for localmapping
14  bool serial = false;
15  // retain the images in the keyframes, so we can store them later
16  bool retainImg = false;
17  // in onlyTracking mode we do not use local mapping and loop closing
18  bool onlyTracking = false;
19  // If true, keyframes loaded from a map will not be culled and the pose will not be changed. Local bundle adjustment is applied only on newly added kfs.
20  // Also, the loop closing will be disabled so that there will be no optimization of the essential graph and no global bundle adjustment.
21  bool fixOldKfs = false;
22  // use lucas canade optical flow tracking
23  bool trackOptFlow = false;
24 
25  // keyframe culling strategy params:
26  // A keyframe is considered redundant if _cullRedundantPerc of the MapPoints it sees, are seen
27  // in at least other 3 keyframes (in the same or finer scale)
28  float cullRedundantPerc = 0.95f; // originally it was 0.9
29 
30  // Min common words as a factor of max common words within candidates
31  // for relocalization and loop closing
32  float minCommonWordFactor = 0.8f;
33 
34  // Min acceleration score filter in detectRelocalizationCandidates
35  bool minAccScoreFilter = false;
36  };
37 
38  WAISlamTrackPool(const cv::Mat& intrinsic,
39  const cv::Mat& distortion,
40  WAIOrbVocabulary* voc,
41  KPextractor* iniExtractor,
42  KPextractor* relocExtractor,
43  KPextractor* extractor,
44  std::unique_ptr<WAIMap> globalMap,
45  Params params);
46 
47  virtual ~WAISlamTrackPool();
48 
49  bool update(cv::Mat& imageGray);
50 
52  void changeIntrinsic(cv::Mat intrinsic, cv::Mat distortion);
53  cv::Mat getPose();
54 
55  void drawInfo(cv::Mat& imageBGR,
56  float scale,
57  bool showInitLine,
58  bool showKeyPoints,
59  bool showKeyPointsMatched);
60 
61  virtual std::vector<WAIMapPoint*> getMapPoints()
62  {
63  if (_globalMap != nullptr)
64  return _globalMap->GetAllMapPoints();
65  return std::vector<WAIMapPoint*>();
66  }
67  std::vector<WAIMapPoint*> getMatchedMapPoints();
68 
69 private:
70  void createFrame(WAIFrame& frame, cv::Mat& imageGray);
71  void updatePose(WAIFrame& frame);
72 
74 
75  unsigned int _relocFrameCounter = 0;
76  unsigned long _lastRelocFrameId = 0;
77  unsigned long _lastKeyFrameFrameId = 0;
78  KPextractor* _extractor = nullptr;
79  KPextractor* _relocExtractor = nullptr;
80  KPextractor* _iniExtractor = nullptr;
82 
84 
86 };
87 //-----------------------------------------------------------------------------
88 #endif
WAITrackingState
Definition: WAISlamTools.h:27
std::unique_ptr< WAIMap > _globalMap
Definition: WAISlamTools.h:208
unsigned int _relocFrameCounter
void changeIntrinsic(cv::Mat intrinsic, cv::Mat distortion)
KPextractor * _relocExtractor
void createFrame(WAIFrame &frame, cv::Mat &imageGray)
void drawInfo(cv::Mat &imageBGR, float scale, bool showInitLine, bool showKeyPoints, bool showKeyPointsMatched)
virtual WAITrackingState getTrackingState()
WAITrackingState _state
unsigned long _lastKeyFrameFrameId
KPextractor * _extractor
virtual ~WAISlamTrackPool()
bool update(cv::Mat &imageGray)
WAISlamTrackPool(const cv::Mat &intrinsic, const cv::Mat &distortion, WAIOrbVocabulary *voc, KPextractor *iniExtractor, KPextractor *relocExtractor, KPextractor *extractor, std::unique_ptr< WAIMap > globalMap, Params params)
std::vector< WAIMapPoint * > getMatchedMapPoints()
std::mutex _cameraExtrinsicMutex
virtual std::vector< WAIMapPoint * > getMapPoints()
KPextractor * _iniExtractor
void updatePose(WAIFrame &frame)
unsigned long _lastRelocFrameId