ViSP  2.7.0
vpMbtPolygon Class Reference

#include <vpMbtPolygon.h>

+ Inheritance diagram for vpMbtPolygon:

Public Member Functions

 vpMbtPolygon ()
 
virtual ~vpMbtPolygon ()
 
void addPoint (const unsigned int n, const vpPoint &P)
 
void changeFrame (const vpHomogeneousMatrix &cMo)
 
int getIndex () const
 
unsigned int getNbPoint () const
 
vpPointgetPoint (const unsigned int _index)
 
std::vector< vpImagePointgetRoi (const vpCameraParameters &_cam)
 
bool isAppearing () const
 
bool isVisible (const vpHomogeneousMatrix &cMo, const bool &depthTest=false)
 
virtual bool isVisible (const vpHomogeneousMatrix &cMo, const double alpha)
 
bool isVisible () const
 
virtual void setIndex (const int i)
 
virtual void setNbPoint (const unsigned int nb)
 

Static Public Member Functions

static void getMinMaxRoi (const std::vector< vpImagePoint > &roi, int &i_min, int &i_max, int &j_min, int &j_max)
 
static bool roiInsideImage (const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &corners)
 

Public Attributes

int index
 
unsigned int nbpt
 
bool isvisible
 
bool isappearing
 
vpPointp
 

Detailed Description

Implementation of a polygon of the model used by the model-based tracker.

Definition at line 67 of file vpMbtPolygon.h.

Constructor & Destructor Documentation

vpMbtPolygon::vpMbtPolygon ( )

Basic constructor.

Definition at line 58 of file vpMbtPolygon.cpp.

References isappearing, isvisible, nbpt, and p.

vpMbtPolygon::~vpMbtPolygon ( )
virtual

Basic destructor.

Definition at line 69 of file vpMbtPolygon.cpp.

References p.

Member Function Documentation

void vpMbtPolygon::addPoint ( const unsigned int  n,
const vpPoint P 
)

Add a corner point to the list of polygon's corners.

Parameters
n: The index of the corner.
P: The point to add.

Definition at line 115 of file vpMbtPolygon.cpp.

References p.

Referenced by vpMbKltTracker::initFaceFromCorners(), and vpMbEdgeTracker::initFaceFromCorners().

void vpMbtPolygon::changeFrame ( const vpHomogeneousMatrix cMo)

Project the 3D corner points into the image thanks to the pose of the camera.

Parameters
cMo: The pose of the camera.

Definition at line 127 of file vpMbtPolygon.cpp.

References vpPoint::changeFrame(), nbpt, p, and vpPoint::projection().

Referenced by isVisible().

int vpMbtPolygon::getIndex ( ) const
inline

Get the index of the face.

Returns
index : the index of the face.

Definition at line 94 of file vpMbtPolygon.h.

void vpMbtPolygon::getMinMaxRoi ( const std::vector< vpImagePoint > &  roi,
int &  i_min,
int &  i_max,
int &  j_min,
int &  j_max 
)
static

Definition at line 285 of file vpMbtPolygon.cpp.

Referenced by vpMbtKltPolygon::updateMask().

unsigned int vpMbtPolygon::getNbPoint ( ) const
inline

Return the number of corners.

Returns
number of corner of the face

Definition at line 101 of file vpMbtPolygon.h.

Referenced by vpMbEdgeTracker::addPolygon().

vpPoint & vpMbtPolygon::getPoint ( const unsigned int  _index)

Get a reference to a corner.

Exceptions
vpException::dimensionErrorif the _index is out of range.
Parameters
_index: the index of the corner

Definition at line 86 of file vpMbtPolygon.cpp.

References vpException::dimensionError, nbpt, and p.

std::vector< vpImagePoint > vpMbtPolygon::getRoi ( const vpCameraParameters _cam)
bool vpMbtPolygon::isAppearing ( ) const
inline

Definition at line 107 of file vpMbtPolygon.h.

bool vpMbtPolygon::isVisible ( const vpHomogeneousMatrix cMo,
const bool &  depthTest = false 
)

Check if the polygon is visible in the image. To do that, the polygon is projected into the image thanks to the camera pose.

Parameters
cMo: The pose of the camera.
depthTest: True if a face has to be entirely visible (in front of the camera). False if it can be partially visible.
Returns
Return true if the polygon is visible.

Definition at line 145 of file vpMbtPolygon.cpp.

References changeFrame(), vpColVector::crossProd(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), isappearing, isvisible, nbpt, and p.

bool vpMbtPolygon::isVisible ( const vpHomogeneousMatrix cMo,
const double  alpha 
)
virtual

Check if the polygon is visible in the image and if the angle between the normal to the face and the normal to the camera plane is below the given threshold. To do that, the polygon is projected into the image thanks to the camera pose.

Parameters
cMo: The pose of the camera.
alpha: maximum angle to detect if the face is visible (in rad)
Returns
Return true if the polygon is visible.

Definition at line 212 of file vpMbtPolygon.cpp.

References changeFrame(), vpColVector::crossProd(), vpColVector::dotProd(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), isappearing, isvisible, nbpt, vpColVector::normalize(), p, vpPoint::set_X(), vpPoint::set_Y(), and vpPoint::set_Z().

bool vpMbtPolygon::isVisible ( ) const
inline

Definition at line 110 of file vpMbtPolygon.h.

bool vpMbtPolygon::roiInsideImage ( const vpImage< unsigned char > &  I,
const std::vector< vpImagePoint > &  corners 
)
static

Static method to check whether the region defined by the vector of image point is contained entirely in the image.

Parameters
I: The image used for its size.
corners: The vector of points defining a region

Definition at line 326 of file vpMbtPolygon.cpp.

References vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().

virtual void vpMbtPolygon::setIndex ( const int  i)
inlinevirtual

Set the index of the face.

Parameters
i: the new index of the face.

Definition at line 117 of file vpMbtPolygon.h.

Referenced by vpMbEdgeTracker::addPolygon(), vpMbKltTracker::initFaceFromCorners(), and vpMbEdgeTracker::initFaceFromCorners().

void vpMbtPolygon::setNbPoint ( const unsigned int  nb)
virtual

Set the number of points which are the corners of the polygon.

Parameters
nb: The number of corners.

Definition at line 100 of file vpMbtPolygon.cpp.

References nbpt, and p.

Referenced by vpMbKltTracker::initFaceFromCorners(), and vpMbEdgeTracker::initFaceFromCorners().

Member Data Documentation

int vpMbtPolygon::index

Index of the polygon. Cannot be unsigned int because deafult value is -1.

Definition at line 71 of file vpMbtPolygon.h.

Referenced by vpMbtKltPolygon::computeInteractionMatrixAndResidu().

bool vpMbtPolygon::isappearing

flag to specify whether the face is appearing or not

Definition at line 77 of file vpMbtPolygon.h.

Referenced by isVisible(), and vpMbtPolygon().

bool vpMbtPolygon::isvisible

flag to specify whether the face is visible or not

Definition at line 75 of file vpMbtPolygon.h.

Referenced by isVisible(), vpMbtKltPolygon::vpMbtKltPolygon(), and vpMbtPolygon().

unsigned int vpMbtPolygon::nbpt

Number of points used to define the polygon.

Definition at line 73 of file vpMbtPolygon.h.

Referenced by changeFrame(), getPoint(), getRoi(), isVisible(), setNbPoint(), and vpMbtPolygon().

vpPoint* vpMbtPolygon::p