40 #ifndef INCLUDE_OKVIS_CAMERAS_CAMERABASE_HPP_
41 #define INCLUDE_OKVIS_CAMERAS_CAMERABASE_HPP_
47 #pragma GCC diagnostic push
48 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
49 #include <opencv2/core/core.hpp>
50 #pragma GCC diagnostic pop
63 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
115 inline const cv::Mat &
mask()
const;
130 inline uint64_t
id()
const
149 virtual void getIntrinsics(Eigen::VectorXd & intrinsics)
const = 0;
152 virtual bool setIntrinsics(
const Eigen::VectorXd & intrinsics) = 0;
165 Eigen::Vector2d * imagePoint)
const = 0;
176 const Eigen::Vector3d & point, Eigen::Vector2d * imagePoint,
177 Eigen::Matrix<double, 2, 3> * pointJacobian,
178 Eigen::Matrix2Xd * intrinsicsJacobian = NULL)
const = 0;
190 const Eigen::Vector3d & point,
const Eigen::VectorXd & parameters,
191 Eigen::Vector2d * imagePoint, Eigen::Matrix<double, 2, 3> * pointJacobian = NULL,
192 Eigen::Matrix2Xd * intrinsicsJacobian = NULL)
const = 0;
200 virtual void projectBatch(
const Eigen::Matrix3Xd & points,
201 Eigen::Matrix2Xd * imagePoints,
202 std::vector<ProjectionStatus> * stati)
const = 0;
211 const Eigen::Vector4d & point, Eigen::Vector2d * imagePoint)
const = 0;
222 const Eigen::Vector4d & point, Eigen::Vector2d * imagePoint,
223 Eigen::Matrix<double, 2, 4> * pointJacobian,
224 Eigen::Matrix2Xd * intrinsicsJacobian = NULL)
const = 0;
236 const Eigen::Vector4d & point,
const Eigen::VectorXd & parameters,
237 Eigen::Vector2d * imagePoint,
238 Eigen::Matrix<double, 2, 4> * pointJacobian = NULL,
239 Eigen::Matrix2Xd * intrinsicsJacobian = NULL)
const = 0;
248 const Eigen::Matrix4Xd & points, Eigen::Matrix2Xd * imagePoints,
249 std::vector<ProjectionStatus> * stati)
const = 0;
260 virtual bool backProject(
const Eigen::Vector2d & imagePoint,
261 Eigen::Vector3d * direction)
const = 0;
269 const Eigen::Vector2d & imagePoint, Eigen::Vector3d * direction,
270 Eigen::Matrix<double, 3, 2> * pointJacobian)
const = 0;
277 Eigen::Matrix3Xd * directions,
278 std::vector<bool> * success)
const = 0;
285 Eigen::Vector4d * direction)
const = 0;
293 const Eigen::Vector2d & imagePoint, Eigen::Vector4d * direction,
294 Eigen::Matrix<double, 4, 2> * pointJacobian)
const = 0;
301 const Eigen::Matrix2Xd & imagePoints, Eigen::Matrix4Xd * directions,
302 std::vector<bool> * success)
const = 0;
318 double maxDist = 10.0)
const;
334 virtual std::string
type()
const = 0;
342 inline bool isMasked(
const Eigen::Vector2d& imagePoint)
const;
345 inline bool isInImage(
const Eigen::Vector2d& imagePoint)
const;
virtual const std::string distortionType() const =0
Obtain the projection type.
uint64_t id() const
Obtain the Id.
Definition: CameraBase.hpp:130
virtual ProjectionStatus projectWithExternalParameters(const Eigen::Vector3d &point, const Eigen::VectorXd ¶meters, Eigen::Vector2d *imagePoint, Eigen::Matrix< double, 2, 3 > *pointJacobian=NULL, Eigen::Matrix2Xd *intrinsicsJacobian=NULL) const =0
Projects a Euclidean point to a 2d image point (projection). Uses projection including distortion mod...
int imageHeight_
image height in pixels
Definition: CameraBase.hpp:350
Indicates what happened when applying any of the project functions.
bool removeMask()
stop masking
Definition: CameraBase.hpp:65
virtual std::string type() const =0
Obtain the type.
bool isInImage(const Eigen::Vector2d &imagePoint) const
Check if the keypoint is in the image.
Definition: CameraBase.hpp:95
virtual Eigen::Vector4d createRandomVisibleHomogeneousPoint(double minDist=0.0, double maxDist=10.0) const
Creates a random visible point in homogeneous coordinates.
Definition: CameraBase.cpp:77
int imageWidth_
image width in pixels
Definition: CameraBase.hpp:349
virtual void projectHomogeneousBatch(const Eigen::Matrix4Xd &points, Eigen::Matrix2Xd *imagePoints, std::vector< ProjectionStatus > *stati) const =0
Projects points in homogenous coordinates to 2d image points (projection) in a batch. Uses projection including distortion models.
virtual int noIntrinsicsParameters() const =0
Obtain the number of intrinsics parameters.
uint32_t imageHeight() const
The height of the image in pixels.
Definition: CameraBase.hpp:143
uint64_t id_
an Id
Definition: CameraBase.hpp:352
virtual ProjectionStatus project(const Eigen::Vector3d &point, Eigen::Vector2d *imagePoint) const =0
Projects a Euclidean point to a 2d image point (projection). Uses projection including distortion mod...
virtual void getIntrinsics(Eigen::VectorXd &intrinsics) const =0
obtain all intrinsics
virtual bool setIntrinsics(const Eigen::VectorXd &intrinsics)=0
overwrite all intrinsics - use with caution !
bool setMask(const cv::Mat &mask)
Set the mask. It must be the same size as the image and comply with OpenCV: 0 == masked, nonzero == valid. Type must be CV_8U1C.
Definition: CameraBase.hpp:47
Header implementation file for the CameraBase class.
virtual ProjectionStatus projectHomogeneous(const Eigen::Vector4d &point, Eigen::Vector2d *imagePoint) const =0
Projects a point in homogenous coordinates to a 2d image point (projection). Uses projection includin...
Header file for the DistortionBase class.
void setId(uint64_t id)
Set an Id.
Definition: CameraBase.hpp:124
bool hasMask() const
Was a nonzero mask set?
Definition: CameraBase.hpp:72
virtual bool backProjectHomogeneousBatch(const Eigen::Matrix2Xd &imagePoints, Eigen::Matrix4Xd *directions, std::vector< bool > *success) const =0
Back-project 2d image points into homogeneous points (direction vectors).
virtual bool backProjectHomogeneous(const Eigen::Vector2d &imagePoint, Eigen::Vector4d *direction) const =0
Back-project a 2d image point into homogeneous point (direction vector).
uint32_t imageWidth() const
The width of the image in pixels.
Definition: CameraBase.hpp:138
const cv::Mat & mask() const
Get the mask.
Definition: CameraBase.hpp:78
virtual Eigen::Vector3d createRandomVisiblePoint(double minDist=0.0, double maxDist=10.0) const
Creates a random visible point in Euclidean coordinates.
Definition: CameraBase.cpp:62
CameraBase()
default Constructor – does nothing serious
Definition: CameraBase.hpp:77
virtual bool backProject(const Eigen::Vector2d &imagePoint, Eigen::Vector3d *direction) const =0
Back-project a 2d image point into Euclidean space (direction vector).
virtual ~CameraBase()
Destructor – does nothing.
Definition: CameraBase.hpp:93
cv::Mat mask_
The mask – empty by default.
Definition: CameraBase.hpp:347
CameraBase(int imageWidth, int imageHeight, uint64_t id=0)
Constructor for width, height and Id.
Definition: CameraBase.hpp:85
bool isMasked(const Eigen::Vector2d &imagePoint) const
Check if the keypoint is masked.
Definition: CameraBase.hpp:83
Base class for all camera models.
Definition: CameraBase.hpp:60
virtual bool backProjectBatch(const Eigen::Matrix2Xd &imagePoints, Eigen::Matrix3Xd *directions, std::vector< bool > *success) const =0
Back-project 2d image points into Euclidean space (direction vectors).
virtual Eigen::Vector2d createRandomImagePoint() const
Creates a random (uniform distribution) image point.
Definition: CameraBase.cpp:47
virtual void projectBatch(const Eigen::Matrix3Xd &points, Eigen::Matrix2Xd *imagePoints, std::vector< ProjectionStatus > *stati) const =0
Projects Euclidean points to 2d image points (projection) in a batch. Uses projection including disto...
virtual ProjectionStatus projectHomogeneousWithExternalParameters(const Eigen::Vector4d &point, const Eigen::VectorXd ¶meters, Eigen::Vector2d *imagePoint, Eigen::Matrix< double, 2, 4 > *pointJacobian=NULL, Eigen::Matrix2Xd *intrinsicsJacobian=NULL) const =0
Projects a point in homogenous coordinates to a 2d image point (projection). Uses projection includin...