Visual Servoing Platform  version 3.0.0
vpTemplateTrackerTriangle Class Reference

#include <visp3/tt/vpTemplateTrackerTriangle.h>

Public Member Functions

 vpTemplateTrackerTriangle ()
 
 vpTemplateTrackerTriangle (const vpTemplateTrackerTriangle &T)
 
 vpTemplateTrackerTriangle (const vpColVector &c1, const vpColVector &c2, const vpColVector &c3)
 
 vpTemplateTrackerTriangle (const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3)
 
 vpTemplateTrackerTriangle (int x1, int y1, int x2, int y2, int x3, int y3)
 
 vpTemplateTrackerTriangle (double x1, double y1, double x2, double y2, double x3, double y3)
 
double getArea () const
 
vpTemplateTrackerTriangle getPyramidDown () const
 
void getCorners (vpColVector &c1, vpColVector &c2, vpColVector &c3) const
 
void getCorners (vpImagePoint &c1, vpImagePoint &c2, vpImagePoint &c3) const
 
void getCorners (std::vector< vpImagePoint > &c) const
 
vpColVector getCorner (unsigned int i) const
 
void getCorner (unsigned int i, double &x, double &y) const
 
double getMaxx () const
 
double getMaxy () const
 
double getMinx () const
 
double getMiny () const
 
void getSize (double &w, double &h) const
 
void getSize (int &w, int &h) const
 
void init (const vpColVector &c1, const vpColVector &c2, const vpColVector &c3)
 
void init (const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3)
 
void init (int x1, int y1, int x2, int y2, int x3, int y3)
 
void init (double x1, double y1, double x2, double y2, double x3, double y3)
 
bool inTriangle (const vpImagePoint &ip) const
 
bool inTriangle (const int &i, const int &j) const
 
bool inTriangle (const double &i, const double &j) const
 
vpTemplateTrackerTriangleoperator= (const vpTemplateTrackerTriangle &T)
 

Protected Attributes

double minx_temp
 
double miny_temp
 
vpTemplateTrackerDPoint C1
 
vpTemplateTrackerDPoint C2
 
vpTemplateTrackerDPoint C3
 
double l_t
 
double h_t
 
bool not_good
 
double uvinv00
 
double uvinv01
 
double uvinv10
 
double uvinv11
 
double marge_triangle
 
double area
 

Detailed Description

Definition at line 60 of file vpTemplateTrackerTriangle.h.

Constructor & Destructor Documentation

vpTemplateTrackerTriangle::vpTemplateTrackerTriangle ( )

Default constructor.

Definition at line 44 of file vpTemplateTrackerTriangle.cpp.

vpTemplateTrackerTriangle::vpTemplateTrackerTriangle ( const vpTemplateTrackerTriangle T)

Copy constructor.

Definition at line 53 of file vpTemplateTrackerTriangle.cpp.

vpTemplateTrackerTriangle::vpTemplateTrackerTriangle ( const vpColVector c1,
const vpColVector c2,
const vpColVector c3 
)

Create a triangle from 3 corners.

Parameters
c1: First corner.
c2: Second corner.
c3: Third corner.

The coordinates of the points are defined as a 2 dimension vector with coordinates (x,y).

Definition at line 103 of file vpTemplateTrackerTriangle.cpp.

References init().

vpTemplateTrackerTriangle::vpTemplateTrackerTriangle ( const vpImagePoint c1,
const vpImagePoint c2,
const vpImagePoint c3 
)

Create a triangle from 3 corners defined as image points.

Parameters
c1: First corner.
c2: Second corner.
c3: Third corner.

Definition at line 139 of file vpTemplateTrackerTriangle.cpp.

References vpImagePoint::get_u(), vpImagePoint::get_v(), and init().

vpTemplateTrackerTriangle::vpTemplateTrackerTriangle ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3 
)

Create a triangle from 3 corners with coordinates (x1,y1), (x2,y2), (x3,y3).

  • x coordinate is along the columns
  • y coordinate is along the rows.

