Visual Servoing Platform
version 3.6.1 under development (2024-11-21)
|
#include <visp3/blob/vpDot.h>
Public Types | |
enum | vpConnexityType { CONNEXITY_4 , CONNEXITY_8 } |
Public Member Functions | |
vpDot () | |
VP_EXPLICIT | vpDot (const vpImagePoint &ip) |
vpDot (const vpDot &d) | |
virtual | ~vpDot () VP_OVERRIDE |
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 &cog) |
void | setComputeMoments (bool activate) |
void | setConnexity (const vpConnexityType &connexityType) |
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 thickness) |
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 | |
Public Attributes Inherited from vpTracker | |
vpColVector | p |
vpColVector | cP |
bool | cPAvailable |
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.
vpDot::vpDot | ( | const vpImagePoint & | cog | ) |
|
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 872 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 813 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 900 of file vpDot.cpp.
References vpDisplay::displayCross(), and vpDisplay::displayPoint().
|
inlineinherited |
Return object parameters expressed in the 3D camera frame.
Definition at line 95 of file vpTracker.h.
|
inline |
|
inlineinherited |
Return object parameters expressed in the 2D image plane computed by perspective projection.
Definition at line 93 of file vpTracker.h.
|
inline |
|
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.
|
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 gray level precision 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 630 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 682 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 735 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.
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 760 of file vpDot.cpp.
References vpDisplay::displayCross(), vpImagePoint::get_u(), vpImagePoint::get_v(), 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 799 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 73 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 79 of file vpTracker.h.
Referenced by vpTracker::init(), and vpTracker::operator=().
|
inherited |
Feature coordinates expressed in the image plane p. They correspond to 2D normalized coordinates expressed in meters.
Definition at line 69 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(), vpMeTracker::init(), vpCircle::init(), vpCylinder::init(), vpLine::init(), vpPoint::init(), vpSphere::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().