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));
91 void setName(
const std::string &
name,
const std::string & leftSuffix =
"left",
const std::string & rightSuffix =
"right");
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;
101 unsigned int deserialize(
const std::vector<unsigned char>& data);
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_;}
115 void scale(
double scale);
116 void roi(
const cv::Rect & roi);
129 void updateStereoRectification();