Definition at line 126 of file vpTemplateTrackerTriangle.cpp.

References init().

vpTemplateTrackerTriangle::vpTemplateTrackerTriangle ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)

Create a triangle from 3 corners with coordinates (x1,y1), (x2,y2), (x3,y3).

  • x coordinate is along the columns
  • y coordinate is along the rows.

Definition at line 151 of file vpTemplateTrackerTriangle.cpp.

References init().

Member Function Documentation

double vpTemplateTrackerTriangle::getArea ( ) const
inline

Return the area of the triangle.

Returns
The area of the triangle.

Definition at line 98 of file vpTemplateTrackerTriangle.h.

Referenced by vpTemplateTrackerZone::getArea().

vpColVector vpTemplateTrackerTriangle::getCorner ( unsigned int  i) const
inline
void vpTemplateTrackerTriangle::getCorner ( unsigned int  i,
double &  x,
double &  y 
) const
inline

Returns the coordinates of a triangle corner.

Parameters
i: Allowed values are 0, 1 or 2.
  • if i = 0, return corner 1 coordinates,
  • if i = 1, return corner 2 coordinates,
  • if i = 2, return corner 3 coordinates.
x,y: The coordinates of the corner.

Definition at line 131 of file vpTemplateTrackerTriangle.h.

References vpTemplateTrackerDPoint::x, and vpTemplateTrackerDPoint::y.

void vpTemplateTrackerTriangle::getCorners ( vpColVector c1,
vpColVector c2,
vpColVector c3 
) const

Returns the coordinates of the triangle corners as a 2 dimension vector (x,y).

Parameters
c1: First corner.
c2: Second corner.
c3: Third corner.

Definition at line 337 of file vpTemplateTrackerTriangle.cpp.

Referenced by vpTemplateTrackerWarp::warpTriangle().

void vpTemplateTrackerTriangle::getCorners ( vpImagePoint c1,
vpImagePoint c2,
vpImagePoint c3 
) const

Returns the coordinates of the triangle corners as an image point.

Parameters
c1: First corner.
c2: Second corner.
c3: Third corner.

Definition at line 312 of file vpTemplateTrackerTriangle.cpp.

References C1, C2, C3, vpImagePoint::set_uv(), vpTemplateTrackerDPoint::x, and vpTemplateTrackerDPoint::y.

void vpTemplateTrackerTriangle::getCorners ( std::vector< vpImagePoint > &  c) const

Returns the coordinates of the triangle corners as a 3 dimension vector of image points.

Parameters
c: 3 dimension vector of image points that correspond to the triangle corners.

Definition at line 323 of file vpTemplateTrackerTriangle.cpp.

References C1, C2, C3, vpTemplateTrackerDPoint::x, and vpTemplateTrackerDPoint::y.

double vpTemplateTrackerTriangle::getMaxx ( ) const
Returns
The maximal x coordinate (along the columns of the image) of the points that are in the triangle.
See also
getMinx()

Definition at line 421 of file vpTemplateTrackerTriangle.cpp.

References l_t, and minx_temp.

Referenced by vpTemplateTrackerZone::add(), vpTemplateTrackerZone::copy(), and vpTemplateTrackerZone::initFromPoints().

double vpTemplateTrackerTriangle::getMaxy ( ) const
Returns
The maximal y coordinate (along the rows of the image) of the points that are in the triangle.
See also
getMaxx()

Definition at line 429 of file vpTemplateTrackerTriangle.cpp.

References h_t, and miny_temp.

Referenced by vpTemplateTrackerZone::add(), vpTemplateTrackerZone::copy(), and vpTemplateTrackerZone::initFromPoints().

double vpTemplateTrackerTriangle::getMinx ( ) const
Returns
The minimal x coordinate (along the columns of the image) of the points that are in the triangle.
See also
getMaxx()

Definition at line 405 of file vpTemplateTrackerTriangle.cpp.

References minx_temp.

