C# Class AForge.Math.Geometry.Posit

3D pose estimation algorithm.

The class implements an algorithm for 3D object's pose estimation from it's 2D coordinates obtained by perspective projection, when the object is described none coplanar points. The idea of the implemented math and algorithm is described in "Model-Based Object Pose in 25 Lines of Code" paper written by Daniel F. DeMenthon and Larry S. Davis (the implementation of the algorithm is almost 1 to 1 translation of the pseudo code given by the paper, so should be easy to follow).

At this point the implementation works only with models described by 4 points, which is the minimum number of points enough for 3D pose estimation.

The 4 model's point must not be coplanar, i.e. must not reside all within same planer. See CoplanarPosit for coplanar case.

Read 3D Pose Estimation article for additional information and samples.

Sample usage:

// points of real object - model Vector3[] positObject = new Vector3[4] { new Vector3( 28, 28, -28 ), new Vector3( -28, 28, -28 ), new Vector3( 28, -28, -28 ), new Vector3( 28, 28, 28 ), }; // focal length of camera used to capture the object float focalLength = 640; // depends on your camera or projection system // initialize POSIT object Posit posit = new Posit( positObject, focalLength ); // 2D points of te object - projection AForge.Point[] projectedPoints = new AForge.Point[4] { new AForge.Point( -4, 29 ), new AForge.Point( -180, 86 ), new AForge.Point( -5, -102 ), new AForge.Point( 76, 137 ), }; // estimate pose Matrix3x3 rotationMatrix; Vector3 translationVector; posit.EstimatePose( projectedPoints, out rotationMatrix, out translationVector );
Show file Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Public Methods

Method Description
EstimatePose ( Point points, AForge.Math.Matrix3x3 &rotation, Vector3 &translation ) : void

Estimate pose of a model from it's projected 2D coordinates.

Posit ( Vector3 model, float focalLength ) : System

Initializes a new instance of the Posit class.

Method Details

EstimatePose() public method

Estimate pose of a model from it's projected 2D coordinates.
4 points must be be given for pose estimation.
public EstimatePose ( Point points, AForge.Math.Matrix3x3 &rotation, Vector3 &translation ) : void
points Point 4 2D points of the model's projection.
rotation AForge.Math.Matrix3x3 Gets object's rotation.
translation Vector3 Gets object's translation.
return void

Posit() public method

Initializes a new instance of the Posit class.
The model must have 4 points.
public Posit ( Vector3 model, float focalLength ) : System
model Vector3 Array of vectors containing coordinates of four real model's point (points /// must not be on the same plane).
focalLength float Effective focal length of the camera used to capture the model.
return System