Ocean
Ocean::PinholeCameraT< T > Class Template Reference

Definition of a pinhole camera model. More...

Inheritance diagram for Ocean::PinholeCameraT< T >:

Data Structures

class  DistortionLookup
 This class encapsulates a lookup table for camera distortion offsets allowing for faster un-distortion of image points (which is than an approximated position only). More...
 

Public Types

enum  OptimizationStrategy {
  OS_NONE = 0 , OS_FOCAL_LENGTH = 1 , OS_FOCAL_LENGTHS = 2 , OS_INTRINSIC_PARAMETERS = 4 ,
  OS_FOCAL_LENGTHS_DISTORTION = 6 , OS_SYMMETRIC_INTRINSIC_PARAMETERS_DISTORTIONS = 7 , OS_INTRINSIC_PARAMETERS_DISTORTIONS = 8 , OS_DISTORTION = 0x1000 | 4 ,
  OS_INTRINSIC_PARAMETERS_RADIAL_DISTORTION = 0x1000 | 6
}
 Definition of individual optimization strategies for camera parameters. More...
 
typedef T TScalar
 The scalar data type of this object. More...
 
typedef std::pair< T, T > DistortionPair
 Definition of a pair of distortion values. More...
 

Public Member Functions

 PinholeCameraT ()=default
 Standard constructor. More...
 
 PinholeCameraT (const unsigned int width, const unsigned int height, const PinholeCameraT< T > &camera)
 Creates a new camera object with specified frame dimension and intrinsic camera parameters best matching to a given reference camera profile with different frame dimension. More...
 
 PinholeCameraT (const T subFrameLeft, const T subFrameTop, const unsigned int subFrameWidth, const unsigned int subFrameHeight, const PinholeCameraT< T > &camera)
 Creates a new sub-frame camera profile based on a camera profile of the entire camera frame. More...
 
 PinholeCameraT (const unsigned int width, const unsigned int height, const T focalX, const T focalY, const T principalX, const T principalY)
 Creates a new PinholeCameraT<T> object by it's given intrinsic parameters. More...
 
 PinholeCameraT (const unsigned int width, const unsigned int height, const T focalX, const T focalY, const T principalX, const T principalY, const DistortionPair &radial, const DistortionPair &tangential)
 Creates a new PinholeCameraT<T> object by it's given intrinsic parameters. More...
 
 PinholeCameraT (const unsigned int width, const unsigned int height, const T *parameters, const bool radialDistortion=true, const bool tangentialDistortion=true)
 Creates a new PinholeCameraT<T> object by it's given intrinsic parameters. More...
 
 PinholeCameraT (const SquareMatrixT3< T > &intrinsic)
 Creates a new PinholeCameraT<T> object by a given projection matrix with the intrinsic camera parameters. More...
 
 PinholeCameraT (const SquareMatrixT3< T > &intrinsic, const unsigned int width, const unsigned int height)
 Creates a new PinholeCameraT<T> object by the given intrinsic camera matrix and width and height of the camera. More...
 
 PinholeCameraT (const SquareMatrixT3< T > &intrinsic, const unsigned int width, const unsigned int height, const DistortionPair &radial, const DistortionPair &tangential)
 Creates a new PinholeCameraT<T> object by the given intrinsic camera matrix, the width and height and the radial distortion parameters. More...
 
 PinholeCameraT (const unsigned int width, const unsigned int height, const T fovX)
 Creates a new PinholeCameraT<T> object by the given width, height and field of view of a camera. More...
 
 PinholeCameraT (const unsigned int width, const unsigned int height, const T fovX, const T principalX, const T principalY)
 Creates a new PinholeCameraT<T> object by the given frame dimensions, the ideal field of view, and the camera's principal point. More...
 
template<typename U >
 PinholeCameraT (const PinholeCameraT< U > &pinholeCamera, const bool copyDistortionParameters=true)
 Copy constructor for a pinhole camera with difference element data type than T. More...
 
const SquareMatrixT3< T > & intrinsic () const
 Returns the intrinsic camera matrix. More...
 
const SquareMatrixT3< T > & invertedIntrinsic () const
 Returns the inverted intrinsic camera matrix. More...
 
const DistortionPairradialDistortion () const
 Returns the pair of radial distortion parameters. More...
 
const DistortionPairtangentialDistortion () const
 Returns the pair of tangential distortion parameters. More...
 
bool hasDistortionParameters () const
 Returns whether this camera object has specified distortion parameters. More...
 
unsigned int width () const
 Returns the width of the camera image. More...
 
unsigned int height () const
 Returns the height of the camera image. More...
 
VectorT2< T > principalPoint () const
 Returns the coordinate of the principal point of the camera image in the pixel domain. More...
 
principalPointX () const
 Returns the x-value of the principal point of the camera image in the pixel domain. More...
 
principalPointY () const
 Returns the y-value of the principal point of the camera image in the pixel domain. More...
 
focalLengthX () const
 Returns the horizontal focal length parameter. More...
 
focalLengthY () const
 Returns the vertical focal length parameter. More...
 
inverseFocalLengthX () const
 Returns the inverse horizontal focal length parameter. More...
 
inverseFocalLengthY () const
 Returns the inverse vertical focal length parameter. More...
 
fovX () const
 Returns the field of view in x direction of the camera. More...
 
fovY () const
 Returns the field of view in x direction of the camera. More...
 
fovXLeft () const
 Returns the left field of view in x direction. More...
 
fovXRight () const
 Returns the right field of view in x direction. More...
 
fovYTop () const
 Returns the top field of view in y direction. More...
 
fovYBottom () const
 Returns the bottom field of view in y direction. More...
 
fovDiagonal () const
 Returns the diagonal field of view of the camera. More...
 
bool rotation (const VectorT2< T > &undistortedPosition, T &angleX, T &angleY) const
 Gets two rotation parameters of the viewing ray for a given undistorted 2D position in the camera image. More...
 
void copyElements (T *arrayValues, const bool copyRadialDistortion=true, const bool copyTangentialDistortion=true) const
 Copies the elements of this camera to an array with 4 to 8 floating point values. More...
 
bool setIntrinsic (const SquareMatrixT3< T > &intrinsic)
 Sets the intrinsic camera matrix. More...
 
void setRadialDistortion (const DistortionPair &radial)
 Sets the radial distortion parameters. More...
 
void setTangentialDistortion (const DistortionPair &tangential)
 Sets the tangential distortion parameters. More...
 
void applyZoomFactor (const T relativeZoom)
 Applies a given (relative) zoom factor which mainly multiplies the focal length parameters by the given factor. More...
 
bool isDistortionPlausible (const T symmetricFocalLengthRatio=T(1.05), const T modelAccuracy=T(0.001), const T symmetricDistortionRatio=T(1.08)) const
 Checks whether the distortion of this camera is plausible. More...
 
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > undistort (const VectorT2< T > &distorted, const unsigned int iterations=10u, const T zoom=T(1)) const
 Returns the undistorted position of a given distorted position defined in pixel coordinates. More...
 
VectorT2< T > undistortDamped (const VectorT2< T > &distorted, const T dampingFactor=T(1), const unsigned int iterations=10u, const T zoom=T(1)) const
 Returns the undistorted position of a given distorted position defined in pixel coordinates. More...
 
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > distort (const VectorT2< T > &undistorted) const
 Returns the distorted position of a given undistorted position defined in pixel coordinates. More...
 
VectorT2< T > distortDamped (const VectorT2< T > &undistorted, const T dampingFactor=T(1), const T zoom=T(1)) const
 Returns the distorted position of a given undistorted position defined in pixel coordinates. More...
 
bool isInside (const VectorT2< T > &imagePoint, const T signedBorder=T(0)) const
 Returns whether a given 2D image point lies inside the camera frame. More...
 
calculateAngleBetween (const VectorT2< T > &first, const VectorT2< T > &second) const
 Returns the viewing angle between two undistorted points on the camera's image plane. More...
 
calculateCosBetween (const VectorT2< T > &first, const VectorT2< T > &second) const
 Returns the cosine of the viewing angle between two undistorted points on the camera's image plane. More...
 
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > imagePoint2normalizedImagePoint (const VectorT2< T > &imagePoint, const bool undistortImagePoint) const
 Calculates the normalized image point corresponding to a given (distorted) image point. More...
 
VectorT2< T > imagePoint2normalizedImagePointDamped (const VectorT2< T > &imagePoint, const bool undistortImagePoint) const
 Calculates the normalized image point corresponding to a given (distorted) image point. More...
 
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > normalizedImagePoint2imagePoint (const VectorT2< T > &normalizedImagePoint, const bool distortImagePoint) const
 Calculates the image point corresponding to a given normalized image point. More...
 
template<bool tUseBorderDistortionIfOutside>
void normalizedImagePoints2imagePoints (const VectorT2< T > *normalizedImagePoints, const size_t numberNormalizedImagePoints, const bool distortImagePoints, VectorT2< T > *imagePoints) const
 Calculates the image points corresponding to a set of given normalized image points. More...
 
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > projectToImage (const HomogenousMatrixT4< T > &world_T_camera, const VectorT3< T > &worldObjectPoint, const bool distortImagePoint, const T zoom=T(1)) const
 Projects a 3D object point to the 2D image plane of the camera by a given camera pose. More...
 
template<bool tUseBorderDistortionIfOutside>
BoxT2< T > projectToImage (const HomogenousMatrixT4< T > &world_T_camera, const BoxT3< T > &worldObjectBox, const bool distortImagePoint, const T zoom=T(1)) const
 Projects a 3D box to the 2D image plane of the camera by a given camera pose. More...
 
template<bool tUseBorderDistortionIfOutside>
TriangleT2< T > projectToImage (const HomogenousMatrixT4< T > &world_T_camera, const TriangleT3< T > &worldObjectTriangle, const bool distortImagePoint, const T zoom=T(1)) const
 Projects a 3D triangle to the 2D image plane of the camera by a given camera pose. More...
 
template<bool tUseBorderDistortionIfOutside>
void projectToImage (const HomogenousMatrixT4< T > &world_T_camera, const VectorT3< T > *worldObjectPoints, const size_t numberObjectPoints, const bool distortImagePoints, VectorT2< T > *imagePoints, const T zoom=T(1)) const
 Projects a set of 3D object points onto an image plane of the camera by a given camera pose. More...
 
template<bool tUseBorderDistortionIfOutside>
LineT2< T > projectToImage (const HomogenousMatrixT4< T > &world_T_camera, const LineT3< T > &worldLine, const bool distortProjectedLine, const T zoom=T(1)) const
 Projects a 3D line onto an image plane of the camera by a given camera pose. More...
 
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > projectToImageIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &objectPoint, const bool distortImagePoint, const T zoom=T(1)) const
 Projects a 3D object point to the 2D image plane of the camera by a given inverse camera pose. More...
 
