Class UnifiedProjectionCamera¶
Defined in File camera-unified-projection.h
Inheritance Relationships¶
Base Type¶
public aslam::Cloneable< Camera, UnifiedProjectionCamera >
(Template Class Cloneable)
Class Documentation¶
-
class
aslam
::
UnifiedProjectionCamera
: public aslam::Cloneable<Camera, UnifiedProjectionCamera>¶ An implementation of the unified projection camera model with (optional) distortion.
Intrinsic parameters ordering: xi, fu, fv, cu, cv
Reference: (1) C. Geyer and K. Daniilidis. A unifying theory for central panoramic systems and practical implications. In ECCV, pages 445461, 2000. (http://www.frc.ri.cmu.edu/users/cgeyer/papers/geyer_eccv00.pdf) (2) Joao P. Barreto and Helder Araujo. Issues on the geometry of central catadioptric image formation. In CVPR, volume 2, pages 422427, 2001. (http://home.isr.uc.pt/~jpbar/Publication_Source/cvpr2001.pdf)
Constructors/destructors and operators
-
friend friend std::ostream & operator<< (std::ostream &out, const UnifiedProjectionCamera &camera)
Convenience function to print the state using streams.
-
UnifiedProjectionCamera
()¶ Empty constructor for serialization interface.
-
UnifiedProjectionCamera
(const UnifiedProjectionCamera &other) = default¶ Copy constructor for clone operation.
-
void
operator=
(const UnifiedProjectionCamera&) = delete¶
-
UnifiedProjectionCamera
(const Eigen::VectorXd &intrinsics, uint32_t image_width, uint32_t image_height, aslam::Distortion::UniquePtr &distortion)¶ Construct a camera with distortion.
- Parameters
[in] intrinsics
: vector containing the intrinsic parameters (xi,fu,fv,cu.cv)[in] image_height
: image height in pixels[in] distortion
: pointer to the distortion model
-
UnifiedProjectionCamera
(const Eigen::VectorXd &intrinsics, uint32_t image_width, uint32_t image_height)¶ Construct a camera without distortion.
- Parameters
[in] intrinsics
: vector containing the intrinsic parameters (xi,fu,fv,cu.cv)[in] image_width
: image width in pixels[in] image_height
: image height in pixels
-
UnifiedProjectionCamera
(double xi, double focallength_cols, double focallength_rows, double imagecenter_cols, double imagecenter_rows, uint32_t image_width, uint32_t image_height, aslam::Distortion::UniquePtr &distortion)¶ Construct a camera with distortion.
- Parameters
[in] xi
: mirror parameter[in] focallength_cols
: focal length in pixels; cols (width-direction)[in] focallength_rows
: focal length in pixels; rows (height-direction)[in] imagecenter_cols
: image center in pixels; cols (width-direction)[in] imagecenter_rows
: image center in pixels; rows (height-direction)[in] image_width
: image width in pixels[in] image_height
: image height in pixels[in] distortion
: pointer to the distortion model
-
UnifiedProjectionCamera
(double xi, double focallength_cols, double focallength_rows, double imagecenter_cols, double imagecenter_rows, uint32_t image_width, uint32_t image_height)¶ Construct a camera without distortion.
- Parameters
[in] xi
: mirror parameter[in] focallength_cols
: focal length in pixels; cols (width-direction)[in] focallength_rows
: focal length in pixels; rows (height-direction)[in] imagecenter_cols
: image center in pixels; cols (width-direction)[in] imagecenter_rows
: image center in pixels; rows (height-direction)[in] image_width
: image width in pixels[in] image_height
: image height in pixels
-
inline virtual
~UnifiedProjectionCamera
()¶
Methods to project and back-project euclidean points
-
virtual bool
backProject3
(const Eigen::Ref<const Eigen::Vector2d> &keypoint, Eigen::Vector3d *out_point_3d) const¶ Compute the 3d bearing vector in euclidean coordinates given a keypoint in image coordinates.
Uses the projection (& distortion) models. The result might be in normalized image plane for some camera implementations but not for the general case.
- Parameters
[in] keypoint
: Keypoint in image coordinates.[out] out_point_3d
: Bearing vector in euclidean coordinates
-
const ProjectionResult
evaluateProjectionResult
(const Eigen::Ref<const Eigen::Vector2d> &keypoint, const Eigen::Vector3d &point_3d) const¶ Checks the success of a projection operation and returns the result in a ProjectionResult object.
- Return
The ProjectionResult object contains details about the success of the projection.
- Parameters
[in] keypoint
: Keypoint in image coordinates.[in] point_3d
: Projected point in euclidean.
-
bool
isUndistortedKeypointValid
(const double &rho2_d, const double &xi) const¶ Checks whether an undistorted keypoint lies in the valid range.
- Parameters
[in] keypoint
: Squared norm of the normalized undistorted keypoint.[in] xi
: Mirror parameter
-
bool
isLiftable
(const Eigen::Ref<const Eigen::Vector2d> &keypoint) const¶ Checks whether a keypoint is liftable to the unit sphere.
- Parameters
[in] keypoint
: Keypoint in image coordinates.
Functional methods to project and back-project points
-
virtual const ProjectionResult
project3Functional
(const Eigen::Ref<const Eigen::Vector3d> &point_3d, const Eigen::VectorXd *intrinsics_external, const Eigen::VectorXd *distortion_coefficients_external, Eigen::Vector2d *out_keypoint, Eigen::Matrix<double, 2, 3> *out_jacobian_point, Eigen::Matrix<double, 2, Eigen::Dynamic> *out_jacobian_intrinsics, Eigen::Matrix<double, 2, Eigen::Dynamic> *out_jacobian_distortion) const¶ This function projects a point into the image using the intrinsic parameters that are passed in as arguments.
If any of the Jacobians are nonnull, they should be filled in with the Jacobian with respect to small changes in the argument.
- Return
Contains information about the success of the projection. Check ProjectionResult for more information.
- Parameters
[in] point_3d
: The point in euclidean coordinates.[in] intrinsics_external
: External intrinsic parameter vector. NOTE: If nullptr, use internal distortion parameters.[in] distortion_coefficients_external
: External distortion parameter vector. Parameter is ignored is no distortion is active. NOTE: If nullptr, use internal distortion parameters.[out] out_keypoint
: The keypoint in image coordinates.[out] out_jacobian_point
: The Jacobian wrt. to changes in the euclidean point. nullptr: calculation is skipped.[out] out_jacobian_intrinsics
: The Jacobian wrt. to changes in the intrinsics. nullptr: calculation is skipped.[out] out_jacobian_distortion
: The Jacobian wrt. to changes in the distortion parameters. nullptr: calculation is skipped.
Methods to support unit testing.
-
virtual Eigen::Vector2d
createRandomKeypoint
() const¶ Creates a random valid keypoint..
-
virtual Eigen::Vector3d
createRandomVisiblePoint
(double depth) const¶ Creates a random visible point.
Negative depth means random between 0 and 100 meters.
Methods to access intrinsics.
-
inline Eigen::Matrix3d
getCameraMatrix
() const¶ Returns the camera matrix for the projection.
-
inline double
xi
() const¶ The horizontal focal length in pixels.
-
inline double
fu
() const¶ The horizontal focal length in pixels.
-
inline double
fv
() const¶ The vertical focal length in pixels.
-
inline double
cu
() const¶ The horizontal image center in pixels.
-
inline double
cv
() const¶ The vertical image center in pixels.
-
inline double
fov_parameter
(double xi) const¶ Returns the fov parameter.
-
virtual bool
intrinsicsValid
(const Eigen::VectorXd &intrinsics) const¶ Function to check wheter the given intrinic parameters are valid for this model.
-
inline virtual int
getParameterSize
() const¶ The number of intrinsic parameters.
-
virtual void
printParameters
(std::ostream &out, const std::string &text) const¶ Print the internal parameters of the camera in a human-readable form Print to the ostream that is passed in.
The text is extra text used by the calling function to distinguish cameras
-
static inline constexpr int
parameterCount
()¶ Returns the number of intrinsic parameters used in this camera model.
-
static bool
areParametersValid
(const Eigen::VectorXd ¶meters)¶ Static function that checks whether the given intrinsic parameters are valid for this model.
Public Types
Public Functions
-
ASLAM_POINTER_TYPEDEFS
(UnifiedProjectionCamera)¶
Public Static Functions
-
template<typename
DistortionType
>
static inline UnifiedProjectionCamera::PtrcreateTestCamera
()¶ Create a test camera object for unit testing.
-
template<typename
DistortionType
>
static inline UnifiedProjectionCamera::UniquePtrcreateTestCameraUnique
()¶ Create a test camera object for unit testing.
-
static UnifiedProjectionCamera::Ptr
createTestCamera
()¶ Create a test camera object for unit testing. (without distortion)
-