Visual Servoing Platform  version 3.2.0
vpMbHiddenFaces< PolygonType > Class Template Reference

#include <vpMbHiddenFaces.h>

Public Member Functions

 vpMbHiddenFaces ()
 
virtual ~vpMbHiddenFaces ()
 
 vpMbHiddenFaces (const vpMbHiddenFaces &copy)
 
vpMbHiddenFacesoperator= (vpMbHiddenFaces other)
 
void addPolygon (PolygonType *p)
 
bool computeVisibility (const vpHomogeneousMatrix &cMo, const double &angleAppears, const double &angleDisappears, bool &changed, bool useOgre, bool not_used, const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpTranslationVector &cameraPos, unsigned int index)
 
void computeClippedPolygons (const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam)
 
void computeScanLineRender (const vpCameraParameters &cam, const unsigned int &w, const unsigned int &h)
 
void computeScanLineQuery (const vpPoint &a, const vpPoint &b, std::vector< std::pair< vpPoint, vpPoint > > &lines, const bool &displayResults=false)
 
vpMbScanLine & getMbScanLineRenderer ()
 
void displayOgre (const vpHomogeneousMatrix &cMo)
 
std::vector< PolygonType * > & getPolygon ()
 
void initOgre (const vpCameraParameters &cam=vpCameraParameters())
 
unsigned int getNbVisiblePolygon () const
 
unsigned int getNbRayCastingAttemptsForVisibility ()
 
vpAROgregetOgreContext ()
 
double getGoodNbRayCastingAttemptsRatio ()
 
bool isAppearing (const unsigned int i)
 
bool isOgreInitialised ()
 
bool isVisible (const unsigned int i)
 
bool isVisibleOgre (const vpTranslationVector &cameraPos, const unsigned int &index)
 
PolygonType * operator[] (const unsigned int i)
 
const PolygonType * operator[] (const unsigned int i) const
 
void reset ()
 
void setBackgroundSizeOgre (const unsigned int &h, const unsigned int &w)
 
void setNbRayCastingAttemptsForVisibility (const unsigned int &attempts)
 
void setGoodNbRayCastingAttemptsRatio (const double &ratio)
 
void setOgreShowConfigDialog (const bool showConfigDialog)
 
unsigned int setVisible (const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpHomogeneousMatrix &cMo, const double &angle, bool &changed)
 
unsigned int setVisible (const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpHomogeneousMatrix &cMo, const double &angleAppears, const double &angleDisappears, bool &changed)
 
unsigned int setVisible (const vpHomogeneousMatrix &cMo, const double &angleAppears, const double &angleDisappears, bool &changed)
 
unsigned int setVisibleOgre (const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpHomogeneousMatrix &cMo, const double &angleAppears, const double &angleDisappears, bool &changed)
 
unsigned int setVisibleOgre (const vpHomogeneousMatrix &cMo, const double &angleAppears, const double &angleDisappears, bool &changed)
 
unsigned int size () const
 

Friends

void swap (vpMbHiddenFaces &first, vpMbHiddenFaces &second)
 

Detailed Description

template<class PolygonType = vpMbtPolygon>
class vpMbHiddenFaces< PolygonType >

Implementation of the polygons management for the model-based trackers.

Definition at line 57 of file vpMbHiddenFaces.h.

Constructor & Destructor Documentation

◆ vpMbHiddenFaces() [1/2]

template<class PolygonType >
vpMbHiddenFaces< PolygonType >::vpMbHiddenFaces ( )

Basic constructor.

Definition at line 283 of file vpMbHiddenFaces.h.

◆ ~vpMbHiddenFaces()

template<class PolygonType >
vpMbHiddenFaces< PolygonType >::~vpMbHiddenFaces ( )
virtual

Basic destructor.

Definition at line 298 of file vpMbHiddenFaces.h.

◆ vpMbHiddenFaces() [2/2]

template<class PolygonType >
vpMbHiddenFaces< PolygonType >::vpMbHiddenFaces ( const vpMbHiddenFaces< PolygonType > &  copy)

Copy constructor.

Definition at line 330 of file vpMbHiddenFaces.h.

Member Function Documentation

◆ addPolygon()

template<class PolygonType>
void vpMbHiddenFaces< PolygonType >::addPolygon ( PolygonType *  p)