template<bool tDistortImagePoint, bool tUseBorderDistortionIfOutside>
VectorT2< T > projectToImageIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &worldObjectPoint, const T zoom=T(1)) const
 Projects a 3D object point to the 2D image plane of the camera by a given inverse camera pose. More...
 
template<bool tUseBorderDistortionIfOutside>
BoxT2< T > projectToImageIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const BoxT3< T > &worldObjectBox, const bool distortImagePoint, const T zoom=T(1)) const
 Projects a 3D box to the 2D image plane of the camera by a given inverse camera pose. More...
 
template<bool tUseBorderDistortionIfOutside>
TriangleT2< T > projectToImageIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const TriangleT3< T > &worldObjectTriangle, const bool distortImagePoint, const T zoom=T(1)) const
 Projects a 3D triangle to the 2D image plane of the camera by a given extrinsic camera pose. More...
 
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > projectToImageIF (const VectorT2< T > &normalizedObjectPoint, const bool distortImagePoint, const T zoom=T(1)) const
 Transforms a normalized object point (a 3D object point transformed by the inverted and flipped extrinsic camera matrix) into the camera pixel coordinate system. More...
 
template<bool tUseBorderDistortionIfOutside>
void projectToImageIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > *worldObjectPoints, const size_t numberObjectPoints, const bool distortImagePoints, VectorT2< T > *imagePoints, const T zoom=T(1)) const
 Projects a set of 3D object points onto an image plane of the camera by a given inverse camera pose. More...
 
template<bool tUseBorderDistortionIfOutside>
LineT2< T > projectToImageIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const LineT3< T > &worldLine, const bool distortProjectedLine, const T zoom=T(1)) const
 Projects a 3D line onto an image plane of the camera by a given inverse camera pose. More...
 
VectorT2< T > projectToImageDamped (const HomogenousMatrixT4< T > &extrinsic, const VectorT3< T > &objectPoint, const bool distortImagePoint, const T dampingFactor=T(1), const T zoom=T(1)) const
 Projects a 3D object point to the 2D image plane of the camera by a given extrinsic camera matrix. More...
 
BoxT2< T > projectToImageDamped (const HomogenousMatrixT4< T > &extrinsic, const BoxT3< T > &objectBox, const bool distortImagePoint, const T dampingFactor=T(1), const T zoom=T(1)) const
 Projects a 3D box to the 2D image plane of the camera by a given inverse extrinsic camera matrix. More...
 
TriangleT2< T > projectToImageDamped (const HomogenousMatrixT4< T > &extrinsic, const TriangleT3< T > &objectTriangle, const bool distortImagePoint, const T dampingFactor=T(1), const T zoom=T(1)) const
 Projects a 3D triangle to the 2D image plane of the camera by a given extrinsic camera matrix. More...
 
void projectToImageDamped (const HomogenousMatrixT4< T > &extrinsic, const VectorT3< T > *objectPoints, const size_t numberObjectPoints, const bool distortImagePoints, VectorT2< T > *imagePoints, const T dampingFactor=T(1), const T zoom=T(1)) const
 Projects a set of 3D object points onto an image plane of the camera by a given extrinsic camera matrix. More...
 
VectorT2< T > projectToImageDampedIF (const HomogenousMatrixT4< T > &iFlippedExtrinsic, const VectorT3< T > &objectPoint, const bool distortImagePoint, const T dampingFactor=T(1), const T zoom=T(1)) const
 Projects a 3D object point to the 2D image plane of the camera by a given inverse extrinsic camera matrix. More...
 
BoxT2< T > projectToImageDampedIF (const HomogenousMatrixT4< T > &iFlippedExtrinsic, const BoxT3< T > &objectBox, const bool distortImagePoint, const T dampingFactor=T(1), const T zoom=T(1)) const
 Projects a 3D box to the 2D image plane of the camera by a given inverse extrinsic camera matrix. More...
 
TriangleT2< T > projectToImageDampedIF (const HomogenousMatrixT4< T > &iFlippedExtrinsic, const TriangleT3< T > &objectTriangle, const bool distortImagePoint, const T dampingFactor=T(1), const T zoom=T(1)) const
 Projects a 3D triangle to the 2D image plane of the camera by a given inverse extrinsic camera matrix. More...
 
void projectToImageDampedIF (const HomogenousMatrixT4< T > &invertedFlippedExtrinsic, const VectorT3< T > *objectPoints, const size_t numberObjectPoints, const bool distortImagePoints, VectorT2< T > *imagePoints, const T dampingFactor=T(1), const T zoom=T(1)) const
 Projects a set of 3D object points onto an image plane of the camera by a given inverse extrinsic camera matrix. More...
 
VectorT3< T > vector (const VectorT2< T > &position, const bool makeUnitVector=true) const
 Returns a normalized vector (with length 1) starting at the camera's center and intersecting a given 2D point on the image plane. More...
 
VectorT3< T > vector (const VectorT2< T > &position, const T zoom, const bool makeUnitVector=true) const
 Returns a normalized vector (with length 1) starting at the camera's center and intersecting a given 2D point on the image plane. More...
 
VectorT3< T > vectorToPlane (const VectorT2< T > &position, const T distance) const
 Returns a vector starting at the camera's center and intersecting a given 2D point on the image plane. More...
 
VectorT3< T > vectorToPlane (const VectorT2< T > &position, const T distance, const T zoom) const
 Returns a vector starting at the camera's center and intersecting a given 2D point on the image plane. More...
 
VectorT3< T > vectorIF (const VectorT2< T > &position, const bool makeUnitVector=true) const
 Returns a normalized vector (with length 1) starting at the camera's center and intersecting a given 2D point on the image plane. More...
 
VectorT3< T > vectorIF (const VectorT2< T > &position, const T zoom, const bool makeUnitVector) const
 Returns a normalized vector (with length 1) starting at the camera's center and intersecting a given 2D point on the image plane. More...
 
LineT3< T > ray (const VectorT2< T > &position, const HomogenousMatrixT4< T > &world_T_camera, const T zoom=T(1)) const
 Returns a ray starting at the camera's center and intersection a given 2D point on the image plane. More...
 
LineT3< T > ray (const VectorT2< T > &position, const VectorT3< T > &world_t_camera, const QuaternionT< T > &world_Q_camera, const T zoom=T(1)) const
 Returns a ray starting at the camera's center and intersection a given 2D point on the image plane. More...
 
SquareMatrixT4< T > frustumMatrix (const T nearDistance, const T farDistance) const
 Returns the 4x4 frustum projection matrix corresponding to this camera. More...
 
HomogenousMatrixT4< T > transformationMatrixIF (const HomogenousMatrixT4< T > &iFlippedExtrinsic, const T zoom=T(1)) const
 Returns a 4x4 homogenous transformation matrix (corresponding to a 3x4 matrix) that covers an extrinsic (inverted and flipped) camera matrix and the intrinsic projection matrix of this camera object. More...
 
bool isEqual (const PinholeCameraT< T > &camera, const T eps=NumericT< T >::eps()) const
 Returns whether two camera profiles are identical up to a given epsilon. More...
 
template<typename U , bool tUseDistortionParameters>
void pointJacobian2x3IF (const VectorT3< U > &flippedCameraObjectPoint, U *jx, U *jy) const
 Calculates the 2x3 jacobian matrix for the 3D object point projection into the camera frame. More...
 
bool isValid () const
 Returns whether this camera is valid. More...
 
bool operator== (const PinholeCameraT< T > &camera) const
 Returns whether two camera objects are identical up to a small epsilon. More...
 
bool operator!= (const PinholeCameraT< T > &camera) const
 Returns whether two camera objects are not identical up to a small epsilon. More...
 
 operator bool () const
 Returns whether the camera holds valid parameters. More...
 

Private Member Functions

void calculateInverseIntrinsic ()
 Determines the inverse of the intrinsic camera matrix. More...
 
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > distortNormalized (const VectorT2< T > &undistortedNormalized, const T invZoom) const
 Returns the distorted position of a given undistorted normalized position. More...
 
VectorT2< T > distortNormalizedDamped (const VectorT2< T > &undistortedNormalized, const T dampingFactor, const T invZoom) const
 Returns the distorted position of a given undistorted normalized position. More...
 
VectorT2< T > dampedNormalized (const VectorT2< T > &normalized, const T dampingFactor, const T invZoom) const
 Determines the damped normalized coordinate for a given normalized coordinate. More...
 
VectorT2< T > dampedNormalized (const VectorT2< T > &normalized, const T dampingFactor, const T leftNormalizedBorder, const T rightNormalizedBorder, const T topNormalizedBorder, const T bottomNormalizedBorder) const
 Determines the damped normalized coordinate for a given normalized coordinate. More...
 

Private Attributes

SquareMatrixT3< T > intrinsics_ = SquareMatrixT3<T>(false)
 Intrinsic camera matrix. More...
 
SquareMatrixT3< T > invertedIntrinsics_ = SquareMatrixT3<T>(false)
 Inverted intrinsic camera matrix. More...
 
unsigned int width_ = 0u
 Width of the camera image (in pixels). More...
 
unsigned int height_ = 0u
 Height of the camera image (in pixels). More...
 
DistortionPair radialDistortion_ = DistortionPair(T(0), T(0))
 Pair of radial distortion parameters for r^2 and r^4. More...
 
DistortionPair tangentialDistortion_ = DistortionPair(T(0), T(0))
 Pair of tangential distortion parameters. More...
 

Friends

template<typename U >
class PinholeCameraT
 

Additional Inherited Members

- Static Public Member Functions inherited from Ocean::CameraT< T >
static T fovX2Y (const T fovX, const T aspectRatio)
 Calculates the vertical FOV from the horizontal FOV and the aspect ratio of the camera image. More...
 
static T fovY2X (const T fovY, const T aspectRatio)
 Calculates the horizontal FOV from the vertical FOV and the aspect ratio of the camera image. More...
 
static T fieldOfViewToFocalLength (const unsigned int width, const T fovX)
 Converts field of view (and width) to the corresponding focal length. More...
 
static VectorT2< T > objectPoint2normalizedImagePoint (const HomogenousMatrixT4< T > &extrinsic, const VectorT3< T > &objectPoint)
 Calculates the normalized image point (the normalized projected object point) for a of given object point with corresponding extrinsic camera matrix. More...
 
static VectorT2< T > objectPoint2normalizedImagePointIF (const HomogenousMatrixT4< T > &iFlippedExtrinsic, const VectorT3< T > &objectPoint)
 Calculates the normalized image point (the normalized projected object point) for a given object point with corresponding inverse and flipped extrinsic camera matrix. More...
 
static void objectPoints2normalizedImagePoints (const HomogenousMatrixT4< T > &extrinsic, const VectorT3< T > *objectPoints, const size_t numberObjectPoints, VectorT2< T > *normalizedImagePoints)
 Calculates the normalized image points (the normalized projected object points) for a set of given object points with corresponding extrinsic camera matrix. More...
 
