Ocean
Ocean::Geometry::CameraCalibration Class Reference

This class implements functions to calibrate a camera, to determine the profile of a camera. More...

Data Structures

class  Pattern
 Definition of a class holding the information about one calibration pattern. More...
 

Public Types

typedef std::vector< PatternPatterns
 Definition of a vector holding calibration patterns. More...
 

Static Public Member Functions

static bool determineCameraCalibrationPlanar (const unsigned int width, const unsigned int height, const ConstIndexedAccessor< Vectors3 > &objectPointGroups, const ConstIndexedAccessor< Vectors2 > &imagePointGroups, PinholeCamera &pinholeCamera, const unsigned int iterations=20u, Scalar *sqrAccuracy=nullptr)
 Determines the camera calibration for several individual groups of 3D object points all lying on the same 3D plane and corresponding 2D image points. More...
 
static bool determineIntrinsicCameraMatrixPlanar (const ConstIndexedAccessor< Vectors3 > &objectPointGroups, const ConstIndexedAccessor< Vectors2 > &imagePointGroups, SquareMatrix3 &intrinsic, SquareMatrices3 *homographies=nullptr, Indices32 *validGroupIndices=nullptr)
 Determines the intrinsic camera matrix for several groups of corresponding 2D/3D points. More...
 
static bool determineCameraCalibration (const PinholeCamera &roughCamera, const ObjectPointGroups &objectPointGroups, const ImagePointGroups &imagePointGroups, PinholeCamera &pinholeCamera, Scalar *sqrAccuracy=nullptr)
 Determines the camera calibration while a rough camera calibration is already known. More...
 
static bool createCorrespondences (const Pattern &pattern, const Vector2 &boxSize, ObjectPoints &objectPoints, ImagePoints &imagePoints)
 Creates point correspondences from a given calibration pattern. More...
 
static bool determineBestMatchingFovX (const unsigned int width, const unsigned int height, const ConstIndexedAccessor< HomogenousMatrix4 > &posesAccessor, const ConstIndexedAccessor< Vectors3 > &objectPointGroupAccessor, const ConstIndexedAccessor< Vectors2 > &imagePointGroupAccessor, Scalar &idealFovX, const bool twoIterations=true, const Scalar lowestFovX=Numeric::deg2rad(25), const Scalar highestFovX=Numeric::deg2rad(75), const unsigned int steps=20u, NonconstIndexedAccessor< HomogenousMatrix4 > *idealPoses=nullptr)
 Determines the horizontal field of view that matches best to a set of poses, object point and image points. More...
 
static bool successiveCameraPoseOptimization (const PinholeCamera &pinholeCamera, const HomogenousMatrices4 &poses, const ObjectPointGroups &objectPointGroups, const ImagePointGroups &imagePointGroups, PinholeCamera &optimizedCamera, HomogenousMatrices4 &optimizedPoses, Scalar *initialSqrError=nullptr, Scalar *finalSqrError=nullptr)
 Applies one camera and one pose optimization successively for a given set of poses and corresponding image and object points. More...
 

Detailed Description

This class implements functions to calibrate a camera, to determine the profile of a camera.

Use CameraCalibration::determineCameraCalibrationPlanar() for groups of 2D/3D point correspondences with all 3D object points located on one plane.
Use CameraCalibration::determineCameraCalibration() for groups of 2D/3D point correspondences with any kind of 3D object points.

Member Typedef Documentation

◆ Patterns

Definition of a vector holding calibration patterns.

Member Function Documentation

◆ createCorrespondences()

static bool Ocean::Geometry::CameraCalibration::createCorrespondences ( const Pattern pattern,
const Vector2 boxSize,
ObjectPoints objectPoints,
ImagePoints imagePoints 
)
static

Creates point correspondences from a given calibration pattern.

Parameters
patternCalibration patter to create the correspondences from
boxSizeSize of one calibration box in m
objectPointsResulting object points
imagePointsResulting image points
Returns
True, if succeeded

◆ determineBestMatchingFovX()

static bool Ocean::Geometry::CameraCalibration::determineBestMatchingFovX ( const unsigned int  width,
const unsigned int  height,
const ConstIndexedAccessor< HomogenousMatrix4 > &  posesAccessor,
const ConstIndexedAccessor< Vectors3 > &  objectPointGroupAccessor,
const ConstIndexedAccessor< Vectors2 > &  imagePointGroupAccessor,
Scalar idealFovX,
const bool  twoIterations = true,
const Scalar  lowestFovX = Numeric::deg2rad(25),
const Scalar  highestFovX = Numeric::deg2rad(75),
const unsigned int  steps = 20u,
NonconstIndexedAccessor< HomogenousMatrix4 > *  idealPoses = nullptr 
)
static

Determines the horizontal field of view that matches best to a set of poses, object point and image points.

Parameters
widthThe width of the camera in pixel, with range [1, infinity)
heightThe height of the camera in pixel, with range [1, infinity)
posesAccessorThe accessor for the poses that match to the number of given object point groups (and image point groups)
objectPointGroupAccessorThe accessor for the individual groups of object points, one group for each group of image points
imagePointGroupAccessorThe accessor for the individual groups of image points, one group for each group of object points with same nubmer of elements
twoIterationsTrue, to apply a two-iteration approach, otherwise a faster one-iteration approach will be applied
idealFovXResulting best matching horizontal field of view, in radian
lowestFovXLowest field of view that will be tested in radian, with range (0, highestFovX)
highestFovXHighest field of view that will be tested in radian, with range (lowestFovX, PI)
stepsNumber of angles that will be tested, with range [1, infinity)
idealPosesOptional resulting poses corresponding to the given sets of object and image points and the found fovX
Returns
True, if succeeded