Add a polygon to the list of polygons.

Parameters
p: The polygon to add.

Definition at line 377 of file vpMbHiddenFaces.h.

Referenced by vpMbTracker::addPolygon(), and vpMbTracker::addProjectionErrorPolygon().

◆ computeClippedPolygons()

template<class PolygonType >
void vpMbHiddenFaces< PolygonType >::computeClippedPolygons ( const vpHomogeneousMatrix cMo,
const vpCameraParameters cam 
)

Compute the clipped points of the polygons that have been added via addPolygon().

Parameters
cMo: Pose that will be used to clip the polygons.
cam: Camera parameters that will be used to clip the polygons.

Definition at line 440 of file vpMbHiddenFaces.h.

Referenced by vpMbTracker::computeProjectionErrorImpl(), vpMbDepthDenseTracker::computeVisibility(), vpMbDepthNormalTracker::computeVisibility(), vpMbDepthDenseTracker::display(), vpMbDepthNormalTracker::display(), vpMbEdgeKltMultiTracker::postTracking(), and vpMbKltTracker::reinit().

◆ computeScanLineQuery()

template<class PolygonType >
void vpMbHiddenFaces< PolygonType >::computeScanLineQuery ( const vpPoint a,
const vpPoint b,
std::vector< std::pair< vpPoint, vpPoint > > &  lines,
const bool &  displayResults = false 
)

Compute Scanline visibility results for a line.

Warning
computeScanLineRender() function has to be called before
Parameters
a: First point of the line.
b: Second point of the line.
lines: Result of the scanline visibility. List of the visible parts of the line.
displayResults: True if the results have to be displayed. False otherwise

Definition at line 500 of file vpMbHiddenFaces.h.

Referenced by vpMbtFaceDepthDense::computeROI(), vpMbtFaceDepthNormal::computeROI(), and vpMbtDistanceKltPoints::display().

◆ computeScanLineRender()

template<class PolygonType >
void vpMbHiddenFaces< PolygonType >::computeScanLineRender ( const vpCameraParameters cam,
const unsigned int &  w,
const unsigned int &  h 
)

Render the scene in order to perform, later via computeScanLineQuery(), visibility tests.

Parameters
cam: Camera parameters that will be used to render the scene.
w: Width of the render window.
h: Height of the render window.

Definition at line 463 of file vpMbHiddenFaces.h.

Referenced by vpMbTracker::computeProjectionErrorImpl(), vpMbDepthDenseTracker::computeVisibility(), vpMbDepthNormalTracker::computeVisibility(), vpMbDepthDenseTracker::display(), vpMbDepthNormalTracker::display(), vpMbEdgeKltMultiTracker::postTracking(), and vpMbKltTracker::reinit().

◆ computeVisibility()

template<class PolygonType >
bool vpMbHiddenFaces< PolygonType >::computeVisibility ( const vpHomogeneousMatrix cMo,
const double &  angleAppears,
const double &  angleDisappears,
bool &  changed,
bool  useOgre,
bool  not_used,
const vpImage< unsigned char > &  I,
const vpCameraParameters cam,
const vpTranslationVector cameraPos,
unsigned int  index 
)

Compute the visibility of a given face index.

Parameters
cMo: The pose of the camera
angleAppears: Angle used to test the appearance of a face
angleDisappears: Angle used to test the disappearance of a face
changed: True if a face appeared, disappeared or too many points have been lost. False otherwise
useOgre: True if a Ogre is used to test the visibility, False otherwise.
not_used: Unused parameter.
I: Image used to test if a face is entirely projected in the image.
cam: Camera parameters.
cameraPos: Position of the camera. Used only when Ogre is used as 3rd party.
index: Index of the face to consider.
Returns
Return true if the face is visible.

Definition at line 568 of file vpMbHiddenFaces.h.

◆ displayOgre()

template<class PolygonType >
void vpMbHiddenFaces< PolygonType >::displayOgre ( const vpHomogeneousMatrix cMo)

Update the display in Ogre Window.

Parameters
cMo: Pose used to display.

Definition at line 742 of file vpMbHiddenFaces.h.

◆ getGoodNbRayCastingAttemptsRatio()

template<class PolygonType = vpMbtPolygon>
double vpMbHiddenFaces< PolygonType >::getGoodNbRayCastingAttemptsRatio ( )
inline

