SDK CV Utils

template<typename Projection>
class CameraGeometry : public Metavision::CameraGeometryBase<Projection::underlying_type>

Camera geometry’s implementation.

Template Parameters
  • Projection: The projection model used to map points

template<typename T>
class Metavision::CameraGeometryBase

Base class for camera geometries.

A camera geometry is a mathematic model allowing to map points from world to image plane and vice versa. As this class uses virtual methods, it was not possible to make them templated. Therefore, eigen has been used for the vector and matrices types because it allows to map other types without copies (i.e. by using a combination of Eigen::Map and Eigen::Ref).

Template Parameters
  • T: Either float or double

Public Functions

~CameraGeometryBase() = default

Default destructor.

std::unique_ptr<CameraGeometryBase<T>> clone() const = 0

Creates a deep copy of this instance.

Return

the new instance

const Vec2i &get_image_size() const = 0

Gets the sensor’s size.

T get_distance_to_image_plane() const = 0

Gets the distance between the camera’s optical center and the undistorted image plane.

void get_undist_norm_to_undist_img_transform(Mat3RMRef m) const = 0

Gets the transform that maps a point from the undistorted normalized image plane (i.e. Z = 1) into the undistorted image plane (row major mode matrix)

Parameters
  • [out] m: The transform

void get_undist_norm_to_undist_img_transform(Mat3CMRef m) const = 0

Gets the transform that maps a point from the undistorted normalized image plane (i.e. Z = 1) into the undistorted image plane (col major mode matrix)

Parameters
  • [out] m: The transform

void camera_to_img(Vec3RefConst pt_c, Vec2Ref pt_dist_img) const = 0

Maps a point from the camera’s coordinates system into the distorted image plane.

Parameters
  • [in] pt_c: The 3D point in the camera’s coordinates system

  • [out] pt_dist_img: The mapped point in the distorted image plane

void camera_to_undist_img(Vec3RefConst pt_c, Vec2Ref pt_undist_img) const = 0

Maps a point from the camera’s coordinates system into the undistorted image plane.

Parameters
  • [in] pt_c: The 3D point in the camera’s coordinates system

  • [out] pt_undist_img: The mapped point in the undistorted image plane

void undist_norm_to_undist_img(Vec2RefConst pt_undist_norm, Vec2Ref pt_undist_img) const = 0

Maps a point from the undistorted normalized image plane into the normalized image plane.

Parameters
  • [in] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] pt_undist_img: The mapped point in the undistorted image plane

void undist_img_to_undist_norm(Vec2RefConst pt_undist_img, Vec2Ref pt_undist_norm) const = 0

Maps a point from the undistorted image plane into the undistorted normalized image plane.

Parameters
  • [in] pt_undist_img: The point in the undistorted image plane

  • [out] pt_undist_norm: The mapped point in the undistorted normalized image plane

void undist_norm_to_img(Vec2RefConst pt_undist_norm, Vec2Ref pt_dist_img) const = 0

Maps a point from the undistorted normalized image plane into the distorted image plane.

Parameters
  • [in] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] pt_dist_img: The mapped point in the distorted image plane

void img_to_undist_norm(Vec2RefConst pt_dist_img, Vec2Ref pt_undist_norm) const = 0

Maps a point from the distorted image plane into the undistorted normalized image plane.

Parameters
  • [in] pt_dist_img: The point in the distorted image plane

  • [out] pt_undist_norm: The mapped point in the undistorted normalized image plane

void vector_undist_norm_to_img(Vec2RefConst ctr_undist_norm, Vec2RefConst vec_undist_norm, Vec2Ref ctr_dist_img, Vec2Ref vec_dist_img) const = 0

Maps a vector from the undistorted normalized image plane into the distorted image plane.

Parameters
  • [in] ctr_undist_norm: The vector’s starting point in the undistorted normalized image plane

  • [in] vec_undist_norm: The vector in the undistorted normalized image plane (the vector must be normalized)

  • [out] ctr_dist_img: The vector’s starting point in the distorted image plane

  • [out] vec_dist_img: The mapped vector in the distorted image plane (the output vector may not be normalized)

void vector_img_to_undist_norm(Vec2RefConst ctr_dist_img, Vec2RefConst vec_dist_img, Vec2Ref ctr_undist_norm, Vec2Ref vec_undist_norm) const = 0

Maps a vector from the distorted image plane into the undistorted normalized image plane.

