Ocean
Loading...
Searching...
No Matches
Ocean::Geometry::GravityConstraintsT< T > Class Template Reference

This class implements a container allowing to define gravity constraints during e.g., camera poses estimation or optimization. More...

#include <GravityConstraints.h>

Public Member Functions

 GravityConstraintsT ()=default
 Creates a default constraint object with invalid parameters.
 
 GravityConstraintsT (const VectorT3< T > &cameraGravityInCamera, const VectorT3< T > &worldGravityInWorld=VectorT3< T >(0, -1, 0), const T weightFactor=T(1), const T maximalAngle=NumericT< T >::deg2rad(5))
 Creates a new gravity constraints object for one camera for which the gravity vector is known (in the camera coordinate system).
 
 GravityConstraintsT (VectorsT3< T > &&cameraGravityInCameras, const VectorT3< T > &worldGravityInWorld=VectorT3< T >(0, -1, 0), const T weightFactor=T(1), const T maximalAngle=NumericT< T >::deg2rad(5))
 Creates a new gravity constraints object for several cameras for which the gravity vectors are known (in the camera coordinate system).
 
 GravityConstraintsT (const HomogenousMatrixT4< T > &world_T_camera, const VectorT3< T > &worldGravityInWorld=VectorT3< T >(0, -1, 0), const T weightFactor=T(1), const T maximalAngle=NumericT< T >::deg2rad(5))
 Creates a new gravity constraints object for one camera for which the precise camera pose is known.
 
 GravityConstraintsT (const HomogenousMatricesT4< T > &world_T_cameras, const VectorT3< T > &worldGravityInWorld=VectorT3< T >(0, -1, 0), const T weightFactor=T(1), const T maximalAngle=NumericT< T >::deg2rad(5))
 Creates a new gravity constraints object for several cameras for which the precise camera poses are known.
 
 GravityConstraintsT (const GravityConstraintsT< T > &constraints, const size_t cameraIndex)
 Creates a new gravity constraints object for a single camera from a given constraints object with several cameras.
 
 GravityConstraintsT (const GravityConstraintsT< T > *constraints, const size_t cameraIndex)
 Creates a new gravity constraints object for a single camera from a given constraints object with several cameras.
 
const VectorT3< T > & cameraGravityInCamera (const size_t cameraIndex=0) const
 Returns the camera gravity vector (which is known for a camera pose), defined in the camera coordinate system, with default camera pointing towards the negative z-space and y-axis pointing upwards.
 
VectorT3< T > cameraGravityInFlippedCamera (const size_t cameraIndex=0) const
 Returns the camera gravity vector (which is known for a camera pose), defined in the flipped camera coordinate system, with default flipped camera pointing towards the positive z-axis and y-axis pointing downwards.
 
VectorT3< T > cameraGravityInWorld (const QuaternionT< T > &world_Q_camera, const size_t cameraIndex=0) const
 Returns the camera gravity vector (which is known for a camera pose), defined in the world coordinate system.
 
VectorT3< T > cameraGravityInWorld (const HomogenousMatrixT4< T > &world_T_camera, const size_t cameraIndex=0) const
 Returns the camera gravity vector (which is known for a camera pose), defined in the world coordinate system.
 
const GravitiescameraGravitiesInCamera () const
 Returns the camera gravity vectors (which are known for one or several camera poses) defined in the camera coordinate system, with default camera pointing towards the negative z-space and y-axis pointing upwards.
 
const VectorT3< T > & worldGravityInWorld () const
 Returns the world gravity vector defined in the world coordinate system.
 
VectorT3< T > worldGravityInFlippedCameraIF (const QuaternionT< T > &flippedCamera_Q_world) const
 Returns the world gravity vector defined in the flipped camera coordinate system, with default flipped camera pointing towards the positive z-axis and y-axis pointing downwards.
 
VectorT3< T > worldGravityInFlippedCameraIF (const HomogenousMatrixT4< T > &flippedCamera_T_world) const
 Returns the world gravity vector defined in the flipped camera coordinate system, with default flipped camera pointing towards the positive z-axis and y-axis pointing downwards.
 
QuaternionT< T > world_R_camera (const size_t cameraIndex) const
 Returns one possible rotation between camera and world.
 
QuaternionT< T > camera_R_world (const size_t cameraIndex) const
 Returns one possible rotation between world and camera.
 
QuaternionT< T > flippedCamera_R_world (const size_t cameraIndex) const
 Returns one possible rotation between world and the flipped camera.
 
weightFactor () const
 Returns the weight factor to be used during a non-linear optimization of a camera pose; 0 to skip any gravity correction, 1 to apply a normal/default gravity correction, larger values to apply a stronger gravity correction.
 
maximalAngle () const
 Returns the maximal angle between world and camera gravity vectors (when converted into the same coordinate system), can be used e.g., when the camera pose is determined e.g., with RANSAC or a PnP algorithm.
 
minimalAngleCos () const
 Returns the cosine value of maximalAngle().
 
size_t numberCameras () const
 Returns the number of cameras for which gravity constraints are defined.
 
