Visual Servoing Platform
version 3.5.1 under development (2023-09-22)
|
#include <visp3/blob/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 |
|
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 870 of file vpDot.cpp.
References vpDisplay::displayCross(), and vpDisplay::displayPoint().
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 814 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 895 of file vpDot.cpp.
References vpDisplay::displayCross(), and vpDisplay::displayPoint().
|
inlineinherited |
Return object parameters expressed in the 3D camera frame.
Definition at line 94 of file vpTracker.h.
|
inline |
Gets the second order normalized centered moment as a 3-dim vector containing such as
Definition at line 206 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 92 of file vpTracker.h.
|
inline |
|
inline |
Return the dot bounding box.
Definition at line 230 of file vpDot.h.
References vpRect::setRect().
|
inline |
Return the location of the dot center of gravity.
Definition at line 243 of file vpDot.h.
Referenced by vpFeatureBuilder::create().
|
inline |
|
inline |
Return the list of all the image points on the border of the dot.
|
inline |
|
inline |
|
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 617 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 670 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 726 of file vpDot.cpp.
References track().
|
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.
|
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 582 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 757 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 800 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 72 of file vpTracker.h.
Referenced by vpFeaturePoint3D::buildFrom(), vpCircle::changeFrame(), vpCylinder::changeFrame(), vpLine::changeFrame(), vpPoint::changeFrame(), vpSphere::changeFrame(), vpFeatureBuilder::create(), vpPoint::get_W(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), vpCircle::init(), vpCylinder::init(), vpLine::init(), vpPoint::init(), vpSphere::init(), vpMbtPolygon::isVisible(), vpTracker::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpCircle::projection(), vpCylinder::projection(), vpLine::projection(), vpPoint::projection(), vpSphere::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 78 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 131 of file vpDot.h.
Referenced by 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 138 of file vpDot.h.
Referenced by 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 166 of file vpDot.h.
Referenced by 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 145 of file vpDot.h.
Referenced by 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 152 of file vpDot.h.
Referenced by 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 159 of file vpDot.h.
Referenced by operator=(), and track().
double vpDot::mu02 |
is a second order centered moment defined by:
Definition at line 183 of file vpDot.h.
Referenced by operator=(), and track().
double vpDot::mu11 |
is a second order centered moment defined by:
Definition at line 173 of file vpDot.h.
Referenced by operator=(), and track().
double vpDot::mu20 |
is a second order centered moment defined by:
Definition at line 178 of file vpDot.h.
Referenced by operator=(), and track().
|
inherited |
Feature coordinates expressed in the image plane p. They correspond to 2D normalized coordinates expressed in meters.
Definition at line 68 of file vpTracker.h.
Referenced by vpMbtDistanceCircle::computeInteractionMatrixError(), vpCircle::computeIntersectionPoint(), vpMeterPixelConversion::convertEllipse(), vpFeatureBuilder::create(), vpCircle::display(), vpCylinder::display(), vpLine::display(), vpPoint::display(), vpSphere::display(), vpProjectionDisplay::display(), vpProjectionDisplay::displayCamera(), vpFeatureDisplay::displayEllipse(), vpPose::displayModel(), vpImageDraw::drawFrame(), vpPoint::get_w(), vpPoint::get_x(), vpPoint::get_y(), vpCircle::init(), vpCylinder::init(), vpLine::init(), vpPoint::init(), vpSphere::init(), vpMeTracker::init(), vpTracker::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpCircle::projection(), vpCylinder::projection(), vpLine::projection(), vpPoint::projection(), vpSphere::projection(), vpPoint::set_w(), vpPoint::set_x(), and vpPoint::set_y().