OKVIS ROS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
okvis::cameras::CameraBase Class Referenceabstract

Base class for all camera models. More...

#include <CameraBase.hpp>

Inheritance diagram for okvis::cameras::CameraBase:
okvis::cameras::PinholeCamera< DISTORTION_T >

Public Types

enum  ProjectionStatus {
  ProjectionStatus::Successful, ProjectionStatus::OutsideImage, ProjectionStatus::Masked, ProjectionStatus::Behind,
  ProjectionStatus::Invalid
}
 

Public Member Functions

 CameraBase ()
 default Constructor – does nothing serious More...
 
 CameraBase (int imageWidth, int imageHeight, uint64_t id=0)
 Constructor for width, height and Id. More...
 
virtual ~CameraBase ()
 Destructor – does nothing. More...
 
uint32_t imageWidth () const
 The width of the image in pixels. More...
 
uint32_t imageHeight () const
 The height of the image in pixels. More...
 
virtual void getIntrinsics (Eigen::VectorXd &intrinsics) const =0
 obtain all intrinsics More...
 
virtual bool setIntrinsics (const Eigen::VectorXd &intrinsics)=0
 overwrite all intrinsics - use with caution ! More...
 
virtual int noIntrinsicsParameters () const =0
 Obtain the number of intrinsics parameters. More...
 
virtual std::string type () const =0
 Obtain the type. More...
 
virtual const std::string distortionType () const =0
 Obtain the projection type. More...
 
Methods related to masking a certain image area as invalid.
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. More...
 
bool hasMask () const
 Was a nonzero mask set? More...
 
bool removeMask ()
 stop masking More...
 
const cv::Mat & mask () const
 Get the mask. More...
 
Methods related Ids of this camera.
void setId (uint64_t id)
 Set an Id. More...
 
uint64_t id () const
 Obtain the Id. More...
 
Methods to project points
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 models. More...
 
virtual ProjectionStatus project (const Eigen::Vector3d &point, Eigen::Vector2d *imagePoint, Eigen::Matrix< double, 2, 3 > *pointJacobian, Eigen::Matrix2Xd *intrinsicsJacobian=NULL) const =0
 Projects a Euclidean point to a 2d image point (projection). Uses projection including distortion models. More...
 
virtual ProjectionStatus projectWithExternalParameters (const Eigen::Vector3d &point, const Eigen::VectorXd &parameters, 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 models. More...
 
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 distortion models. More...
 
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 including distortion models. More...
 
virtual ProjectionStatus projectHomogeneous (const Eigen::Vector4d &point, Eigen::Vector2d *imagePoint, Eigen::Matrix< double, 2, 4 > *pointJacobian, Eigen::Matrix2Xd *intrinsicsJacobian=NULL) const =0
 Projects a point in homogenous coordinates to a 2d image point (projection). Uses projection including distortion models. More...
 
virtual ProjectionStatus projectHomogeneousWithExternalParameters (const Eigen::Vector4d &point, const Eigen::VectorXd &parameters, 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 including distortion models. More...
 
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. More...
 
Methods to backproject points
virtual bool backProject (const Eigen::Vector2d &imagePoint, Eigen::Vector3d *direction) const =0
 Back-project a 2d image point into Euclidean space (direction vector). More...
 
virtual bool backProject (const Eigen::Vector2d &imagePoint, Eigen::Vector3d *direction, Eigen::Matrix< double, 3, 2 > *pointJacobian) const =0
 Back-project a 2d image point into Euclidean space (direction vector). More...
 
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). More...
 
virtual bool backProjectHomogeneous (const Eigen::Vector2d &imagePoint, Eigen::Vector4d *direction) const =0
 Back-project a 2d image point into homogeneous point (direction vector). More...
 
virtual bool backProjectHomogeneous (const Eigen::Vector2d &imagePoint, Eigen::Vector4d *direction, Eigen::Matrix< double, 4, 2 > *pointJacobian) const =0
 Back-project a 2d image point into homogeneous point (direction vector). More...
 
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). More...
 
Methods to facilitate unit testing
virtual Eigen::Vector2d createRandomImagePoint () const
 Creates a random (uniform distribution) image point. More...
 