Get the ratio of visibility attempts that has to be successful to consider a polygon as visible.

See also
getNbRayCastingAttemptsForVisibility()
Returns
Ratio of succesful attempts that has to be considered. Value will be between 0.0 (0%) and 1.0 (100%).

Definition at line 165 of file vpMbHiddenFaces.h.

◆ getMbScanLineRenderer()

template<class PolygonType = vpMbtPolygon>
vpMbScanLine& vpMbHiddenFaces< PolygonType >::getMbScanLineRenderer ( )
inline

◆ getNbRayCastingAttemptsForVisibility()

template<class PolygonType = vpMbtPolygon>
unsigned int vpMbHiddenFaces< PolygonType >::getNbRayCastingAttemptsForVisibility ( )
inline

Get the number of rays that will be sent toward each polygon for visibility test. Each ray will go from the optic center of the camera to a random point inside the considered polygon.

See also
getGoodNbRayCastingAttemptsRatio()
Returns
Number of rays sent.

Definition at line 147 of file vpMbHiddenFaces.h.

◆ getNbVisiblePolygon()

template<class PolygonType = vpMbtPolygon>
unsigned int vpMbHiddenFaces< PolygonType >::getNbVisiblePolygon ( ) const
inline

get the number of visible polygons.

Returns
number of visible polygons.

Definition at line 135 of file vpMbHiddenFaces.h.

◆ getOgreContext()

◆ getPolygon()

template<class PolygonType = vpMbtPolygon>
std::vector<PolygonType *>& vpMbHiddenFaces< PolygonType >::getPolygon ( )
inline

Get the list of polygons.

Returns
Mbt Klt polygons list.

Definition at line 124 of file vpMbHiddenFaces.h.

Referenced by vpMbTracker::addPolygon(), vpMbTracker::addProjectionErrorPolygon(), and vpMbTracker::getPolygonFaces().

◆ initOgre()

template<class PolygonType >
void vpMbHiddenFaces< PolygonType >::initOgre ( const vpCameraParameters cam = vpCameraParameters())

Initialise the ogre context for face visibility tests.

Parameters
cam: Camera parameters.

Definition at line 710 of file vpMbHiddenFaces.h.

Referenced by vpMbTracker::computeProjectionErrorImpl(), vpMbDepthDenseTracker::init(), vpMbDepthNormalTracker::init(), and vpMbKltTracker::init().

◆ isAppearing()

template<class PolygonType = vpMbtPolygon>
bool vpMbHiddenFaces< PolygonType >::isAppearing ( const unsigned int  i)
inline

◆ isOgreInitialised()

template<class PolygonType = vpMbtPolygon>
bool vpMbHiddenFaces< PolygonType >::isOgreInitialised ( )
inline

Tell whether if Ogre Context is initialised or not.

Returns
True if it does, false otherwise.

Definition at line 176 of file vpMbHiddenFaces.h.

Referenced by vpMbTracker::computeProjectionErrorImpl(), vpMbDepthDenseTracker::init(), vpMbDepthNormalTracker::init(), and vpMbKltTracker::init().

◆ isVisible()

template<class PolygonType = vpMbtPolygon>
bool vpMbHiddenFaces< PolygonType >::isVisible ( const unsigned int  i)
inline

Check if the polygon at position i in the list is visible.

Parameters
i: TPosition in the list.
Returns
Return true if the polygon is visible.

Definition at line 186 of file vpMbHiddenFaces.h.

Referenced by vpMbtFaceDepthDense::computeVisibilityDisplay(), vpMbtFaceDepthNormal::computeVisibilityDisplay(), and vpMbTracker::projectionErrorInitMovingEdge().

◆ isVisibleOgre()

template<class PolygonType >
bool vpMbHiddenFaces< PolygonType >::isVisibleOgre ( const vpTranslationVector cameraPos,
const unsigned int &  index 
)

Test the visibility of a polygon through Ogre3D via RayCasting.

Parameters
cameraPos: Position of the camera in the 3D world.
index: Index of the polygon.
Returns
Return true if the polygon is visible, False otherwise.

Definition at line 803 of file vpMbHiddenFaces.h.

◆ operator=()

