Skip to content

Class libCalibGeom::CameraModelBSplineRay

General ray based B-Spline Camera Model

This is Calib.io's general B-Spline based camera model that operates in ray space. It models the camera by warping 3D ray directions using bicubic B-spline surfaces, making it capable of representing any central projection lens, including fisheye and omnidirectional cameras.

The model uses a 2D grid of B-spline control points to warp normalized ray directions. This provides smooth, continuously differentiable distortion with excellent fitting capability for complex lens systems.

Knot Count Configuration:The resolution of the B-spline grid (number of knots) is configurable at construction time via CameraModelConfig: nKnotsX: Number of knots along the horizontal dimension (default: 16) nKnotsY: Number of knots along the vertical dimension (default: 12)

Higher knot counts provide more flexibility for modeling complex distortions but increase the parameter count and computational cost. Typical values range from 8-20 knots depending on image resolution and lens complexity.

Performance:More generic than BSplineWarp but computationally slower due to ray-space operations. Best suited for wide-angle and fisheye lenses where ray-based modeling is more natural than image-space warping.

CameraModelBSplineWarp for a faster image-space variant suitable for pinhole-like lenses

Inherits from: public libCalibGeom::CameraModelCRT< CameraModelBSplineRay >

Constructors and destructors

CameraModelBSplineRay()

CameraModelBSplineRay()

Returns:

void

CameraModelBSplineRay()

CameraModelBSplineRay(const ImageSize imageSize,const CameraModelConfig & config = {})

Returns:

void

CameraModelBSplineRay()

CameraModelBSplineRay(const CameraModelBSplineRay & other)

Returns:

void

~CameraModelBSplineRay()

~CameraModelBSplineRay()

Returns:

void

Public member functions

initialize()

boolinitialize(const std::vector< std::vector< Point3 >> &worldPoints, const std::vector< std::vector< Point2 >> &imagePoints, std::vector< Rotation > &Rc, std::vector< Translation > &Tc, const InitializationMethod method) override

Initializes the model from calibration observations.

Returns:

bool

regularizationFunction()

std::unique_ptr< ceres::CostFunction >regularizationFunction(const int nResiduals) const override

Creates a regularization cost function.

Parameters:

nResidualsNumber of residuals to regularize over.

Returns:

std::unique_ptr< ceres::CostFunction >

project()

boolproject(const T &X, const T &Y, const T &Z, T &c, T &r, const T *params) const

Returns:

bool

unproject()

boolunproject(const T &u, const T &v, T &X, T &Y, T &Z, const T *params) const

Returns:

bool

project()

boolproject(double X, double Y, double Z, double &u, double &v) const

Returns:

bool

unproject()

boolunproject(double u, double v, double &X, double &Y, double &Z) const

Returns:

bool

nKnotsX()

intnKnotsX() const

Returns:

int

nKnotsY()

intnKnotsY() const

Returns:

int

config()

CameraModelConfigconfig() const override

Returns the parameters needed to reconstruct this model layout.

Returns:

CameraModelConfig

getUndistortionMaps()

voidgetUndistortionMaps(Image< float > &mapU, Image< float > &mapV, Matrix< double, 3, 3 > &K) const override

Computes undistortion maps and the new camera matrix.

The returned maps define a source-image remap induced by a default virtual linear camera. For each output pixel, K maps the pixel to a point on the virtual camera plane at Z==1, which in turn defines the corresponding virtual camera ray. The maps contain the source-image lookup coordinates produced by projecting that ray through the camera model.

For central models this rectification is exact. For non-central models, a single depth-independent 2D remap is only an approximation, so the result should be interpreted as a convenient best-fit rectification.

Parameters:

mapUMap for u-coordinates.
mapVMap for v-coordinates.
KNew camera matrix.

Returns:

void

getUnprojectionMaps()

voidgetUnprojectionMaps(Image< float > &mapX, Image< float > &mapY, Image< float > &mapZ) const override

Computes 3-channel bearing-vector maps.

The returned maps store the unit ray direction (X, Y, Z) associated with each pixel.

For non-central models, these maps describe direction only and do not encode any per-pixel ray origin. Use getRayMaps() for the full geometry.

Parameters:

mapXMap for X-components.
mapYMap for Y-components.
mapZMap for Z-components.

Returns:

void

toString()

std::stringtoString() const override

Returns a string representation of the model parameters.

Returns:

std::string

Public data members

parameters

CameraParametersparameters

No documentation provided.

Public Static Attributes

hasDynamicParameterCount

constexpr boolhasDynamicParameterCount

No documentation provided.

Public Static Functions

name()

const std::stringname()

Returns:

const std::string