static void objectPoints2normalizedImagePointsIF (const HomogenousMatrixT4< T > &iFlippedExtrinsic, const VectorT3< T > *objectPoints, const size_t numberObjectPoints, VectorT2< T > *normalizedImagePoints)
 Calculates the normalized image points (the normalized projected object points) for a set of given object points with corresponding inverse and flipped extrinsic camera matrix. More...
 
template<typename U = T>
static SquareMatrixT3< U > flipMatrix3 ()
 Returns the 3x3 transformation matrix flipping a transformation around the x-axis by 180 deg. More...
 
template<typename U = T>
static HomogenousMatrixT4< U > flipMatrix4 ()
 Returns the 4x4 transformation matrix flipping a transformation around the x-axis by 180 deg. More...
 
template<typename U = T>
static QuaternionT< U > flipQuaternion ()
 Returns the quaternion flipping a rotation around the x-axis by 180 deg. More...
 
template<typename U >
static HomogenousMatrixT4< U > flippedTransformationLeftSide (const HomogenousMatrixT4< U > &left_T_right)
 Flips a transformation matrix around the x-axis by 180 degree. More...
 
template<typename U >
static HomogenousMatrixT4< U > flippedTransformationRightSide (const HomogenousMatrixT4< U > &left_T_right)
 Flips a transformation matrix around the x-axis by 180 degree. More...
 
template<typename U >
static HomogenousMatrixT4< U > flippedTransformationLeftAndRightSide (const HomogenousMatrixT4< U > &left_T_right)
 Flips a transformation matrix around the x-axis by 180 degree. More...
 
template<typename U >
static SquareMatrixT3< U > flippedTransformationLeftSide (const SquareMatrixT3< U > &left_R_right)
 Flips a 3x3 rotation matrix around the x-axis by 180 degree. More...
 
template<typename U >
static SquareMatrixT3< U > flippedTransformationRightSide (const SquareMatrixT3< U > &left_R_right)
 Flips a 3x3 rotation matrix around the x-axis by 180 degree. More...
 
template<typename U >
static SquareMatrixT3< U > flippedTransformationLeftAndRightSide (const SquareMatrixT3< U > &left_R_right)
 Flips a 3x3 rotation matrix around the x-axis by 180 degree. More...
 
template<typename U >
static QuaternionT< U > flippedTransformationLeftSide (const QuaternionT< U > &left_Q_right)
 Flips a quaternion around the x-axis by 180 degree. More...
 
template<typename U >
static QuaternionT< U > flippedTransformationRightSide (const QuaternionT< U > &left_Q_right)
 Flips a quaternion around the x-axis by 180 degree. More...
 
template<typename U >
static QuaternionT< U > flippedTransformationLeftAndRightSide (const QuaternionT< U > &left_Q_right)
 Flips a quaternion around the x-axis by 180 degree. More...
 
template<typename U >
static HomogenousMatrixT4< U > standard2InvertedFlipped (const HomogenousMatrixT4< U > &world_T_camera)
 Transforms a standard homogenous 4x4 viewing (extrinsic camera) matrix into an inverted and flipped camera pose. More...
 
template<typename U >
static HomogenousMatricesT4< U > standard2InvertedFlipped (const HomogenousMatrixT4< U > *world_T_cameras, const size_t number)
 Transforms standard homogenous 4x4 viewing (extrinsic camera) matrices into an inverted and flipped camera matrices. More...
 
template<typename U >
static void standard2InvertedFlipped (const HomogenousMatrixT4< U > *world_T_cameras, HomogenousMatrixT4< U > *flippedCameras_T_world, const size_t number)
 Transforms standard homogenous 4x4 viewing (extrinsic camera) matrices into an inverted and flipped camera matrices. More...
 
template<typename U >
static HomogenousMatricesT4< U > standard2InvertedFlipped (const HomogenousMatricesT4< U > &world_T_cameras)
 Transforms standard homogenous 4x4 viewing (extrinsic camera) matrices into an inverted and flipped camera matrices. More...
 
template<typename U >
static SquareMatrixT3< U > standard2InvertedFlipped (const SquareMatrixT3< U > &world_R_camera)
 Transforms a standard 3x3 rotation matrix into an inverted and flipped rotation matrix. More...
 
template<typename U >
static QuaternionT< U > standard2InvertedFlipped (const QuaternionT< U > &world_Q_camera)
 Transforms a standard rotation quaternion into an inverted and flipped rotation quaternion. More...
 
template<typename U >
static HomogenousMatrixT4< U > invertedFlipped2Standard (const HomogenousMatrixT4< U > &flippedCamera_T_world)
 Transforms an inverted and flipped camera pose into a standard camera pose. More...
 
template<typename U >
static HomogenousMatricesT4< U > invertedFlipped2Standard (const HomogenousMatrixT4< U > *flippedCameras_T_world, const size_t number)
 Transforms inverted and flipped camera matrices into standard viewing (extrinsic camera) matrices. More...
 
template<typename U >
static void invertedFlipped2Standard (const HomogenousMatrixT4< U > *flippedCameras_T_world, HomogenousMatrixT4< U > *world_T_cameras, const size_t number)
 Transforms inverted and flipped camera matrices into standard viewing (extrinsic camera) matrices. More...
 
template<typename U >
static HomogenousMatricesT4< U > invertedFlipped2Standard (const HomogenousMatricesT4< U > &flippedCameras_T_world)
 Transforms inverted and flipped camera matrices into standard viewing (extrinsic camera) matrices. More...
 
template<typename U >
static SquareMatrixT3< U > invertedFlipped2Standard (const SquareMatrixT3< U > &flippedCamera_R_world)
 Transforms an inverted and flipped rotation matrix into a standard viewing rotation matrix. More...
 
template<typename U >
static QuaternionT< U > invertedFlipped2Standard (const QuaternionT< U > &flippedCamera_Q_world)
 Transforms an inverted and flipped rotation quaternion into a standard viewing rotation quaternion. More...
 
static bool isObjectPointInFrontIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &objectPoint, const T epsilon=NumericT< T >::eps())
 Determines whether a given 3D object point lies in front of a camera while the location of the camera is defined by a 6-DOF pose. More...
 
static bool isObjectPointInFrontIF (const SquareMatrixT3< T > &flippedCamera_R_world, const VectorT3< T > &objectPoint, const T epsilon=NumericT< T >::eps())
 Determines whether a given 3D object point lies in front of a camera while the location of the camera is defined by a 3-DOF orientation. More...
 

Detailed Description

template<typename T>
class Ocean::PinholeCameraT< T >

Definition of a pinhole camera model.


The class holds the intrinsic and distortion parameters of a camera.

The camera holds:
1) Width and height of the camera image.
2) Intrinsic camera matrix:
| Fx  0 mx |
|  0 Fy my |
|  0  0  1 |
with mx and my as principal point,
and with Fx = f / sx, Fy = f / sy, with focus f and pixel sizes sx and sy.
3) Two radial distortion parameters k1, and k2 for r^2 and r^4:
4) Two tangential distortion parameters p1 and p2.
An distortion free (undistorted) image point is transformed to the corresponding distorted image position as follows:
x' = x + x * (k1 * r^2 + k2 * r^4) + p1 * 2 * x * y + p2 * (r^2 + 2 * x^2),
y' = y + y * (k1 * r^2 + k2 * r^4) + p2 * 2 * x * y + p1 * (r^2 + 2 * y^2).
With: Undistorted and normalized image coordinates (x, y) and distorted and normalized image coordinates (x', y'),
r^2 is defined by: r^2 = (x^2 + y^2), while r^4 = (x^2 + y^2)^2.
The normalized image coordinate is obtained from a 3D object point by application of the perspective division.
Normalized image coordinates may be transformed into the pixel coordinate system by applying the focal length and the principal point.

This class provides several distort, undistort or projection functions of image points or object points.
Points lying outside the camera frame, may be distorted or undistorted due to the given position or due to the nearest position lying on the camera frame's border.
The larger the distance to the principal point of the camera, the more irregular the un-/distortion of the distortion model of this camera.

Template Parameters
TThe data type of a scalar, 'float' or 'double'

Member Typedef Documentation

◆ DistortionPair

template<typename T >
typedef std::pair<T, T> Ocean::PinholeCameraT< T >::DistortionPair

Definition of a pair of distortion values.

◆ TScalar

template<typename T >
typedef T Ocean::PinholeCameraT< T >::TScalar

The scalar data type of this object.

Member Enumeration Documentation

◆ OptimizationStrategy

template<typename T >
enum Ocean::PinholeCameraT::OptimizationStrategy

Definition of individual optimization strategies for camera parameters.

Enumerator
OS_NONE 

No optimization.

OS_FOCAL_LENGTH 

Optimization of one focal length parameter (the same/identical parameter for horizontal and vertical focal length).

OS_FOCAL_LENGTHS 

Optimization of two focal length parameters: Horizontal focal length and vertical focal length.

OS_INTRINSIC_PARAMETERS 

Optimization of the four (basic) intrinsic camera parameters: Horizontal focal length, vertical focal length, horizontal principal point, vertical principal point.

OS_FOCAL_LENGTHS_DISTORTION 

Optimization of six parameters: Horizontal focal length, vertical focal length, two radial distortion parameters, two tangential distortion parameters.

OS_SYMMETRIC_INTRINSIC_PARAMETERS_DISTORTIONS 

Optimization of all camera parameters while the horizontal and vertical focal length parameter is identical.

OS_INTRINSIC_PARAMETERS_DISTORTIONS 

Optimization of all 8 intrinsic camera parameters including the distortion parameters: (2x focal length, 2x principal point, 2x radial distortion, 2x tangential distortion).

OS_DISTORTION 

Optimization of four distortion parameters: Two radial distortion parameters, two tangential distortion parameters.

OS_INTRINSIC_PARAMETERS_RADIAL_DISTORTION 

Optimization of four (basic) intrinsic camera parameters: Horizontal focal length, vertical focal length, horizontal principal point, vertical principal point and two radial distortion parameters.

Constructor & Destructor Documentation

