farm-ng-core
sophus::CameraModelT< TScalar, TDistortion, TProj > Class Template Reference

Camera model class template for pinhole-like camera projections. More...

#include <camera_model.h>

Public Types

using Distortion = TDistortion
 
using Proj = TProj
 
using PointCamera = Eigen::Matrix< TScalar, 3, 1 >
 
using PixelImage = Eigen::Matrix< TScalar, 2, 1 >
 
using ProjInCameraLifted = Eigen::Matrix< TScalar, 2, 1 >
 
using Params = Eigen::Matrix< TScalar, kNumParams, 1 >
 
using DistorationParams = Eigen::Matrix< TScalar, kNumDistortionParams, 1 >
 

Public Member Functions

 CameraModelT (ImageSize const &image_size, Params const &params)
 Constructs camera model from image size and set up parameters. More...
 
 CameraModelT ()
 
auto focalLength () const -> PixelImage
 Focal length. More...
 
void setFocalLength (PixelImage const &focal_length)
 Focal length. More...
 
auto principalPoint () const -> PixelImage
 
void setPrincipalPoint (PixelImage const &principal_point)
 Focal length. More...
 
auto distortionParams () const -> DistorationParams
 Returns distortion parameters by value. More...
 
auto params () -> Eigen::Matrix< TScalar, kNumParams, 1 > &
 Parameters mutator. More...
 
auto params () const -> Eigen::Matrix< TScalar, kNumParams, 1 > const &
 Parameters accessor. More...
 
auto subsampleDown () const -> CameraModelT
 Subsamples pixel down, factor of 0.5. More...
 
auto subsampleUp () const -> CameraModelT
 Subsamples pixel up, factor of 2.0. More...
 
auto binDown () const -> CameraModelT
 Bins pixel down, factor of 0.5. More...
 
auto binUp () const -> CameraModelT
 Bins pixel up, factor of 2.0. More...
 
auto scale (ImageSize const &image_size) const -> CameraModelT
 
auto roi (Eigen::Vector2i const &top_left, ImageSize roi_size) const -> CameraModelT
 Region of interest given top_left and `roi_size. More...
 
auto distort (ProjInCameraLifted const &point2_in_camera_lifted) const -> PixelImage
 Maps a 2-point in the z=1 plane of the camera to a pixel in the image. More...
 
auto dxDistort (PixelImage const &pixel_in_image) const -> Eigen::Matrix< TScalar, 2, 2 >
 
auto undistort (PixelImage const &pixel_in_image) const -> ProjInCameraLifted
 Maps a pixel in the image to a 2-point in the z=1 plane of the camera. More...
 
auto undistortTable () const -> MutImage< Eigen::Vector2f >
 
auto camProj (PointCamera const &point_in_camera) const -> PixelImage
 Projects 3-point in camera frame to a pixel in the image. More...
 
auto dxCamProjX (PointCamera const &point_in_camera) const -> Eigen::Matrix< TScalar, 2, 3 >
 
auto camUnproj (PixelImage const &pixel_in_image, double depth_z) const -> PointCamera
 Unprojects pixel in the image to point in camera frame. More...
 
auto data () -> TScalar *
 Raw data access. To be used in ceres optimization only. More...
 
auto imageSize () const -> ImageSize const &
 Accessor of image size. More...
 
auto contains (Eigen::Vector2i const &obs, int border=0) const -> bool
 Returns true if obs is within image. More...
 
auto contains (PixelImage const &obs, TScalar border=TScalar(0)) const -> bool
 Returns true if obs is within image. More...
 
template<typename TScalar2 >
auto cast () const -> CameraModelT< TScalar2, TDistortion, TProj >
 cast to different scalar type. More...
 

Static Public Member Functions

static auto fromData (TScalar const *const ptr) -> CameraModelT
 Returns camera model from raw data pointer. To be used within ceres optimization only. More...
 

Static Public Attributes

static constexpr int kNumDistortionParams = Distortion::kNumDistortionParams
 
static constexpr int kNumParams = Distortion::kNumParams
 
static constexpr const std::string_view kProjectionModel
 

Detailed Description

template<class TScalar, class TDistortion, class TProj = ProjectionZ1>
class sophus::CameraModelT< TScalar, TDistortion, TProj >

Camera model class template for pinhole-like camera projections.

Member Typedef Documentation

◆ DistorationParams

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
using sophus::CameraModelT< TScalar, TDistortion, TProj >::DistorationParams = Eigen::Matrix<TScalar, kNumDistortionParams, 1>

◆ Distortion

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
using sophus::CameraModelT< TScalar, TDistortion, TProj >::Distortion = TDistortion

◆ Params

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
using sophus::CameraModelT< TScalar, TDistortion, TProj >::Params = Eigen::Matrix<TScalar, kNumParams, 1>

◆ PixelImage

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
using sophus::CameraModelT< TScalar, TDistortion, TProj >::PixelImage = Eigen::Matrix<TScalar, 2, 1>

◆ PointCamera

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
using sophus::CameraModelT< TScalar, TDistortion, TProj >::PointCamera = Eigen::Matrix<TScalar, 3, 1>

◆ Proj

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
using sophus::CameraModelT< TScalar, TDistortion, TProj >::Proj = TProj

◆ ProjInCameraLifted

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
using sophus::CameraModelT< TScalar, TDistortion, TProj >::ProjInCameraLifted = Eigen::Matrix<TScalar, 2, 1>

Constructor & Destructor Documentation

◆ CameraModelT() [1/2]

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
sophus::CameraModelT< TScalar, TDistortion, TProj >::CameraModelT ( ImageSize const &  image_size,
Params const &  params 
)
inline

Constructs camera model from image size and set up parameters.

◆ CameraModelT() [2/2]

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
sophus::CameraModelT< TScalar, TDistortion, TProj >::CameraModelT ( )
inline

Member Function Documentation

◆ binDown()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::binDown ( ) const -> CameraModelT
inline

Bins pixel down, factor of 0.5.

See for details: https://docs.google.com/document/d/1xmhCMWklP2UoQMGaMqFnsoPWoeMvBfXN7S8-ie9k0UA/edit#heading=h.elfm6123mecj

If the original width [height] is odd, the new width [height] will be: (width+1)/2 [height+1)/2].

◆ binUp()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::binUp ( ) const -> CameraModelT
inline

◆ camProj()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::camProj ( PointCamera const &  point_in_camera) const -> PixelImage
inline

Projects 3-point in camera frame to a pixel in the image.

◆ camUnproj()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::camUnproj ( PixelImage const &  pixel_in_image,
double  depth_z 
) const -> PointCamera
inline

Unprojects pixel in the image to point in camera frame.

The point is projected onto the xy-plane at z = depth_z.

◆ cast()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
template<typename TScalar2 >
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::cast ( ) const -> CameraModelT<TScalar2, TDistortion, TProj>
inline

cast to different scalar type.

◆ contains() [1/2]

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::contains ( Eigen::Vector2i const &  obs,
int  border = 0 
) const -> bool
inline

Returns true if obs is within image.

Note: Positive border makes the image frame smaller.

◆ contains() [2/2]

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::contains ( PixelImage const &  obs,
TScalar  border = TScalar(0) 
) const -> bool
inline

Returns true if obs is within image.

Note: Positive border makes the image frame smaller.

◆ data()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::data ( ) -> TScalar*
inline

Raw data access. To be used in ceres optimization only.

◆ distort()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::distort ( ProjInCameraLifted const &  point2_in_camera_lifted) const -> PixelImage
inline

Maps a 2-point in the z=1 plane of the camera to a pixel in the image.

◆ distortionParams()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::distortionParams ( ) const -> DistorationParams
inline

Returns distortion parameters by value.

◆ dxCamProjX()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::dxCamProjX ( PointCamera const &  point_in_camera) const -> Eigen::Matrix<TScalar, 2, 3>
inline

◆ dxDistort()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::dxDistort ( PixelImage const &  pixel_in_image) const -> Eigen::Matrix<TScalar, 2, 2>
inline

◆ focalLength()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::focalLength ( ) const -> PixelImage
inline

Focal length.

◆ fromData()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
static auto sophus::CameraModelT< TScalar, TDistortion, TProj >::fromData ( TScalar const *const  ptr) -> CameraModelT
inlinestatic

Returns camera model from raw data pointer. To be used within ceres optimization only.

◆ imageSize()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::imageSize ( ) const -> ImageSize const&
inline

Accessor of image size.

◆ params() [1/2]

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::params ( ) -> Eigen::Matrix<TScalar, kNumParams, 1>&
inline

Parameters mutator.

◆ params() [2/2]

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::params ( ) const -> Eigen::Matrix<TScalar, kNumParams, 1> const&
inline

Parameters accessor.

◆ principalPoint()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::principalPoint ( ) const -> PixelImage
inline

◆ roi()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::roi ( Eigen::Vector2i const &  top_left,
ImageSize  roi_size 
) const -> CameraModelT
inline

Region of interest given top_left and `roi_size.