virtual Eigen::Vector3d createRandomVisiblePoint (double minDist=0.0, double maxDist=10.0) const
 Creates a random visible point in Euclidean coordinates. More...
 
virtual Eigen::Vector4d createRandomVisibleHomogeneousPoint (double minDist=0.0, double maxDist=10.0) const
 Creates a random visible point in homogeneous coordinates. More...
 

Protected Member Functions

bool isMasked (const Eigen::Vector2d &imagePoint) const
 Check if the keypoint is masked. More...
 
bool isInImage (const Eigen::Vector2d &imagePoint) const
 Check if the keypoint is in the image. More...
 

Protected Attributes

cv::Mat mask_
 The mask – empty by default. More...
 
int imageWidth_
 image width in pixels More...
 
int imageHeight_
 image height in pixels More...
 
uint64_t id_
 an Id More...
 

Detailed Description

Base class for all camera models.

Member Enumeration Documentation

Enumerator
Successful 
OutsideImage 
Masked 
Behind 
Invalid 

Constructor & Destructor Documentation

okvis::cameras::CameraBase::CameraBase ( )
inline

default Constructor – does nothing serious

okvis::cameras::CameraBase::CameraBase ( int  imageWidth,
int  imageHeight,
uint64_t  id = 0 
)
inline

Constructor for width, height and Id.

virtual okvis::cameras::CameraBase::~CameraBase ( )
inlinevirtual

Destructor – does nothing.

Member Function Documentation

virtual bool okvis::cameras::CameraBase::backProject ( const Eigen::Vector2d &  imagePoint,
Eigen::Vector3d *  direction 
) const
pure virtual

Back-project a 2d image point into Euclidean space (direction vector).

Parameters
[in]imagePointThe image point.
[out]directionThe Euclidean direction vector.
Returns
true on success.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual bool okvis::cameras::CameraBase::backProject ( const Eigen::Vector2d &  imagePoint,
Eigen::Vector3d *  direction,
Eigen::Matrix< double, 3, 2 > *  pointJacobian 
) const
pure virtual

Back-project a 2d image point into Euclidean space (direction vector).

Parameters
[in]imagePointThe image point.
[out]directionThe Euclidean direction vector.
[out]pointJacobianJacobian of the back-projection function w.r.t. the point.
Returns
true on success.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual bool okvis::cameras::CameraBase::backProjectBatch ( const Eigen::Matrix2Xd &  imagePoints,
Eigen::Matrix3Xd *  directions,
std::vector< bool > *  success 
) const
pure virtual

Back-project 2d image points into Euclidean space (direction vectors).

Parameters
[in]imagePointsThe image points (one point per column).
[out]directionsThe Euclidean direction vectors (one point per column).
[out]successSuccess of each of the back-projection

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual bool okvis::cameras::CameraBase::backProjectHomogeneous ( const Eigen::Vector2d &  imagePoint,
Eigen::Vector4d *  direction 
) const
pure virtual

Back-project a 2d image point into homogeneous point (direction vector).

Parameters
[in]imagePointThe image point.
[out]directionThe homogeneous point as direction vector.
Returns
true on success.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual bool okvis::cameras::CameraBase::backProjectHomogeneous ( const Eigen::Vector2d &  imagePoint,
Eigen::Vector4d *  direction,
Eigen::Matrix< double, 4, 2 > *  pointJacobian 
) const
pure virtual

Back-project a 2d image point into homogeneous point (direction vector).

Parameters
[in]imagePointThe image point.
[out]directionThe homogeneous point as direction vector.
[out]pointJacobianJacobian of the back-projection function.
Returns
true on success.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual bool okvis::cameras::CameraBase::backProjectHomogeneousBatch ( const Eigen::Matrix2Xd &  imagePoints,
Eigen::Matrix4Xd *  directions,
std::vector< bool > *  success 
) const
pure virtual

Back-project 2d image points into homogeneous points (direction vectors).

Parameters
[in]imagePointsThe image points (one point per column).
[out]directionsThe homogeneous points as direction vectors (one point per column).
[out]successSuccess of each of the back-projection

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

Eigen::Vector2d okvis::cameras::CameraBase::createRandomImagePoint ( ) const
virtual

Creates a random (uniform distribution) image point.