◆ PinholeCameraT() [1/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( )
default

Standard constructor.

Creates a new PinholeCameraT<T> object with all internal parameters as zero. The resulting camera object is invalid.

◆ PinholeCameraT() [2/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const unsigned int  width,
const unsigned int  height,
const PinholeCameraT< T > &  camera 
)

Creates a new camera object with specified frame dimension and intrinsic camera parameters best matching to a given reference camera profile with different frame dimension.

Beware: The dimension aspect ratio between the new camera and the given reference camera profile should be almost similar.

Parameters
widthThe width of the camera dimension in pixel, with range [1, infinity)
heightThe height of the camera dimension in pixel, with range [1, infinity)
cameraThe camera profile that is used to adopt the intrinsic (and distortion) parameters

◆ PinholeCameraT() [3/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const T  subFrameLeft,
const T  subFrameTop,
const unsigned int  subFrameWidth,
const unsigned int  subFrameHeight,
const PinholeCameraT< T > &  camera 
)

Creates a new sub-frame camera profile based on a camera profile of the entire camera frame.

Parameters
subFrameLeftThe horizontal start position of the sub-frame within the original camera frame, in pixel, with range (-infinity, infinity)
subFrameTopThe vertical start position of the sub-frame within the original camera frame, in pixel, with range (-infinity, infinity)
subFrameWidthThe width of the sub-frame in pixel, with range [1, infinity)
subFrameHeightThe height of the sub-frame in pixel, with range [1, infinity)
cameraThe original camera profile for which a sub-frame camera profile will be created

◆ PinholeCameraT() [4/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const unsigned int  width,
const unsigned int  height,
const T  focalX,
const T  focalY,
const T  principalX,
const T  principalY 
)

Creates a new PinholeCameraT<T> object by it's given intrinsic parameters.

Parameters
widthThe width of the camera image, in pixel, with range [1, infinity)
heightThe height of the camera image, in pixel, with range [1, infinity)
focalXThe focal parameter of the horizontal axis
focalYThe focal parameter of the vertical axis
principalXThe principal point of the horizontal axis (in pixel)
principalYThe principal point of the vertical axis (in pixel)

◆ PinholeCameraT() [5/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const unsigned int  width,
const unsigned int  height,
const T  focalX,
const T  focalY,
const T  principalX,
const T  principalY,
const DistortionPair radial,
const DistortionPair tangential 
)

Creates a new PinholeCameraT<T> object by it's given intrinsic parameters.

Parameters
widthThe width of the camera image, in pixel, with range [1, infinity)
heightThe height of the camera image, in pixel, with range [1, infinity)
focalXThe focal parameter of the horizontal axis
focalYThe focal parameter of the vertical axis
principalXThe principal point of the horizontal axis (in pixel)
principalYThe principal point of the vertical axis (in pixel)
radialThe pair of radial distortion parameter for r^2 and r^4
tangentialThe tangential distortion parameters

◆ PinholeCameraT() [6/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const unsigned int  width,
const unsigned int  height,
const T *  parameters,
const bool  radialDistortion = true,
const bool  tangentialDistortion = true 
)

Creates a new PinholeCameraT<T> object by it's given intrinsic parameters.

Parameters
widthThe width of the camera image, in pixel, with range [1, infinity)
heightThe height of the camera image, in pixel, with range [1, infinity)
parametersThe four to eight intrinsic and distortion parameters of the camera focalLegnthX(), focalLengthY(), principalPointX(), principalPointY(), radialDistortion().first, radialDistortion().second, tangentialDistortion().first, tangentialDistortion().second
radialDistortionTrue, if parameter[4] and parameter[5] exist and store radial distortion parameters, must be 'True' if tangentialDistortion is 'True'
tangentialDistortionTrue, if parameter[6] and parameter[7] exist and store tangential distortion parameters

◆ PinholeCameraT() [7/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const SquareMatrixT3< T > &  intrinsic)
explicit

Creates a new PinholeCameraT<T> object by a given projection matrix with the intrinsic camera parameters.

Parameters
intrinsicThe matrix with intrinsic camera parameter.

◆ PinholeCameraT() [8/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const SquareMatrixT3< T > &  intrinsic,
const unsigned int  width,
const unsigned int  height 
)

Creates a new PinholeCameraT<T> object by the given intrinsic camera matrix and width and height of the camera.

Parameters
intrinsicThe intrinsic camera matrix
widthThe width of the camera image, in pixel, with range [1, infinity)
heightThe height of the camera image, in pixel, with range [1, infinity)

◆ PinholeCameraT() [9/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const SquareMatrixT3< T > &  intrinsic,
const unsigned int  width,
const unsigned int  height,
const DistortionPair radial,
const DistortionPair tangential 
)

Creates a new PinholeCameraT<T> object by the given intrinsic camera matrix, the width and height and the radial distortion parameters.

Parameters
intrinsicThe intrinsic camera matrix
widthThe width of the camera image, in pixel, with range [1, infinity)
heightThe height of the camera image, in pixel, with range [1, infinity)
radialThe radial distortion parameters (r^2 and r^4)
tangentialThe tangential distortion parameters

◆ PinholeCameraT() [10/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const unsigned int  width,
const unsigned int  height,
const T  fovX 
)

Creates a new PinholeCameraT<T> object by the given width, height and field of view of a camera.

This camera has no radial distortion.

Parameters
widthThe width of the camera image, in pixel, with range [1, infinity)
heightThe height of the camera image, in pixel, with range [1, infinity)
fovXThe field of view in x-direction, in radian, with range (0, PI)

◆ PinholeCameraT() [11/12]

template<typename T >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const unsigned int  width,
const unsigned int  height,
const T  fovX,
const T  principalX,
const T  principalY 
)

Creates a new PinholeCameraT<T> object by the given frame dimensions, the ideal field of view, and the camera's principal point.

The provided field of view is expected to be the ideal field of view (if the camera would have a principal point in the perfect center of the image).
This camera has no radial distortion.

Parameters
widthThe width of the camera image, in pixel, with range [1, infinity)
heightThe height of the camera image, in pixel, with range [1, infinity)
fovXThe camera's ideal field of view in x-direction, in radian, with range (0, PI)
principalXThe horizontal principal point within the camera frame, in pixel, with range (-infinity, infinity)
principalYThe vertical principal point within the camera frame, in pixel, with range (-infinity, infinity)

◆ PinholeCameraT() [12/12]

template<typename T >
template<typename U >
Ocean::PinholeCameraT< T >::PinholeCameraT ( const PinholeCameraT< U > &  pinholeCamera,
const bool  copyDistortionParameters = true 
)
inlineexplicit

Copy constructor for a pinhole camera with difference element data type than T.

Parameters
pinholeCameraThe pinhole camera profile to be copied
copyDistortionParametersTrue, to copy the distortion parameters; False, create a new pinhole camera without distortion parameters
Template Parameters
UThe element data type of the given pinhole camera

Member Function Documentation

◆ applyZoomFactor()

template<typename T >
void Ocean::PinholeCameraT< T >::applyZoomFactor ( const T  relativeZoom)

Applies a given (relative) zoom factor which mainly multiplies the focal length parameters by the given factor.

Parameters
relativeZoomThe (realtive) zoom factor to apply, with range (0, infinity)

◆ calculateAngleBetween()

template<typename T >
T Ocean::PinholeCameraT< T >::calculateAngleBetween ( const VectorT2< T > &  first,
const VectorT2< T > &  second 
) const

Returns the viewing angle between two undistorted points on the camera's image plane.

Parameters
firstThe first undistorted point
secondThe second undistorted point
Returns
The viewing angle between the defined points (in radian)
See also
calculateCosBetween().

◆ calculateCosBetween()

template<typename T >
T Ocean::PinholeCameraT< T >::calculateCosBetween ( const VectorT2< T > &  first,
const VectorT2< T > &  second 
) const

Returns the cosine of the viewing angle between two undistorted points on the camera's image plane.

Parameters
firstThe first undistorted point
secondThe second undistorted point
Returns
The cosine of viewing angle between the defined points
See also
calculateAngleBetween().

◆ calculateInverseIntrinsic()

template<typename T >
void Ocean::PinholeCameraT< T >::calculateInverseIntrinsic
inlineprivate

Determines the inverse of the intrinsic camera matrix.

This function must be invoked immediately after the intrinsic matrix has changed.

The calculation is identical to the multiplication between the inverted camera matrix and the position vector.

Inverse camera matrix: | 1/Fx 0 -mx/Fx |
| 0 1/Fy -my/Fy |
| 0 0 1 |

◆ copyElements()

template<typename T >
void Ocean::PinholeCameraT< T >::copyElements ( T *  arrayValues,
const bool  copyRadialDistortion = true,
const bool  copyTangentialDistortion = true 
) const

Copies the elements of this camera to an array with 4 to 8 floating point values.

The resulting values are stored in the following order: focalLegnthX(), focalLengthY(), principalPointX(), principalPointY(), radialDistortion().first, radialDistortion().second, tangentialDistortion().first, tangentialDistortion().second.

Parameters
arrayValuesThe array with 4 to 8 floating point values receiving the camera data
copyRadialDistortionTrue, if the array holds at least 6 elements so that the radial parameters will be copied too, must be 'True' if tangentialDistortion is 'True'
copyTangentialDistortionTrue, if the array holds at least 8 elements so that the tangential parameters will be copied too

◆ dampedNormalized() [1/2]

template<typename T >
VectorT2<T> Ocean::PinholeCameraT< T >::dampedNormalized ( const VectorT2< T > &  normalized,
const T  dampingFactor,
const T  invZoom 
) const
private

Determines the damped normalized coordinate for a given normalized coordinate.

The damping is applied to coordinates outside the camera frame.
The damping has an asymptotic pattern so that a damped coordinate never reaches a boundary (specified by the dampingFactor).

Parameters
normalizedThe normalized coordinate for which the damped coordinate will be calculated
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
invZoomThe optional the inverse zoom factor (1/zoom) of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The damped normalized coordinate

◆ dampedNormalized() [2/2]

template<typename T >
VectorT2<T> Ocean::PinholeCameraT< T >::dampedNormalized ( const VectorT2< T > &  normalized,
const T  dampingFactor,
const T  leftNormalizedBorder,
const T  rightNormalizedBorder,
const T  topNormalizedBorder,
const T  bottomNormalizedBorder 
) const
private

Determines the damped normalized coordinate for a given normalized coordinate.

The damping is applied to coordinates outside the camera frame.
The damping has an asymptotic pattern so that a damped coordinate never reaches a boundary (specified by the dampingFactor).

Parameters
normalizedThe normalized coordinate for which the damped coordinate will be calculated
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
leftNormalizedBorderThe left border of camera frame in normalized coordinates, respecting a possible zoom factor already
rightNormalizedBorderThe right border of the camera frame in normalized coordinates, respecting a possible zoom factor already
topNormalizedBorderThe top border of the camera frame in normalized coordinates, respecting a possible zoom factor already
bottomNormalizedBorderThe bottom border of the camera frame in normalized coordinates, respecting a possible zoom factor already
Returns
The damped normalized coordinate

◆ distort()

template<typename T >
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > Ocean::PinholeCameraT< T >::distort ( const VectorT2< T > &  undistorted) const

Returns the distorted position of a given undistorted position defined in pixel coordinates.


The distorted position is calculated by the usage of the internal distortion parameters of this camera object:

dx = x + x * (k1 * r^2 + k2 * r^4) + p1 * 2 * x * y + p2 * (r^2 + 2 * x^2),
dy = y + y * (k1 * r^2 + k2 * r^4) + p2 * 2 * x * y + p1 * (r^2 + 2 * y^2).

With (dx, dy) the distorted normalized point coordinates, (x, y) the undistorted normalized point coordinates,
and dcx = Fx * dx + mx, dcy = Fy * dy + my the distorted pixel coordinates.

