Ocean
Ocean::Geometry::P4P Class Reference

This class provides functions determining the camera's pose by a set of four 3D object and 2D image points. More...

Inheritance diagram for Ocean::Geometry::P4P:

Static Public Member Functions

static bool pose (const AnyCamera &camera, const Vector3 *objectPoints, const Vector2 *imagePoints, HomogenousMatrix4 &world_T_camera)
 Calculates the pose of a camera by a set of four image and object points. More...
 

Static Protected Member Functions

static bool calculatePointDistances (const Vector3 *objectPoints, const Vector3 *imageRays, Scalar distances[4])
 Calculates four distances between camera center and the four 3D object points. More...
 
- Static Protected Member Functions inherited from Ocean::Geometry::PerspectivePose
template<typename T >
static bool calculateCosineSolutions (const T x1, const T x1_2, const T cos12, const T d12_2, T &x2a, T &x2b)
 Calculates the two possible solutions for the law of cosines. More...
 
template<typename T >
static T calculateCosineResults (const T x1, const T x1_2, const T x2, const T x2_2, const T cos12, const T d12_2)
 Returns the result of the law of cosines. More...
 

Detailed Description

This class provides functions determining the camera's pose by a set of four 3D object and 2D image points.

Member Function Documentation

◆ calculatePointDistances()

static bool Ocean::Geometry::P4P::calculatePointDistances ( const Vector3 objectPoints,
const Vector3 imageRays,
Scalar  distances[4] 
)
staticprotected

Calculates four distances between camera center and the four 3D object points.

Parameters
objectPointsFour object points, must be valid
imageRaysThree 3D rays with unit length, defined in the coordinate system of the camera, starting at the camera's center of projection (equal to the origin), hitting the image plane at image points corresponding to the 3D object points and pointing towards the object points, each ray corresponds to one 3D object point, must be valid
distancesThe four resulting distances between camera center and each of the four object points
Returns
True, if succeeded

◆ pose()

static bool Ocean::Geometry::P4P::pose ( const AnyCamera camera,
const Vector3 objectPoints,
const Vector2 imagePoints,
HomogenousMatrix4 world_T_camera 
)
static

Calculates the pose of a camera by a set of four image and object points.

Parameters
cameraThe camera profile defining the projection, must be valid
objectPointsFour 3D object points, defined in world, must be valid
imagePointsFour 2D image points, one for each 3D object point, must be valid
world_T_cameraResulting camera pose, with default camera pointing towards the negative z-space, with y-axis upwards
Returns
True, if succeeded

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