alignmentCosine (const QuaternionT< T > &world_Q_camera, const size_t cameraIndex=0) const
 Returns the cosine between the world gravity vector and the camera gravity vector (after converting into the same coordinate system).
 
alignmentCosine (const HomogenousMatrixT4< T > &world_T_camera, const size_t cameraIndex=0) const
 Returns the cosine between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.
 
alignmentCosineIF (const QuaternionT< T > &flippedCamera_Q_world, const size_t cameraIndex=0) const
 Returns the cosine between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.
 
alignmentCosineIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const size_t cameraIndex=0) const
 Returns the cosine between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.
 
alignmentAngle (const QuaternionT< T > &world_Q_camera, const size_t cameraIndex=0) const
 Returns the angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.
 
alignmentAngle (const HomogenousMatrixT4< T > &world_T_camera, const size_t cameraIndex=0) const
 Returns the angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.
 
alignmentAngleIF (const QuaternionT< T > &flippedCamera_Q_world, const size_t cameraIndex=0) const
 Returns the angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.
 
alignmentAngleIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const size_t cameraIndex=0) const
 Returns the angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.
 
bool isCameraAlignedWithGravity (const QuaternionT< T > &world_Q_camera, const size_t cameraIndex=0) const
 Returns whether a camera pose is aligned with the gravity constraints using the specified angle threshold.
 
bool isCameraAlignedWithGravity (const HomogenousMatrixT4< T > &world_T_camera, const size_t cameraIndex=0) const
 Returns whether a camera pose is aligned with the gravity constraints using the specified angle threshold.
 
bool isCameraAlignedWithGravityIF (const QuaternionT< T > &flippedCamera_Q_world, const size_t cameraIndex=0) const
 Returns whether a provided flipped and inverted camera pose is aligned with the gravity constraints using the specified angle threshold.
 
bool isCameraAlignedWithGravityIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const size_t cameraIndex=0) const
 Returns whether a provided flipped and inverted camera pose is aligned with the gravity constraints using the specified angle threshold.
 
bool isCameraAlignedWithGravity (const QuaternionT< T > &world_Q_camera, const size_t cameraIndex, const T maxAngle) const
 Returns whether a camera pose is aligned with the gravity constraints using a custom angle threshold.
 
bool isCameraAlignedWithGravity (const HomogenousMatrixT4< T > &world_T_camera, const size_t cameraIndex, const T maxAngle) const
 Returns whether a camera pose is aligned with the gravity constraints using a custom angle threshold.
 
bool isCameraAlignedWithGravityIF (const QuaternionT< T > &flippedCamera_Q_world, const size_t cameraIndex, const T maxAngle) const
 Returns whether a provided flipped and inverted camera pose is aligned with the gravity constraints using a custom angle threshold.
 
bool isCameraAlignedWithGravityIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const size_t cameraIndex, const T maxAngle) const
 Returns whether a provided flipped and inverted camera pose is aligned with the gravity constraints using a custom angle threshold.
 
HomogenousMatrixT4< T > alignCameraWithGravity (const HomogenousMatrixT4< T > &world_T_camera, const size_t cameraIndex=0) const
 Rotates a camera pose so that the camera is aligned with the gravity constraints.
 
HomogenousMatrixT4< T > alignCameraWithGravityIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const size_t cameraIndex=0) const
 Rotates a inverted and flipped camera pose so that the flipped camera is aligned with the gravity constraints.
 
const GravityConstraintsT< T > * conditionalPointer (const bool pointerIfValid=true) const
 Returns the pointer to this gravity constraints object if it is valid.
 
bool isValid () const
 Returns whether this constraint object holds valid parameters.
 

Static Public Member Functions

static VectorT3< T > cameraGravityInCamera (const QuaternionT< T > &camera_Q_world, const VectorT3< T > &worldGravityInWorld)
 Helper function returning the camera gravity vector in the camera coordinate system based on a given camera pose and the world gravity vector.
 
static VectorT3< T > cameraGravityInCamera (const HomogenousMatrixT4< T > &camera_T_world, const VectorT3< T > &worldGravityInWorld)
 Helper function returning the camera gravity vector in the camera coordinate system based on a given camera pose and the world gravity vector.
 
static VectorT3< T > cameraGravityInCameraIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &worldGravityInWorld)
 Helper function returning the camera gravity vector in the camera coordinate system based on a given camera pose and the world gravity vector.
 
static VectorT3< T > cameraGravityInFlippedCameraIF (const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &worldGravityInWorld)
 Helper function returning the camera gravity vector in the flipped camera coordinate system based on a given camera pose and the world gravity vector.
 

Protected Types

using Gravities = StackHeapVector< VectorT3< T >, 2 >
 Definition of a vector holding gravity vectors.
 

Protected Attributes

Gravities cameraGravityInCameras_
 The gravity vectors which are known for one or more camera poses, defined in the camera coordinate system, with default camera pointing towards the negative z-space and y-axis pointing upwards.
 
VectorT3< T > worldGravityInWorld_ = VectorT3<T>(0, -1, 0)
 The world gravity vector defined in the world coordinate system, mainly defining how the world coordinate system is oriented/aligned wrt gravity.
 
