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 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
intrinsics – [in] vector containing the intrinsic parameters (xi,fu,fv,cu.cv)
image_height – [in] image height in pixels
distortion – [in] pointer to the distortion model
-
UnifiedProjectionCamera(const Eigen::VectorXd &intrinsics, uint32_t image_width, uint32_t image_height)¶
Construct a camera without distortion.
- Parameters
intrinsics – [in] vector containing the intrinsic parameters (xi,fu,fv,cu.cv)
image_width – [in] image width in pixels
image_height – [in] 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
xi – [in] mirror parameter
focallength_cols – [in] focal length in pixels; cols (width-direction)
focallength_rows – [in] focal length in pixels; rows (height-direction)
imagecenter_cols – [in] image center in pixels; cols (width-direction)
imagecenter_rows – [in] image center in pixels; rows (height-direction)
image_width – [in] image width in pixels
image_height – [in] image height in pixels
distortion – [in] 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
xi – [in] mirror parameter
focallength_cols – [in] focal length in pixels; cols (width-direction)
focallength_rows – [in] focal length in pixels; rows (height-direction)
imagecenter_cols – [in] image center in pixels; cols (width-direction)
imagecenter_rows – [in] image center in pixels; rows (height-direction)
image_width – [in] image width in pixels
image_height – [in] 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
keypoint – [in] Keypoint in image coordinates.
out_point_3d – [out] 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.
- Parameters
keypoint – [in] Keypoint in image coordinates.
point_3d – [in] Projected point in euclidean.
- Returns
The ProjectionResult object contains details about the success of the projection.
-
bool isUndistortedKeypointValid(const double &rho2_d, const double &xi) const¶
Checks whether an undistorted keypoint lies in the valid range.
- Parameters
keypoint – [in] Squared norm of the normalized undistorted keypoint.
xi – [in] Mirror parameter
-
bool isLiftable(const Eigen::Ref<const Eigen::Vector2d> &keypoint) const¶
Checks whether a keypoint is liftable to the unit sphere.
- Parameters
keypoint – [in] 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.
- Parameters
point_3d – [in] The point in euclidean coordinates.
intrinsics_external – [in] External intrinsic parameter vector. NOTE: If nullptr, use internal distortion parameters.
distortion_coefficients_external – [in] External distortion parameter vector. Parameter is ignored is no distortion is active. NOTE: If nullptr, use internal distortion parameters.
out_keypoint – [out] The keypoint in image coordinates.
out_jacobian_point – [out] The Jacobian wrt. to changes in the euclidean point. nullptr: calculation is skipped.
out_jacobian_intrinsics – [out] The Jacobian wrt. to changes in the intrinsics. nullptr: calculation is skipped.
out_jacobian_distortion – [out] The Jacobian wrt. to changes in the distortion parameters. nullptr: calculation is skipped.
- Returns
Contains information about the success of the projection. Check ProjectionResult for more information.
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::Ptr createTestCamera()¶ Create a test camera object for unit testing.
-
template<typename DistortionType>
static inline UnifiedProjectionCamera::UniquePtr createTestCameraUnique()¶ Create a test camera object for unit testing.
-
static UnifiedProjectionCamera::Ptr createTestCamera()¶
Create a test camera object for unit testing. (without distortion)
-
friend std::ostream &operator<<(std::ostream &out, const UnifiedProjectionCamera &camera)¶