Returns
A random image point.
Eigen::Vector4d okvis::cameras::CameraBase::createRandomVisibleHomogeneousPoint ( double  minDist = 0.0,
double  maxDist = 10.0 
) const
virtual

Creates a random visible point in homogeneous coordinates.

Parameters
[in]minDistThe minimal distance of this point.
[in]maxDistThe maximum distance of this point.
Returns
A random homogeneous point.
Eigen::Vector3d okvis::cameras::CameraBase::createRandomVisiblePoint ( double  minDist = 0.0,
double  maxDist = 10.0 
) const
virtual

Creates a random visible point in Euclidean coordinates.

Parameters
[in]minDistThe minimal distance of this point.
[in]maxDistThe maximum distance of this point.
Returns
A random Euclidean point.
virtual const std::string okvis::cameras::CameraBase::distortionType ( ) const
pure virtual

Obtain the projection type.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual void okvis::cameras::CameraBase::getIntrinsics ( Eigen::VectorXd &  intrinsics) const
pure virtual

obtain all intrinsics

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

bool okvis::cameras::CameraBase::hasMask ( ) const
inline

Was a nonzero mask set?

uint64_t okvis::cameras::CameraBase::id ( ) const
inline

Obtain the Id.

uint32_t okvis::cameras::CameraBase::imageHeight ( ) const
inline

The height of the image in pixels.

uint32_t okvis::cameras::CameraBase::imageWidth ( ) const
inline

The width of the image in pixels.

bool okvis::cameras::CameraBase::isInImage ( const Eigen::Vector2d &  imagePoint) const
inlineprotected

Check if the keypoint is in the image.

bool okvis::cameras::CameraBase::isMasked ( const Eigen::Vector2d &  imagePoint) const
inlineprotected

Check if the keypoint is masked.

const cv::Mat & okvis::cameras::CameraBase::mask ( ) const
inline

Get the mask.

virtual int okvis::cameras::CameraBase::noIntrinsicsParameters ( ) const
pure virtual

Obtain the number of intrinsics parameters.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual ProjectionStatus okvis::cameras::CameraBase::project ( const Eigen::Vector3d &  point,
Eigen::Vector2d *  imagePoint 
) const
pure virtual

Projects a Euclidean point to a 2d image point (projection). Uses projection including distortion models.

Parameters
[in]pointThe point in Euclidean coordinates.
[out]imagePointThe image point.
Returns
Get information about the success of the projection. See ProjectionStatus for more information.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual ProjectionStatus okvis::cameras::CameraBase::project ( const Eigen::Vector3d &  point,
Eigen::Vector2d *  imagePoint,
Eigen::Matrix< double, 2, 3 > *  pointJacobian,
Eigen::Matrix2Xd *  intrinsicsJacobian = NULL 
) const
pure virtual

Projects a Euclidean point to a 2d image point (projection). Uses projection including distortion models.

Parameters
[in]pointThe point in Euclidean coordinates.
[out]imagePointThe image point.
[out]pointJacobianThe Jacobian of the projection function w.r.t. the point..
[out]intrinsicsJacobianThe Jacobian of the projection function w.r.t. the intinsics.
Returns
Get information about the success of the projection. See ProjectionStatus for more information.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual void okvis::cameras::CameraBase::projectBatch ( const Eigen::Matrix3Xd &  points,
Eigen::Matrix2Xd *  imagePoints,
std::vector< ProjectionStatus > *  stati 
) const
pure virtual

Projects Euclidean points to 2d image points (projection) in a batch. Uses projection including distortion models.

Parameters
[in]pointsThe points in Euclidean coordinates (one point per column).
[out]imagePointsThe image points (one point per column).
[out]statiGet information about the success of the projections. See ProjectionStatus for more information.
virtual ProjectionStatus okvis::cameras::CameraBase::projectHomogeneous ( const Eigen::Vector4d &  point,
Eigen::Vector2d *  imagePoint 
) const
pure virtual

Projects a point in homogenous coordinates to a 2d image point (projection). Uses projection including distortion models.

