ViSP
2.8.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) |
vpRect | getBBox () |
vpImagePoint | getCog () const |
std::list< vpImagePoint > | getEdges () |
std::list< vpImagePoint > | getConnexities () |
double | getGamma () |
double | getGrayLevelPrecision () const |
double | getMaxDotSize () |
double | getMeanGrayLevel () |
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) |
bool | operator!= (const vpDot &d) |
void | print (std::ostream &os) |
void | setCog (const vpImagePoint &cog) |
void | setComputeMoments (const bool activate) |
void | setConnexity (vpConnexityType connexityType) |
void | setMaxDotSize (double percentage) |
void | setGrayLevelMin (const unsigned int &gray_level_min) |
void | setGrayLevelMax (const unsigned int &gray_level_max) |
void | setGrayLevelPrecision (const double &grayLevelPrecision) |
void | setGraphics (const bool activate) |
void | setGraphicsThickness (unsigned int thickness) |
void | track (const vpImage< unsigned char > &I) |
void | track (const vpImage< unsigned char > &I, vpImagePoint &ip) |
Deprecated functions | |
vp_deprecated void | getEdges (std::list< vpImagePoint > &edges_list) |
vp_deprecated void | getConnexities (vpList< vpImagePoint > &connexities_list) |
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 |
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.
vpDot::vpDot | ( | const vpImagePoint & | ip | ) |
void vpDot::display | ( | const vpImage< unsigned char > & | I, |
vpColor | color = vpColor::red , |
||
unsigned int | thickness = 1 |
||
) |
Display in overlay the dot edges and center of gravity.
I | : Image. |
color | : The color used for the display. |
thickness | : Thickness of the displayed cross located at the dot cog. |
Definition at line 852 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 912 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 939 of file vpDot.cpp.
References vpDisplay::displayCross(), and vpDisplay::displayPoint().
|
inline |
Return the dot bounding box.
Definition at line 212 of file vpDot.h.
References vpRect::setRect().
|
inline |
Return the location of the dot center of gravity.
Definition at line 227 of file vpDot.h.
Referenced by vpFeatureBuilder::create(), operator!=(), operator=(), and operator==().
|
inline |
|
inline |
connexities_list | : The list of all the images points on the dot border. This list is update after a call to track(). |
Definition at line 456 of file vpDot.h.
References vpList< type >::kill().
|
inline |
Return the list of all the image points on the border of the dot.
|
inline |
edges_list | : The list of all the images points on the dot border. This list is update after a call to track(). |
|
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 642 of file vpDot.cpp.
References vpImagePoint::get_i(), vpImagePoint::get_j(), vpDisplay::getClick(), track(), and vpERROR_TRACE.
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 697 of file vpDot.cpp.
References vpImagePoint::get_i(), vpImagePoint::get_j(), track(), and vpERROR_TRACE.
void vpDot::initTracking | ( | const vpImage< unsigned char > & | I, |
const vpImagePoint & | ip, | ||
unsigned int | gray_level_min, | ||
unsigned int | gray_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. |
gray_level_min | : Minimum gray level threshold used to segment the dot; value comprised between 0 and 255. |
gray_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 756 of file vpDot.cpp.
References track(), and vpERROR_TRACE.
bool vpDot::operator!= | ( | const vpDot & | d | ) |
bool vpDot::operator== | ( | const vpDot & | d | ) |
|
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.
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 & | grayLevelPrecision | ) |
Set the precision of the gray level of the dot.
grayLevelPrecision | : 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 605 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 791 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(), vpImagePoint::set_v(), and vpERROR_TRACE.
Referenced by initTracking(), and track().
void vpDot::track | ( | const vpImage< unsigned char > & | I, |
vpImagePoint & | cog | ||
) |
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. |
cog | [out] : Sub pixel coordinate of the tracked dot. |
Definition at line 838 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 82 of file vpTracker.h.
Referenced by vpFeaturePoint3D::buildFrom(), vpSphere::changeFrame(), vpCircle::changeFrame(), vpCylinder::changeFrame(), vpLine::changeFrame(), vpFeatureBuilder::create(), vpCircle::init(), vpSphere::init(), vpLine::init(), vpPoint::init(), vpCylinder::init(), vpTracker::operator=(), vpPoint::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpSphere::projection(), vpCircle::projection(), vpCylinder::projection(), and vpLine::projection().
|
inherited |
Flag used to indicate if the feature parameters cP expressed in the camera frame are available.
Definition at line 88 of file vpTracker.h.
Referenced by vpTracker::init(), vpTracker::operator=(), and vpPoint::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 133 of file vpDot.h.
Referenced by vpFeatureBuilder::create(), 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 140 of file vpDot.h.
Referenced by vpFeatureBuilder::create(), 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 172 of file vpDot.h.
Referenced by vpFeatureBuilder::create(), 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 147 of file vpDot.h.
Referenced by vpFeatureBuilder::create(), 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 154 of file vpDot.h.
Referenced by vpFeatureBuilder::create(), 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 vpFeatureBuilder::create(), operator=(), and track().
double vpDot::mu02 |
is a second order central moments defined by:
Definition at line 191 of file vpDot.h.
Referenced by operator=(), and track().
double vpDot::mu11 |
is a second order central moments defined by:
Definition at line 181 of file vpDot.h.
Referenced by operator=(), and track().
double vpDot::mu20 |
is a second order central moments defined by:
Definition at line 186 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 78 of file vpTracker.h.
Referenced by vpFeatureBuilder::create(), vpPoint::display(), vpSphere::display(), vpProjectionDisplay::display(), vpMeTracker::display(), vpCircle::display(), vpCylinder::display(), vpLine::display(), vpProjectionDisplay::displayCamera(), vpDisplay::displayFrame(), vpPose::displayModel(), vpCircle::init(), vpSphere::init(), vpMeTracker::init(), vpLine::init(), vpPoint::init(), vpCylinder::init(), vpMeLine::leastSquare(), vpTracker::operator=(), vpPoint::operator=(), vpForwardProjection::print(), vpPose::printPoint(), vpForwardProjection::project(), vpSphere::projection(), vpCircle::projection(), vpCylinder::projection(), vpLine::projection(), and vpMeLine::updateDelta().