Parameters
undistortedThe undistorted position to be distorted in pixel coordinates
Returns
The resulting distorted position in pixel coordinates
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
undistort().

◆ distortDamped()

template<typename T >
VectorT2<T> Ocean::PinholeCameraT< T >::distortDamped ( const VectorT2< T > &  undistorted,
const T  dampingFactor = T(1),
const T  zoom = T(1) 
) const

Returns the distorted position of a given undistorted position defined in pixel coordinates.


This function applies a damping for the distortion outside the camera frame so that the quadratic and quartic radii do not have such a significant impact.
The damping has an asymptotic pattern and so that distortion is based on normalized coordinates never reaching a specified boundary.
The distorted position is calculated by the usage of the internal distortion parameters of this camera object:

dx = x + x * (k1 * r^2 + k2 * r^4) + p1 * 2 * x * y + p2 * (r^2 + 2 * x^2),
dy = y + y * (k1 * r^2 + k2 * r^4) + p2 * 2 * x * y + p1 * (r^2 + 2 * y^2).

With (dx, dy) the distorted normalized point coordinates, (x, y) the undistorted normalized point coordinates,
and dcx = Fx * dx + mx, dcy = Fy * dy + my the distorted pixel coordinates.

Parameters
undistortedThe undistorted position to be distorted in pixel coordinates
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
zoomThe optional zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The resulting distorted position in pixel coordinates
See also
undistortDamped().

◆ distortNormalized()

template<typename T >
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > Ocean::PinholeCameraT< T >::distortNormalized ( const VectorT2< T > &  undistortedNormalized,
const T  invZoom 
) const
private

Returns the distorted position of a given undistorted normalized position.


The distorted position is calculated by the usage of the internal distortion parameters of this camera object:

x' = x + x * (k1 * r^2 + k2 * r^4) + p1 * 2 * x * y + p2 * (r^2 + 2 * x^2),
y' = y + y * (k1 * r^2 + k2 * r^4) + p2 * 2 * x * y + p1 * (r^2 + 2 * y^2).
Parameters
undistortedNormalizedThe undistorted normalized position to be distorted
invZoomThe optional the inverse zoom factor (1/zoom) of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The resulting distorted normalized position
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
distort().

◆ distortNormalizedDamped()

template<typename T >
VectorT2<T> Ocean::PinholeCameraT< T >::distortNormalizedDamped ( const VectorT2< T > &  undistortedNormalized,
const T  dampingFactor,
const T  invZoom 
) const
private

Returns the distorted position of a given undistorted normalized position.


This function applies a damping for the distortion outside the camera frame so that the quadratic and quartic radii do not have such a significant impact.
The damping has an asymptotic pattern and so that distortion is based on normalized coordinates never reaching a specified boundary.
The distorted position is calculated by the usage of the internal distortion parameters of this camera object:

dx = x + x * (k1 * r^2 + k2 * r^4) + p1 * 2 * x * y + p2 * (r^2 + 2 * x^2),
dy = y + y * (k1 * r^2 + k2 * r^4) + p2 * 2 * x * y + p1 * (r^2 + 2 * y^2).

With (dx, dy) the distorted normalized point coordinates and (x, y) the undistorted normalized point coordinates.

Parameters
undistortedNormalizedThe undistorted normalized position to be distorted
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
invZoomThe optional the inverse zoom factor (1/zoom) of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The resulting distorted normalized position
See also
distortDamped().

◆ focalLengthX()

template<typename T >
T Ocean::PinholeCameraT< T >::focalLengthX
inline

Returns the horizontal focal length parameter.

Returns
The horizontal focal length parameter

◆ focalLengthY()

template<typename T >
T Ocean::PinholeCameraT< T >::focalLengthY
inline

Returns the vertical focal length parameter.

Returns
The vertical focal length parameter

◆ fovDiagonal()

template<typename T >
T Ocean::PinholeCameraT< T >::fovDiagonal ( ) const

Returns the diagonal field of view of the camera.

Returns
The diagonal field of view (in radian), with range (0, PI)

◆ fovX()

template<typename T >
T Ocean::PinholeCameraT< T >::fovX ( ) const

Returns the field of view in x direction of the camera.

The fov is the sum of the left and right part of the camera.

Returns
The field of view (in radian), with range (0, PI)

◆ fovXLeft()

template<typename T >
T Ocean::PinholeCameraT< T >::fovXLeft ( ) const

Returns the left field of view in x direction.

Returns
The left field of view (in radian), with range (-PI, PI), negative if principal point is outside image region

◆ fovXRight()

template<typename T >
T Ocean::PinholeCameraT< T >::fovXRight ( ) const

Returns the right field of view in x direction.

Returns
The right field of view (in radian), with range (-PI, PI), negative if principal point is outside image region

◆ fovY()

template<typename T >
T Ocean::PinholeCameraT< T >::fovY ( ) const

Returns the field of view in x direction of the camera.

The fov is the sum of the top and bottom part of the camera.

Returns
The field of view (in radian), with range (0, PI)

◆ fovYBottom()

template<typename T >
T Ocean::PinholeCameraT< T >::fovYBottom ( ) const

Returns the bottom field of view in y direction.

Returns
The bottom field of view (in radian), with range (-PI, PI), negative if principal point is outside image region

◆ fovYTop()

template<typename T >
T Ocean::PinholeCameraT< T >::fovYTop ( ) const

Returns the top field of view in y direction.

Returns
The top field of view (in radian), with range (-PI, PI), negative if principal point is outside image region

◆ frustumMatrix()

template<typename T >
SquareMatrixT4<T> Ocean::PinholeCameraT< T >::frustumMatrix ( const T  nearDistance,
const T  farDistance 
) const

Returns the 4x4 frustum projection matrix corresponding to this camera.

The frustum matrix is defined to point into negative z axis and does not provide any distortion parameters.

Parameters
nearDistanceThe positive distance to the near clipping plane
farDistanceThe positive distance to the far clipping plane
Returns
The resulting frustum projection matrix

◆ hasDistortionParameters()

template<typename T >
bool Ocean::PinholeCameraT< T >::hasDistortionParameters
inline

Returns whether this camera object has specified distortion parameters.

Returns
True, if so

◆ height()

template<typename T >
unsigned int Ocean::PinholeCameraT< T >::height
inline

Returns the height of the camera image.

Returns
The height of the camera image

◆ imagePoint2normalizedImagePoint()

template<typename T >
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > Ocean::PinholeCameraT< T >::imagePoint2normalizedImagePoint ( const VectorT2< T > &  imagePoint,
const bool  undistortImagePoint 
) const

Calculates the normalized image point corresponding to a given (distorted) image point.

Parameters
imagePointThe image point (that might be distorted)
undistortImagePointTrue, to force the un-distortion of the image point using the distortion parameters of this camera object
Returns
The resulting normalized and (optional undistorted) image point
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position

◆ imagePoint2normalizedImagePointDamped()

template<typename T >
VectorT2< T > Ocean::PinholeCameraT< T >::imagePoint2normalizedImagePointDamped ( const VectorT2< T > &  imagePoint,
const bool  undistortImagePoint 
) const
inline

Calculates the normalized image point corresponding to a given (distorted) image point.

This function applies a damping for the distortion outside the camera frame so that the quadratic and quartic radii do not have such a significant impact.

Parameters
imagePointThe image point (that might be distorted)
undistortImagePointTrue, to force the un-distortion of the image point using the distortion parameters of this camera object
Returns
The resulting normalized and (optional undistorted) image point

◆ intrinsic()

template<typename T >
const SquareMatrixT3< T > & Ocean::PinholeCameraT< T >::intrinsic
inline

Returns the intrinsic camera matrix.

Returns
The intrinsic camera matrix

◆ inverseFocalLengthX()

template<typename T >
T Ocean::PinholeCameraT< T >::inverseFocalLengthX
inline

Returns the inverse horizontal focal length parameter.

Returns
The inverse horizontal focal length parameter

◆ inverseFocalLengthY()

template<typename T >
T Ocean::PinholeCameraT< T >::inverseFocalLengthY
inline

Returns the inverse vertical focal length parameter.

Returns
The inverse vertical focal length parameter

◆ invertedIntrinsic()

template<typename T >
const SquareMatrixT3< T > & Ocean::PinholeCameraT< T >::invertedIntrinsic
inline

Returns the inverted intrinsic camera matrix.

Returns
The inverted intrinsic camera matrix

◆ isDistortionPlausible()

template<typename T >
bool Ocean::PinholeCameraT< T >::isDistortionPlausible ( const T  symmetricFocalLengthRatio = T(1.05),
const T  modelAccuracy = T(0.001),
const T  symmetricDistortionRatio = T(1.08) 
) const

Checks whether the distortion of this camera is plausible.

The check is based on two individual criteria. First, we check whether we can distort and un-distort the corner points of the camera frame to almost the same position in the camera frame.
Second we check whether the distortion is almost symmetric by checking that the distances between the distorted corner points of the camera frame and the (virtual) center of the camera frame are almost identical.

Parameters
symmetricFocalLengthRatioThe symmetric tolerance ratio between the horizontal and vertical focal length values of the camera, with range (1, infinity)
modelAccuracyThe accuracy of the distortion model function, measuring the maximal offset between the distorted position of an undistorted position, in percent of the frame size, with range (0, 1)
symmetricDistortionRatioThe symmetric tolerance ratio between the camera frame's center and the distorted corner positions in percent, with range (1, infinity)
Returns
True, if so

◆ isEqual()

template<typename T >
bool Ocean::PinholeCameraT< T >::isEqual ( const PinholeCameraT< T > &  camera,
const T  eps = NumericT< T >::eps() 
) const

Returns whether two camera profiles are identical up to a given epsilon.

The image resolution must always be identical.

Parameters
cameraThe second camera profile to be used for comparison, can be invalid
epsThe epsilon threshold to be used, with range [0, infinity)
Returns
True, if so

◆ isInside()

template<typename T >
bool Ocean::PinholeCameraT< T >::isInside ( const VectorT2< T > &  imagePoint,
const T  signedBorder = T(0) 
) const
inline

Returns whether a given 2D image point lies inside the camera frame.

Optional an explicit border can be defined to allow points slightly outside the camera image, or further inside the image.
Defined a negative border size to allow image points outside the camera frame, or a positive border size to prevent points within the camera frame but close to the boundary.

