Visual Servoing Platform  version 3.6.1 under development (2024-11-15)
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 62 of file vpTemplateTrackerTriangle.h.

Constructor & Destructor Documentation

◆ vpTemplateTrackerTriangle() [1/6]

BEGIN_VISP_NAMESPACE vpTemplateTrackerTriangle::vpTemplateTrackerTriangle ( )

Default constructor.

Definition at line 45 of file vpTemplateTrackerTriangle.cpp.

◆ vpTemplateTrackerTriangle() [2/6]

vpTemplateTrackerTriangle::vpTemplateTrackerTriangle ( const vpTemplateTrackerTriangle T)

Copy constructor.

Definition at line 53 of file vpTemplateTrackerTriangle.cpp.

◆ vpTemplateTrackerTriangle() [3/6]

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 104 of file vpTemplateTrackerTriangle.cpp.

References init().

◆ vpTemplateTrackerTriangle() [4/6]

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() [5/6]

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() [6/6]

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 152 of file vpTemplateTrackerTriangle.cpp.

References init().

Member Function Documentation

◆ getArea()

double vpTemplateTrackerTriangle::getArea ( ) const
inline

Return the area of the triangle.

Returns
The area of the triangle.

Definition at line 100 of file vpTemplateTrackerTriangle.h.

Referenced by vpTemplateTrackerZone::getArea().

◆ getCorner() [1/2]

vpColVector vpTemplateTrackerTriangle::getCorner ( unsigned int  i) const
inline

Returns the coordinates of a triangle corner.

Parameters
i: Allowed values are 0, 1 or 2.
Returns
  • if i = 0, return corner 1 coordinates,
  • if i = 1, return corner 2 coordinates,
  • if i = 2, return corner 3 coordinates.

The coordinates are returned as a 2 dimension vector (x,y).

Definition at line 117 of file vpTemplateTrackerTriangle.h.

Referenced by vpTemplateTracker::computeEvalRMS(), vpTemplateTrackerWarp::getDistanceBetweenZoneAndWarpedZone(), and vpTemplateTracker::initPosEvalRMS().

◆ getCorner() [2/2]

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: The coordinate of the corner along horizontal axis.
y: The coordinate of the corner along vertical axis.

Definition at line 136 of file vpTemplateTrackerTriangle.h.

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

◆ getCorners() [1/3]

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 327 of file vpTemplateTrackerTriangle.cpp.

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

◆ getCorners() [2/3]

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 340 of file vpTemplateTrackerTriangle.cpp.

Referenced by vpTemplateTrackerWarp::warpTriangle().

◆ getCorners() [3/3]

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 315 of file vpTemplateTrackerTriangle.cpp.

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

◆ getMaxx()

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().

◆ getMaxy()

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 426 of file vpTemplateTrackerTriangle.cpp.

References h_t, and miny_temp.

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

◆ getMinx()

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 411 of file vpTemplateTrackerTriangle.cpp.

References minx_temp.

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

◆ getMiny()

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 416 of file vpTemplateTrackerTriangle.cpp.

References miny_temp.

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

◆ getPyramidDown()

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().

◆ getSize() [1/2]

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 391 of file vpTemplateTrackerTriangle.cpp.

References h_t, and l_t.

◆ getSize() [2/2]

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 401 of file vpTemplateTrackerTriangle.cpp.

References h_t, and l_t.

◆ init() [1/4]

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 167 of file vpTemplateTrackerTriangle.cpp.

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

◆ init() [2/4]

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 177 of file vpTemplateTrackerTriangle.cpp.

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

◆ init() [3/4]

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 199 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.

◆ init() [4/4]

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 188 of file vpTemplateTrackerTriangle.cpp.

References init().

◆ inTriangle() [1/3]

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 288 of file vpTemplateTrackerTriangle.cpp.

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

◆ inTriangle() [2/3]

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 265 of file vpTemplateTrackerTriangle.cpp.

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

◆ inTriangle() [3/3]

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 308 of file vpTemplateTrackerTriangle.cpp.

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

Referenced by vpTemplateTrackerZone::fillTriangle().

◆ operator=()

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

Member Data Documentation

◆ area

double vpTemplateTrackerTriangle::area
protected

Definition at line 80 of file vpTemplateTrackerTriangle.h.

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

◆ C1

vpTemplateTrackerDPoint vpTemplateTrackerTriangle::C1
protected

Definition at line 67 of file vpTemplateTrackerTriangle.h.

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

◆ C2

vpTemplateTrackerDPoint vpTemplateTrackerTriangle::C2
protected

Corner 1.

Definition at line 68 of file vpTemplateTrackerTriangle.h.

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

◆ C3

vpTemplateTrackerDPoint vpTemplateTrackerTriangle::C3
protected

Corner 2.

Definition at line 69 of file vpTemplateTrackerTriangle.h.

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

◆ h_t

double vpTemplateTrackerTriangle::h_t
protected

Definition at line 72 of file vpTemplateTrackerTriangle.h.

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

◆ l_t

double vpTemplateTrackerTriangle::l_t
protected

Corner 3.

Definition at line 71 of file vpTemplateTrackerTriangle.h.

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

◆ marge_triangle

double vpTemplateTrackerTriangle::marge_triangle
protected

Definition at line 79 of file vpTemplateTrackerTriangle.h.

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

◆ minx_temp

double vpTemplateTrackerTriangle::minx_temp
protected

Definition at line 65 of file vpTemplateTrackerTriangle.h.

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

◆ miny_temp

double vpTemplateTrackerTriangle::miny_temp
protected

Definition at line 66 of file vpTemplateTrackerTriangle.h.

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

◆ not_good

bool vpTemplateTrackerTriangle::not_good
protected

Definition at line 74 of file vpTemplateTrackerTriangle.h.

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

◆ uvinv00

double vpTemplateTrackerTriangle::uvinv00
protected

Definition at line 75 of file vpTemplateTrackerTriangle.h.

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

◆ uvinv01

double vpTemplateTrackerTriangle::uvinv01
protected

Definition at line 76 of file vpTemplateTrackerTriangle.h.

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

◆ uvinv10

double vpTemplateTrackerTriangle::uvinv10
protected

Definition at line 77 of file vpTemplateTrackerTriangle.h.

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

◆ uvinv11

double vpTemplateTrackerTriangle::uvinv11
protected

Definition at line 78 of file vpTemplateTrackerTriangle.h.

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