weightFactor_ = T(-1)
 The weight factor to be used during a non-linear optimization of a camera pose; 0 to skip any gravity correction, 1 to apply a full gravity correction; with range [0, 1).
 
maximalAngle_ = T(-1)
 The maximal angle between world and camera gravity vectors (when converted into the same coordinate system), can be used e.g., when the camera pose is determined e.g., with RANSAC or a PnP algorithm, in radian, with range [0, PI/2).
 
minimalAngleCos_ = T(-1)
 The cosine value of maximalAngle(), with range [0, 1].
 

Detailed Description

template<typename T>
class Ocean::Geometry::GravityConstraintsT< T >

This class implements a container allowing to define gravity constraints during e.g., camera poses estimation or optimization.

The constraint is defined by a gravity vector defined in the world coordinate system (e.g., VectorT3<T>(0, -1, 0) for a gravity vector pointing towards the earth, in case the y-axis is pointing towards the sky).
Further, the constraints define a gravity vector for each camera, defined in the camera coordinate system, with default camera pointing towards the negative z-space and y-axis pointing upwards.
The camera gravity vector(s) may be provided by a IMU sensor.
All gravity vectors must be normalized (must be unit vectors).

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

Member Typedef Documentation

◆ Gravities

template<typename T >
using Ocean::Geometry::GravityConstraintsT< T >::Gravities = StackHeapVector<VectorT3<T>, 2>
protected

Definition of a vector holding gravity vectors.

Constructor & Destructor Documentation

◆ GravityConstraintsT() [1/7]

template<typename T >
Ocean::Geometry::GravityConstraintsT< T >::GravityConstraintsT ( )
default

Creates a default constraint object with invalid parameters.

◆ GravityConstraintsT() [2/7]

template<typename T >
Ocean::Geometry::GravityConstraintsT< T >::GravityConstraintsT ( const VectorT3< T > &  cameraGravityInCamera,
const VectorT3< T > &  worldGravityInWorld = VectorT3<T>(0, -1, 0),
const T  weightFactor = T(1),
const T  maximalAngle = NumericT<T>::deg2rad(5) 
)
inlineexplicit

Creates a new gravity constraints object for one camera for which the gravity vector is known (in the camera coordinate system).

Parameters
gravityInCameraThe camera gravity vector (which is known for a camera pose), defined in the camera coordinate system, with default camera pointing towards the negative z-space and y-axis pointing upwards.
worldGravityInWorldThe world gravity vector in the world coordinate system, mainly defining how the world coordinate system is oriented/aligned wrt gravity
weightFactorThe weight factor to be used during a non-linear optimization of a camera pose; 0 to skip any gravity correction, 1 to apply a normal/default gravity correction, larger values to apply a stronger gravity correction, with range [0, infinity)
maximalAngleThe maximal angle between world and camera gravity vector (when converted into the same coordinate system), can be used e.g., when the camera pose is determined e.g., with RANSAC or a PnP algorithm, in radian, with range [0, PI/2).

◆ GravityConstraintsT() [3/7]

template<typename T >
Ocean::Geometry::GravityConstraintsT< T >::GravityConstraintsT ( VectorsT3< T > &&  cameraGravityInCameras,
const VectorT3< T > &  worldGravityInWorld = VectorT3<T>(0, -1, 0),
const T  weightFactor = T(1),
const T  maximalAngle = NumericT<T>::deg2rad(5) 
)
inlineexplicit

Creates a new gravity constraints object for several cameras for which the gravity vectors are known (in the camera coordinate system).

Parameters
gravityInCamerasThe camera gravity vectors (which are known for several camera poses), defined in the camera coordinate system, with default camera pointing towards the negative z-space and y-axis pointing upwards.
worldGravityInWorldThe world gravity vector in the world coordinate system, mainly defining how the world coordinate system is oriented/aligned wrt gravity
weightFactorThe weight factor to be used during a non-linear optimization of a camera pose; 0 to skip any gravity correction, 1 to apply a normal/default gravity correction, larger values to apply a stronger gravity correction, with range [0, infinity)
maximalAngleThe maximal angle between world and camera gravity vectors (when converted into the same coordinate system), can be used e.g., when the camera pose is determined e.g., with RANSAC or a PnP algorithm, in radian, with range [0, PI/2).

◆ GravityConstraintsT() [4/7]

template<typename T >
Ocean::Geometry::GravityConstraintsT< T >::GravityConstraintsT ( const HomogenousMatrixT4< T > &  world_T_camera,
const VectorT3< T > &  worldGravityInWorld = VectorT3<T>(0, -1, 0),
const T  weightFactor = T(1),
const T  maximalAngle = NumericT<T>::deg2rad(5) 
)
inlineexplicit

Creates a new gravity constraints object for one camera for which the precise camera pose is known.

The camera gravity vector is determined from the precise camera pose.

