libfovis
stereo_calibration.hpp
1 #ifndef __fovis_stereo_calibration_hpp__
2 #define __fovis_stereo_calibration_hpp__
3 
4 #include <inttypes.h>
5 
6 #include "camera_intrinsics.hpp"
7 #include "rectification.hpp"
8 
9 namespace fovis
10 {
11 
17 {
26 
31 
36 };
37 
43 {
44  public:
47 
53  Eigen::Matrix4d getUvdToXyz() const {
54  double fx_inv = 1./_rectified_parameters.fx;
55  double base_inv = 1./getBaseline();
56  double cx = _rectified_parameters.cx;
57  double cy = _rectified_parameters.cy;
58  Eigen::Matrix4d result;
59  result <<
60  fx_inv , 0 , 0 , -cx * fx_inv ,
61  0 , fx_inv , 0 , -cy * fx_inv ,
62  0 , 0 , 0 , 1 ,
63  0 , 0 , fx_inv*base_inv , 0;
64  return result;
65  }
66 
70  int getWidth() const {
71  return _rectified_parameters.width;
72  }
73 
77  int getHeight() const {
78  return _rectified_parameters.height;
79  }
80 
81  double getBaseline() const {
82  return -_parameters.right_to_left_translation[0];
83  }
84 
85  const Rectification* getLeftRectification() const {
86  return _left_rectification;
87  }
88 
89  const Rectification* getRightRectification() const {
90  return _right_rectification;
91  }
92 
93  const CameraIntrinsicsParameters& getRectifiedParameters() const {
94  return _rectified_parameters;
95  }
96 
100  StereoCalibration* makeCopy() const;
101 
102  private:
103  StereoCalibration() { }
104  void initialize();
105 
106  StereoCalibrationParameters _parameters;
107  CameraIntrinsicsParameters _rectified_parameters;
108  Rectification* _left_rectification;
109  Rectification* _right_rectification;
110 };
111 
112 }
113 
114 #endif
CameraIntrinsicsParameters left_parameters
Definition: stereo_calibration.hpp:30
int getWidth() const
Definition: stereo_calibration.hpp:70
int height
Definition: camera_intrinsics.hpp:49
double right_to_left_rotation[4]
Definition: stereo_calibration.hpp:25
int getHeight() const
Definition: stereo_calibration.hpp:77
Computes useful information from a StereoCalibrationParameters object.
Definition: stereo_calibration.hpp:42
quick and dirty profiling tool.inspired by the matlab tic/toc command
Definition: camera_intrinsics.hpp:6
StereoCalibration * makeCopy() const
double cx
Definition: camera_intrinsics.hpp:64
double cy
Definition: camera_intrinsics.hpp:69
int width
Definition: camera_intrinsics.hpp:44
Intrinsic parameters for a pinhole camera with plumb-bob distortion model.
Definition: camera_intrinsics.hpp:14
double right_to_left_translation[3]
Definition: stereo_calibration.hpp:21
double fx
Definition: camera_intrinsics.hpp:54
Calibration data structure for stereo cameras.
Definition: stereo_calibration.hpp:16
Eigen::Matrix4d getUvdToXyz() const
Definition: stereo_calibration.hpp:53
CameraIntrinsicsParameters right_parameters
Definition: stereo_calibration.hpp:35