![]() |
Visual Servoing Platform version 3.7.0
|
#include <vpTemplateTrackerZone.h>
Public Member Functions | |
| vpTemplateTrackerZone () | |
| vpTemplateTrackerZone (const vpTemplateTrackerZone &z) | |
| virtual | ~vpTemplateTrackerZone () |
| void | add (const vpTemplateTrackerTriangle &t) |
| void | clear () |
| void | copy (const vpTemplateTrackerZone &z) |
| void | display (const vpImage< unsigned char > &I, const vpColor &col=vpColor::green, unsigned int thickness=3) |
| void | display (const vpImage< vpRGBa > &I, const vpColor &col=vpColor::green, unsigned int thickness=3) |
| void | fillTriangle (vpImage< unsigned char > &I, unsigned int id, unsigned char gray_level) |
| double | getArea () const |
| vpImagePoint | getCenter () const |
| vpImagePoint | getCenter (int borne_x, int borne_y) const |
| int | getMaxx () const |
| int | getMaxy () const |
| int | getMinx () const |
| int | getMiny () const |
| vpRect | getBoundingBox () const |
| unsigned int | getNbTriangle () const |
| vpTemplateTrackerZone | getPyramidDown () const |
| void | getTriangle (unsigned int i, vpTemplateTrackerTriangle &T) const |
| vpTemplateTrackerTriangle | getTriangle (unsigned int i) const |
| void | initClick (const vpImage< unsigned char > &I, bool delaunay=false) |
| void | initFromPoints (const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &ip, bool delaunay=false) |
| bool | inZone (const int &i, const int &j) const |
| bool | inZone (const double &i, const double &j) const |
| bool | inZone (const int &i, const int &j, unsigned int &id_triangle) const |
| bool | inZone (const double &i, const double &j, unsigned int &id_triangle) const |
| vpTemplateTrackerZone & | operator= (const vpTemplateTrackerZone &z) |
Protected Attributes | |
| std::vector< vpTemplateTrackerTriangle > | Zone |
| int | min_x |
| int | min_y |
| int | max_x |
| int | max_y |
A zone is defined by a set of triangles defined as vpTemplateTrackerTriangle.
A zone can be initialized either by user interaction using mouse click in a display device throw initClick(), or by a list of points throw initFromPoints().
Tutorials
If you are interested in the Template Tracker (TT), you may have a look at:
Definition at line 68 of file vpTemplateTrackerZone.h.
| BEGIN_VISP_NAMESPACE vpTemplateTrackerZone::vpTemplateTrackerZone | ( | ) |
Default constructor.
Definition at line 46 of file vpTemplateTrackerZone.cpp.
References max_x, max_y, min_x, min_y, and Zone.
Referenced by copy(), getPyramidDown(), operator=(), and vpTemplateTrackerZone().
| vpTemplateTrackerZone::vpTemplateTrackerZone | ( | const vpTemplateTrackerZone & | z | ) |
Copy constructor.
Definition at line 51 of file vpTemplateTrackerZone.cpp.
References max_x, max_y, min_x, min_y, vpTemplateTrackerZone(), and Zone.
|
virtual |
| void vpTemplateTrackerZone::add | ( | const vpTemplateTrackerTriangle & | t | ) |
Add a triangle to the zone and update the bounding box.
| t | : Triangle to introduce in the zone. |
Definition at line 245 of file vpTemplateTrackerZone.cpp.
References max_x, max_y, min_x, min_y, and Zone.
Referenced by copy(), getPyramidDown(), initFromPoints(), and vpTemplateTrackerWarp::warpZone().
| void vpTemplateTrackerZone::clear | ( | ) |
Remove all the triangles that define the zone.
Definition at line 60 of file vpTemplateTrackerZone.cpp.
References max_x, max_y, min_x, min_y, and Zone.
Referenced by operator=(), vpTemplateTrackerWarp::warpZone(), and ~vpTemplateTrackerZone().
| void vpTemplateTrackerZone::copy | ( | const vpTemplateTrackerZone & | z | ) |
Copy all the triangles that define zone Z in the current zone (*this) and update the zone bounding box.
| z | : Zone with a set of triangles provided as input. |
Definition at line 537 of file vpTemplateTrackerZone.cpp.
References add(), vpTemplateTrackerTriangle::getMaxx(), vpTemplateTrackerTriangle::getMaxy(), vpTemplateTrackerTriangle::getMinx(), vpTemplateTrackerTriangle::getMiny(), max_x, max_y, min_x, min_y, and vpTemplateTrackerZone().
Referenced by operator=().
| void vpTemplateTrackerZone::display | ( | const vpImage< unsigned char > & | I, |
| const vpColor & | col = vpColor::green, | ||
| unsigned int | thickness = 3 ) |
If a display device is associated to image I, display in overlay the triangles that define the zone.
| I | : Image. |
| col | : Color used to display the triangles. |
| thickness | : Thickness of the triangle lines. |
Definition at line 458 of file vpTemplateTrackerZone.cpp.
References vpDisplay::displayLine(), and Zone.
Referenced by vpTemplateTracker::display(), and vpTemplateTracker::display().
| void vpTemplateTrackerZone::display | ( | const vpImage< vpRGBa > & | I, |
| const vpColor & | col = vpColor::green, | ||
| unsigned int | thickness = 3 ) |
If a display device is associated to image I, display in overlay the triangles that define the zone.
| I | : Image. |
| col | : Color used to display the triangles. |
| thickness | : Thickness of the triangle lines. |
Definition at line 478 of file vpTemplateTrackerZone.cpp.
References vpDisplay::displayLine(), and Zone.
| void vpTemplateTrackerZone::fillTriangle | ( | vpImage< unsigned char > & | I, |
| unsigned int | id, | ||
| unsigned char | gray_level ) |
Modify all the pixels inside a triangle with a given gray level.
| I | : Output image. |
| id | : Triangle id. This value should be less than the number of triangles used to define the zone and available using getNbTriangle(). |
| gray_level | : Color used to fill the triangle with. |
Definition at line 502 of file vpTemplateTrackerZone.cpp.
References getNbTriangle(), getTriangle(), and vpTemplateTrackerTriangle::inTriangle().
| double vpTemplateTrackerZone::getArea | ( | ) | const |
Return the area of the template zone.
Definition at line 588 of file vpTemplateTrackerZone.cpp.
References vpTemplateTrackerTriangle::getArea(), getNbTriangle(), and getTriangle().
| vpRect vpTemplateTrackerZone::getBoundingBox | ( | ) | const |
Return a rectangle that defines the bounding box of the zone.
Definition at line 442 of file vpTemplateTrackerZone.cpp.
References max_x, max_y, min_x, min_y, vpRect::setBottomRight(), and vpRect::setTopLeft().
| vpImagePoint vpTemplateTrackerZone::getCenter | ( | ) | const |
Return the position of the center of gravity of the zone.
| vpException::divideByZeroError | The size of the zone is null. |
Definition at line 395 of file vpTemplateTrackerZone.cpp.
References vpException::divideByZeroError, inZone(), max_x, max_y, min_x, min_y, and vpImagePoint::set_uv().
| vpImagePoint vpTemplateTrackerZone::getCenter | ( | int | borne_x, |
| int | borne_y ) const |
Return the position of the center of gravity in a given area.
| borne_x | : Right coordinate of the area to consider. |
| borne_y | : Bottom coordinate of the area to consider. |
| vpException::divideByZeroError | The size of the zone is null. |
Definition at line 562 of file vpTemplateTrackerZone.cpp.
References vpException::divideByZeroError, inZone(), and vpImagePoint::set_uv().
| int vpTemplateTrackerZone::getMaxx | ( | ) | const |
Definition at line 421 of file vpTemplateTrackerZone.cpp.
References max_x.
| int vpTemplateTrackerZone::getMaxy | ( | ) | const |
Definition at line 426 of file vpTemplateTrackerZone.cpp.
References max_y.
| int vpTemplateTrackerZone::getMinx | ( | ) | const |
Definition at line 431 of file vpTemplateTrackerZone.cpp.
References min_x.
| int vpTemplateTrackerZone::getMiny | ( | ) | const |
Definition at line 436 of file vpTemplateTrackerZone.cpp.
References min_y.
|
inline |
Return the number of triangles that define the zone.
Definition at line 106 of file vpTemplateTrackerZone.h.
References Zone.
Referenced by fillTriangle(), getArea(), getPyramidDown(), getTriangle(), getTriangle(), and vpTemplateTrackerWarp::warpZone().
| vpTemplateTrackerZone vpTemplateTrackerZone::getPyramidDown | ( | ) | const |
Return a zone with triangles that are down scaled by a factor 2.
Definition at line 519 of file vpTemplateTrackerZone.cpp.
References add(), getNbTriangle(), vpTemplateTrackerTriangle::getPyramidDown(), getTriangle(), and vpTemplateTrackerZone().
| vpTemplateTrackerTriangle vpTemplateTrackerZone::getTriangle | ( | unsigned int | i | ) | const |
A zone is defined by a set of triangles. This function returns the ith triangle.
| i | : Index of the triangle to return. |
The following sample code shows how to use this function:
Definition at line 384 of file vpTemplateTrackerZone.cpp.
References vpException::badValue, getNbTriangle(), and Zone.
| void vpTemplateTrackerZone::getTriangle | ( | unsigned int | i, |
| vpTemplateTrackerTriangle & | T ) const |
A zone is defined by a set of triangles. This function returns the ith triangle.
| [in] | i | : Index of the triangle to return. |
| [out] | T | : The triangle corresponding to index i. |
| pException::badValue | When the triangle with index i was not found. |
The following sample code shows how to use this function:
Definition at line 361 of file vpTemplateTrackerZone.cpp.
References vpException::badValue, getNbTriangle(), and Zone.
Referenced by fillTriangle(), getArea(), getPyramidDown(), and vpTemplateTrackerWarp::warpZone().
| void vpTemplateTrackerZone::initClick | ( | const vpImage< unsigned char > & | I, |
| bool | delaunay = false ) |
Initialize a zone in image I using mouse click.
| I | : Image used to select the zone. |
| delaunay | : Flag used to enable Delaunay triangulation.
|
Definition at line 103 of file vpTemplateTrackerZone.cpp.
References vpColor::blue, vpMouseButton::button3, vpDisplay::displayCross(), vpDisplay::displayLine(), vpDisplay::flush(), vpDisplay::getClick(), initFromPoints(), vpColor::red, vpTime::wait(), and Zone.
| void vpTemplateTrackerZone::initFromPoints | ( | const vpImage< unsigned char > & | I, |
| const std::vector< vpImagePoint > & | vip, | ||
| bool | delaunay = false ) |
Initialize the zone using a vector of image points.
| I | : Image to process. |
| vip | : Vector of image points used as initialization. |
| delaunay | :
|
Definition at line 161 of file vpTemplateTrackerZone.cpp.
References add(), vpException::functionNotImplementedError, vpTemplateTrackerTriangle::getMaxx(), vpTemplateTrackerTriangle::getMaxy(), vpTemplateTrackerTriangle::getMinx(), vpTemplateTrackerTriangle::getMiny(), initFromPoints(), max_x, max_y, min_x, min_y, and Zone.
Referenced by initClick(), and initFromPoints().
| bool vpTemplateTrackerZone::inZone | ( | const double & | i, |
| const double & | j ) const |
Test if a pixel with coordinates (i,j) is in the zone.
| i | : Coordinate i of the pixel to test. |
| j | : Coordinate j of the pixel to test. |
Definition at line 285 of file vpTemplateTrackerZone.cpp.
References Zone.
| bool vpTemplateTrackerZone::inZone | ( | const double & | i, |
| const double & | j, | ||
| unsigned int & | id_triangle ) const |
Test if a pixel with coordinates (i,j) is in the zone and returns also the index of the triangle that contains the pixel.
| i | : Coordinate i of the pixel to test. |
| j | : Coordinate j of the pixel to test. |
| id_triangle | : Index of the triangle that contains the pixel (i,j). |
Definition at line 329 of file vpTemplateTrackerZone.cpp.
References Zone.
| bool vpTemplateTrackerZone::inZone | ( | const int & | i, |
| const int & | j ) const |
Test if a pixel with coordinates (i,j) is in the zone.
| i | : Coordinate i of the pixel to test. |
| j | : Coordinate j of the pixel to test. |
Definition at line 267 of file vpTemplateTrackerZone.cpp.
References Zone.
Referenced by getCenter(), getCenter(), and vpTemplateTracker::initTracking().
| bool vpTemplateTrackerZone::inZone | ( | const int & | i, |
| const int & | j, | ||
| unsigned int & | id_triangle ) const |
Test if a pixel with coordinates (i,j) is in the zone and returns also the index of the triangle that contains the pixel.
| i | : Coordinate i of the pixel to test. |
| j | : Coordinate j of the pixel to test. |
| id_triangle | : Index of the triangle that contains the pixel (i,j). |
Definition at line 305 of file vpTemplateTrackerZone.cpp.
References Zone.
| vpTemplateTrackerZone & vpTemplateTrackerZone::operator= | ( | const vpTemplateTrackerZone & | z | ) |
Copy operator.
Definition at line 73 of file vpTemplateTrackerZone.cpp.
References clear(), copy(), and vpTemplateTrackerZone().
|
protected |
Bounding box parameter.
Definition at line 74 of file vpTemplateTrackerZone.h.
Referenced by add(), clear(), copy(), getBoundingBox(), getCenter(), getMaxx(), initFromPoints(), vpTemplateTrackerZone(), and vpTemplateTrackerZone().
|
protected |
Bounding box parameter.
Definition at line 75 of file vpTemplateTrackerZone.h.
Referenced by add(), clear(), copy(), getBoundingBox(), getCenter(), getMaxy(), initFromPoints(), vpTemplateTrackerZone(), and vpTemplateTrackerZone().
|
protected |
Bounding box parameter.
Definition at line 72 of file vpTemplateTrackerZone.h.
Referenced by add(), clear(), copy(), getBoundingBox(), getCenter(), getMinx(), initFromPoints(), vpTemplateTrackerZone(), and vpTemplateTrackerZone().
|
protected |
Bounding box parameter.
Definition at line 73 of file vpTemplateTrackerZone.h.
Referenced by add(), clear(), copy(), getBoundingBox(), getCenter(), getMiny(), initFromPoints(), vpTemplateTrackerZone(), and vpTemplateTrackerZone().
|
protected |
Vector of triangles that defines the zone.
Definition at line 71 of file vpTemplateTrackerZone.h.
Referenced by add(), clear(), display(), display(), getNbTriangle(), getTriangle(), getTriangle(), initClick(), initFromPoints(), inZone(), inZone(), inZone(), inZone(), vpTemplateTrackerZone(), and vpTemplateTrackerZone().