Referenced by vpTemplateTrackerZone::add(), vpTemplateTrackerZone::copy(), and vpTemplateTrackerZone::initFromPoints().

double vpTemplateTrackerTriangle::getMiny ( ) const
Returns
The minimal y coordinate (along the rows of the image) of the points that are in the triangle.
See also
getMaxy()

Definition at line 413 of file vpTemplateTrackerTriangle.cpp.

References miny_temp.

Referenced by vpTemplateTrackerZone::add(), vpTemplateTrackerZone::copy(), and vpTemplateTrackerZone::initFromPoints().

vpTemplateTrackerTriangle vpTemplateTrackerTriangle::getPyramidDown ( ) const

Return a triangle with coordinates that are down scaled by a factor 2.

Definition at line 114 of file vpTemplateTrackerTriangle.cpp.

References C1, C2, C3, init(), vpTemplateTrackerDPoint::x, and vpTemplateTrackerDPoint::y.

Referenced by vpTemplateTrackerZone::getPyramidDown().

void vpTemplateTrackerTriangle::getSize ( double &  w,
double &  h 
) const

Get the size of the triangle bounding box.

Parameters
w: Bounding box width.
h: Bounding box height.

Definition at line 385 of file vpTemplateTrackerTriangle.cpp.

References h_t, and l_t.

void vpTemplateTrackerTriangle::getSize ( int &  w,
int &  h 
) const

Get the size of the triangle bounding box.

Parameters
w: Bounding box width.
h: Bounding box height.

Definition at line 395 of file vpTemplateTrackerTriangle.cpp.

References h_t, and l_t.

void vpTemplateTrackerTriangle::init ( const vpColVector c1,
const vpColVector c2,
const vpColVector c3 
)

Initializes a triangle from 3 corners.

Parameters
c1: First corner.
c2: Second corner.
c3: Third corner.

The coordinates of the points are defined as a 2 dimension vector with coordinates (x,y).

Definition at line 165 of file vpTemplateTrackerTriangle.cpp.

Referenced by getPyramidDown(), init(), vpTemplateTrackerTriangle(), and vpTemplateTrackerWarp::warpTriangle().

void vpTemplateTrackerTriangle::init ( const vpImagePoint c1,
const vpImagePoint c2,
const vpImagePoint c3 
)

Initializes a triangle from 3 corners defined as image points.

Parameters
c1: First corner.
c2: Second corner.
c3: Third corner.

Definition at line 175 of file vpTemplateTrackerTriangle.cpp.

References vpImagePoint::get_u(), vpImagePoint::get_v(), and init().

void vpTemplateTrackerTriangle::init ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3 
)

Initializes a triangle from 3 corners with coordinates (x1,y1), (x2,y2), (x3,y3).

  • x coordinate is along the columns
  • y coordinate is along the rows.

Definition at line 185 of file vpTemplateTrackerTriangle.cpp.

References init().

void vpTemplateTrackerTriangle::init ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)

Initializes a triangle from 3 corners with coordinates (x1,y1), (x2,y2), (x3,y3).

  • x coordinate is along the columns
  • y coordinate is along the rows.

Definition at line 195 of file vpTemplateTrackerTriangle.cpp.

References area, C1, C2, C3, vpMatrix::det(), h_t, vpMatrix::inverseByLU(), l_t, marge_triangle, minx_temp, miny_temp, not_good, vpColVector::resize(), uvinv00, uvinv01, uvinv10, uvinv11, vpTemplateTrackerDPoint::x, and vpTemplateTrackerDPoint::y.

bool vpTemplateTrackerTriangle::inTriangle ( const vpImagePoint ip) const

Indicates if an image point is in the triangle.

Parameters
ip: Image point to consider.

Definition at line 302 of file vpTemplateTrackerTriangle.cpp.

References vpImagePoint::get_i(), and vpImagePoint::get_j().

Referenced by vpTemplateTrackerZone::fillTriangle().