◆ determineCameraCalibration()

static bool Ocean::Geometry::CameraCalibration::determineCameraCalibration ( const PinholeCamera roughCamera,
const ObjectPointGroups objectPointGroups,
const ImagePointGroups imagePointGroups,
PinholeCamera pinholeCamera,
Scalar sqrAccuracy = nullptr 
)
static

Determines the camera calibration while a rough camera calibration is already known.

The camera calibration is improved by usage of all given groups of point correspondences.
The individual groups of image points can be arbitrary and do not need to be based on a planar calibration pattern.
The camera profile must not change between individual groups (images of the calibration pattern).

Parameters
roughCameraRough camera object already determined, must be valid
objectPointGroupsGroups of object points, each group corresponds to a group of image points, at least one
imagePointGroupsGroups of image points, each group corresponds to a group of object points, at least one
pinholeCameraResulting pinhole camera holding all extracted calibration information like e.g. intrinsic camera and distortion parameters
sqrAccuracyOptional resulting average square pixel error, if defined
Returns
True, if succeeded
See also
determineCameraCalibrationPlanar().

◆ determineCameraCalibrationPlanar()

static bool Ocean::Geometry::CameraCalibration::determineCameraCalibrationPlanar ( const unsigned int  width,
const unsigned int  height,
const ConstIndexedAccessor< Vectors3 > &  objectPointGroups,
const ConstIndexedAccessor< Vectors2 > &  imagePointGroups,
PinholeCamera pinholeCamera,
const unsigned int  iterations = 20u,
Scalar sqrAccuracy = nullptr 
)
static

Determines the camera calibration for several individual groups of 3D object points all lying on the same 3D plane and corresponding 2D image points.

The camera calibration is determines by usage of all given correspondences.
The individual groups of image points can e.g., be the result of individual images of a calibration pattern observed from different viewing positions.
The camera profile must not change between individual groups (images of the calibration pattern).
Each group must provide at least 10 points.

Parameters
widthThe width of the camera frame in pixel, with range [1, infinity)
heightThe height of the camera frame in pixel, with range [1, infinity)
objectPointGroupsThe groups of object points (all points lie in the Z == 0 plane), each group has a corresponding group of image points, at least 3
imagePointGroupsThe groups of image points, each group has a corresponding group of object points
pinholeCameraResulting pinhole camera profile holding all extracted calibration information like e.g. intrinsic camera and distortion parameters
iterationsNumber of iterations the camera parameters will be improved after the initial model has been determined, using a non linear optimization approach, with range [0, infinity)
sqrAccuracyOptional resulting average square pixel error for all point correspondences
Returns
True, if succeeded
See also
determineCameraCalibration().

◆ determineIntrinsicCameraMatrixPlanar()

static bool Ocean::Geometry::CameraCalibration::determineIntrinsicCameraMatrixPlanar ( const ConstIndexedAccessor< Vectors3 > &  objectPointGroups,
const ConstIndexedAccessor< Vectors2 > &  imagePointGroups,
SquareMatrix3 intrinsic,
SquareMatrices3 homographies = nullptr,
Indices32 validGroupIndices = nullptr 
)
static

Determines the intrinsic camera matrix for several groups of corresponding 2D/3D points.

All 3D object points must be located on a plane. Each group must provide at least 10 points.

Parameters
objectPointGroupsGroups of object points, each group corresponds to a group of image points, at least three
imagePointGroupsGroups of image points, each group corresponds to a group of object points, at least three
intrinsicResulting intrinsic camera matrix
homographiesOptional resulting homographies, one for each given group for which a valid homography could be determined, may be less than the provided number of groups
validGroupIndicesOptional resulting indices of the valid groups for which a valid homography could be determined
Returns
True, if succeeded

◆ successiveCameraPoseOptimization()

static bool Ocean::Geometry::CameraCalibration::successiveCameraPoseOptimization ( const PinholeCamera pinholeCamera,
const HomogenousMatrices4 poses,
const ObjectPointGroups objectPointGroups,
const ImagePointGroups imagePointGroups,
PinholeCamera optimizedCamera,
HomogenousMatrices4 optimizedPoses,
Scalar initialSqrError = nullptr,
Scalar finalSqrError = nullptr 
)
static

Applies one camera and one pose optimization successively for a given set of poses and corresponding image and object points.

Parameters
pinholeCameraThe initial pinhole camera object that has to be optimized according to the projection error of the given point sets
posesA set of camera poses, each pose corresponds to a group of image and object points
objectPointGroupsGroups of object points, each group corresponds to one camera pose and the group of image points
imagePointGroupsGroups of image points, each group corresponds to one camera pose and the group of object points
optimizedCameraResulting optimized camera
optimizedPosesResulting optimized poses
initialSqrErrorOptional initial average sqr projection error
finalSqrErrorOptional resulting final average sqr projection error
Returns
True, if succeeded

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