Parameters
  • [in] ctr_dist_img: The vector’s starting point in the distorted image plane

  • [in] vec_dist_img: The vector in the distorted image plane (the vector must be normalized)

  • [out] ctr_undist_norm: The vector’s starting point in the undistorted normalized image plane

  • [out] vec_undist_norm: The vector in the undistorted normalized image plane (the output vector may not be normalized)

void get_undist_norm_to_img_jacobian(Vec2RefConst pt_undist_norm, Vec2Ref pt_dist_img, Mat2RMRef J) const = 0

Computes the distortion function’s jacobian (Row major mode matrix)

Parameters
  • [in] pt_undist_norm: The point in the undistorted normalized image plane at which the jacobian is computed

  • [out] pt_dist_img: The point in the distorted image plane

  • [out] J: The computed jacobian

void get_undist_norm_to_img_jacobian(Vec2RefConst pt_undist_norm, Vec2Ref pt_dist_img, Mat2CMRef J) const = 0

Computes the distortion function’s jacobian (Col major mode matrix)

Parameters
  • [in] pt_undist_norm: The point in the undistorted normalized image plane at which the jacobian is computed

  • [out] pt_dist_img: The point in the distorted image plane

  • [out] J: The computed jacobian

void get_img_to_undist_norm_jacobian(Vec2RefConst pt_dist_img, Vec2Ref pt_undist_norm, Mat2RMRef J) const = 0

Computes the undistortion function’s jacobian (Row major mode matrix)

Parameters
  • [in] pt_dist_img: The point in the distorted image plane at which the jacobian is computed

  • [out] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] J: The computed jacobian

void get_img_to_undist_norm_jacobian(Vec2RefConst pt_dist_img, Vec2Ref pt_undist_norm, Mat2CMRef J) const = 0

Computes the undistortion function’s jacobian (Col major mode matrix)

Parameters
  • [in] pt_dist_img: The point in the distorted image plane at which the jacobian is computed

  • [out] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] J: The computed jacobian

template<typename FloatType>
class Metavision::OcamModel

Class implementing the Scaramuzza’s fisheye camera model.

(“A Toolbox for Easily Calibrating Omnidirectional Cameras”). The projection and distortion are done simultaneously.

Template Parameters
  • FloatType: Either float or double.

Public Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW OcamModel(const Vec2i &img_size, const VecX &poly, const VecX &inv_poly, const Vec2 &center, const Mat2CM &affine_transform, FloatType zoom_factor = FloatType(1))

Builds a new OcamModel.

The intrinsics must correspond to a camera having:

  • its X axis pointing to the righ,

  • its Y axis pointing down, and

  • its Z axis pointing toward

    Parameters
    • [in] img_size: Sensor’s size

    • [in] poly: Polynom used to undistort coordinates

    • [in] inv_poly: Polynom used to distort coordinates

    • [in] center: Projection of the camera’s optical center in the image plane

    • [in] affine_transform: Transform that maps from the ideal sensor plane to the image plane

    • [in] zoom_factor: Scale factor indicating how the image appears once undistorted. The bigger is the factor, the smaller is the undistorted image (i.e. the more black areas in the image).

const Vec2i &get_image_size() const

Gets the sensor’s size.

FloatType get_distance_to_image_plane() const

Gets the distance between the camera’s optical center and the undistorted image plane.

template<typename M>
void get_undist_norm_to_undist_img_transform(M &m) const

Gets the transform that maps a point from the undistorted normalized image plane (i.e. Z = 1) into the undistorted image plane.

Template Parameters
  • M: The 3x3 matrix’s type used

Parameters
  • [out] m: The transform

template<typename V1, typename V2>
void camera_to_img(const V1 &pt_c, V2 &pt_dist_img) const

Maps a point from the camera’s coordinates system into the distorted image plane.

Template Parameters
  • V1: The 3D point’s type used

  • V2: The 2D point’s type used

Parameters
  • [in] pt_c: The 3D point in the camera’s coordinates system

  • [out] pt_dist_img: The mapped point in the distorted image plane

template<typename V1, typename V2>
void undist_norm_to_img(const V1 &pt_undist_norm, V2 &pt_dist_img) const

Maps a point from the undistorted normalized image plane into the distorted image plane.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

Parameters
  • [in] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] pt_dist_img: The mapped point in the distorted image plane