◆ scale()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::scale ( ImageSize const &  image_size) const -> CameraModelT
inline

◆ setFocalLength()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
void sophus::CameraModelT< TScalar, TDistortion, TProj >::setFocalLength ( PixelImage const &  focal_length)
inline

Focal length.

◆ setPrincipalPoint()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
void sophus::CameraModelT< TScalar, TDistortion, TProj >::setPrincipalPoint ( PixelImage const &  principal_point)
inline

Focal length.

◆ subsampleDown()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::subsampleDown ( ) const -> CameraModelT
inline

Subsamples pixel down, factor of 0.5.

See for details: https://docs.google.com/document/d/1xmhCMWklP2UoQMGaMqFnsoPWoeMvBfXN7S8-ie9k0UA/edit#heading=h.97r8rr8owwpc

If the original width [height] is odd, the new width [height] will be: (width+1)/2 [height+1)/2].

◆ subsampleUp()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::subsampleUp ( ) const -> CameraModelT
inline

◆ undistort()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::undistort ( PixelImage const &  pixel_in_image) const -> ProjInCameraLifted
inline

Maps a pixel in the image to a 2-point in the z=1 plane of the camera.

◆ undistortTable()

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
auto sophus::CameraModelT< TScalar, TDistortion, TProj >::undistortTable ( ) const -> MutImage<Eigen::Vector2f>
inline

Member Data Documentation

◆ kNumDistortionParams

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
constexpr int sophus::CameraModelT< TScalar, TDistortion, TProj >::kNumDistortionParams = Distortion::kNumDistortionParams
staticconstexpr

◆ kNumParams

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
constexpr int sophus::CameraModelT< TScalar, TDistortion, TProj >::kNumParams = Distortion::kNumParams
staticconstexpr

◆ kProjectionModel

template<class TScalar , class TDistortion , class TProj = ProjectionZ1>
constexpr const std::string_view sophus::CameraModelT< TScalar, TDistortion, TProj >::kProjectionModel
staticconstexpr
Initial value:
=
Distortion::kProjectionModel

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