Image Component Library (ICL)
|
Implementation of the posit algorithm for 6D pose detection from a single camera. More...
#include <Posit.h>
Classes | |
struct | Result |
result type (basically a 4x4 homogeneous transformation matrix) More... | |
Public Member Functions | |
Posit (int maxIterations=100, float minDelta=0.001) | |
creates new posit instance with optionally given termination criterions More... | |
Posit (const std::vector< Vec > &modelPoints, int maxIterations=100, float minDelta=0.001) | |
creates new posit with given model points More... | |
~Posit () | |
Destructor. More... | |
Posit (const Posit &other) | |
Copy constructor (all internal data is simply copied deeply) More... | |
Posit & | operator= (const Posit &other) |
assignment operator (all internal data is simply copied deeply) More... | |
void | setModel (const std::vector< Vec > &modelPoints) |
sets new model points More... | |
void | setMaxIterations (int maxIterations) |
sets the max-iterations termination criterion More... | |
void | setMinDelta (float minDelta) |
sets the min-delta termination criterion More... | |
int | getMaxIterations () const |
returns the current max-iterations termination criterion More... | |
float | getMinDelta () const |
returns the current min-delta termination criterion More... | |
const std::vector< Vec > & | getModel () const |
returns the current model points More... | |
const Result & | findPose (const std::vector< utils::Point32f > &imagePoints, const Camera &cam) |
main function to obtain an objects pose from given image points and camera More... | |
const Result & | findPose (const std::vector< utils::Point32f > &imagePoints, const utils::Point &principlePointOffset, float focalLengthX, float focalLengthY) |
utility wrapper if no whole camera is available More... | |
Private Attributes | |
Data * | data |
internal data storage class More... | |
Implementation of the posit algorithm for 6D pose detection from a single camera.
The POSIT algorithm allows for 6D object pose detection using a single camera. POSIT needs an indexed set of model-points (in the model coordinate frame). In the detection step, also a set of corresponding image coordinates are needed. POSIT runs iteratively to find an optimal object pose.
We implement the 'modern' POSIT algorithm, which internally uses another norm as the 'classic' POSIT algorithm, both can easily be found in literature.
Please note, that POSIT needs non-coplanar model points. If the model points are complanar (or even almost coplanar), pose estimation results are undefined. TODO find heuristik for this or add another algorithm ...
The algorithm is well described in the paper "Model-based object pose in 25 lines of code" written by Dementhon and Davis in 1995
icl::geom::Posit::Posit | ( | int | maxIterations = 100 , |
float | minDelta = 0.001 |
||
) |
creates new posit instance with optionally given termination criterions
icl::geom::Posit::Posit | ( | const std::vector< Vec > & | modelPoints, |
int | maxIterations = 100 , |
||
float | minDelta = 0.001 |
||
) |
creates new posit with given model points
icl::geom::Posit::~Posit | ( | ) |
Destructor.
icl::geom::Posit::Posit | ( | const Posit & | other | ) |
Copy constructor (all internal data is simply copied deeply)
const Result& icl::geom::Posit::findPose | ( | const std::vector< utils::Point32f > & | imagePoints, |
const Camera & | cam | ||
) |
main function to obtain an objects pose from given image points and camera
const Result& icl::geom::Posit::findPose | ( | const std::vector< utils::Point32f > & | imagePoints, |
const utils::Point & | principlePointOffset, | ||
float | focalLengthX, | ||
float | focalLengthY | ||
) |
utility wrapper if no whole camera is available
Please note, that the focal lenghts have to be combined with a cameras x- and y-sampling-resolution in order to get valid focal length values. In other words given focal length have to be relative to an x- and y-sampling-resolution of 1.0. Therefore, the given focal length might sometimes be in range [500,...] event though the used camera has a default focal lenght of e.g. [10-55] mm.
For ICL's icl::Camera type, the focal length values are computed as follows:
However, if you already have an instance of icl::Camera in your code, you can simply use Posit::findPose(const std::vector<utils::Point32f> &, const icl::Camera&), which automatically extracts the correct focal length and principal point offset values from the given icl::Camera instance.
int icl::geom::Posit::getMaxIterations | ( | ) | const |
returns the current max-iterations termination criterion
float icl::geom::Posit::getMinDelta | ( | ) | const |
returns the current min-delta termination criterion
const std::vector<Vec>& icl::geom::Posit::getModel | ( | ) | const |
returns the current model points
assignment operator (all internal data is simply copied deeply)
void icl::geom::Posit::setMaxIterations | ( | int | maxIterations | ) |
sets the max-iterations termination criterion
void icl::geom::Posit::setMinDelta | ( | float | minDelta | ) |
sets the min-delta termination criterion
void icl::geom::Posit::setModel | ( | const std::vector< Vec > & | modelPoints | ) |
sets new model points
|
private |
internal data storage class
internal data storage