template<typename V1, typename V2>
void camera_to_undist_img(const V1 &pt_c, V2 &pt_undist_img) const

Maps a point from the camera’s coordinates system into the undistorted image plane.

Template Parameters
  • V1: The 3D point’s type used

  • V2: The 2D point’s type used

Parameters
  • [in] pt_c: The 3D point in the camera’s coordinates system

  • [out] pt_undist_img: The mapped point in the undistorted image plane

template<typename V1, typename V2>
void undist_norm_to_undist_img(const V1 &pt_undist_norm, V2 &pt_undist_img) const

Maps a point from the undistorted normalized image plane into the undistorted image plane.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

Parameters
  • [in] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] pt_undist_img: The mapped point in the undistorted image plane

template<typename V1, typename V2>
void undist_img_to_undist_norm(const V1 &pt_undist_img, V2 &pt_undist_norm) const

Maps a point from the undistorted image plane into the undistorted normalized image plane.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

Parameters
  • [in] pt_undist_img: The point in the undistorted image plane

  • [out] pt_undist_norm: The mapped point in the undistorted normalized image plane

template<typename V1, typename V2>
void img_to_undist_norm(const V1 &pt_dist_img, V2 &pt_undist_norm) const

Maps a point from the distorted image plane into the undistorted normalized image plane.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

Parameters
  • [in] pt_dist_img: The point in the distorted image plane

  • [out] pt_undist_norm: The mapped point in the undistorted normalized image plane

template<typename V1, typename V2, typename M>
void get_undist_norm_to_img_jacobian(const V1 &pt_undist_norm, V2 &pt_dist_img, M &J) const

Computes the distortion function’s jacobian.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

  • V3: The output 2x2 matrix’s type used

Parameters
  • [in] pt_undist_norm: The point in the undistorted normalized image plane at which the jacobian is computed

  • [out] pt_dist_img: The point in the distorted image plane

  • [out] J: The computed jacobian

template<typename V1, typename V2, typename M>
void get_img_to_undist_norm_jacobian(const V1 &pt_dist_img, V2 &pt_undist_norm, M &J) const

Computes the undistortion function’s jacobian.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

  • V3: The output 2x2 matrix’s type used

Parameters
  • [in] pt_dist_img: The point in the distorted image plane at which the jacobian is computed

  • [out] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] J: The computed jacobian

template<typename FloatType>
class Metavision::PinholeCameraModel

Class implementing the Pinhole camera model with radial and tangential distortion.

Template Parameters
  • FloatType: Either float or double

Public Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW PinholeCameraModel(int width, int height, const std::vector<FloatType> &K, const std::vector<FloatType> &D)

Builds a new PinholeCameraModel.

Parameters
  • [in] width: Sensor’s width

  • [in] height: Sensor’s height

  • [in] K: Camera’s intrinsics 3x3 matrix

  • [in] D: Camera’s distortion coefficients

const Vec2i &get_image_size() const

Gets the sensor’s size.

const Mat3 &K() const

Gets the camera’s intrinsics.

const Mat3 &Kinv() const

Gets the camera’s inverse intrinsics.

const Vec5 &D() const

Gets the camera’s distortion coefficients.

FloatType get_distance_to_image_plane() const

Gets the distance between the camera’s optical center and the undistorted image plane.

template<typename M>
void get_undist_norm_to_undist_img_transform(M &m) const

Gets the transform that maps a point from the undistorted normalized image plane (i.e. Z = 1) into the undistorted image plane.

Template Parameters
  • M: The 3x3 matrix’s type used

Parameters
  • [out] m: The transform

template<typename V1, typename V2>
void camera_to_img(const V1 &pt_c, V2 &pt_dist_img) const

Maps a point from the camera’s coordinates system into the distorted image plane.

Template Parameters
  • V1: The 3D point’s type used

  • V2: The 2D point’s type used

Parameters
  • [in] pt_c: The 3D point in the camera’s coordinates system

  • [out] pt_dist_img: The mapped point in the distorted image plane

template<typename V1, typename V2>
void undist_norm_to_img(const V1 &pt_undist_norm, V2 &pt_dist_img) const

Maps a point from the undistorted normalized image plane into the distorted image plane.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

Parameters
  • [in] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] pt_dist_img: The mapped point in the distorted image plane

template<typename V1, typename V2>
void camera_to_undist_img(const V1 &pt_c, V2 &pt_undist_img) const

