#include <vpDot.h>
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.
#include <visp3/blob/vpDot.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/sensor/vp1394TwoGrabber.h>
int main()
{
#if defined(VISP_HAVE_DC1394)
#if defined(VISP_HAVE_X11)
#endif
while(1) {
}
#endif
}
- See also
- vpDot2
- Examples
- poseVirtualVS.cpp, servoAfma4Point2DArtVelocity.cpp, servoAfma4Point2DCamVelocity.cpp, servoAfma6Ellipse2DCamVelocity.cpp, servoAfma6FourPoints2DArtVelocity.cpp, servoAfma6Point2DArtVelocity.cpp, servoAfma6Point2DCamVelocity.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoAfma6Segment2DCamVelocity.cpp, servoBiclopsPoint2DArtVelocity.cpp, servoViper850FourPoints2DArtVelocityLs_des.cpp, testRobotAfma6Pose.cpp, testRobotViper850Pose.cpp, and trackDot.cpp.
Definition at line 114 of file vpDot.h.
◆ vpConnexityType
Type of connexity 4, or 8.
Enumerator |
---|
CONNEXITY_4 | For a given pixel 4 neighbors are considered (left, right, up, down)
|
CONNEXITY_8 | For a given pixel 8 neighbors are considered (left, right, up, down, and the 4 pixels located on the diagonal)
|
Definition at line 120 of file vpDot.h.
◆ vpDot() [1/3]
◆ vpDot() [2/3]
Constructor with initialization of the dot location.
- Parameters
-
ip | : An image point with sub-pixel coordinates. |
Definition at line 105 of file vpDot.cpp.
◆ vpDot() [3/3]
vpDot::vpDot |
( |
const vpDot & |
d | ) |
|
◆ ~vpDot()
◆ display() [1/3]
Display the dot center of gravity and its list of edges.
- Parameters
-
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 879 of file vpDot.cpp.
◆ display() [2/3]
Display in overlay the dot edges and center of gravity.
- Parameters
-
I | : Image. |
color | : The color used for the display. |
thick | : Thickness of the displayed cross located at the dot cog. |
Definition at line 825 of file vpDot.cpp.
◆ display() [3/3]
Display the dot center of gravity and its list of edges.
- Parameters
-
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 904 of file vpDot.cpp.
◆ getBBox()
vpRect vpDot::getBBox |
( |
| ) |
const |
|
inline |
◆ getCog()
◆ getConnexities()
Return the list of all the image points inside the dot.
- Returns
- The list of all the images points in the dot. This list is updated after a call to track().
Definition at line 238 of file vpDot.h.
◆ getEdges()
Return the list of all the image points on the border of the dot.
- Warning
- Doesn't return the image points inside the dot anymore. To get those points see getConnexities().
Definition at line 228 of file vpDot.h.
◆ getGamma()
double vpDot::getGamma |
( |
| ) |
const |
|
inline |
◆ getGrayLevelPrecision()
double vpDot::getGrayLevelPrecision |
( |
| ) |
const |
|
inline |
Return the precision of the gray level of the dot. It is a double precision float witch value is in ]0,1]. 1 means full precision, whereas values close to 0 show a very bad precision.
Definition at line 248 of file vpDot.h.
◆ getHeight()
unsigned int vpDot::getHeight |
( |
| ) |
const |
|
inline |
◆ getMaxDotSize()
double vpDot::getMaxDotSize |
( |
| ) |
const |
|
inline |
◆ getMeanGrayLevel()
double vpDot::getMeanGrayLevel |
( |
| ) |
const |
|
inline |
Return the mean gray level value of the dot.
Definition at line 253 of file vpDot.h.
◆ getPolygon()
◆ getWidth()
unsigned int vpDot::getWidth |
( |
| ) |
const |
|
inline |
◆ initTracking() [1/3]
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().
- Warning
- The content of the image modified since we call track() to compute the dot characteristics.
- Parameters
-
- See also
- track(), getCog()
- Examples
- servoAfma4Point2DArtVelocity.cpp, servoAfma4Point2DCamVelocity.cpp, servoAfma6Ellipse2DCamVelocity.cpp, servoAfma6FourPoints2DArtVelocity.cpp, servoAfma6Point2DArtVelocity.cpp, servoAfma6Point2DCamVelocity.cpp, servoAfma6Points2DCamVelocityEyeToHand.cpp, servoBiclopsPoint2DArtVelocity.cpp, servoViper850FourPoints2DArtVelocityLs_des.cpp, testRobotAfma6Pose.cpp, and testRobotViper850Pose.cpp.
Definition at line 634 of file vpDot.cpp.
◆ initTracking() [2/3]
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().
- Warning
- The content of the image modified since we call track() to compute the dot characteristics.
- Parameters
-
I | : Image to process. |
ip | : Location of the starting point from which the dot will be tracked in the image. |
- See also
- track()
Definition at line 685 of file vpDot.cpp.
◆ initTracking() [3/3]
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().
- Warning
- The content of the image modified since we call track() to compute the dot characteristics.
- Parameters
-
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. |
- See also
- track(), getCog()
Definition at line 739 of file vpDot.cpp.
◆ operator!=()
bool vpDot::operator!= |
( |
const vpDot & |
d | ) |
const |
◆ operator=()
◆ operator==()
bool vpDot::operator== |
( |
const vpDot & |
d | ) |
const |
◆ print()
void vpDot::print |
( |
std::ostream & |
os | ) |
|
|
inline |
◆ setCog()
Initialize the dot coordinates with ip.
Definition at line 293 of file vpDot.h.
◆ setComputeMoments()
void vpDot::setComputeMoments |
( |
bool |
activate | ) |
|
|
inline |
◆ setConnexity()
Set the type of connexity: 4 or 8.
Definition at line 314 of file vpDot.h.
◆ setGraphics()
void vpDot::setGraphics |
( |
bool |
activate | ) |
|
|
inline |
◆ setGraphicsThickness()
void vpDot::setGraphicsThickness |
( |
unsigned int |
t | ) |
|
|
inline |
◆ setGrayLevelMax()
void vpDot::setGrayLevelMax |
( |
const unsigned int & |
level_max | ) |
|
|
inline |
◆ setGrayLevelMin()
void vpDot::setGrayLevelMin |
( |
const unsigned int & |
level_min | ) |
|
|
inline |
◆ setGrayLevelPrecision()
void vpDot::setGrayLevelPrecision |
( |
const double & |
precision | ) |
|
Set the precision of the gray level of the dot.
- Parameters
-
precision | : It is a double precision float which value is in ]0,1]:
- 1 means full precision, whereas values close to 0 show a very bad accuracy.
- Values lower or equal to 0 are brought back to an epsion>0
- Values higher than 1 are brought back to 1 If the initial gray level is I, the gray levels of the dot will be between :
and with .
|
- See also
- setWidth(), setHeight(), setGrayLevelMin(), setGrayLevelMax()
Definition at line 853 of file vpDot.cpp.
◆ setMaxDotSize()
void vpDot::setMaxDotSize |
( |
double |
percentage | ) |
|
Maximal size of the region to track in terms of image size percentage.
- Parameters
-
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.
- Examples
- servoAfma6Ellipse2DCamVelocity.cpp.
Definition at line 600 of file vpDot.cpp.
◆ track() [1/2]
void vpDot::track |
( |
const vpImage< unsigned char > & |
I | ) |
|
◆ track() [2/2]
Track and updates the new dot coordinates
To compute the moments use setComputeMoments(true) before a call to initTracking() or track().
- Warning
- The image is modified (all the pixels that belong to the point are set to white (ie to 255).
- Parameters
-
I | : Image to process. |
ip | [out] : Sub pixel coordinate of the tracked dot center of gravity. |
Definition at line 811 of file vpDot.cpp.
◆ operator<<
VISP_EXPORT std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
vpDot & |
d |
|
) |
| |
|
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.
Definition at line 920 of file vpDot.cpp.
◆ cP
◆ cPAvailable
bool vpTracker::cPAvailable |
|
inherited |
Flag used to indicate if the feature parameters cP expressed in the camera frame are available.
Definition at line 80 of file vpTracker.h.
Referenced by vpTracker::operator=().
◆ m00
◆ m01
◆ m02
◆ m10
◆ m11
◆ m20
◆ mu02
◆ mu11
◆ mu20
◆ SPIRAL_SEARCH_SIZE
const unsigned int vpDot::SPIRAL_SEARCH_SIZE = 350 |
|
static |
Spiral size for the dot search.
Definition at line 127 of file vpDot.h.