Parameters
world_T_cameraThe transformation transforming camera to world, with default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
worldGravityInWorldThe world gravity vector in the world coordinate system, mainly defining how the world coordinate system is oriented/aligned wrt gravity
weightFactorThe weight factor to be used during a non-linear optimization of a camera pose; 0 to skip any gravity correction, 1 to apply a normal/default gravity correction, larger values to apply a stronger gravity correction, with range [0, infinity)
maximalAngleThe maximal angle between world and camera gravity vector (when converted into the same coordinate system), can be used e.g., when the camera pose is determined e.g., with RANSAC or a PnP algorithm, in radian, with range [0, PI/2).

◆ GravityConstraintsT() [5/7]

template<typename T >
Ocean::Geometry::GravityConstraintsT< T >::GravityConstraintsT ( const HomogenousMatricesT4< T > &  world_T_cameras,
const VectorT3< T > &  worldGravityInWorld = VectorT3<T>(0, -1, 0),
const T  weightFactor = T(1),
const T  maximalAngle = NumericT<T>::deg2rad(5) 
)
inlineexplicit

Creates a new gravity constraints object for several cameras for which the precise camera poses are known.

The camera gravity vectors are determined from the precise camera poses.

Parameters
world_T_camerasThe transformations transforming camera to world, with default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
worldGravityInWorldThe world gravity vector in the world coordinate system, mainly defining how the world coordinate system is oriented/aligned wrt gravity
weightFactorThe weight factor to be used during a non-linear optimization of a camera pose; 0 to skip any gravity correction, 1 to apply a normal/default gravity correction, larger values to apply a stronger gravity correction, with range [0, infinity)
maximalAngleThe maximal angle between world and camera gravity vectors (when converted into the same coordinate system), can be used e.g., when the camera pose is determined e.g., with RANSAC or a PnP algorithm, in radian, with range [0, PI/2).

◆ GravityConstraintsT() [6/7]

template<typename T >
Ocean::Geometry::GravityConstraintsT< T >::GravityConstraintsT ( const GravityConstraintsT< T > &  constraints,
const size_t  cameraIndex 
)
inline

Creates a new gravity constraints object for a single camera from a given constraints object with several cameras.

Parameters
constraintsThe constraints object with several cameras, must be valid
cameraIndexThe index of the camera for which the gravity constraint will be extracted, with range [0, constraints.numberCameras() - 1]

◆ GravityConstraintsT() [7/7]

template<typename T >
Ocean::Geometry::GravityConstraintsT< T >::GravityConstraintsT ( const GravityConstraintsT< T > *  constraints,
const size_t  cameraIndex 
)
inline

Creates a new gravity constraints object for a single camera from a given constraints object with several cameras.

The constructor will create an invalid object if the given constraints object is nullptr.

Parameters
constraintsThe constraints object with several cameras, nullptr to create an invalid constraint object, must be valid if not nullptr
cameraIndexThe index of the camera for which the gravity constraint will be extracted, with range [0, constraints.numberCameras() - 1]

Member Function Documentation

◆ alignCameraWithGravity()

template<typename T >
HomogenousMatrixT4< T > Ocean::Geometry::GravityConstraintsT< T >::alignCameraWithGravity ( const HomogenousMatrixT4< T > &  world_T_camera,
const size_t  cameraIndex = 0 
) const

Rotates a camera pose so that the camera is aligned with the gravity constraints.

Parameters
world_T_cameraThe transformation transforming camera to world, with a default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the alignment will be performed, with range [0, numberCameras() - 1]
Returns
The camera pose aligned with the gravity constraints (world_T_alignedCamera)

◆ alignCameraWithGravityIF()

template<typename T >
HomogenousMatrixT4< T > Ocean::Geometry::GravityConstraintsT< T >::alignCameraWithGravityIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const size_t  cameraIndex = 0 
) const

Rotates a inverted and flipped camera pose so that the flipped camera is aligned with the gravity constraints.

Parameters
flippedCamera_T_worldThe transformation transforming world to flipped camera, with a default flipped camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
cameraIndexThe index of the camera for which the alignment will be performed, with range [0, numberCameras() - 1]
Returns
The flipped inverted and flipped camera pose aligned with the gravity constraints (alignedFlippedCamera_T_world)

◆ alignmentAngle() [1/2]

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::alignmentAngle ( const HomogenousMatrixT4< T > &  world_T_camera,
const size_t  cameraIndex = 0 
) const
inline

Returns the angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.

Parameters
world_T_cameraThe transformation transforming camera to world, with a default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the angle will be returned, with range [0, numberCameras() - 1]
Returns
The angle between the world gravity vector and the camera gravity vector, in radian, with range [0, PI]

◆ alignmentAngle() [2/2]

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::alignmentAngle ( const QuaternionT< T > &  world_Q_camera,
const size_t  cameraIndex = 0 
) const
inline

Returns the angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.

Parameters
world_Q_cameraThe rotation rotating camera to world, with a default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the angle will be returned, with range [0, numberCameras() - 1]
Returns
The angle between the world gravity vector and the camera gravity vector, in radian, with range [0, PI]

◆ alignmentAngleIF() [1/2]

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::alignmentAngleIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const size_t  cameraIndex = 0 
) const
inline

