farm-ng-core
sophus::CameraModel Class Reference

Concrete camera model class. More...

#include <camera_model.h>

Public Member Functions

 CameraModel ()
 
template<class TTransformModelT >
 CameraModel (TTransformModelT model)
 Constructs camera model from frame_name and concrete projection model. More...
 
 CameraModel (ImageSize image_size, CameraDistortionType projection_type, Eigen::VectorXd const &params)
 Constructs camera model from frame_name, image_size, projection_type flag and params vector. More...
 
auto isEmpty () const -> bool
 Returns true if this camera remains default-initialized with zero image dimensions. More...
 
auto distortionModelName () const -> std::string_view
 Returns name of the camera distortion model. More...
 
auto modelVariant () -> CameraDistortionVariant &
 Distortion variant mutator. More...
 
auto modelVariant () const -> CameraDistortionVariant const &
 Distortion variant accessor. More...
 
auto distortionType () const -> CameraDistortionType
 Camera transform flag. More...
 
auto focalLength () const -> Eigen::Vector2d
 
void setFocalLength (Eigen::Vector2d const &focal_length)
 Focal length. More...
 
auto principalPoint () const -> Eigen::Vector2d
 
void setPrincipalPoint (Eigen::Vector2d const &principal_point)
 Focal length. More...
 
auto params () const -> Eigen::VectorXd
 Returns params vector by value. More...
 
void setParams (Eigen::VectorXd const &params)
 Sets params vector. More...
 
auto distortionParams () const -> Eigen::VectorXd
 Returns distortion parameters vector by value. More...
 
auto camProj (Eigen::Vector3d const &point_camera) const -> Eigen::Vector2d
 Given a point in 3D space in the camera frame, compute the corresponding pixel coordinates in the image. More...
 
auto distort (Eigen::Vector2d const &point2_in_camera_lifted) const -> Eigen::Vector2d
 Maps a 2-point in the z=1 plane of the camera to a (distorted) pixel in the image. More...
 
auto dxDistort (Eigen::Vector2d const &point2_in_camera_lifted) const -> Eigen::Matrix2d
 
auto undistort (Eigen::Vector2d const &pixel_image) const -> Eigen::Vector2d
 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 dxCamProjX (Eigen::Vector3d const &point_in_camera) const -> Eigen::Matrix< double, 2, 3 >
 Derivative of camProj(x) with respect to x=0. More...
 
auto dxCamProjExpXPointAt0 (Eigen::Vector3d const &point_in_camera) const -> Eigen::Matrix< double, 2, 6 >
 Derivative of camProj(exp(x) * point) with respect to x=0. More...
 
auto camUnproj (Eigen::Vector2d const &pixel_image, double depth_z) const -> Eigen::Vector3d
 Given pixel coordinates in the distorted image, and a corresponding depth, reproject to a 3d point in the camera's reference frame. More...
 
auto subsampleDown () const -> CameraModel
 Subsamples pixel down, factor of 0.5. More...
 
auto subsampleUp () const -> CameraModel
 Subsamples pixel up, factor of 2.0. More...
 
auto binDown () const -> CameraModel
 Bins pixel down, factor of 0.5. More...
 
auto binUp () const -> CameraModel
 Bins pixel up, factor of 2.0. More...
 
auto imageSize () const -> ImageSize const &
 Image size accessor. More...
 