Parameters
imagePointThe image point to be checked, must be valid
signedBorderThe optional border increasing or decreasing the rectangle in which the image point must be located, in pixels, with range (-infinity, std::min(width() / 2, height() / 2)
Returns
True, if the image point lies in the ranges [0, width())x[0, height())

◆ isValid()

template<typename T >
bool Ocean::PinholeCameraT< T >::isValid
inline

Returns whether this camera is valid.

Returns
True, if so

◆ normalizedImagePoint2imagePoint()

template<typename T >
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > Ocean::PinholeCameraT< T >::normalizedImagePoint2imagePoint ( const VectorT2< T > &  normalizedImagePoint,
const bool  distortImagePoint 
) const

Calculates the image point corresponding to a given normalized image point.

Parameters
normalizedImagePointThe normalized image point (projected 3D object point without adjustment of focal length and principal point)
distortImagePointTrue, to force the distortion of the normalized image point using the distortion parameters of this camera object
Returns
The resulting image point
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position

◆ normalizedImagePoints2imagePoints()

template<typename T >
template<bool tUseBorderDistortionIfOutside>
void Ocean::PinholeCameraT< T >::normalizedImagePoints2imagePoints ( const VectorT2< T > *  normalizedImagePoints,
const size_t  numberNormalizedImagePoints,
const bool  distortImagePoints,
VectorT2< T > *  imagePoints 
) const

Calculates the image points corresponding to a set of given normalized image points.

Parameters
normalizedImagePointsThe set of normalized image points (projected 3D object points without adjustment of focal length and principal point)
numberNormalizedImagePointsThe number of normalized image points
distortImagePointsTrue, to force the distortion of the normalized image point using the distortion parameters of this camera object
imagePointsThe resulting image points, make sure that enough memory is provided
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position

◆ operator bool()

template<typename T >
Ocean::PinholeCameraT< T >::operator bool
inlineexplicit

Returns whether the camera holds valid parameters.

Returns
True, if so

◆ operator!=()

template<typename T >
bool Ocean::PinholeCameraT< T >::operator!= ( const PinholeCameraT< T > &  camera) const
inline

Returns whether two camera objects are not identical up to a small epsilon.

Parameters
cameraThe second camera object
Returns
True, if so

◆ operator==()

template<typename T >
bool Ocean::PinholeCameraT< T >::operator== ( const PinholeCameraT< T > &  camera) const

Returns whether two camera objects are identical up to a small epsilon.

Parameters
cameraThe second camera object
Returns
True, if so

◆ pointJacobian2x3IF()

template<typename T >
template<typename U , bool tUseDistortionParameters>
void Ocean::PinholeCameraT< T >::pointJacobian2x3IF ( const VectorT3< U > &  flippedCameraObjectPoint,
U *  jx,
U *  jy 
) const
inline

Calculates the 2x3 jacobian matrix for the 3D object point projection into the camera frame.

The resulting jacobian matrix has the following layout:

| dfu / dx, dfu / dy, dfu / dz |
| dfv / dx, dfv / dy, dfv / dz |
with projection function
q = f(p)
q_u = fu(p), q_y = fv(p)
with 2D image point q = (q_u, q_v) and 3D object point p = (x, y, z)
Parameters
flippedCameraObjectPointThe 3D object point defined in relation to the inverted and flipped camera pose (camera looking into the positive z-space with y-axis pointing down).
jxThe resulting first row of the Jacobian matrix, must contain three elements, must be valid
jyThe resulting second row of the Jacobian matrix, must contain three elements, must be valid
Template Parameters
UThe data type of the scalar element either 'float' or 'double'
tUseDistortionParametersTrue, to use the camera profile's distortion parameters when calculating the Jacobian; False, to skip the distortion parameters

◆ principalPoint()

template<typename T >
VectorT2< T > Ocean::PinholeCameraT< T >::principalPoint
inline

Returns the coordinate of the principal point of the camera image in the pixel domain.

Returns
The 2D location of the principal point, with range [0, width)x[0, height)

◆ principalPointX()

template<typename T >
T Ocean::PinholeCameraT< T >::principalPointX
inline

Returns the x-value of the principal point of the camera image in the pixel domain.

Returns
The x-value of the principal point, with range [0, width)

◆ principalPointY()

template<typename T >
T Ocean::PinholeCameraT< T >::principalPointY
inline

Returns the y-value of the principal point of the camera image in the pixel domain.

Returns
The y-value of the principal point, with range [0, height)

◆ projectToImage() [1/5]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
BoxT2< T > Ocean::PinholeCameraT< T >::projectToImage ( const HomogenousMatrixT4< T > &  world_T_camera,
const BoxT3< T > &  worldObjectBox,
const bool  distortImagePoint,
const T  zoom = T(1) 
) const
inline

Projects a 3D box to the 2D image plane of the camera by a given camera pose.

The extrinsic matrix transforms a 3D point given in camera coordinates into 3D world coordinates.
The viewing direction of the camera is along the negative z-axis.
The extrinsic matrix will be flipped and inverted internally.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
world_T_cameraThe pose of the camera, must be valid
worldObjectBoxThe 3D box to project, defined in world, must be valid
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The 2D image box defined inside the camera pixel coordinate system
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
projectToImageIF().

◆ projectToImage() [2/5]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
LineT2< T > Ocean::PinholeCameraT< T >::projectToImage ( const HomogenousMatrixT4< T > &  world_T_camera,
const LineT3< T > &  worldLine,
const bool  distortProjectedLine,
const T  zoom = T(1) 
) const
inline

Projects a 3D line onto an image plane of the camera by a given camera pose.

The extrinsic matrix transforms a 3D point given in camera coordinates into 3D world coordinates.
The viewing direction of the camera is along the negative z-axis.
The extrinsic matrix will be flipped and inverted internally.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
world_T_cameraThe pose of the camera, must be valid
worldLineThe 3D line to be projected, defined in world, with unit length direction
distortProjectedLineTrue, to distort the projected 3D line (a very rough approximation only)
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The projectedLine Resulting projected 2D line, an invalid line is returned if the projection fails
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position

◆ projectToImage() [3/5]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
TriangleT2< T > Ocean::PinholeCameraT< T >::projectToImage ( const HomogenousMatrixT4< T > &  world_T_camera,
const TriangleT3< T > &  worldObjectTriangle,
const bool  distortImagePoint,
const T  zoom = T(1) 
) const
inline

Projects a 3D triangle to the 2D image plane of the camera by a given camera pose.

The extrinsic matrix transforms a 3D point given in camera coordinates into 3D world coordinates.
The viewing direction of the camera is along the negative z-axis.
The extrinsic matrix will be flipped and inverted internally.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
world_T_cameraThe pose of the camera, must be valid
worldObjectTriangleThe 3D triangle to project, defined in world, must be valid
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The 2D image triangle defined inside the camera pixel coordinate system
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
projectToImageIF().

◆ projectToImage() [4/5]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > Ocean::PinholeCameraT< T >::projectToImage ( const HomogenousMatrixT4< T > &  world_T_camera,
const VectorT3< T > &  worldObjectPoint,
const bool  distortImagePoint,
const T  zoom = T(1) 
) const
inline

Projects a 3D object point to the 2D image plane of the camera by a given camera pose.

This function may not apply the distortion parameters if the distortion-free projected image point lies outside the camera image.
The extrinsic matrix transforms a 3D point given in camera coordinates into 3D world coordinates.
The viewing direction of the camera is along the negative z-axis.
The extrinsic matrix will be flipped and inverted internally.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
world_T_cameraThe pose of the camera, must be valid
worldObjectPointThe 3D object point to project, defined in world
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
zoomThe optional zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The imagePoint Resulting 2D image plane point defined inside the camera pixel coordinate system
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
projectToImageIF().

◆ projectToImage() [5/5]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
void Ocean::PinholeCameraT< T >::projectToImage ( const HomogenousMatrixT4< T > &  world_T_camera,
const VectorT3< T > *  worldObjectPoints,
const size_t  numberObjectPoints,
const bool  distortImagePoints,
VectorT2< T > *  imagePoints,
const T  zoom = T(1) 
) const
inline

Projects a set of 3D object points onto an image plane of the camera by a given camera pose.

The extrinsic matrix transforms a 3D point given in camera coordinates into 3D world coordinates.
The viewing direction of the camera is along the negative z-axis.
The extrinsic matrix will be flipped and inverted internally.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
world_T_cameraThe pose of the camera, must be valid
worldObjectPointsThe 3D object points to project, defined in world
numberObjectPointsThe number of object points to project, with range [0, infinity)
distortImagePointsTrue, to force the distortion of the image point using the distortion parameters of this camera object
imagePointsThe resulting image points, make sure that enough memory is provided
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
projectToImageIF().

◆ projectToImageDamped() [1/4]

template<typename T >
BoxT2< T > Ocean::PinholeCameraT< T >::projectToImageDamped ( const HomogenousMatrixT4< T > &  extrinsic,
const BoxT3< T > &  objectBox,
const bool  distortImagePoint,
const T  dampingFactor = T(1),
const T  zoom = T(1) 
) const
inline

Projects a 3D box to the 2D image plane of the camera by a given inverse extrinsic camera matrix.

The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Object points projecting outside the camera frame will be distorted (if desired) by application of a damping factor.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
extrinsicThe extrinsic camera matrix
objectBoxThe 3D box to project
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
zoomThe optional zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The 2D box defined inside the camera pixel coordinate system
See also
projectToImageDampedIF().

◆ projectToImageDamped() [2/4]

template<typename T >
TriangleT2< T > Ocean::PinholeCameraT< T >::projectToImageDamped ( const HomogenousMatrixT4< T > &  extrinsic,
const TriangleT3< T > &  objectTriangle,
const bool  distortImagePoint,
const T  dampingFactor = T(1),
const T  zoom = T(1) 
) const
inline

Projects a 3D triangle to the 2D image plane of the camera by a given extrinsic camera matrix.

The extrinsic matrix transforms a 3D point given in camera coordinates into 3D world coordinates.
The viewing direction of the camera is along the negative z-axis.
The extrinsic matrix will be flipped and inverted internally.
Object points projecting outside the camera frame will be distorted (if desired) by application of a damping factor.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
extrinsicThe extrinsic camera matrix
objectTriangleThe 3D triangle to project
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The 2D image triangle defined inside the camera pixel coordinate system
See also
projectToImageDampedIF().

◆ projectToImageDamped() [3/4]

template<typename T >
VectorT2< T > Ocean::PinholeCameraT< T >::projectToImageDamped ( const HomogenousMatrixT4< T > &  extrinsic,
const VectorT3< T > &  objectPoint,
const bool  distortImagePoint,
const T  dampingFactor = T(1),
const T  zoom = T(1) 
) const
inline

Projects a 3D object point to the 2D image plane of the camera by a given extrinsic camera matrix.

The extrinsic matrix transforms a 3D point given in camera coordinates into 3D world coordinates.
The viewing direction of the camera is along the negative z-axis.
Object points projecting outside the camera frame will be distorted (if desired) by application of a damping factor.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
extrinsicThe extrinsic camera matrix
objectPointThe 3D object point to project
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
zoomThe optional zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The imagePoint Resulting 2D image plane point defined inside the camera pixel coordinate system
See also
projectToImageDampedIF().

◆ projectToImageDamped() [4/4]

template<typename T >
void Ocean::PinholeCameraT< T >::projectToImageDamped ( const HomogenousMatrixT4< T > &  extrinsic,
const VectorT3< T > *  objectPoints,
const size_t  numberObjectPoints,
const bool  distortImagePoints,
VectorT2< T > *  imagePoints,
const T  dampingFactor = T(1),
const T  zoom = T(1) 
) const
inline

Projects a set of 3D object points onto an image plane of the camera by a given extrinsic camera matrix.

The extrinsic matrix transforms a 3D point given in camera coordinates into 3D world coordinates.
The viewing direction of the camera is along the negative z-axis.
The extrinsic matrix will be flipped and inverted internally.
Object points projecting outside the camera frame will be distorted (if desired) by application of a damping factor.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
extrinsicThe extrinsic camera matrix
objectPointsThe set of 3D object points to project
numberObjectPointsThe number of object points to project
distortImagePointsTrue, to force the distortion of the image point using the distortion parameters of this camera object
imagePointsThe resulting image points, make sure that enough memory is provided
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
See also
projectToImageIF().

◆ projectToImageDampedIF() [1/4]

template<typename T >
BoxT2<T> Ocean::PinholeCameraT< T >::projectToImageDampedIF ( const HomogenousMatrixT4< T > &  iFlippedExtrinsic,
const BoxT3< T > &  objectBox,
const bool  distortImagePoint,
const T  dampingFactor = T(1),
const T  zoom = T(1) 
) const

Projects a 3D box to the 2D image plane of the camera by a given inverse extrinsic camera matrix.

The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Object points projecting outside the camera frame will be distorted (if desired) by application of a damping factor.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
iFlippedExtrinsicThe inverted and flipped extrinsic camera matrix
objectBoxThe 3D box to project
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
zoomThe optional zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The 2D box defined inside the camera pixel coordinate system
See also
projectToImageDamped().

◆ projectToImageDampedIF() [2/4]

template<typename T >
TriangleT2<T> Ocean::PinholeCameraT< T >::projectToImageDampedIF ( const HomogenousMatrixT4< T > &  iFlippedExtrinsic,
const TriangleT3< T > &  objectTriangle,
const bool  distortImagePoint,
const T  dampingFactor = T(1),
const T  zoom = T(1) 
) const

Projects a 3D triangle to the 2D image plane of the camera by a given inverse extrinsic camera matrix.

The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Object points projecting outside the camera frame will be distorted (if desired) by application of a damping factor.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
iFlippedExtrinsicThe inverted and flipped extrinsic camera matrix
objectTriangleThe 3D triangle to project
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The 2D triangle defined inside the camera pixel coordinate system
See also
projectToImageDamped().

◆ projectToImageDampedIF() [3/4]

template<typename T >
VectorT2<T> Ocean::PinholeCameraT< T >::projectToImageDampedIF ( const HomogenousMatrixT4< T > &  iFlippedExtrinsic,
const VectorT3< T > &  objectPoint,
const bool  distortImagePoint,
const T  dampingFactor = T(1),
const T  zoom = T(1) 
) const

Projects a 3D object point to the 2D image plane of the camera by a given inverse extrinsic camera matrix.

The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Object points projecting outside the camera frame will be distorted (if desired) by application of a damping factor.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
iFlippedExtrinsicThe inverted and flipped extrinsic camera matrix
objectPointThe 3D object point to project
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
zoomThe optional zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The resulting 2D image plane point defined inside the camera pixel coordinate system
See also
projectToImageDamped().

◆ projectToImageDampedIF() [4/4]

template<typename T >
void Ocean::PinholeCameraT< T >::projectToImageDampedIF ( const HomogenousMatrixT4< T > &  invertedFlippedExtrinsic,
const VectorT3< T > *  objectPoints,
const size_t  numberObjectPoints,
const bool  distortImagePoints,
VectorT2< T > *  imagePoints,
const T  dampingFactor = T(1),
const T  zoom = T(1) 
) const

Projects a set of 3D object points onto an image plane of the camera by a given inverse extrinsic camera matrix.

The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Object points projecting outside the camera frame will be distorted (if desired) by application of a damping factor.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
invertedFlippedExtrinsicThe inverted and flipped extrinsic camera matrix
objectPointsThe set of 3D object points to project
numberObjectPointsThe number of object points to project
distortImagePointsTrue, to force the distortion of the image point using the distortion parameters of this camera object
imagePointsThe resulting image points, make sure that enough memory is provided
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
See also
projectToImageDamped().

◆ projectToImageIF() [1/7]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
BoxT2< T > Ocean::PinholeCameraT< T >::projectToImageIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const BoxT3< T > &  worldObjectBox,
const bool  distortImagePoint,
const T  zoom = T(1) 
) const