bool vpTemplateTrackerTriangle::inTriangle ( const int &  i,
const int &  j 
) const

Indicates if a point with coordinates (i,j) is in the triangle.

Parameters
i: Coordinate along the rows.
j: Coordinate along the columns.

Definition at line 259 of file vpTemplateTrackerTriangle.cpp.

References C1, marge_triangle, not_good, uvinv00, uvinv01, uvinv10, uvinv11, vpTemplateTrackerDPoint::x, and vpTemplateTrackerDPoint::y.

bool vpTemplateTrackerTriangle::inTriangle ( const double &  i,
const double &  j 
) const

Indicates if a point with coordinates (i,j) is in the triangle.

Parameters
i: Coordinate along the rows.
j: Coordinate along the columns.

Definition at line 282 of file vpTemplateTrackerTriangle.cpp.

References C1, marge_triangle, not_good, uvinv00, uvinv01, uvinv10, uvinv11, vpTemplateTrackerDPoint::x, and vpTemplateTrackerDPoint::y.

vpTemplateTrackerTriangle & vpTemplateTrackerTriangle::operator= ( const vpTemplateTrackerTriangle T)

Member Data Documentation

double vpTemplateTrackerTriangle::area
protected

Definition at line 78 of file vpTemplateTrackerTriangle.h.

Referenced by init(), and operator=().

vpTemplateTrackerDPoint vpTemplateTrackerTriangle::C1
protected

Definition at line 65 of file vpTemplateTrackerTriangle.h.

Referenced by getCorners(), getPyramidDown(), init(), inTriangle(), and operator=().

vpTemplateTrackerDPoint vpTemplateTrackerTriangle::C2
protected

Corner 1.

Definition at line 66 of file vpTemplateTrackerTriangle.h.

Referenced by getCorners(), getPyramidDown(), init(), and operator=().

vpTemplateTrackerDPoint vpTemplateTrackerTriangle::C3
protected

Corner 2.

Definition at line 67 of file vpTemplateTrackerTriangle.h.

Referenced by getCorners(), getPyramidDown(), init(), and operator=().

double vpTemplateTrackerTriangle::h_t
protected

Definition at line 70 of file vpTemplateTrackerTriangle.h.

Referenced by getMaxy(), getSize(), init(), and operator=().

double vpTemplateTrackerTriangle::l_t
protected

Corner 3.

Definition at line 69 of file vpTemplateTrackerTriangle.h.

Referenced by getMaxx(), getSize(), init(), and operator=().

double vpTemplateTrackerTriangle::marge_triangle
protected

Definition at line 77 of file vpTemplateTrackerTriangle.h.

Referenced by init(), inTriangle(), and operator=().

double vpTemplateTrackerTriangle::minx_temp
protected

Definition at line 63 of file vpTemplateTrackerTriangle.h.

Referenced by getMaxx(), getMinx(), init(), and operator=().

double vpTemplateTrackerTriangle::miny_temp
protected

Definition at line 64 of file vpTemplateTrackerTriangle.h.

Referenced by getMaxy(), getMiny(), init(), and operator=().

bool vpTemplateTrackerTriangle::not_good
protected

Definition at line 72 of file vpTemplateTrackerTriangle.h.

Referenced by init(), inTriangle(), and operator=().

double vpTemplateTrackerTriangle::uvinv00
protected

Definition at line 73 of file vpTemplateTrackerTriangle.h.

Referenced by init(), inTriangle(), and operator=().

double vpTemplateTrackerTriangle::uvinv01
protected

Definition at line 74 of file vpTemplateTrackerTriangle.h.

Referenced by init(), inTriangle(), and operator=().

double vpTemplateTrackerTriangle::uvinv10
protected

Definition at line 75 of file vpTemplateTrackerTriangle.h.

Referenced by init(), inTriangle(), and operator=().

double vpTemplateTrackerTriangle::uvinv11
protected

Definition at line 76 of file vpTemplateTrackerTriangle.h.

Referenced by init(), inTriangle(), and operator=().