template<class PolygonType >
vpMbHiddenFaces< PolygonType > & vpMbHiddenFaces< PolygonType >::operator= ( vpMbHiddenFaces< PolygonType >  other)

Copy assignment operator.

Definition at line 365 of file vpMbHiddenFaces.h.

◆ operator[]() [1/2]

template<class PolygonType = vpMbtPolygon>
PolygonType* vpMbHiddenFaces< PolygonType >::operator[] ( const unsigned int  i)
inline

operator[] as modifier.

Definition at line 193 of file vpMbHiddenFaces.h.

◆ operator[]() [2/2]

template<class PolygonType = vpMbtPolygon>
const PolygonType* vpMbHiddenFaces< PolygonType >::operator[] ( const unsigned int  i) const
inline

operator[] as reader.

Definition at line 195 of file vpMbHiddenFaces.h.

◆ reset()

template<class PolygonType >
void vpMbHiddenFaces< PolygonType >::reset ( )

Reset the Hidden faces (remove the list of PolygonType)

Definition at line 397 of file vpMbHiddenFaces.h.

Referenced by vpMbDepthDenseTracker::resetTracker(), and vpMbDepthNormalTracker::resetTracker().

◆ setBackgroundSizeOgre()

template<class PolygonType = vpMbtPolygon>
void vpMbHiddenFaces< PolygonType >::setBackgroundSizeOgre ( const unsigned int &  h,
const unsigned int &  w 
)
inline

Set the background size (by default it is 640x480). The background size has to match with the size of the image that you are using for the traking.

Warning
This function has to be called before initOgre().
Parameters
h: Height of the background
w: Width of the background

Definition at line 210 of file vpMbHiddenFaces.h.

Referenced by vpMbTracker::computeProjectionErrorImpl(), vpMbDepthDenseTracker::init(), vpMbDepthNormalTracker::init(), and vpMbKltTracker::init().

◆ setGoodNbRayCastingAttemptsRatio()

template<class PolygonType = vpMbtPolygon>
void vpMbHiddenFaces< PolygonType >::setGoodNbRayCastingAttemptsRatio ( const double &  ratio)
inline

Set the ratio of visibility attempts that has to be successful to consider a polygon as visible.

See also
setNbRayCastingAttemptsForVisibility(const unsigned int &)
Parameters
ratio: Ratio of succesful attempts that has to be considered. Value has to be between 0.0 (0%) and 1.0 (100%).

Definition at line 235 of file vpMbHiddenFaces.h.

◆ setNbRayCastingAttemptsForVisibility()

template<class PolygonType = vpMbtPolygon>
void vpMbHiddenFaces< PolygonType >::setNbRayCastingAttemptsForVisibility ( const unsigned int &  attempts)
inline

Set the number of rays that will be sent toward each polygon for visibility test. Each ray will go from the optic center of the camera to a random point inside the considered polygon.

See also
setGoodNbRayCastingAttemptsRatio(const double &)
Parameters
attemptsNumber of rays to be sent.

Definition at line 224 of file vpMbHiddenFaces.h.

◆ setOgreShowConfigDialog()

template<class PolygonType = vpMbtPolygon>
void vpMbHiddenFaces< PolygonType >::setOgreShowConfigDialog ( const bool  showConfigDialog)
inline

Enable/Disable the appearance of Ogre config dialog on startup.

Warning
This method has only effect when Ogre is used and Ogre visibility test is enabled using setOgreVisibilityTest() with true parameter.
Parameters
showConfigDialog: if true, shows Ogre dialog window (used to set Ogre rendering options) when Ogre visibility is enabled. By default, this functionality is turned off.

Definition at line 253 of file vpMbHiddenFaces.h.

Referenced by vpMbTracker::computeProjectionErrorImpl(), vpMbDepthDenseTracker::init(), vpMbDepthNormalTracker::init(), and vpMbKltTracker::init().

◆ setVisible() [1/3]

template<class PolygonType >
unsigned int vpMbHiddenFaces< PolygonType >::setVisible ( const vpHomogeneousMatrix cMo,
const double &  angleAppears,
const double &  angleDisappears,
bool &  changed 
)

Compute the number of visible polygons.

Parameters
cMo: The pose of the camera
angleAppears: Angle used to test the appearance of a face
angleDisappears: Angle used to test the disappearance of a face
changed: True if a face appeared, disappeared or too many points have been lost. False otherwise
Returns
Return the number of visible polygons