auto roi (Eigen::Vector2i const &top_left, ImageSize roi_size) const -> CameraModel
 Region of interest given top_left and `roi_size. More...
 
auto contains (Eigen::Vector2i const &obs, int border=0) const -> bool
 Returns true if obs is within image. More...
 
auto contains (Eigen::Vector2d const &obs, double border=0) const -> bool
 Returns true if obs is within image. More...
 
auto scale (ImageSize image_size) const -> CameraModel
 

Static Public Member Functions

static auto createDefaultPinholeModel (ImageSize image_size) -> CameraModel
 Creates default pinhole model from image_size. More...
 

Detailed Description

Concrete camera model class.

Constructor & Destructor Documentation

◆ CameraModel() [1/3]

sophus::CameraModel::CameraModel ( )
inline

◆ CameraModel() [2/3]

template<class TTransformModelT >
sophus::CameraModel::CameraModel ( TTransformModelT  model)
inline

Constructs camera model from frame_name and concrete projection model.

◆ CameraModel() [3/3]

sophus::CameraModel::CameraModel ( ImageSize  image_size,
CameraDistortionType  projection_type,
Eigen::VectorXd const &  params 
)

Constructs camera model from frame_name, image_size, projection_type flag and params vector.

Precondition: params.size() must match the number of parameters of the specified projection_type (TransformModel::kNumParams).

Member Function Documentation

◆ binDown()

auto sophus::CameraModel::binDown ( ) const -> CameraModel

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()

auto sophus::CameraModel::binUp ( ) const -> CameraModel

◆ camProj()

auto sophus::CameraModel::camProj ( Eigen::Vector3d const &  point_camera) const -> Eigen::Vector2d

Given a point in 3D space in the camera frame, compute the corresponding pixel coordinates in the image.

◆ camUnproj()

auto sophus::CameraModel::camUnproj ( Eigen::Vector2d const &  pixel_image,
double  depth_z 
) const -> Eigen::Vector3d

Given pixel coordinates in the distorted image, and a corresponding depth, reproject to a 3d point in the camera's reference frame.

◆ contains() [1/2]

auto sophus::CameraModel::contains ( Eigen::Vector2d const &  obs,
double  border = 0 
) const -> bool

Returns true if obs is within image.

Positive border makes the image frame smaller.

◆ contains() [2/2]

auto sophus::CameraModel::contains ( Eigen::Vector2i const &  obs,
int  border = 0 
) const -> bool

Returns true if obs is within image.

Note: Positive border makes the image frame smaller.

◆ createDefaultPinholeModel()

auto sophus::CameraModel::createDefaultPinholeModel ( ImageSize  image_size) -> CameraModel
static

Creates default pinhole model from image_size.

◆ distort()

auto sophus::CameraModel::distort ( Eigen::Vector2d const &  point2_in_camera_lifted) const -> Eigen::Vector2d

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

◆ distortionModelName()

auto sophus::CameraModel::distortionModelName ( ) const -> std::string_view

Returns name of the camera distortion model.

◆ distortionParams()

auto sophus::CameraModel::distortionParams ( ) const -> Eigen::VectorXd

Returns distortion parameters vector by value.

◆ distortionType()

auto sophus::CameraModel::distortionType ( ) const -> CameraDistortionType

Camera transform flag.

◆ dxCamProjExpXPointAt0()

auto sophus::CameraModel::dxCamProjExpXPointAt0 ( Eigen::Vector3d const &  point_in_camera) const -> Eigen::Matrix<double, 2, 6>

Derivative of camProj(exp(x) * point) with respect to x=0.

◆ dxCamProjX()

auto sophus::CameraModel::dxCamProjX ( Eigen::Vector3d const &  point_in_camera) const -> Eigen::Matrix<double, 2, 3>

Derivative of camProj(x) with respect to x=0.

◆ dxDistort()

auto sophus::CameraModel::dxDistort ( Eigen::Vector2d const &  point2_in_camera_lifted) const -> Eigen::Matrix2d

◆ focalLength()

auto sophus::CameraModel::focalLength ( ) const -> Eigen::Vector2d

◆ imageSize()

auto sophus::CameraModel::imageSize ( ) const -> ImageSize const&

Image size accessor.

◆ isEmpty()

auto sophus::CameraModel::isEmpty ( ) const -> bool
inline

Returns true if this camera remains default-initialized with zero image dimensions.

◆ modelVariant() [1/2]

auto sophus::CameraModel::modelVariant ( ) -> CameraDistortionVariant&
inline

Distortion variant mutator.

◆ modelVariant() [2/2]

auto sophus::CameraModel::modelVariant ( ) const -> CameraDistortionVariant const&
inline

Distortion variant accessor.

◆ params()

auto sophus::CameraModel::params ( ) const -> Eigen::VectorXd

Returns params vector by value.

◆ principalPoint()

auto sophus::CameraModel::principalPoint ( ) const -> Eigen::Vector2d

◆ roi()

auto sophus::CameraModel::roi ( Eigen::Vector2i const &  top_left,
ImageSize  roi_size 
) const -> CameraModel

Region of interest given top_left and `roi_size.

◆ scale()

auto sophus::CameraModel::scale ( ImageSize  image_size) const -> CameraModel

◆ setFocalLength()

void sophus::CameraModel::setFocalLength ( Eigen::Vector2d const &  focal_length)

Focal length.

◆ setParams()

void sophus::CameraModel::setParams ( Eigen::VectorXd const &  params)

Sets params vector.

Precontion: params.size() must match the number of parameters of the specified projection_type (TransformModel::kNumParams).

◆ setPrincipalPoint()

void sophus::CameraModel::setPrincipalPoint ( Eigen::Vector2d const &  principal_point)

Focal length.

◆ subsampleDown()

auto sophus::CameraModel::subsampleDown ( ) const -> CameraModel

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()

auto sophus::CameraModel::subsampleUp ( ) const -> CameraModel

Subsamples pixel up, factor of 2.0.

◆ undistort()

auto sophus::CameraModel::undistort ( Eigen::Vector2d const &  pixel_image) const -> Eigen::Vector2d

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

◆ undistortTable()

auto sophus::CameraModel::undistortTable ( ) const -> MutImage<Eigen::Vector2f>

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