Parameters
[in]pointThe point in Homogeneous coordinates.
[out]imagePointThe image point.
Returns
Get information about the success of the projection. See ProjectionStatus for more information.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual ProjectionStatus okvis::cameras::CameraBase::projectHomogeneous ( const Eigen::Vector4d &  point,
Eigen::Vector2d *  imagePoint,
Eigen::Matrix< double, 2, 4 > *  pointJacobian,
Eigen::Matrix2Xd *  intrinsicsJacobian = NULL 
) const
pure virtual

Projects a point in homogenous coordinates to a 2d image point (projection). Uses projection including distortion models.

Parameters
[in]pointThe point in Homogeneous coordinates.
[out]imagePointThe image point.
[out]pointJacobianThe Jacobian of the projection function w.r.t. the point.
[out]intrinsicsJacobianThe Jacobian of the projection function w.r.t. the intrinsics.
Returns
Get information about the success of the projection. See ProjectionStatus for more information.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual void okvis::cameras::CameraBase::projectHomogeneousBatch ( const Eigen::Matrix4Xd &  points,
Eigen::Matrix2Xd *  imagePoints,
std::vector< ProjectionStatus > *  stati 
) const
pure virtual

Projects points in homogenous coordinates to 2d image points (projection) in a batch. Uses projection including distortion models.

Parameters
[in]pointsThe points in homogeneous coordinates (one point per column).
[out]imagePointsThe image points (one point per column).
[out]statiGet information about the success of the projections. See ProjectionStatus for more information.
virtual ProjectionStatus okvis::cameras::CameraBase::projectHomogeneousWithExternalParameters ( const Eigen::Vector4d &  point,
const Eigen::VectorXd &  parameters,
Eigen::Vector2d *  imagePoint,
Eigen::Matrix< double, 2, 4 > *  pointJacobian = NULL,
Eigen::Matrix2Xd *  intrinsicsJacobian = NULL 
) const
pure virtual

Projects a point in homogenous coordinates to a 2d image point (projection). Uses projection including distortion models.

Parameters
[in]pointThe point in Homogeneous coordinates.
[in]parametersThe intrinsics.
[out]imagePointThe image point.
[out]pointJacobianThe Jacobian of the projection function w.r.t. the point.
[out]intrinsicsJacobianThe Jacobian of the projection function w.r.t. the intrinsics.
Returns
Get information about the success of the projection. See ProjectionStatus for more information.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

virtual ProjectionStatus okvis::cameras::CameraBase::projectWithExternalParameters ( const Eigen::Vector3d &  point,
const Eigen::VectorXd &  parameters,
Eigen::Vector2d *  imagePoint,
Eigen::Matrix< double, 2, 3 > *  pointJacobian = NULL,
Eigen::Matrix2Xd *  intrinsicsJacobian = NULL 
) const
pure virtual

Projects a Euclidean point to a 2d image point (projection). Uses projection including distortion models.

Parameters
[in]pointThe point in Euclidean coordinates.
[in]parametersThe intrinsics.
[out]imagePointThe image point.
[out]pointJacobianThe Jacobian of the projection function w.r.t. the point..
[out]intrinsicsJacobianThe Jacobian of the projection function w.r.t. the intinsics.
Returns
Get information about the success of the projection. See ProjectionStatus for more information.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

bool okvis::cameras::CameraBase::removeMask ( )
inline

stop masking

Was a nonzero mask set?

void okvis::cameras::CameraBase::setId ( uint64_t  id)
inline

Set an Id.

virtual bool okvis::cameras::CameraBase::setIntrinsics ( const Eigen::VectorXd &  intrinsics)
pure virtual

overwrite all intrinsics - use with caution !

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

bool okvis::cameras::CameraBase::setMask ( const cv::Mat &  mask)
inline

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.

Parameters
[in]maskThe actual mask.
Returns
True if the requirements were followed.
virtual std::string okvis::cameras::CameraBase::type ( ) const
pure virtual

Obtain the type.

Implemented in okvis::cameras::PinholeCamera< DISTORTION_T >.

Member Data Documentation

uint64_t okvis::cameras::CameraBase::id_
protected

an Id

int okvis::cameras::CameraBase::imageHeight_
protected

image height in pixels

int okvis::cameras::CameraBase::imageWidth_
protected

image width in pixels

cv::Mat okvis::cameras::CameraBase::mask_
protected

The mask – empty by default.


The documentation for this class was generated from the following files: