Image Component Library (ICL)
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
icl::geom::CoplanarPointPoseEstimator Class Reference

Utility class that allows for 6D pose estimation from a set of at least 4 coplanar points. More...

#include <CoplanarPointPoseEstimator.h>

Inheritance diagram for icl::geom::CoplanarPointPoseEstimator:
icl::utils::Configurable

Classes

struct  RANSACSpec
 Parameter struct that is used to specify optional RANSAC parameters for the internal pose estimation. More...
 

Public Types

enum  ReferenceFrame { cameraFrame, worldFrame }
 Reference frame enumeration. More...
 
enum  PoseEstimationAlgorithm {
  HomographyBasedOnly, SimplexSampling, SamplingCoarse, SamplingMedium,
  SamplingFine, SamplingCustom
}
 Algorithm, that is used for pose-estimation. More...
 
- Public Types inherited from icl::utils::Configurable
typedef Function< void, const Property & > Callback
 Function type for changed properties. More...
 

Public Member Functions

 CoplanarPointPoseEstimator (ReferenceFrame returnedPosesReferenceFrame=worldFrame, PoseEstimationAlgorithm a=SimplexSampling, const RANSACSpec &spec=RANSACSpec())
 Default constructor with given reference-frame for the returned poses. More...
 
 ~CoplanarPointPoseEstimator ()
 Destructor. More...
 
 CoplanarPointPoseEstimator (const CoplanarPointPoseEstimator &other)
 Copy constructor. More...
 
CoplanarPointPoseEstimatoroperator= (const CoplanarPointPoseEstimator &other)
 Assignment operator. More...
 
ReferenceFrame getReferenceFrame () const
 returns the current reference frame value More...
 
void setReferenceFrame (ReferenceFrame f)
 sets the refernce-frame property More...
 
math::FixedMatrix< float, 4, 4 > getPose (int n, const utils::Point32f *modelPoints, const utils::Point32f *imagePoints, const Camera &cam)
 main working function that estimates the pose from given model- and image points More...
 
- Public Member Functions inherited from icl::utils::Configurable
virtual ~Configurable ()
 virtual destructor More...
 
 Configurable (const Configurable &other)
 Copy constructor. More...
 
Configurableoperator= (const Configurable &other)
 Assignment operator. More...
 
void setConfigurableID (const std::string &ID)
 sets the ID of this configurable More...
 
const std::string & getConfigurableID () const
 returns the configurables static ID More...
 
bool isOrderedFlagSet () const
 returns whether the ordered flag is set More...
 
void deactivateProperty (const std::string &pattern)
 adds an additional deativation pattern More...
 
void deleteDeactivationPattern (const std::string &pattern)
 removed a formerly added deactivation pattern More...
 
std::vector< std::string > getPropertyListWithoutDeactivated () const
 this returns a filtered list of properties (using all filters added by deactivateProperty) More...
 
virtual void adaptProperty (const std::string &name, const std::string &newType, const std::string &newInfo, const std::string &newToolTip)
 this function can be used to adapt a specific property afterwards More...
 
void registerCallback (const Callback &cb)
 add a callback for changed properties More...
 
void removedCallback (const Callback &cb)
 removes a callback that was registered before More...
 
void syncChangesTo (Configurable *others, int num=1)
 this can be used to let this instance also apply property changes to others More...
 
virtual void setPropertyValue (const std::string &propertyName, const Any &value)
 sets a property value More...
 
virtual std::vector< std::string > getPropertyList () const
 returns a list of All properties, that can be set using setProperty More...
 
virtual bool supportsProperty (const std::string &propertyName) const
 base implementation for property check (seaches in the property list) More...
 
virtual void saveProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=EMPTY_VEC) const
 writes all available properties into a file More...
 
virtual void loadProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=EMPTY_VEC)
 reads a camera config file from disc More...
 
virtual std::string getPropertyType (const std::string &propertyName) const
 get type of property More...
 
virtual std::string getPropertyInfo (const std::string &propertyName) const
 get information of a properties valid values More...
 
virtual Any getPropertyValue (const std::string &propertyName) const
 returns the current value of a property or a parameter More...
 
virtual std::string getPropertyToolTip (const std::string &propertyName) const
 returns the tooltip description for a given property More...
 
virtual int getPropertyVolatileness (const std::string &propertyName) const
 Returns whether this property may be changed internally. More...
 

Private Member Functions

void propertyChangedCallback (const Property &p)
 Internally used to sync property settings with internal data. More...
 
void robustPoseCorrection (int n, const utils::Point32f *modelPoints, const utils::Point32f *normalizedImagePoints)
 Internally used to correct the first transformation matrix using robust pose estimation algorithm. More...
 
math::FixedMatrix< float, 4, 4 > getPoseInternal (PoseEstimationAlgorithm a, int n, const utils::Point32f *modelPoints, const utils::Point32f *imagePoints, const utils::Point32f *normalizedImagePoints, const Camera &cam)
 internal utility function More...
 

Private Attributes

Data * data
 Internally used data pointer. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from icl::utils::Configurable
static std::string create_default_ID (const std::string &prefix)
 this function can be used in subclasses to create a default ID More...
 
static Configurableget (const std::string &id)
 returns configurable by given ID More...
 
static void register_configurable_type (const std::string &classname, Function< Configurable * > creator)
 registers a configurable type More...
 
static std::vector< std::string > get_registered_configurables ()
 returns a list of all registered configurable classnames More...
 
static Configurablecreate_configurable (const std::string &classname)
 creates a configurable by given name More...
 
- Static Public Attributes inherited from icl::utils::Configurable
static const std::vector< std::string > EMPTY_VEC
 used as shortcut – just an empty vector of std::strings More...
 
- Protected Member Functions inherited from icl::utils::Configurable
void addProperty (const std::string &name, const std::string &type, const std::string &info, const Any &value=Any(), const int volatileness=0, const std::string &tooltip=std::string())
 This can be used by derived classes to store supported properties in the internal list. More...
 
void addChildConfigurable (Configurable *configurable, const std::string &childPrefix="")
 This adds another configurable as child. More...
 
void removeChildConfigurable (Configurable *configurable)
 removes the given child configurable More...
 
Propertyprop (const std::string &propertyName)
 this CAN be used e.g. to store a property value in internal property-list More...
 
const Propertyprop (const std::string &propertyName) const
 this CAN be used e.g. to store a property value in internal property-list More...
 
 Configurable (const std::string &ID="", bool ordered=true)
 create this configurable with given ID More...
 
void call_callbacks (const std::string &propertyName, const Configurable *caller) const
 calls all registered callbacks More...
 
- Protected Attributes inherited from icl::utils::Configurable
std::vector< Callbackcallbacks
 internally managed list of callbacks More...
 

Detailed Description

Utility class that allows for 6D pose estimation from a set of at least 4 coplanar points.

General Information

In contrast to the POSIT algorithms (see icl::Posit), this class is able to compute the 6D-pose of an object from coplanar points.

Pose Detection Problem

Given at least 4 model-points (which are 2D because of the fact, that they have to be coplanar), where no subset of 3 points is collinear, and a set of corresponding pixel-locations of these points, the pose-estimation problem can be redefined as homography problem.

The Object Coordinate Frame

As all reference points of the object are coplanar, you can define the objects coordinate in that way that all reference points lie within the z=0 plane. As the algorithm uses this as prior knowledge, the CoplanarPointPoseEstimator::getPose interface does allow to pass 2D object reference points only.

Algorithms

We implemented the algorithm from the paper "Pose estimation based on four coplanar point correspondences" written by Yang et. al. and published 2009. Internally, a 9 by 2N matrix A is created. The solution for the pose detection problem is basically achieved by minimizing |Ax| using SVD. Finally, the resulting x can be used to obtain the transformation matrix. We also added one heuristic to the method described in the paper above. As the projection of a plane is ambiguous (you can project from the front and from the back), we always use always use the solution, where the resulting z-value is in front of the camera (Otherwise, we would not be able to see it). Mathematically, this means, that we do not always use x, but sometimes also -x, which obviously leads to the same error |Ax|.

Reference Frames

CoplanarPointPoseEstimator instances can be set up to return the estimated pose w.r.t. the world frame or with respect to the camera frame. If you obtain the pose w.r.t. the camera frame, you have to multiply it with the inverted camera coordinate system transformation matrix.

Integration with ICL's Scene class

In order to use the CoplanarPointPoseEstimator to estimate an objects pose matrix for visualization using an instance of the icl::Scene class, you can simply define an objects base vertices in the object coordinate frame:
e.g. (1,1,1,1), (1, 1,-1,1), ... for a unity cube. For moving these points to their real location in the 3D scene, you simply have to transform these vectors by the obtained 'w.r.t. world frame' transformation matrix.

