Class libCalibGeom::CameraModelBase¶
Constructors and destructors¶
CameraModelBase()¶
CameraModelBaseconst ImageSize imageSize,const ImageRegion validRegion = ImageRegion()
Returns:
void |
~CameraModelBase()¶
~CameraModelBase
Returns:
void |
Public member functions¶
getName()¶
const std::stringgetName
Returns the name of the camera model.
Returns:
const std::string |
config()¶
CameraModelConfigconfig
Returns the parameters needed to reconstruct this model layout.
Returns:
CameraModelConfig |
getNParams()¶
intgetNParams
Returns the total number of parameters.
Returns:
int |
getParameterNames()¶
const std::vector< ParameterSpec > &getParameterNames
Returns the specifications for all parameters.
Returns:
const std::vector< ParameterSpec > & |
hasParam()¶
boolhasParam
Checks if a parameter with the given name exists.
Returns:
bool |
param()¶
param()¶
param()¶
ParameterReferenceparam
Returns a mutable reference to a parameter by index.
Returns:
ParameterReference |
param()¶
ParameterReferenceparam
Returns a mutable reference to a parameter by name.
Returns:
ParameterReference |
parameterValues()¶
std::vector< double >parameterValues
Returns the parameter values in optimizer order.
Returns:
std::vector< double > |
setParameterValues()¶
voidsetParameterValues
Replaces the parameter values from optimizer-order storage.
Returns:
void |
getConstantParamIds()¶
std::vector< int >getConstantParamIds
Returns the indices of constant (fixed) parameters.
Returns:
std::vector< int > |
isCentral()¶
boolisCentral
Returns whether the model is central.
Central models have a single ray origin at (0, 0, 0) for all pixels. Non-central models may expose per-pixel ray origins via unprojectRay() and getRayMaps().
Returns:
bool |
projectPoint()¶
boolprojectPoint
Projects a 3D point into image coordinates (u, v).
Parameters:
X | X-coordinate in camera frame. |
Y | Y-coordinate in camera frame. |
Z | Z-coordinate in camera frame. |
u | Resulting horizontal image coordinate. |
v | Resulting vertical image coordinate. |
Returns:
bool | True if the point is projectable (e.g. not behind camera). |
unprojectPoint()¶
boolunprojectPoint
Unprojects an image point (u, v) into a 3D direction.
For central models, the resulting vector (X, Y, Z) is a unit bearing vector in camera coordinates. For models that expose richer ray geometry, this method still returns the normalized ray direction only; use unprojectRay() when the ray origin also matters.
Parameters:
u | Horizontal image coordinate. |
v | Vertical image coordinate. |
X | X component of direction. |
Y | Y component of direction. |
Z | Z component of direction. |
Returns:
bool | True if unprojection was successful. |
unprojectRay()¶
boolunprojectRay
Unprojects an image point (u, v) into a full 3D ray.
For central models, the ray origin is (0, 0, 0) and the direction is a unit bearing vector. Models with non-zero per-pixel ray origins should override this function to return the full ray geometry.
Parameters:
u | Horizontal image coordinate. |
v | Vertical image coordinate. |
origin | Ray origin in camera coordinates. |
direction | Unit ray direction in camera coordinates. |
Returns:
bool | True if unprojection was successful. |
getUndistortionMaps()¶
voidgetUndistortionMaps
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:
mapU | Map for u-coordinates. |
mapV | Map for v-coordinates. |
K | New camera matrix. |
Returns:
void |
getUnprojectionMaps()¶
voidgetUnprojectionMaps
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:
mapX | Map for X-components. |
mapY | Map for Y-components. |
mapZ | Map for Z-components. |
Returns:
void |
getRayMaps()¶
voidgetRayMaps
Computes per-pixel ray origin and direction maps.
Central models return zero origin everywhere and a unit bearing vector in the direction maps. Models with per-pixel ray origins can override this to expose the full ray geometry.
Parameters:
mapOx | Map for ray-origin X-coordinates. |
mapOy | Map for ray-origin Y-coordinates. |
mapOz | Map for ray-origin Z-coordinates. |
mapDx | Map for ray-direction X-coordinates. |
mapDy | Map for ray-direction Y-coordinates. |
mapDz | Map for ray-direction Z-coordinates. |
Returns:
void |
defaultInitializationMethod()¶
InitializationMethoddefaultInitializationMethod
Returns the default initialization method for this camera model.
Returns:
InitializationMethod |
initialize()¶
boolinitialize
Initializes the model from calibration observations.
Returns:
bool |
newCostFunction()¶
std::unique_ptr< ceres::CostFunction >newCostFunction
Creates a Ceres CostFunction for optimizing Reprojection Error.
Parameters:
imagePoint | The detected 2D point. |
Returns:
std::unique_ptr< ceres::CostFunction > |
newCostFunction()¶
std::unique_ptr< ceres::CostFunction >newCostFunction
Creates a Ceres CostFunction with uncertainty weighting.
Parameters:
imagePoint | The detected 2D point. |
W | Weight matrix. |
Returns:
std::unique_ptr< ceres::CostFunction > |
clone()¶
std::unique_ptr< CameraModelBase >clone
Clones the camera model.
Returns:
std::unique_ptr< CameraModelBase > |
regularizationFunction()¶
std::unique_ptr< ceres::CostFunction >regularizationFunction
Creates a regularization cost function.
Parameters:
nResiduals | Number of residuals to regularize over. |
Returns:
std::unique_ptr< ceres::CostFunction > |
toString()¶
std::stringtoString
Returns a string representation of the model parameters.
Returns:
std::string |
Public data members¶
imageSize¶
ImageSizeimageSize
Pixel dimensions of the sensor.
validRegion¶
ImageRegionvalidRegion
Polygon describing the image region in which the camera model can be assumed valid. Usually corresponds to convex hull of observed feature point locations.
Friends¶
Friend: internal::OptimizationParameterStorage¶
Protected Functions¶
CameraModelBase()¶
CameraModelBase
Returns:
void |