Returns the angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.

Parameters
flippedCamera_T_worldThe transformation transforming world to flipped camera, with a default flipped camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
cameraIndexThe index of the camera for which the angle will be returned, with range [0, numberCameras() - 1]
Returns
The angle between the world gravity vector and the camera gravity vector, in radian, with range [0, PI]

◆ alignmentAngleIF() [2/2]

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::alignmentAngleIF ( const QuaternionT< T > &  flippedCamera_Q_world,
const size_t  cameraIndex = 0 
) const
inline

Returns the angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.

Parameters
flippedCamera_Q_worldThe rotation rotating world to flipped camera, with a default flipped camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
cameraIndexThe index of the camera for which the angle will be returned, with range [0, numberCameras() - 1]
Returns
The angle between the world gravity vector and the camera gravity vector, in radian, with range [0, PI]

◆ alignmentCosine() [1/2]

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::alignmentCosine ( const HomogenousMatrixT4< T > &  world_T_camera,
const size_t  cameraIndex = 0 
) const
inline

Returns the cosine between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.

Parameters
world_T_cameraThe transformation transforming camera to world, with a default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the cosine will be returned, with range [0, numberCameras() - 1]
Returns
The cosine of the angle between the world gravity vector and the camera gravity vector, with range [-1, 1]

◆ alignmentCosine() [2/2]

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::alignmentCosine ( const QuaternionT< T > &  world_Q_camera,
const size_t  cameraIndex = 0 
) const
inline

Returns the cosine between the world gravity vector and the camera gravity vector (after converting into the same coordinate system).

Parameters
world_Q_cameraThe rotation rotating camera to world, with a default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the cosine will be returned, with range [0, numberCameras() - 1]
Returns
The cosine of the angle between the world gravity vector and the camera gravity vector, with range [-1, 1]

◆ alignmentCosineIF() [1/2]

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::alignmentCosineIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const size_t  cameraIndex = 0 
) const
inline

Returns the cosine between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.

Parameters
flippedCamera_T_worldThe transformation transforming world to flipped camera, with a default flipped camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
cameraIndexThe index of the camera for which the cosine will be returned, with range [0, numberCameras() - 1]
Returns
The cosine of the angle between the world gravity vector and the camera gravity vector, with range [-1, 1]

◆ alignmentCosineIF() [2/2]

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::alignmentCosineIF ( const QuaternionT< T > &  flippedCamera_Q_world,
const size_t  cameraIndex = 0 
) const
inline

Returns the cosine between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian.

Parameters
flippedCamera_Q_worldThe rotation rotating world to flipped camera, with a default flipped camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
cameraIndexThe index of the camera for which the cosine will be returned, with range [0, numberCameras() - 1]
Returns
The cosine of the angle between the world gravity vector and the camera gravity vector, with range [-1, 1]

◆ camera_R_world()

template<typename T >
QuaternionT< T > Ocean::Geometry::GravityConstraintsT< T >::camera_R_world ( const size_t  cameraIndex) const
inline

Returns one possible rotation between world and camera.

The resulting rotation contains a remaining degree of freedom as the rotation is only based on the corresponding gravity vectors.
Any rotation around the gravity vector would be a valid rotation as well.

Parameters
cameraIndexThe index of the camera for which the rotation will be returned, with range [0, numberCameras() - 1]
Returns
The requested rotation, with default camera pointing towards the negative z-space and y-axis pointing upwards

◆ cameraGravitiesInCamera()

template<typename T >
const GravityConstraintsT< T >::Gravities & Ocean::Geometry::GravityConstraintsT< T >::cameraGravitiesInCamera ( ) const
inline

Returns the camera gravity vectors (which are known for one or several camera poses) defined in the camera coordinate system, with default camera pointing towards the negative z-space and y-axis pointing upwards.

Returns
The known gravity vectors for one or several cameras

◆ cameraGravityInCamera() [1/3]

template<typename T >
VectorT3< T > Ocean::Geometry::GravityConstraintsT< T >::cameraGravityInCamera ( const HomogenousMatrixT4< T > &  camera_T_world,
const VectorT3< T > &  worldGravityInWorld 
)
static

Helper function returning the camera gravity vector in the camera coordinate system based on a given camera pose and the world gravity vector.

The resulting camera gravity vector is obtained by converting the world gravity vector into the camera coordinate system.

Parameters
camera_T_worldThe transformation transforming world to camera, with default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
worldGravityInWorldThe world gravity vector defined in the world coordinate system, must be a unit vector
Returns
The camera gravity vector in the camera coordinate system

◆ cameraGravityInCamera() [2/3]

template<typename T >
VectorT3< T > Ocean::Geometry::GravityConstraintsT< T >::cameraGravityInCamera ( const QuaternionT< T > &  camera_Q_world,
const VectorT3< T > &  worldGravityInWorld 
)
static

Helper function returning the camera gravity vector in the camera coordinate system based on a given camera pose and the world gravity vector.

The resulting camera gravity vector is obtained by converting the world gravity vector into the camera coordinate system.