Benchmarks:

Simple Pose estimation with 4 points needs about 80 ns on an Intel(R) Xeon(R) E5530 (2.40GHz). If 9 points are used, it needs about 110 ns.

Enabling RANSAC

As a new feature, the pose estimation step can be optimized using RANSAC internally. @TODO perhaps, we need some more text here !

Member Enumeration Documentation

◆ PoseEstimationAlgorithm

Algorithm, that is used for pose-estimation.

TODO: describe the algorithms

Enumerator
HomographyBasedOnly 

uses the above described algorithm (Algorithms) only

SimplexSampling 

performs simplex sampling for optimization (very fast and very accurate!

SamplingCoarse 

use some predefined sampling parameters for brute force coase sampling (fast)

SamplingMedium 

use some predefined sampling parameters for brute force medium sampling (average speed)

SamplingFine 

use some predefined sampling parameters for brute force fine sampling (slow)

SamplingCustom 

uses custom properties to define sampling parameters for brute force sampling

◆ ReferenceFrame

Reference frame enumeration.

Enumerator
cameraFrame 

poses are returned w.r.t. the camera frame

worldFrame 

poses are returned w.r.t. the world frame

Constructor & Destructor Documentation

◆ CoplanarPointPoseEstimator() [1/2]

icl::geom::CoplanarPointPoseEstimator::CoplanarPointPoseEstimator ( ReferenceFrame  returnedPosesReferenceFrame = worldFrame,
PoseEstimationAlgorithm  a = SimplexSampling,
const RANSACSpec spec = RANSACSpec() 
)

Default constructor with given reference-frame for the returned poses.

Please note that the Downhill Simplex based pose optimization is very accurate and very fast. Using other modes does usually slowdown the pose estimation process and also decrease the result quality. Hovever the brute force search is still provided due to 'historic' reasons.

Parameters
specOptionally the CoplanarPointPoseEstimator can be set up to use RANSAC to automatically filter out invalid points by means for stochastic sampling.

◆ ~CoplanarPointPoseEstimator()

icl::geom::CoplanarPointPoseEstimator::~CoplanarPointPoseEstimator ( )

Destructor.

◆ CoplanarPointPoseEstimator() [2/2]

icl::geom::CoplanarPointPoseEstimator::CoplanarPointPoseEstimator ( const CoplanarPointPoseEstimator other)

Copy constructor.

Member Function Documentation

◆ getPose()

math::FixedMatrix<float,4,4> icl::geom::CoplanarPointPoseEstimator::getPose ( int  n,
const utils::Point32f modelPoints,
const utils::Point32f imagePoints,
const Camera cam 
)

main working function that estimates the pose from given model- and image points

See also
Pose Detection Problem
The Object Coordinate Frame
Algorithms

note: the camera class is only forward-declared for this file

◆ getPoseInternal()

math::FixedMatrix<float,4,4> icl::geom::CoplanarPointPoseEstimator::getPoseInternal ( PoseEstimationAlgorithm  a,
int  n,
const utils::Point32f modelPoints,
const utils::Point32f imagePoints,
const utils::Point32f normalizedImagePoints,
const Camera cam 
)
private

internal utility function

◆ getReferenceFrame()

ReferenceFrame icl::geom::CoplanarPointPoseEstimator::getReferenceFrame ( ) const

returns the current reference frame value

◆ operator=()

CoplanarPointPoseEstimator& icl::geom::CoplanarPointPoseEstimator::operator= ( const CoplanarPointPoseEstimator other)

Assignment operator.

◆ propertyChangedCallback()

void icl::geom::CoplanarPointPoseEstimator::propertyChangedCallback ( const Property p)
private

Internally used to sync property settings with internal data.

◆ robustPoseCorrection()

void icl::geom::CoplanarPointPoseEstimator::robustPoseCorrection ( int  n,
const utils::Point32f modelPoints,
const utils::Point32f normalizedImagePoints 
)
private

Internally used to correct the first transformation matrix using robust pose estimation algorithm.

◆ setReferenceFrame()

void icl::geom::CoplanarPointPoseEstimator::setReferenceFrame ( ReferenceFrame  f)

sets the refernce-frame property

Member Data Documentation

◆ data

Data* icl::geom::CoplanarPointPoseEstimator::data
private

Internally used data pointer.


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