Projects a 3D box to the 2D image plane of the camera by a given inverse camera pose.

The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
flippedCamera_T_worldThe inverted and flipped extrinsic camera matrix, must be valid
worldObjectBoxThe 3D box to project, defined in world, must be valid
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The 2D box defined inside the camera pixel coordinate system
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
projectToImage().

◆ projectToImageIF() [2/7]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
LineT2< T > Ocean::PinholeCameraT< T >::projectToImageIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const LineT3< T > &  worldLine,
const bool  distortProjectedLine,
const T  zoom = T(1) 
) const

Projects a 3D line onto an image plane of the camera by a given inverse camera pose.

The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
flippedCamera_T_worldThe inverted and flipped extrinsic camera matrix, must be valid
worldLineThe 3D line to be projected, with unit length direction, defined in world, must be valid
distortProjectedLineTrue, to distort the projected 3D line (a very rough approximation only)
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The projectedLine Resulting projected 2D line, an invalid line is returned if the projection fails
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position

◆ projectToImageIF() [3/7]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
TriangleT2< T > Ocean::PinholeCameraT< T >::projectToImageIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const TriangleT3< T > &  worldObjectTriangle,
const bool  distortImagePoint,
const T  zoom = T(1) 
) const

Projects a 3D triangle to the 2D image plane of the camera by a given extrinsic camera pose.

The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
flippedCamera_T_worldThe inverted and flipped extrinsic camera matrix, must be valid
worldObjectTriangleThe 3D triangle to project, defined in world, must be valid
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The 2D triangle defined inside the camera pixel coordinate system
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
projectToImage().

◆ projectToImageIF() [4/7]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > Ocean::PinholeCameraT< T >::projectToImageIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const VectorT3< T > &  objectPoint,
const bool  distortImagePoint,
const T  zoom = T(1) 
) const

Projects a 3D object point to the 2D image plane of the camera by a given inverse camera pose.

This function may not apply the distortion parameters if the (default) projected image point lies outside the camera image.
The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
flippedCamera_T_worldThe inverted and flipped extrinsic camera matrix, must be valid
objectPointThe 3D object point to project
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
zoomThe optional zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The imagePoint Resulting 2D image plane point defined inside the camera pixel coordinate system
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
projectToImage().

◆ projectToImageIF() [5/7]

template<typename T >
template<bool tDistortImagePoint, bool tUseBorderDistortionIfOutside>
VectorT2< T > Ocean::PinholeCameraT< T >::projectToImageIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const VectorT3< T > &  worldObjectPoint,
const T  zoom = T(1) 
) const
inline

Projects a 3D object point to the 2D image plane of the camera by a given inverse camera pose.

The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
flippedCamera_T_worldThe inverted and flipped extrinsic camera matrix, must be valid
worldObjectPointThe 3D object point to project, defined in world
zoomThe optional zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The 2D image plane point defined inside the camera pixel coordinate system
Template Parameters
tDistortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
projectToImage().

◆ projectToImageIF() [6/7]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
void Ocean::PinholeCameraT< T >::projectToImageIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const VectorT3< T > *  worldObjectPoints,
const size_t  numberObjectPoints,
const bool  distortImagePoints,
VectorT2< T > *  imagePoints,
const T  zoom = T(1) 
) const

Projects a set of 3D object points onto an image plane of the camera by a given inverse camera pose.

The inverse extrinsic matrix transforms a 3D point given in world coordinates into 3D camera coordinates.
The coordinate system of the camera is flipped meaning that the viewing direction is along the positive z-axis.
The flipped coordinate system can be received by a rotation around the x-axis by 180 degree.
Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
flippedCamera_T_worldThe inverted and flipped extrinsic camera matrix, must be valid
worldObjectPointsThe 3D object points to project, defined in world
numberObjectPointsThe number of object points to project, with range [0, infinity)
distortImagePointsTrue, to force the distortion of the image point using the distortion parameters of this camera object
imagePointsThe resulting image points, make sure that enough memory is provided
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
projectToImage().

◆ projectToImageIF() [7/7]

template<typename T >
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > Ocean::PinholeCameraT< T >::projectToImageIF ( const VectorT2< T > &  normalizedObjectPoint,
const bool  distortImagePoint,
const T  zoom = T(1) 
) const

Transforms a normalized object point (a 3D object point transformed by the inverted and flipped extrinsic camera matrix) into the camera pixel coordinate system.

Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
normalizedObjectPointThe 2D normalized object point of a 3D object point
distortImagePointTrue, to force the distortion of the image point using the distortion parameters of this camera object
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The 2D image plane point defined inside the camera pixel coordinate system
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
projectToImage().

◆ radialDistortion()

template<typename T >
const PinholeCameraT< T >::DistortionPair & Ocean::PinholeCameraT< T >::radialDistortion
inline

Returns the pair of radial distortion parameters.

Returns
The radial distortion parameters for r^2 and r^4

◆ ray() [1/2]

template<typename T >
LineT3< T > Ocean::PinholeCameraT< T >::ray ( const VectorT2< T > &  position,
const HomogenousMatrixT4< T > &  world_T_camera,
const T  zoom = T(1) 
) const
inline

Returns a ray starting at the camera's center and intersection a given 2D point on the image plane.

Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
positionThe 2D position on the image plane, specified in the pixel domain
world_T_cameraThe pose of the camera, the extrinsic camera matrix, must be valid
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The specified ray for a camera pointing towards the negative z-space
See also
vector().

◆ ray() [2/2]

template<typename T >
LineT3< T > Ocean::PinholeCameraT< T >::ray ( const VectorT2< T > &  position,
const VectorT3< T > &  world_t_camera,
const QuaternionT< T > &  world_Q_camera,
const T  zoom = T(1) 
) const
inline

Returns a ray starting at the camera's center and intersection a given 2D point on the image plane.

Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
positionThe 2D position on the image plane, specified in the pixel domain
world_t_cameraThe translation (position) of the camera pose
world_Q_cameraThe standard rotation quaternion of the camera pose, must be valid
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The specified ray for a camera pointing towards the negative z-space
See also
vector().

◆ rotation()

template<typename T >
bool Ocean::PinholeCameraT< T >::rotation ( const VectorT2< T > &  undistortedPosition,
T &  angleX,
T &  angleY 
) const

Gets two rotation parameters of the viewing ray for a given undistorted 2D position in the camera image.

Parameters
undistortedPositionThe undistorted 2D position [in pixel]
angleXThe horizontal angle for the viewing ray [in radian]
angleYThe vertical angle for the viewing ray [in radian]
Returns
True, if succeeded