Parameters
camera_Q_worldThe rotation rotating world to camera, with default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
worldGravityInWorldThe world gravity vector defined in the world coordinate system, must be a unit vector
Returns
The camera gravity vector in the camera coordinate system

◆ cameraGravityInCamera() [3/3]

template<typename T >
const VectorT3< T > & Ocean::Geometry::GravityConstraintsT< T >::cameraGravityInCamera ( const size_t  cameraIndex = 0) const
inline

Returns the camera gravity vector (which is known for a camera pose), defined in the camera coordinate system, with default camera pointing towards the negative z-space and y-axis pointing upwards.

Parameters
cameraIndexThe index of the camera for which the gravity vector is requested, with range [0, numberCameras() - 1]
Returns
The known gravity vector for a specified camera, defined in the camera coordinate system

◆ cameraGravityInCameraIF()

template<typename T >
VectorT3< T > Ocean::Geometry::GravityConstraintsT< T >::cameraGravityInCameraIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const VectorT3< T > &  worldGravityInWorld 
)
static

Helper function returning the camera gravity vector in the camera coordinate system based on a given camera pose and the world gravity vector.

The resulting camera gravity vector is obtained by converting the world gravity vector into the camera coordinate system.,br> This function return the same gravity vector as cameraGravityInCamera(), but uses the flipped camera pose as input parameter.

Parameters
flippedCamera_T_worldThe transformation transforming world to flipped camera, with default camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
worldGravityInWorldThe world gravity vector defined in the world coordinate system, must be a unit vector
Returns
The camera gravity vector in the standard camera coordinate system (not in the flipped camera coordinate system)
See also
cameraGravityInCamera(), cameraGravityInFlippedCameraIF().

◆ cameraGravityInFlippedCamera()

template<typename T >
VectorT3< T > Ocean::Geometry::GravityConstraintsT< T >::cameraGravityInFlippedCamera ( const size_t  cameraIndex = 0) const
inline

Returns the camera gravity vector (which is known for a camera pose), defined in the flipped camera coordinate system, with default flipped camera pointing towards the positive z-axis and y-axis pointing downwards.

Parameters
cameraIndexThe index of the camera for which the gravity vector is requested, with range [0, numberCameras() - 1]
Returns
The known gravity vector for a specified camera, defined in the flipped camera coordinate system

◆ cameraGravityInFlippedCameraIF()

template<typename T >
VectorT3< T > Ocean::Geometry::GravityConstraintsT< T >::cameraGravityInFlippedCameraIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const VectorT3< T > &  worldGravityInWorld 
)
static

Helper function returning the camera gravity vector in the flipped camera coordinate system based on a given camera pose and the world gravity vector.

The resulting camera gravity vector is obtained by converting the world gravity vector into the flipped camera coordinate system.

Parameters
flippedCamera_T_worldThe transformation transforming world to flipped camera, with default camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
worldGravityInWorldThe world gravity vector defined in the world coordinate system, must be a unit vector
Returns
The camera gravity vector in the flipped camera coordinate system

◆ cameraGravityInWorld() [1/2]

template<typename T >
VectorT3< T > Ocean::Geometry::GravityConstraintsT< T >::cameraGravityInWorld ( const HomogenousMatrixT4< T > &  world_T_camera,
const size_t  cameraIndex = 0 
) const
inline

Returns the camera gravity vector (which is known for a camera pose), defined in the world coordinate system.

Parameters
world_T_cameraThe transformation transforming camera to world, with default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the gravity vector is requested, with range [0, numberCameras() - 1]
Returns
The known gravity vector for a specified camera, defined in the world coordinate system

◆ cameraGravityInWorld() [2/2]

template<typename T >
VectorT3< T > Ocean::Geometry::GravityConstraintsT< T >::cameraGravityInWorld ( const QuaternionT< T > &  world_Q_camera,
const size_t  cameraIndex = 0 
) const
inline

Returns the camera gravity vector (which is known for a camera pose), defined in the world coordinate system.

Parameters
world_Q_cameraThe rotation rotating camera to world, with default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the gravity vector is requested, with range [0, numberCameras() - 1]
Returns
The known gravity vector for a specified camera, defined in the world coordinate system

◆ conditionalPointer()

template<typename T >
const GravityConstraintsT< T > * Ocean::Geometry::GravityConstraintsT< T >::conditionalPointer ( const bool  pointerIfValid = true) const
inline

Returns the pointer to this gravity constraints object if it is valid.

Parameters
pointerIfValidTrue, to return a pointer to this object if this object is valid; False, to always return a null pointer
Returns
The pointer to this object if the object holds valid constraints and if 'pointerIfValid == true', nullptr if this object does not hold valid constraints or if 'pointerIfValid == false'

◆ flippedCamera_R_world()

template<typename T >
QuaternionT< T > Ocean::Geometry::GravityConstraintsT< T >::flippedCamera_R_world ( const size_t  cameraIndex) const
inline

Returns one possible rotation between world and the flipped camera.

The resulting rotation contains a remaining degree of freedom as the rotation is only based on the corresponding gravity vectors.
Any rotation around the gravity vector would be a valid rotation as well.

