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,
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,
72 const cv::Size & imageSize = cv::Size(0,0));
75 const std::string & name,
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");
92 const std::string &
name()
const {
return name_;}
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;
101 double baseline()
const {
return right_.fx()!=0.0 && left_.fx() != 0.0 ? left_.Tx() / left_.fx() - right_.Tx()/right_.fx():0.0;}
103 float computeDepth(
float disparity)
const;
104 float computeDisparity(
float depth)
const;
105 float computeDisparity(
unsigned short depth)
const;
107 const cv::Mat &
R()
const {
return R_;}
108 const cv::Mat &
T()
const {
return T_;}
109 const cv::Mat &
E()
const {
return E_;}
110 const cv::Mat &
F()
const {
return F_;}
113 void roi(
const cv::Rect & roi);
const cv::Mat & R() const
const cv::Mat & F() const
const std::string & getRightSuffix() const
void initRectificationMap()
bool isValidForProjection() const
const CameraModel & left() const
const cv::Mat & T() const
const cv::Mat & E() const
virtual ~StereoCameraModel()
bool isValidForRectification() const
const CameraModel & right() const
void setLocalTransform(const Transform &transform)
void setImageSize(const cv::Size &size)
const std::string & getLeftSuffix() const
const Transform & localTransform() const
bool isRectificationMapInitialized()
const std::string & name() const