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");
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;
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_;}
116 void roi(
const cv::Rect & roi);
129 void updateStereoRectification();
void serialize(const Eigen::Matrix< S, T, U > &mat, std::ostream &strm)
const cv::Mat & R() const
bool isRectificationMapInitialized() 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
void deserialize(std::istream &strm, Eigen::Matrix< S, T, U > *mat)
const std::string & name() const