Maps a point from the camera’s coordinates system into the undistorted image plane.

Template Parameters
  • V1: The 3D point’s type used

  • V2: The 2D point’s type used

Parameters
  • [in] pt_c: The 3D point in the camera’s coordinates system

  • [out] pt_undist_img: The mapped point in the undistorted image plane

template<typename V1, typename V2>
void undist_norm_to_undist_img(const V1 &pt_undist_norm, V2 &pt_undist_img) const

Maps a point from the undistorted normalized image plane into the undistorted image plane.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

Parameters
  • [in] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] pt_undist_img: The mapped point in the undistorted image plane

template<typename V1, typename V2>
void undist_img_to_undist_norm(const V1 &pt_undist_img, V2 &pt_undist_norm) const

Maps a point from the undistorted image plane into the undistorted normalized image plane.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

Parameters
  • [in] pt_undist_img: The point in the undistorted image plane

  • [out] pt_undist_norm: The mapped point in the undistorted normalized image plane

template<typename V1, typename V2>
void img_to_undist_norm(const V1 &pt_dist_img, V2 &pt_undist_norm) const

Maps a point from the distorted image plane into the undistorted normalized image plane.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

Parameters
  • [in] pt_dist_img: The point in the distorted image plane

  • [out] pt_undist_norm: The mapped point in the undistorted normalized image plane

template<typename V1, typename V2, typename M>
void get_undist_norm_to_img_jacobian(const V1 &pt_undist_norm, V2 &pt_dist_img, M &J) const

Computes the distortion function’s jacobian.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

  • V3: The output 2x2 matrix’s type used

Parameters
  • [in] pt_undist_norm: The point in the undistorted normalized image plane at which the jacobian is computed

  • [out] pt_dist_img: The point in the distorted image plane

  • [out] J: The computed jacobian

template<typename V1, typename V2, typename M>
void get_img_to_undist_norm_jacobian(const V1 &pt_dist_img, V2 &pt_undist_norm, M &J) const

Computes the undistortion function’s jacobian.

Template Parameters
  • V1: The input 2D point’s type used

  • V2: The output 2D point’s type used

  • V3: The output 2x2 matrix’s type used

Parameters
  • [in] pt_dist_img: The point in the distorted image plane at which the jacobian is computed

  • [out] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] J: The computed jacobian

template<typename T, typename Ti, typename To>
void Metavision::undist_norm_to_camera(const Ti &pt_norm, To &pt_c, T depth)

Maps a point from the undistorted normalized image plane into the camera’s coordinates system.

Template Parameters
  • T: The floating point type used

  • Ti: The input 2D point type used

  • To: The output 3D point type used

Parameters
  • [in] pt_norm: The point in the undistorted normalized image plane

  • [out] pt_c: The point in the camera’s coordinates system

  • [in] depth: The depth of the point in the camera’s coordinates system

template<typename Ti, typename To>
bool Metavision::camera_to_undist_norm(const Ti &pt3_cam, To &pt2_norm, double epsilonz = 1e-10)

Maps a 3D point from the camera’s coordinates system into the undistorted normalized image plane.

Return

True if the point has been successfully mapped, False otherwise

Template Parameters
  • Ti: The input 3D point type used

  • To: The output 2D point type used

Parameters
  • [in] pt3_cam: The 3D point expressed in the camera’s coordinate system

  • [out] pt2_norm: The point in the undistorted normalized image plane

  • [in] epsilonz: The point’s depth in the camera’s coordinate system should be greater than this value

template<typename Ti, typename To>
bool Metavision::vec_camera_to_undist_norm(const Ti &v3_cam, const Ti &pt3_cam, To &v2_norm, double epsilonz = 1e-10, double epsilon = 1e-10, bool normalize = true)

Maps a 3D vector from the camera’s coordinates system into the undistorted normalized image plane.

Return

True if the vector has been successfully mapped and normalized, False otherwise

Template Parameters
  • Ti: The input 3D vector type used

  • To: The output 2D vector type used

Parameters
  • [in] v3_cam: The 3D vector in the camera’s coordinates system

  • [in] pt3_cam: The vector’s starting point in the camera’s coordinates system

  • [out] v2_norm: The vector in the undistorted normalized image plane

  • [in] epsilonz: The starting point’s depth in the camera’s coordinates system should be greater than this value

  • [in] epsilon: To be normalized, the output vector’s norm should be greater than eps

  • [in] normalize: If True the output vector is normalized

