Visual Servoing Platform
version 3.4.0
|
#include <vpDot.h>
Public Types | |
enum | vpConnexityType { CONNEXITY_4, CONNEXITY_8 } |
Public Member Functions | |
vpDot () | |
vpDot (const vpImagePoint &ip) | |
vpDot (const vpDot &d) | |
virtual | ~vpDot () |
void | display (const vpImage< unsigned char > &I, vpColor color=vpColor::red, unsigned int thickness=1) const |
vpColVector | get_nij () const |
double | getArea () const |
vpRect | getBBox () const |
vpImagePoint | getCog () const |
std::list< vpImagePoint > | getEdges () const |
std::list< vpImagePoint > | getConnexities () const |
double | getGamma () const |
double | getGrayLevelPrecision () const |
double | getMaxDotSize () const |
double | getMeanGrayLevel () const |
vpPolygon | getPolygon () const |
unsigned int | getWidth () const |
unsigned int | getHeight () const |
void | initTracking (const vpImage< unsigned char > &I) |
void | initTracking (const vpImage< unsigned char > &I, const vpImagePoint &ip) |
void | initTracking (const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int gray_level_min, unsigned int gray_level_max) |
vpDot & | operator= (const vpDot &d) |
bool | operator== (const vpDot &d) const |
bool | operator!= (const vpDot &d) const |
void | print (std::ostream &os) |
void | setCog (const vpImagePoint &ip) |
void | setComputeMoments (bool activate) |
void | setConnexity (vpConnexityType type) |
void | setMaxDotSize (double percentage) |
void | setGrayLevelMin (const unsigned int &level_min) |
void | setGrayLevelMax (const unsigned int &level_max) |
void | setGrayLevelPrecision (const double &grayLevelPrecision) |
void | setGraphics (bool activate) |
void | setGraphicsThickness (unsigned int t) |
void | track (const vpImage< unsigned char > &I) |
void | track (const vpImage< unsigned char > &I, vpImagePoint &ip) |
Public Member Functions Inherited from vpTracker | |
vpColVector | get_p () const |
vpColVector | get_cP () const |
Static Public Member Functions | |
static void | display (const vpImage< unsigned char > &I, const vpImagePoint &cog, const std::list< vpImagePoint > &edges_list, vpColor color=vpColor::red, unsigned int thickness=1) |
static void | display (const vpImage< vpRGBa > &I, const vpImagePoint &cog, const std::list< vpImagePoint > &edges_list, vpColor color=vpColor::red, unsigned int thickness=1) |
Public Attributes | |
double | m00 |
double | m01 |
double | m10 |
double | m11 |
double | m20 |
double | m02 |
double | mu11 |
double | mu20 |
double | mu02 |
Public Attributes Inherited from vpTracker | |
vpColVector | p |
vpColVector | cP |
bool | cPAvailable |
Static Public Attributes | |
static const unsigned int | SPIRAL_SEARCH_SIZE = 350 |
Friends | |
VISP_EXPORT std::ostream & | operator<< (std::ostream &os, vpDot &d) |
This tracker is meant to track a dot (connected pixels with same gray level) on a vpImage.
The underground algorithm is based on a binarization of the image and a connex component segmentation to determine the dot characteristics (location, moments, size...).
The following sample code shows how to grab images from a firewire camera, track a blob and display the tracking results.
|
explicit |
void vpDot::display | ( | const vpImage< unsigned char > & | I, |
vpColor | color = vpColor::red , |
||
unsigned int | thick = 1 |
||
) | const |
Display in overlay the dot edges and center of gravity.
I | : Image. |
color | : The color used for the display. |
thick | : Thickness of the displayed cross located at the dot cog. |
Definition at line 826 of file vpDot.cpp.
References vpDisplay::displayCross(), and vpDisplay::displayPoint().
|
static |
Display the dot center of gravity and its list of edges.
I | : The image used as background. |
cog | : The center of gravity. |
edges_list | : The list of edges; |
color | : Color used to display the dot. |
thickness | : Thickness of the dot. |
Definition at line 880 of file vpDot.cpp.
References vpDisplay::displayCross(), and vpDisplay::displayPoint().
|
static |
Display the dot center of gravity and its list of edges.
I | : The image used as background. |
cog | : The center of gravity. |
edges_list | : The list of edges; |
color | : Color used to display the dot. |
thickness | : Thickness of the dot. |
Definition at line 905 of file vpDot.cpp.
References vpDisplay::displayCross(), and vpDisplay::displayPoint().
|
inlineinherited |
Return object parameters expressed in the 3D camera frame.
Definition at line 99 of file vpTracker.h.
|
inline |
Gets the second order normalized centered moment as a 3-dim vector containing such as
Definition at line 210 of file vpDot.h.
Referenced by vpFeatureBuilder::create().
|
inlineinherited |
Return object parameters expressed in the 2D image plane computed by perspective projection.
Definition at line 97 of file vpTracker.h.
|
inline |
Gets the area of the blob corresponding also to the zero order moment.
|
inline |
Return the dot bounding box.
Definition at line 234 of file vpDot.h.
References vpRect::setRect().
|
inline |
Return the location of the dot center of gravity.
Definition at line 247 of file vpDot.h.
Referenced by vpFeatureBuilder::create(), operator!=(), operator=(), and operator==().
|
inline |
|
inline |
Return the list of all the image points on the border of the dot.
|
inline |
|
inline |
Return the width of the dot.
Definition at line 303 of file vpDot.h.
References vpTracker::operator=().
|
inline |
|
inline |
|
inline |
void vpDot::initTracking | ( | const vpImage< unsigned char > & | I | ) |
Initialize the tracking with a mouse click and update the dot characteristics (center of gravity, moments).
Wait a user click in a gray area in the image I. The clicked pixel will be the starting point from which the dot will be tracked.
The threshold used to segment the dot is set with the grayLevelPrecision parameter. See the formula in setGrayLevelPrecision() function.
The sub pixel coordinates of the dot are updated. To get the center of gravity coordinates of the dot, use getCog(). To compute the moments use setComputeMoments(true) before a call to initTracking().
I | : Image to process. |
Definition at line 635 of file vpDot.cpp.
References vpImagePoint::get_i(), vpImagePoint::get_j(), vpDisplay::getClick(), and track().
void vpDot::initTracking | ( | const vpImage< unsigned char > & | I, |
const vpImagePoint & | ip | ||
) |
Initialize the tracking for a dot supposed to be located at (u,v) and updates the dot characteristics (center of gravity, moments).
The threshold used to segment the dot is set to 80 percent of the gray level of the pixel (u,v).
The sub pixel coordinates of the dot are updated. To get the center of gravity coordinates of the dot, use getCog(). To compute the moments use setComputeMoments(true) before a call to initTracking().
I | : Image to process. |
ip | : Location of the starting point from which the dot will be tracked in the image. |
Definition at line 686 of file vpDot.cpp.
References vpImagePoint::get_i(), vpImagePoint::get_j(), and track().
void vpDot::initTracking | ( | const vpImage< unsigned char > & | I, |
const vpImagePoint & | ip, | ||
unsigned int | level_min, | ||
unsigned int | level_max | ||
) |
Initialize the tracking for a dot supposed to be located at (u,v) and updates the dot characteristics (center of gravity, moments).
The sub pixel coordinates of the dot are updated. To get the center of gravity coordinates of the dot, use getCog(). To compute the moments use setComputeMoments(true) before a call to initTracking().
I | : Image to process. |
ip | : Location of the starting point from which the dot will be tracked in the image. |
level_min | : Minimum gray level threshold used to segment the dot; value comprised between 0 and 255. |
level_max | : Maximum gray level threshold used to segment the dot; value comprised between 0 and 255. gray_level_max should be greater than gray_level_min. |
Definition at line 740 of file vpDot.cpp.
References track().
bool vpDot::operator!= | ( | const vpDot & | d | ) | const |
bool vpDot::operator== | ( | const vpDot & | d | ) | const |
Definition at line 174 of file vpDot.cpp.
References CONNEXITY_8, vpDisplay::displayPoint(), vpTrackingException::featureLostError, vpImagePoint::get_u(), getCog(), vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpTrackingException::initializationError, m00, m01, m02, m10, m11, m20, mu02, mu11, mu20, vpColor::red, vpImagePoint::set_u(), vpImagePoint::set_v(), and SPIRAL_SEARCH_SIZE.
|
inline |
|
inline |
Activates the dot's moments computation.
activate | true, if you want to compute the moments. If false, moments are not computed. |
Computed moment are vpDot::m00, vpDot::m10, vpDot::m01, vpDot::m11, vpDot::m20, vpDot::m02 and second order centered moments vpDot::mu11, vpDot::mu20, vpDot::mu02 computed with respect to the blob centroid.
The coordinates of the region's centroid (u, v) can be computed from the moments by and .
|
inline |
|
inline |
Activates the display of all the pixels of the dot during the tracking. The default thickness of the overlayed drawings can be modified using setGraphicsThickness().
activate | true to activate the display of dot pixels, false to turn off the display. |
|
inline |
Modify the default thickness that is set to 1 of the drawings in overlay when setGraphics() is enabled.
Definition at line 368 of file vpDot.h.
References vpTracker::init(), and vpColor::red.
|
inline |
|
inline |
void vpDot::setGrayLevelPrecision | ( | const double & | precision | ) |
Set the precision of the gray level of the dot.
precision | : It is a double precision float which value is in ]0,1]:
|
void vpDot::setMaxDotSize | ( | double | percentage | ) |
Maximal size of the region to track in terms of image size percentage.
percentage | : Image size percentage corresponding to the dot maximal size. Values should be in ]0 : 1]. If 1, that means that the dot to track could take up the whole image. |
During the tracking, if the dot size if bigger than the maximal size allowed an exception is throwed : vpTrackingException::featureLostError.
Definition at line 601 of file vpDot.cpp.
References vpTRACE.
void vpDot::track | ( | const vpImage< unsigned char > & | I | ) |
Track and compute the dot characteristics.
To get the center of gravity coordinates of the dot, use getCog(). To compute the moments use setComputeMoments(true) before a call to initTracking().
I | : Image to process. |
Definition at line 770 of file vpDot.cpp.
References vpDisplay::displayCross(), vpImagePoint::get_u(), vpImagePoint::get_v(), m01, m02, m10, m11, m20, mu02, mu11, mu20, vpColor::red, vpImagePoint::set_u(), and vpImagePoint::set_v().
Referenced by initTracking(), and track().
void vpDot::track | ( | const vpImage< unsigned char > & | I, |
vpImagePoint & | ip | ||
) |
Track and updates the new dot coordinates
To compute the moments use setComputeMoments(true) before a call to initTracking() or track().
I | : Image to process. |
ip | [out] : Sub pixel coordinate of the tracked dot center of gravity. |
Definition at line 812 of file vpDot.cpp.
References track().
|
friend |
Writes the dot center of gravity coordinates in the frame (i,j) (For more details about the orientation of the frame see the vpImagePoint documentation) to the stream os, and returns a reference to the stream.
|
inherited |
Feature coordinates expressed in the camera frame cP.
Definition at line 77 of file vpTracker.h.
Referenced by vpFeaturePoint3D::buildFrom(), vpSphere::changeFrame(), vpPoint::changeFrame(), vpCircle::changeFrame(), vpLine::changeFrame(), vpCylinder::changeFrame(), vpFeatureBuilder::create(), vpPoint::get_W(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), vpSphere::init(), vpCircle::init(), vpPoint::init(), vpLine::init(), vpCylinder::init(), vpMbtPolygon::isVisible(), vpTracker::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpSphere::projection(), vpCircle::projection(), vpPoint::projection(), vpLine::projection(), vpCylinder::projection(), vpPoint::set_W(), vpPoint::set_X(), vpPoint::set_Y(), and vpPoint::set_Z().
|
inherited |
Flag used to indicate if the feature parameters cP expressed in the camera frame are available.
Definition at line 83 of file vpTracker.h.
Referenced by vpTracker::init(), and vpTracker::operator=().
double vpDot::m00 |
Considering the general distribution moments for points defined by the relation , is a zero order moment obtained with .
Definition at line 135 of file vpDot.h.
Referenced by operator=(), and operator==().
double vpDot::m01 |
Considering the general distribution moments for points defined by the relation , is a first order moment obtained with and .
Definition at line 142 of file vpDot.h.
Referenced by operator=(), operator==(), and track().
double vpDot::m02 |
Considering the general distribution moments for points defined by the relation , is a second order moment obtained with and .
Definition at line 170 of file vpDot.h.
Referenced by operator=(), operator==(), and track().
double vpDot::m10 |
Considering the general distribution moments for points defined by the relation , is a first order moment obtained with and .
Definition at line 149 of file vpDot.h.
Referenced by operator=(), operator==(), and track().
double vpDot::m11 |
Considering the general distribution moments for points defined by the relation , is a first order moment obtained with and .
Definition at line 156 of file vpDot.h.
Referenced by operator=(), operator==(), and track().
double vpDot::m20 |
Considering the general distribution moments for points defined by the relation , is a second order moment obtained with and .
Definition at line 163 of file vpDot.h.
Referenced by operator=(), operator==(), and track().
double vpDot::mu02 |
is a second order centered moment defined by:
Definition at line 187 of file vpDot.h.
Referenced by operator=(), operator==(), and track().
double vpDot::mu11 |
is a second order centered moment defined by:
Definition at line 177 of file vpDot.h.
Referenced by operator=(), operator==(), and track().
double vpDot::mu20 |
is a second order centered moment defined by:
Definition at line 182 of file vpDot.h.
Referenced by operator=(), operator==(), and track().
|
inherited |
Feature coordinates expressed in the image plane p. They correspond to 2D normalized coordinates expressed in meters.
Definition at line 73 of file vpTracker.h.
Referenced by vpMbtDistanceCircle::computeInteractionMatrixError(), vpCircle::computeIntersectionPoint(), vpMeterPixelConversion::convertEllipse(), vpFeatureBuilder::create(), vpSphere::display(), vpPoint::display(), vpCircle::display(), vpLine::display(), vpProjectionDisplay::display(), vpCylinder::display(), vpProjectionDisplay::displayCamera(), vpFeatureDisplay::displayEllipse(), vpPose::displayModel(), vpImageDraw::drawFrame(), vpPoint::get_w(), vpPoint::get_x(), vpPoint::get_y(), vpSphere::init(), vpMeTracker::init(), vpCircle::init(), vpPoint::init(), vpLine::init(), vpCylinder::init(), vpTracker::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpSphere::projection(), vpCircle::projection(), vpPoint::projection(), vpLine::projection(), vpCylinder::projection(), vpPoint::set_w(), vpPoint::set_x(), and vpPoint::set_y().
|
static |