28 #ifndef STEREOCAMERAMODEL_H_ 29 #define STEREOCAMERAMODEL_H_ 40 const std::string &
name,
41 const cv::Size & imageSize1,
42 const cv::Mat & K1,
const cv::Mat & D1,
const cv::Mat & R1,
const cv::Mat & P1,
43 const cv::Size & imageSize2,
44 const cv::Mat & K2,
const cv::Mat & D2,
const cv::Mat & R2,
const cv::Mat & P2,
45 const cv::Mat & R,
const cv::Mat &
T,
const cv::Mat & E,
const cv::Mat & F,
46 const Transform & localTransform =
Transform(0,0,1,0, -1,0,0,0, 0,-1,0,0));
50 const std::string & name,
53 const cv::Mat & R = cv::Mat(),
54 const cv::Mat & T = cv::Mat(),
55 const cv::Mat & E = cv::Mat(),
56 const cv::Mat & F = cv::Mat());
59 const std::string & name,
71 const Transform & localTransform =
Transform(0,0,1,0, -1,0,0,0, 0,-1,0,0),
72 const cv::Size & imageSize = cv::Size(0,0));
75 const std::string & name,
81 const Transform & localTransform =
Transform(0,0,1,0, -1,0,0,0, 0,-1,0,0),
82 const cv::Size & imageSize = cv::Size(0,0));
85 bool isValidForProjection()
const {
return left_.isValidForProjection() && right_.isValidForProjection() && baseline() > 0.0;}
91 void setName(
const std::string & name,
const std::string & leftSuffix =
"left",
const std::string & rightSuffix =
"right");
95 void setImageSize(
const cv::Size & size) {left_.setImageSize(size); right_.setImageSize(size);}
97 bool load(
const std::string & directory,
const std::string & cameraName,
bool ignoreStereoTransform =
true);
98 bool save(
const std::string & directory,
bool ignoreStereoTransform =
true)
const;
99 bool saveStereoTransform(
const std::string & directory)
const;
100 std::vector<unsigned char>
serialize()
const;
102 unsigned int deserialize(
const unsigned char * data,
unsigned int dataSize);
104 double baseline()
const {
return right_.fx()!=0.0 && left_.fx() != 0.0 ? left_.Tx() / left_.fx() - right_.Tx()/right_.fx():0.0;}
106 float computeDepth(
float disparity)
const;
107 float computeDisparity(
float depth)
const;
108 float computeDisparity(
unsigned short depth)
const;
110 const cv::Mat &
R()
const {
return R_;}
111 const cv::Mat &
T()
const {
return T_;}
112 const cv::Mat &
E()
const {
return E_;}
113 const cv::Mat &
F()
const {
return F_;}
116 void roi(
const cv::Rect & roi);
129 void updateStereoRectification();
bool isValidForProjection() const
void serialize(const Eigen::Matrix< S, T, U > &mat, std::ostream &strm)
bool isValidForRectification() const
const cv::Mat & T() const
void initRectificationMap()
const std::string & name() const
const cv::Mat & F() const
bool isRectificationMapInitialized() const
const std::string & getLeftSuffix() const
virtual ~StereoCameraModel()
const cv::Mat & R() const
const Transform & localTransform() const
const std::string & getRightSuffix() const
RTABMAP_EXP std::ostream & operator<<(std::ostream &os, const CameraModel &model)
const cv::Mat & E() const
void setLocalTransform(const Transform &transform)
void setImageSize(const cv::Size &size)
NearestNeighbourSearch< T >::Matrix load(const char *fileName)
const CameraModel & right() const
void deserialize(std::istream &strm, Eigen::Matrix< S, T, U > *mat)
const CameraModel & left() const