template<typename T, typename To>
void Metavision::get_undist_norm_to_undist_img_transform(const CameraGeometryBase<T> &camera_geometry, To &m)

Gets the transform that maps a point from the undistorted normalized image plane (i.e. Z = 1) into the undistorted image plane.

Template Parameters
  • T: The floating point type used

  • To: The 3x3 matrix type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [out] m: The transform

template<typename T, typename T1, typename T2>
void Metavision::camera_to_img(const CameraGeometryBase<T> &camera_geometry, const T1 &pt_c, T2 &pt_dist_img)

Maps a point from the camera’s coordinates system into the distorted image plane.

Template Parameters
  • T: The floating point type used

  • T1: The 3D point type used

  • T2: The 2D point type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [in] pt_c: The 3D point in the camera’s coordinates system

  • [out] pt_dist_img: The mapped point in the distorted image plane

template<typename T, typename T1, typename T2>
bool Metavision::safe_camera_to_img(const CameraGeometryBase<T> &camera_geometry, const T1 &pt_c, T2 &pt_dist_img, T epsilonz = T(1e-10))

Maps a point from the camera’s coordinates system into the distorted image plane.

Return

True if the point has been successfully mapped, False otherwise

Template Parameters
  • T: The floating point type used

  • T1: The 3D point type used

  • T2: The 2D point type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [in] pt_c: The 3D point in the camera’s coordinates system

  • [out] pt_dist_img: The mapped point in the distorted image plane

  • [in] epsilonz: To be mapped, the point’s depth in the camera’s coordinates system must less than this value

template<typename T, typename T1, typename T2>
void Metavision::camera_to_undist_img(const CameraGeometryBase<T> &camera_geometry, const T1 &pt_c, T2 &pt_undist_img)

Maps a point from the camera’s coordinates system into the undistorted image plane.

Template Parameters
  • T: The floating point type used

  • T1: The 3D point type used

  • T2: The 2D point type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [in] pt_c: The 3D point in the camera’s coordinates system

  • [out] pt_undist_img: The mapped point in the undistorted image plane

template<typename T, typename T1, typename T2>
void Metavision::undist_norm_to_undist_img(const CameraGeometryBase<T> &camera_geometry, const T1 &pt_undist_norm, T2 &pt_undist_img)

Maps a point from the undistorted normalized image plane into the undistorted image plane.

Template Parameters
  • T: The floating point type used

  • T1: The input 2D point type used

  • T2: The output 2D point type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [in] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] pt_undist_img: The mapped point in the undistorted image plane

template<typename T, typename T1, typename T2>
void Metavision::undist_img_to_undist_norm(const CameraGeometryBase<T> &camera_geometry, const T1 &pt_undist_img, T2 &pt_undist_norm)

Maps a point from the undistorted image plane into the undistorted normalized image plane.

Template Parameters
  • T: The floating point type used

  • T1: The input 2D point type used

  • T2: The output 2D point type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [in] pt_undist_img: The point in the undistorted image plane

  • [out] pt_undist_norm: The mapped point in the undistorted normalized image plane

template<typename T, typename T1, typename T2>
void Metavision::undist_norm_to_img(const CameraGeometryBase<T> &camera_geometry, const T1 &pt_undist_norm, T2 &pt_dist_img)

Maps a point from the undistorted normalized image plane into the distorted image plane.

Template Parameters
  • T: The floating point type used

  • T1: The input 2D point type used

  • T2: The output 2D point type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [in] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] pt_dist_img: The mapped point in the distorted image plane

template<typename T, typename T1, typename T2>
void Metavision::img_to_undist_norm(const CameraGeometryBase<T> &camera_geometry, const T1 &pt_dist_img, T2 &pt_undist_norm)

Maps a point from the distorted image plane into the undistorted normalized image plane.

Template Parameters
  • T: The floating point type used

  • T1: The input 2D point type used

  • T2: The output 2D point type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [in] pt_dist_img: The point in the distorted image plane

  • [out] pt_undist_norm: The mapped point in the undistorted normalized image plane

template<typename T, typename T1, typename T2, typename T3, typename T4>
void Metavision::vector_undist_norm_to_img(const CameraGeometryBase<T> &camera_geometry, const T1 &ctr_undist_norm, const T2 &vec_undist_norm, T3 &ctr_dist_img, T4 &vec_dist_img)

