Class Distortion

Inheritance Relationships

Derived Types

Class Documentation

class aslam::Distortion

This class represents a standard implementation of the distortion block.

The function “distort” applies this nonlinear transformation. The function “undistort” applies the inverse transformation.

Subclassed by aslam::Cloneable< Distortion, EquidistantDistortion >, aslam::Cloneable< Distortion, FisheyeDistortion >, aslam::Cloneable< Distortion, NullDistortion >, aslam::Cloneable< Distortion, RadTanDistortion >

Constructors/destructors and operators

inline virtual ~Distortion()
virtual bool operator==(const Distortion &rhs) const

Checks for same distortion type and same parameters.

Returns

Same distortion?

virtual aslam::Distortion *clone() const = 0

Clones the camera instance and returns a pointer to the copy.

Distortion() = delete
Distortion(const Eigen::VectorXd &dist_coeffs, Type distortion_type)

Distortion base constructor.

Parameters
  • dist_coeffs[in] Vector containing the distortion parameters.

  • distortion_type[in] DistortionType enum value with information which distortion model is used by the derived class.

Distortion(const Distortion&) = default

Copy constructor for clone operation.

void operator=(const Distortion&) = delete
friend friend std::ostream & operator<< (std::ostream &out, const Distortion &distortion)

Convenience function to print the state using streams.

Distort methods: applies the distortion model to a point.

void distort(Eigen::Vector2d *point) const

Apply distortion to a point in the normalized image plane.

Parameters

point[inout] The point in the normalized image plane. After the function, this point is distorted.

void distort(const Eigen::Vector2d &point, Eigen::Vector2d *out_point) const

Apply distortion to a point in the normalized image plane.

Parameters
  • point[in] The point in the normalized image plane.

  • out_point[out] The distorted point.

void distort(Eigen::Vector2d *point, Eigen::Matrix2d *out_jacobian) const

Apply distortion to a point in the normalized image plane.

Parameters
  • point[inout] The point in the normalized image plane. After the function, this point is distorted.

  • out_jacobian[out] The Jacobian of the distortion function with respect to small changes in the input point.

virtual void distortUsingExternalCoefficients(const Eigen::VectorXd *dist_coeffs, Eigen::Vector2d *point, Eigen::Matrix2d *out_jacobian) const = 0

Apply distortion to a point in the normalized image plane using provided distortion coefficients.

External distortion coefficients can be specified using this function. (Ignores the internally stored parameters.

Parameters
  • dist_coeffs[in] Vector containing the coefficients for the distortion model. NOTE: If nullptr, use internal distortion parameters.

  • point[inout] The point in the normalized image plane. After the function, this point is distorted.

  • out_jacobian[out] The Jacobian of the distortion function with respect to small changes in the input point. If NULL is passed, the Jacobian calculation is skipped.

virtual void distortParameterJacobian(const Eigen::VectorXd *dist_coeffs, const Eigen::Vector2d &point, Eigen::Matrix<double, 2, Eigen::Dynamic> *out_jacobian) const = 0

Apply distortion to the point and provide the Jacobian of the distortion with respect to small changes in the distortion parameters.

Parameters
  • dist_coeffs[in] Vector containing the coefficients for the distortion model. NOTE: If nullptr, use internal distortion parameters.

  • point[in] The point in the normalized image plane.

  • out_jacobian[out] The Jacobian of the distortion with respect to small changes in the distortion parameters.

Undistort methods: Removes the modeled distortion effects from a point.

void undistort(Eigen::Vector2d *point) const

Apply undistortion to recover a point in the normalized image plane.

Parameters

point[inout] The distorted point. After the function, this point is in the normalized image plane.

void undistort(const Eigen::Vector2d &point, Eigen::Vector2d *out_point) const

Apply undistortion to recover a point in the normalized image plane.

Parameters
  • point[in] External distortion coefficients to use.

  • out_point[out] The undistorted point in normalized image plane.

virtual void undistortUsingExternalCoefficients(const Eigen::VectorXd &dist_coeffs, Eigen::Vector2d *point) const = 0

Apply undistortion to recover a point in the normalized image plane using provided distortion coefficients.

External distortion coefficients can be specified using this function. Ignores the internally stored parameters.

Parameters
  • dist_coeffs[in] Vector containing the coefficients for the distortion model.

  • point[inout] The distorted point. After the function, this point is in the normalized image plane.

Methods to set/get distortion parameters.

void setParameters(const Eigen::VectorXd &dist_coeffs)

Set the coefficients for the distortion model.

Parameters

dist_coeffs[in] Vector containing the coefficients.

inline const Eigen::VectorXd &getParameters() const

Get the distortion model coefficients.

Returns

Vector containing the coefficients.

inline double *getParametersMutable()

Get the pointer to the distortion model coefficients.

Returns

Pointer to the first coefficient.

virtual int getParameterSize() const = 0

Returns the number of parameters used in the distortion model.

NOTE: Use the constexpr function parameterCount if you know the exact distortion type.

virtual bool distortionParametersValid(const Eigen::VectorXd &dist_coeffs) const = 0

Check the validity of distortion parameters.

Parameters

dist_coeffs[in] Vector containing the coefficients. Parameters will NOT be stored.

Returns

If the distortion parameters are valid.

virtual void printParameters(std::ostream &out, const std::string &text) const = 0

Print the internal parameters of the distortion 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.

inline Type getType() const

Returns type of the distortion model.

Returns

DistortionType value representing the distortion model used by the derived class.

Public Types

enum [anonymous]

Values:

enumerator CLASS_SERIALIZATION_VERSION
enum Type

Values:

enumerator kNoDistortion
enumerator kEquidistant
enumerator kFisheye
enumerator kRadTan

Public Functions

ASLAM_POINTER_TYPEDEFS(Distortion)

Protected Attributes

Eigen::VectorXd distortion_coefficients_

Parameter vector for the distortion model.

Type distortion_type_

Enum field to store the type of distortion model.