Parameters
cameraIndexThe index of the camera for which the rotation will be returned, with range [0, numberCameras() - 1]
Returns
The requested rotation, with default flipped camera pointing towards the positive z-axis and y-axis pointing downwards

◆ isCameraAlignedWithGravity() [1/4]

template<typename T >
bool Ocean::Geometry::GravityConstraintsT< T >::isCameraAlignedWithGravity ( const HomogenousMatrixT4< T > &  world_T_camera,
const size_t  cameraIndex,
const T  maxAngle 
) const
inline

Returns whether a camera pose is aligned with the gravity constraints using a custom angle threshold.

Parameters
world_T_cameraThe transformation transforming camera to world, with a default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the alignment check will be performed, with range [0, numberCameras() - 1]
maxAngleThe maximal angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian, with range [0, PI/2)
Returns
True, if so

◆ isCameraAlignedWithGravity() [2/4]

template<typename T >
bool Ocean::Geometry::GravityConstraintsT< T >::isCameraAlignedWithGravity ( const HomogenousMatrixT4< T > &  world_T_camera,
const size_t  cameraIndex = 0 
) const
inline

Returns whether a camera pose is aligned with the gravity constraints using the specified angle threshold.

Parameters
world_T_cameraThe transformation transforming camera to world, with a default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the alignment check will be performed, with range [0, numberCameras() - 1]
Returns
True, if so

◆ isCameraAlignedWithGravity() [3/4]

template<typename T >
bool Ocean::Geometry::GravityConstraintsT< T >::isCameraAlignedWithGravity ( const QuaternionT< T > &  world_Q_camera,
const size_t  cameraIndex,
const T  maxAngle 
) const

Returns whether a camera pose is aligned with the gravity constraints using a custom angle threshold.

Parameters
world_Q_cameraThe rotation rotating camera to world, with a default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the alignment check will be performed, with range [0, numberCameras() - 1]
maxAngleThe maximal angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian, with range [0, PI/2)
Returns
True, if so

◆ isCameraAlignedWithGravity() [4/4]

template<typename T >
bool Ocean::Geometry::GravityConstraintsT< T >::isCameraAlignedWithGravity ( const QuaternionT< T > &  world_Q_camera,
const size_t  cameraIndex = 0 
) const

Returns whether a camera pose is aligned with the gravity constraints using the specified angle threshold.

Parameters
world_Q_cameraThe rotation rotating camera to world, with a default camera pointing towards the negative z-space and y-axis pointing upwards, must be valid
cameraIndexThe index of the camera for which the alignment check will be performed, with range [0, numberCameras() - 1]
Returns
True, if so

◆ isCameraAlignedWithGravityIF() [1/4]

template<typename T >
bool Ocean::Geometry::GravityConstraintsT< T >::isCameraAlignedWithGravityIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const size_t  cameraIndex,
const T  maxAngle 
) const
inline

Returns whether a provided flipped and inverted camera pose is aligned with the gravity constraints using a custom angle threshold.

Parameters
flippedCamera_T_worldThe transformation transforming world to flipped camera, with a default flipped camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
cameraIndexThe index of the camera for which the alignment check will be performed, with range [0, numberCameras() - 1]
maxAngleThe maximal angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian, with range [0, PI/2)
Returns
True, if so

◆ isCameraAlignedWithGravityIF() [2/4]

template<typename T >
bool Ocean::Geometry::GravityConstraintsT< T >::isCameraAlignedWithGravityIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world,
const size_t  cameraIndex = 0 
) const
inline

Returns whether a provided flipped and inverted camera pose is aligned with the gravity constraints using the specified angle threshold.

Parameters
flippedCamera_T_worldThe transformation transforming world to flipped camera, with a default flipped camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
cameraIndexThe index of the camera for which the alignment check will be performed, with range [0, numberCameras() - 1]
maxAngleThe maximal angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian, with range [0, PI/2)
Returns
True, if so

◆ isCameraAlignedWithGravityIF() [3/4]

template<typename T >
bool Ocean::Geometry::GravityConstraintsT< T >::isCameraAlignedWithGravityIF ( const QuaternionT< T > &  flippedCamera_Q_world,
const size_t  cameraIndex,
const T  maxAngle 
) const

Returns whether a provided flipped and inverted camera pose is aligned with the gravity constraints using a custom angle threshold.

Parameters
flippedCamera_Q_worldThe rotation rotating world to flipped camera, with a default flipped camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
cameraIndexThe index of the camera for which the alignment check will be performed, with range [0, numberCameras() - 1]
maxAngleThe maximal angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian, with range [0, PI/2)
Returns
True, if so

◆ isCameraAlignedWithGravityIF() [4/4]

template<typename T >
bool Ocean::Geometry::GravityConstraintsT< T >::isCameraAlignedWithGravityIF ( const QuaternionT< T > &  flippedCamera_Q_world,
const size_t  cameraIndex = 0 
) const

Returns whether a provided flipped and inverted camera pose is aligned with the gravity constraints using the specified angle threshold.