Maps a vector from the undistorted normalized image plane into the distorted image plane.

Template Parameters
  • T: The floating point type used

  • T1: The input 2D point type used

  • T2: The input 2D vector type used

  • T3: The output 2D point type used

  • T4: The output 2D vector type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the vector

  • [in] ctr_undist_norm: The vector’s starting point in the undistorted normalized image plane

  • [in] vec_undist_norm: The vector in the undistorted normalized image plane (the vector must be normalized)

  • [out] ctr_dist_img: The vector’s starting point in the distorted image plane

  • [out] vec_dist_img: The mapped vector in the distorted image plane (the output vector may not be normalized)

template<typename T, typename T1, typename T2, typename T3, typename T4>
void Metavision::vector_img_to_undist_norm(const CameraGeometryBase<T> &camera_geometry, const T1 &ctr_dist_img, const T2 &vec_dist_img, T3 &ctr_undist_norm, T4 &vec_undist_norm)

Maps a vector from the distorted image plane into the undistorted normalized image plane.

Template Parameters
  • T: The floating point type used

  • T1: The input 2D point type used

  • T2: The input 2D vector type used

  • T3: The output 2D point type used

  • T4: The output 2D vector type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the vector

  • [in] ctr_dist_img: The vector’s starting point in the distorted image plane

  • [in] vec_dist_img: The vector in the distorted image plane (the vector must be normalized)

  • [out] ctr_undist_norm: The vector’s starting point in the undistorted normalized image plane

  • [out] vec_undist_norm: The vector in the undistorted normalized image plane (the output vector may not be normalized)

template<typename T, typename T1, typename T2, typename T3>
void Metavision::get_undist_norm_to_img_jacobian(const CameraGeometryBase<T> &camera_geometry, const T1 &pt_undist_norm, T2 &pt_dist_img, T3 &J)

Computes the distortion function’s jacobian.

Template Parameters
  • T: The floating point type used

  • T1: The input 2D point type used

  • T2: The output 2D point type used

  • T3: The output 2x2 matrix type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [in] pt_undist_norm: The point in the undistorted normalized image plane at which the jacobian is computed

  • [out] pt_dist_img: The point in the distorted image plane

  • [out] J: The computed jacobian

template<typename T, typename T1, typename T2, typename T3>
void Metavision::get_img_to_undist_norm_jacobian(const CameraGeometryBase<T> &camera_geometry, const T1 &pt_dist_img, T2 &pt_undist_norm, T3 &J)

Computes the undistortion function’s jacobian.

Template Parameters
  • T: The floating point type used

  • T1: The input 2D point type used

  • T2: The output 2D point type used

  • T3: The output 2x2 matrix type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [in] pt_dist_img: The point in the distorted image plane at which the jacobian is computed

  • [out] pt_undist_norm: The point in the undistorted normalized image plane

  • [out] J: The computed jacobian

template<typename T, typename T1>
void Metavision::get_distortion_maps(const CameraGeometryBase<T> &camera_geometry, T1 &mapx, T1 &mapy)

Computes the distortion maps which are LUT used to distort coordinates.

The LUT are NxM matrices where NxM is the sensor’s resolution. The LUT must be allocated before calling this function.

Warning

: Such maps are used with cv::remap to undistort an image.

Template Parameters
  • T: The floating point type used

  • T1: The output matrix type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [out] mapx: LUT giving the distorted x coordinate of the input undistorted point (integer coordinates)

  • [out] mapy: LUT giving the distorted y coordinate of the input undistorted point (integer coordinates)

template<typename T, typename T1>
void Metavision::get_undistortion_maps(const CameraGeometryBase<T> &camera_geometry, T1 &mapx, T1 &mapy)

Computes the undistortion maps which are LUT used to undistort coordinates.

The LUT are NxM matrices where NxM is the sensor’s resolution. The LUT must be allocated before calling this function.

Warning

: Such maps are used with cv::remap to distort an image.

Template Parameters
  • T: The floating point type used

  • T1: The output matrix type used

Parameters
  • [in] camera_geometry: The CameraGeometryBase instance used to map the point

  • [out] mapx: LUT giving the undistorted x coordinate of the input distorted point (integer coordinates)

  • [out] mapy: LUT giving the undistorted y coordinate of the input distorted point (integer coordinates)