mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Added Source/Mirroring parameter for convenience
This commit is contained in:
@@ -56,10 +56,12 @@ public:
|
||||
//getters
|
||||
void getImageSize(unsigned int & width, unsigned int & height);
|
||||
float getImageRate() const {return _imageRate;}
|
||||
bool isMirroringEnabled() const {return _mirroring;}
|
||||
|
||||
//setters
|
||||
void setImageRate(float imageRate) {_imageRate = imageRate;}
|
||||
void setImageSize(unsigned int width, unsigned int height);
|
||||
void setMirroringEnabled(bool enabled) {_mirroring = enabled;}
|
||||
|
||||
void setCalibration(const std::string & fileName);
|
||||
void setCalibration(const cv::Mat & cameraMatrix, const cv::Mat & distorsionCoefficients);
|
||||
@@ -81,6 +83,7 @@ private:
|
||||
float _imageRate;
|
||||
unsigned int _imageWidth;
|
||||
unsigned int _imageHeight;
|
||||
bool _mirroring;
|
||||
UTimer * _frameRateTimer;
|
||||
cv::Mat _k; // camera_matrix
|
||||
cv::Mat _d; // distorsion_coefficients
|
||||
|
||||
@@ -77,6 +77,7 @@ public:
|
||||
//getters
|
||||
float getImageRate() const {return _imageRate;}
|
||||
const Transform & getLocalTransform() const {return _localTransform;}
|
||||
bool isMirroringEnabled() const {return _mirroring;}
|
||||
float getFx() const {return _fx;}
|
||||
float getFy() const {return _fy;}
|
||||
float getCx() const {return _cx;}
|
||||
@@ -85,6 +86,7 @@ public:
|
||||
//setters
|
||||
void setImageRate(float imageRate) {_imageRate = imageRate;}
|
||||
void setLocalTransform(const Transform & localTransform) {_localTransform= localTransform;}
|
||||
void setMirroringEnabled(bool mirroring) {_mirroring = mirroring;}
|
||||
void setFx(float fx) {_fx = fx;}
|
||||
void setFy(float fy) {_fy = fy;}
|
||||
void setCx(float cx) {_cx = cx;}
|
||||
@@ -108,6 +110,7 @@ protected:
|
||||
private:
|
||||
float _imageRate;
|
||||
Transform _localTransform;
|
||||
bool _mirroring;
|
||||
UTimer * _frameRateTimer;
|
||||
float _fx;
|
||||
float _fy;
|
||||
|
||||
@@ -50,6 +50,7 @@ Camera::Camera(float imageRate,
|
||||
_imageRate(imageRate),
|
||||
_imageWidth(imageWidth),
|
||||
_imageHeight(imageHeight),
|
||||
_mirroring(false),
|
||||
_frameRateTimer(new UTimer())
|
||||
{
|
||||
}
|
||||
@@ -177,6 +178,10 @@ cv::Mat Camera::takeImage()
|
||||
cv::Mat temp = img.clone();
|
||||
cv::undistort(temp, img, _k, _d);
|
||||
}
|
||||
if(!img.empty() && _mirroring)
|
||||
{
|
||||
cv::flip(img,img,1);
|
||||
}
|
||||
UDEBUG("Time capturing image = %fs", timer.ticks());
|
||||
return img;
|
||||
}
|
||||
|
||||
@@ -118,6 +118,15 @@ void CameraRGBD::takeImage(cv::Mat & rgb, cv::Mat & depth, float & fx, float & f
|
||||
{
|
||||
cy = _cy; // override if set
|
||||
}
|
||||
if(!rgb.empty() && !depth.empty() && _mirroring)
|
||||
{
|
||||
cv::flip(rgb,rgb,1);
|
||||
cv::flip(depth,depth,1);
|
||||
if(cx != 0.0f)
|
||||
{
|
||||
cx = float(rgb.cols) - cx;
|
||||
}
|
||||
}
|
||||
UDEBUG("Time capturing image = %fs", timer.ticks());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user