Parameters
flippedCamera_Q_worldThe rotation rotating world to flipped camera, with a default flipped camera pointing towards the positive z-space and y-axis pointing downwards, must be valid
cameraIndexThe index of the camera for which the alignment check will be performed, with range [0, numberCameras() - 1]
maxAngleThe maximal angle between the world gravity vector and the camera gravity vector (after converting into the same coordinate system), in radian, with range [0, PI/2)
Returns
True, if so

◆ isValid()

template<typename T >
bool Ocean::Geometry::GravityConstraintsT< T >::isValid ( ) const
inline

Returns whether this constraint object holds valid parameters.

Returns
True, if so

◆ maximalAngle()

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::maximalAngle ( ) const
inline

Returns the maximal angle between world and camera gravity vectors (when converted into the same coordinate system), can be used e.g., when the camera pose is determined e.g., with RANSAC or a PnP algorithm.

Returns
The object's maximal angle, in radian, with range [0, PI/2)

◆ minimalAngleCos()

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::minimalAngleCos ( ) const
inline

Returns the cosine value of maximalAngle().

Returns
The object's minimal angle cosine, with range [0, 1]

◆ numberCameras()

template<typename T >
size_t Ocean::Geometry::GravityConstraintsT< T >::numberCameras ( ) const
inline

Returns the number of cameras for which gravity constraints are defined.

Returns
The number of cameras, with range [1, infinity)

◆ weightFactor()

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::weightFactor ( ) const
inline

Returns the weight factor to be used during a non-linear optimization of a camera pose; 0 to skip any gravity correction, 1 to apply a normal/default gravity correction, larger values to apply a stronger gravity correction.

Returns
The object's weight factor, with range [0, infinity)

◆ world_R_camera()

template<typename T >
QuaternionT< T > Ocean::Geometry::GravityConstraintsT< T >::world_R_camera ( const size_t  cameraIndex) const
inline

Returns one possible rotation between camera and world.

The resulting rotation contains a remaining degree of freedom as the rotation is only based on the corresponding gravity vectors.
Any rotation around the gravity vector would be a valid rotation as well.

Parameters
cameraIndexThe index of the camera for which the rotation will be returned, with range [0, numberCameras() - 1]
Returns
The requested rotation, with default camera pointing towards the negative z-space and y-axis pointing upwards

◆ worldGravityInFlippedCameraIF() [1/2]

template<typename T >
VectorT3< T > Ocean::Geometry::GravityConstraintsT< T >::worldGravityInFlippedCameraIF ( const HomogenousMatrixT4< T > &  flippedCamera_T_world) const
inline

Returns the world gravity vector defined in the flipped camera coordinate system, with default flipped camera pointing towards the positive z-axis and y-axis pointing downwards.

Parameters
flippedCamera_T_worldThe transformation transforming world to flipped camera, must be valid
Returns
The world's gravity vector in flipped camera

◆ worldGravityInFlippedCameraIF() [2/2]

template<typename T >
VectorT3< T > Ocean::Geometry::GravityConstraintsT< T >::worldGravityInFlippedCameraIF ( const QuaternionT< T > &  flippedCamera_Q_world) const
inline

Returns the world gravity vector defined in the flipped camera coordinate system, with default flipped camera pointing towards the positive z-axis and y-axis pointing downwards.

Parameters
flippedCamera_Q_worldThe rotation rotating world to flipped camera, must be valid
Returns
The world's gravity vector in flipped camera

◆ worldGravityInWorld()

template<typename T >
const VectorT3< T > & Ocean::Geometry::GravityConstraintsT< T >::worldGravityInWorld ( ) const
inline

Returns the world gravity vector defined in the world coordinate system.

Returns
The world's gravity vector in world

Field Documentation

◆ cameraGravityInCameras_

template<typename T >
Gravities Ocean::Geometry::GravityConstraintsT< T >::cameraGravityInCameras_
protected

The gravity vectors which are known for one or more camera poses, defined in the camera coordinate system, with default camera pointing towards the negative z-space and y-axis pointing upwards.

◆ maximalAngle_

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::maximalAngle_ = T(-1)
protected

The maximal angle between world and camera gravity vectors (when converted into the same coordinate system), can be used e.g., when the camera pose is determined e.g., with RANSAC or a PnP algorithm, in radian, with range [0, PI/2).

◆ minimalAngleCos_

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::minimalAngleCos_ = T(-1)
protected

The cosine value of maximalAngle(), with range [0, 1].

◆ weightFactor_

template<typename T >
T Ocean::Geometry::GravityConstraintsT< T >::weightFactor_ = T(-1)
protected

The weight factor to be used during a non-linear optimization of a camera pose; 0 to skip any gravity correction, 1 to apply a full gravity correction; with range [0, 1).

◆ worldGravityInWorld_

template<typename T >
VectorT3<T> Ocean::Geometry::GravityConstraintsT< T >::worldGravityInWorld_ = VectorT3<T>(0, -1, 0)
protected

The world gravity vector defined in the world coordinate system, mainly defining how the world coordinate system is oriented/aligned wrt gravity.


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