Definition at line 698 of file vpMbHiddenFaces.h.

◆ setVisible() [2/3]

template<class PolygonType >
unsigned int vpMbHiddenFaces< PolygonType >::setVisible ( const vpImage< unsigned char > &  I,
const vpCameraParameters cam,
const vpHomogeneousMatrix cMo,
const double &  angle,
bool &  changed 
)

Compute the number of visible polygons.

Parameters
I: Image used to check if the region of interest is inside the image.
cam: Camera parameters.
cMo: The pose of the camera.
angle: Angle used to test the appearance and disappearance of a face.
changed: True if a face appeared, disappeared or too many points have been lost. False otherwise
Returns
Return the number of visible polygons

Definition at line 659 of file vpMbHiddenFaces.h.

Referenced by vpMbDepthDenseTracker::computeVisibility(), vpMbDepthNormalTracker::computeVisibility(), vpMbDepthDenseTracker::display(), vpMbDepthNormalTracker::display(), vpMbDepthDenseTracker::init(), vpMbDepthNormalTracker::init(), vpMbKltTracker::init(), and vpMbTracker::projectionErrorVisibleFace().

◆ setVisible() [3/3]

template<class PolygonType >
unsigned int vpMbHiddenFaces< PolygonType >::setVisible ( const vpImage< unsigned char > &  I,
const vpCameraParameters cam,
const vpHomogeneousMatrix cMo,
const double &  angleAppears,
const double &  angleDisappears,
bool &  changed 
)

Compute the number of visible polygons.

Parameters
I: Image used to check if the region of interest is inside the image.
cam: Camera parameters.
cMo: The pose of the camera
changed: True if a face appeared, disappeared or too many points have been lost. False otherwise
angleAppears: Angle used to test the appearance of a face
angleDisappears: Angle used to test the disappearance of a face
Returns
Return the number of visible polygons

Definition at line 679 of file vpMbHiddenFaces.h.

◆ setVisibleOgre() [1/2]

template<class PolygonType >
unsigned int vpMbHiddenFaces< PolygonType >::setVisibleOgre ( const vpHomogeneousMatrix cMo,
const double &  angleAppears,
const double &  angleDisappears,
bool &  changed 
)

Compute the number of visible polygons through Ogre3D.

Parameters
cMo: The pose of the camera
angleAppears: Angle used to test the appearance of a face
angleDisappears: Angle used to test the disappearance of a face
changed: True if a face appeared, disappeared or too many points have been lost. False otherwise
Returns
Return the number of visible polygons

Definition at line 788 of file vpMbHiddenFaces.h.

◆ setVisibleOgre() [2/2]

template<class PolygonType >
unsigned int vpMbHiddenFaces< PolygonType >::setVisibleOgre ( const vpImage< unsigned char > &  I,
const vpCameraParameters cam,
const vpHomogeneousMatrix cMo,
const double &  angleAppears,
const double &  angleDisappears,
bool &  changed 
)

Compute the number of visible polygons through Ogre3D.

Parameters
I: Image used to check if the region of interest is inside the image.
cam: Camera parameters.
cMo: The pose of the camera
changed: True if a face appeared, disappeared or too many points have been lost. False otherwise
angleAppears: Angle used to test the appearance of a face
angleDisappears: Angle used to test the disappearance of a face
Returns
Return the number of visible polygons

Definition at line 768 of file vpMbHiddenFaces.h.

Referenced by vpMbDepthDenseTracker::init(), vpMbDepthNormalTracker::init(), vpMbKltTracker::init(), and vpMbTracker::projectionErrorVisibleFace().

◆ size()

template<class PolygonType = vpMbtPolygon>
unsigned int vpMbHiddenFaces< PolygonType >::size ( ) const
inline

Get the number of polygons.

Returns
Size of the list.

Definition at line 276 of file vpMbHiddenFaces.h.

Friends And Related Function Documentation

◆ swap

template<class PolygonType = vpMbtPolygon>
void swap ( vpMbHiddenFaces< PolygonType > &  first,
vpMbHiddenFaces< PolygonType > &  second 
)
friend

Definition at line 345 of file vpMbHiddenFaces.h.