libfovis
stereo_depth.hpp
1 #ifndef __fovis_stereo_depth_hpp__
2 #define __fovis_stereo_depth_hpp__
3 
4 #include <inttypes.h>
5 
6 #include "stereo_calibration.hpp"
7 #include "depth_source.hpp"
8 #include "frame.hpp"
9 #include "stereo_frame.hpp"
10 #include "feature_match.hpp"
11 #include "options.hpp"
12 
13 #include "motion_estimation.hpp"
14 
15 namespace fovis
16 {
17 
24 class StereoDepth : public DepthSource
25 {
26  public:
27  StereoDepth(const StereoCalibration* calib,
28  const VisualOdometryOptions& options);
29 
30  ~StereoDepth();
31 
32  void setRightImage(const uint8_t * img);
33 
34  virtual bool haveXyz(int u, int v);
35 
36  virtual void getXyz(OdometryFrame * frame);
37 
38  virtual void refineXyz(FeatureMatch * matches,
39  int num_matches,
40  OdometryFrame * frame);
41 
42  virtual double getBaseline() const { return _calib->getBaseline(); }
43 
44  private:
45  typedef std::vector<std::pair<double, double> > Points2d;
46 
47  void leftRightMatch(PyramidLevel* left_level,
48  PyramidLevel* right_level,
49  Points2d* matched_right_keypoints);
50 
51  const StereoCalibration* _calib;
52 
53  int _width;
54  int _height;
55 
56  int _feature_window_size;
57 
58  int _num_pyramid_levels;
59 
60  // params for adaptive feature detector threshold
61  int _fast_threshold;
62  int _fast_threshold_min;
63  int _fast_threshold_max;
64  int _target_pixels_per_feature;
65  float _fast_threshold_adaptive_gain;
66 
67  bool _use_adaptive_threshold;
68  bool _require_mutual_match;
69  double _max_dist_epipolar_line;
70  double _max_refinement_displacement;
71 
72  StereoFrame* _right_frame;
73 
74  FeatureMatcher _matcher;
75  std::vector<Points2d> _matched_right_keypoints_per_level;
76  std::vector<std::vector<int> > _legal_matches;
77 
78  Eigen::Matrix4d *_uvd1_to_xyz;
79 
80  int _max_disparity;
81 
82  const VisualOdometryOptions _options;
83 
84  // matches buffer.
85  FeatureMatch* _matches;
86  int _num_matches;
87  int _matches_capacity;
88 
89 };
90 
91 }
92 
93 #endif
Matches features between a reference and a target image.
Definition: feature_matcher.hpp:12
virtual double getBaseline() const
Definition: stereo_depth.hpp:42
One level of a Gaussian image pyramid.
Definition: pyramid_level.hpp:21
Stores data specific to an input frame.
Definition: frame.hpp:33
Provides depth estimates for input image pixels.
Definition: depth_source.hpp:29
Represents a single image feature matched between two camera images taken at different times...
Definition: feature_match.hpp:41
virtual bool haveXyz(int u, int v)
virtual void getXyz(OdometryFrame *frame)
virtual void refineXyz(FeatureMatch *matches, int num_matches, OdometryFrame *frame)
Stores the right-hand image for a stereo pair.
Definition: stereo_frame.hpp:24
std::map< std::string, std::string > VisualOdometryOptions
Options.
Definition: options.hpp:106
Computes useful information from a StereoCalibrationParameters object.
Definition: stereo_calibration.hpp:42
Stores image data for a stereo camera pair.
Definition: stereo_depth.hpp:24
quick and dirty profiling tool.inspired by the matlab tic/toc command
Definition: camera_intrinsics.hpp:6
Options.