◆ setIntrinsic()

template<typename T >
bool Ocean::PinholeCameraT< T >::setIntrinsic ( const SquareMatrixT3< T > &  intrinsic)

Sets the intrinsic camera matrix.

Parameters
intrinsicThe intrinsic camera matrix
Returns
True, if the camera matrix is valid

◆ setRadialDistortion()

template<typename T >
void Ocean::PinholeCameraT< T >::setRadialDistortion ( const DistortionPair radial)
inline

Sets the radial distortion parameters.

Parameters
radialThe pair of radial distortion parameters for r^2 and r^4

◆ setTangentialDistortion()

template<typename T >
void Ocean::PinholeCameraT< T >::setTangentialDistortion ( const DistortionPair tangential)
inline

Sets the tangential distortion parameters.

Parameters
tangentialThe pair of tangential distortion parameters

◆ tangentialDistortion()

template<typename T >
const PinholeCameraT< T >::DistortionPair & Ocean::PinholeCameraT< T >::tangentialDistortion
inline

Returns the pair of tangential distortion parameters.

Returns
The tangential distortion parameters

◆ transformationMatrixIF()

template<typename T >
HomogenousMatrixT4< T > Ocean::PinholeCameraT< T >::transformationMatrixIF ( const HomogenousMatrixT4< T > &  iFlippedExtrinsic,
const T  zoom = T(1) 
) const
inline

Returns a 4x4 homogenous transformation matrix (corresponding to a 3x4 matrix) that covers an extrinsic (inverted and flipped) camera matrix and the intrinsic projection matrix of this camera object.

Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
iFlippedExtrinsicThe inverted and flipped extrinsic camera matrix
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The resulting transformation matrix

◆ undistort()

template<typename T >
template<bool tUseBorderDistortionIfOutside>
VectorT2< T > Ocean::PinholeCameraT< T >::undistort ( const VectorT2< T > &  distorted,
const unsigned int  iterations = 10u,
const T  zoom = T(1) 
) const

Returns the undistorted position of a given distorted position defined in pixel coordinates.


Beware: As the camera distortion model can not be inverted numerically, there is no guarantee that a given point can be undistorted for any given camera profile.

Parameters
distortedThe distorted pixel position to be undistorted
iterationsThe number of iterative calculations, with range [1, 100]
zoomThe optional zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The resulting undistorted pixel position
Template Parameters
tUseBorderDistortionIfOutsideTrue, to apply the distortion from the nearest point lying on the frame border if the point lies outside the visible camera area; False to apply the distortion from the given position
See also
distort().

◆ undistortDamped()

template<typename T >
VectorT2<T> Ocean::PinholeCameraT< T >::undistortDamped ( const VectorT2< T > &  distorted,
const T  dampingFactor = T(1),
const unsigned int  iterations = 10u,
const T  zoom = T(1) 
) const

Returns the undistorted position of a given distorted position defined in pixel coordinates.


Beware: As the camera distortion model can not be inverted numerically, there is no guarantee that a given point can be undistorted for any given camera profile. This function applies a damping for the distortion outside the camera frame so that the quadratic and quartic radii do not have such a significant impact.

Parameters
distortedThe distorted pixel position to be undistorted
dampingFactorThe factor defining the boundary of the asymptotic damping behavior for normalized coordinates, with range [0, infinity)
iterationsThe number of iterative calculations, with range [1, 100]
zoomThe optional zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The resulting undistorted pixel position
See also
distortDamped().

◆ vector() [1/2]

template<typename T >
VectorT3< T > Ocean::PinholeCameraT< T >::vector ( const VectorT2< T > &  position,
const bool  makeUnitVector = true 
) const
inline

Returns a normalized vector (with length 1) starting at the camera's center and intersecting a given 2D point on the image plane.

Parameters
positionThe 2D position on the image plane, specified in the pixel domain
makeUnitVectorTrue, to return a vector with length 1; False, to return a vector with any length
Returns
The normalized vector with -Z direction
See also
vectorIF(), ray().

Ray determination: with object point (X, Y, Z) and image point (x, y, z) -> (x', y')

x = Fx * X + mx * Z y = Fy * Y + my * Z z = Z

x' = x / z = (Fx * X) / Z + mx y' = y / z = (Fy * Y) / Z + my

Inverse calculation: (x' - mx) / Fx = X / Z (y' - my) / Fy = Y / Z

Using a distance of Z:= 1 results in: X = (x' - mx) / Fx Y = (y' - my) / Fy

The calculation is identical to the multiplication between the inverted camera matrix and the position vector.

Inverse camera matrix: | 1/Fx 0 -mx/Fx |
| 0 1/Fy -my/Fy |
| 0 0 1 |

◆ vector() [2/2]

template<typename T >
VectorT3< T > Ocean::PinholeCameraT< T >::vector ( const VectorT2< T > &  position,
const T  zoom,
const bool  makeUnitVector = true 
) const
inline

Returns a normalized vector (with length 1) starting at the camera's center and intersecting a given 2D point on the image plane.

Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
positionThe 2D position on the image plane, specified in the pixel domain
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
makeUnitVectorTrue, to return a vector with length 1; False, to return a vector with any length
Returns
The normalized vector with -Z direction
See also
vectorIF(), ray().

Ray determination: with object point (X, Y, Z), zoom s, and image point (x, y, z) -> (x', y')

x = s * Fx * X + mx * Z y = s * Fy * Y + my * Z z = Z

x' = x / z = (s * Fx * X) / Z + mx y' = y / z = (s * Fy * Y) / Z + my

Inverse calculation: (x' - mx) / (s * Fx) = X / Z (y' - my) / (s * Fy) = Y / Z

Using a distance of Z:= 1 results in: X = (x' - mx) / (s * Fx) Y = (y' - my) / (s * Fy)

The calculation is identical to the multiplication between the inverted camera matrix and the position vector.

Inverse camera matrix: | 1/(s Fx) 0 -mx/(s Fx) |
| 0 1/(s Fy) -my/(s Fy) |
| 0 0 1 |

◆ vectorIF() [1/2]

template<typename T >
VectorT3< T > Ocean::PinholeCameraT< T >::vectorIF ( const VectorT2< T > &  position,
const bool  makeUnitVector = true 
) const
inline

Returns a normalized vector (with length 1) starting at the camera's center and intersecting a given 2D point on the image plane.

Parameters
positionThe 2D position on the image plane, specified in the pixel domain
makeUnitVectorTrue, to return a vector with length 1; False, to return a vector with any length
Returns
The normalized vector with +Z direction

◆ vectorIF() [2/2]

template<typename T >
VectorT3< T > Ocean::PinholeCameraT< T >::vectorIF ( const VectorT2< T > &  position,
const T  zoom,
const bool  makeUnitVector 
) const
inline

Returns a normalized vector (with length 1) starting at the camera's center and intersecting a given 2D point on the image plane.

Further this function can apply a specific zoom to the intrinsic camera matrix.

Parameters
positionThe 2D position on the image plane, specified in the pixel domain
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
makeUnitVectorTrue, to return a vector with length 1; False, to return a vector with any length
Returns
The normalized vector with +Z direction

◆ vectorToPlane() [1/2]

template<typename T >
VectorT3< T > Ocean::PinholeCameraT< T >::vectorToPlane ( const VectorT2< T > &  position,
const T  distance 
) const
inline

Returns a vector starting at the camera's center and intersecting a given 2D point on the image plane.

The length of the vector is determined so that the vector (exactly) reaches a plane parallel to the image plane.
The plane's normal is parallel to the z-axis while a positive distance locates the plane in the space of the negative z-axis.

Parameters
positionThe 2D position on the image plane, specified in the pixel domain
distanceThe distance between the camera's center and the plane parallel to the image plane, with range (0, infinity)
Returns
The normalized vector with -Z direction

Ray determination: with object point (X, Y, Z) and image point (x, y, z) -> (x / z, y / z, 1) -> (x', y')

x = Fx * X + mx * Z y = Fy * Y + my * Z z = Z

x' = x / z = (Fx * X) / Z + mx y' = y / z = (Fy * Y) / Z + my

Inverse calculation: (x' - mx) / Fx = X / Z (y' - my) / Fy = Y / Z

◆ vectorToPlane() [2/2]

template<typename T >
VectorT3< T > Ocean::PinholeCameraT< T >::vectorToPlane ( const VectorT2< T > &  position,
const T  distance,
const T  zoom 
) const
inline

Returns a vector starting at the camera's center and intersecting a given 2D point on the image plane.

Further this function can apply a specific zoom to the intrinsic camera matrix.
The length of the vector is determined so that the vector (exactly) reaches a plane parallel to the image plane.
The plane's normal is parallel to the z-axis while a positive distance locates the plane in the space of the negative z-axis.

Parameters
positionThe 2D position on the image plane, specified in the pixel domain
distanceThe distance between the camera's center and the plane parallel to the image plane, with range (0, infinity)
zoomThe zoom factor of the camera, with range (0, infinity), with 1 the default zoom factor
Returns
The normalized vector with -Z direction

Ray determination: with object point (X, Y, Z) and image point (x, y, z) -> (x / z, y / z, 1) -> (x', y')

x = Fx * X + mx * Z y = Fy * Y + my * Z z = Z

x' = x / z = (Fx * X) / Z + mx y' = y / z = (Fy * Y) / Z + my

Inverse calculation: (x' - mx) / Fx = X / Z (y' - my) / Fy = Y / Z

◆ width()

template<typename T >
unsigned int Ocean::PinholeCameraT< T >::width
inline

Returns the width of the camera image.

Returns
The width of the camera image

Friends And Related Function Documentation

◆ PinholeCameraT

template<typename T >
template<typename U >
friend class PinholeCameraT
friend

Field Documentation

◆ height_

template<typename T >
unsigned int Ocean::PinholeCameraT< T >::height_ = 0u
private

Height of the camera image (in pixels).

◆ intrinsics_

template<typename T >
SquareMatrixT3<T> Ocean::PinholeCameraT< T >::intrinsics_ = SquareMatrixT3<T>(false)
private

Intrinsic camera matrix.

◆ invertedIntrinsics_

template<typename T >
SquareMatrixT3<T> Ocean::PinholeCameraT< T >::invertedIntrinsics_ = SquareMatrixT3<T>(false)
private

Inverted intrinsic camera matrix.

◆ radialDistortion_

template<typename T >
DistortionPair Ocean::PinholeCameraT< T >::radialDistortion_ = DistortionPair(T(0), T(0))
private

Pair of radial distortion parameters for r^2 and r^4.

◆ tangentialDistortion_

template<typename T >
DistortionPair Ocean::PinholeCameraT< T >::tangentialDistortion_ = DistortionPair(T(0), T(0))
private

Pair of tangential distortion parameters.

◆ width_

template<typename T >
unsigned int Ocean::PinholeCameraT< T >::width_ = 0u
private

Width of the camera image (in pixels).


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