![]() |
Visual Servoing Platform version 3.6.0
|
#include <vpMe.h>
Public Types | |
| enum | vpLikelihoodThresholdType { OLD_THRESHOLD = 0 , NORMALIZED_THRESHOLD = 1 } |
Public Member Functions | |
| vpMe () | |
| vpMe (const vpMe &me) | |
| virtual | ~vpMe () |
| vpMe & | operator= (const vpMe &me) |
| vpMe & | operator= (const vpMe &&me) |
| void | checkSamplestep (double &sample_step) |
| unsigned int | getAngleStep () const |
| vpMatrix * | getMask () const |
| unsigned int | getMaskNumber () const |
| int | getMaskSign () const |
| unsigned int | getMaskSize () const |
| double | getMinSampleStep () const |
| double | getMu1 () const |
| double | getMu2 () const |
| int | getNbTotalSample () const |
| int | getPointsToTrack () const |
| unsigned int | getRange () const |
| int | getStrip () const |
| double | getThreshold () const |
| vpLikelihoodThresholdType | getLikelihoodThresholdType () const |
| void | initMask () |
| void | print () |
| void | setAngleStep (const unsigned int &a) |
| void | setMaskNumber (const unsigned int &a) |
| void | setMaskSign (const int &a) |
| void | setMaskSize (const unsigned int &a) |
| void | setMinSampleStep (const double &min) |
| void | setMu1 (const double &mu_1) |
| void | setMu2 (const double &mu_2) |
| void | setNbTotalSample (const int &nb) |
| void | setPointsToTrack (const int &n) |
| void | setRange (const unsigned int &r) |
| void | setSampleStep (const double &s) |
| double | getSampleStep () const |
| void | setStrip (const int &a) |
| void | setThreshold (const double &t) |
| void | setLikelihoodThresholdType (const vpLikelihoodThresholdType likelihood_threshold_type) |
Public Attributes | |
| double | threshold |
| double | mu1 |
| double | mu2 |
| double | min_samplestep |
| unsigned int | anglestep |
| int | mask_sign |
| unsigned int | range |
| double | sample_step |
| int | ntotal_sample |
| int | points_to_track |
| unsigned int | mask_size |
| unsigned int | n_mask |
| int | strip |
| vpMatrix * | mask |
Friends | |
| void | to_json (nlohmann::json &j, const vpMe &me) |
| void | from_json (const nlohmann::json &j, vpMe &me) |
This class defines predetermined masks for sites and holds moving edges tracking parameters.
JSON serialization
Since ViSP 3.6.0, if ViSP is build with JSON for modern C++ 3rd-party we introduce JSON serialization capabilities for vpMe. The following sample code shows how to save moving-edges settings in a file named me.json and reload the values from this JSON file.
If you build and execute the sample code, it will produce the following output:
The content of the me.json file is the following:
| vpMe::vpMe | ( | ) |
Array of matrices defining the different masks (one for every angle step).
Default constructor.
Definition at line 364 of file vpMe.cpp.
References anglestep, initMask(), mask, mask_sign, mask_size, min_samplestep, mu1, mu2, n_mask, ntotal_sample, OLD_THRESHOLD, points_to_track, range, sample_step, strip, and threshold.
Referenced by from_json, operator=(), operator=(), to_json, and vpMe().
| vpMe::vpMe | ( | const vpMe & | me | ) |
Copy constructor.
Definition at line 376 of file vpMe.cpp.
References anglestep, mask, mask_sign, mask_size, min_samplestep, mu1, mu2, n_mask, ntotal_sample, OLD_THRESHOLD, points_to_track, range, sample_step, strip, threshold, and vpMe().
|
inline |
Check sample step wrt min value.
| [in,out] | sample_step | : When this value is lower than the min sample step value, it is modified to the min sample step value. |
Definition at line 198 of file vpMe.h.
References min_samplestep, and sample_step.
|
inline |
Return the angle step.
Definition at line 208 of file vpMe.h.
References anglestep.
Referenced by vpMeSite::convolution().
|
inline |
Return the selected choice for the likelihood threshold.
Definition at line 297 of file vpMe.h.
Referenced by from_json, to_json, and vpMeSite::track().
|
inline |
Get the matrix of the mask.
Definition at line 214 of file vpMe.h.
References mask.
Referenced by vpMeSite::convolution().
|
inline |
Return the number of mask applied to determine the object contour. The number of mask determines the precision of the normal of the edge for every sample. If precision is 2deg, then there are 360/2 = 180 masks.
Definition at line 222 of file vpMe.h.
References n_mask.
Referenced by to_json.
|
inline |
|
inline |
Return the actual mask size (in pixel) used to compute the image gradient and determine the object contour. The mask size defines the size of the convolution mask used to detect an edge.
Definition at line 236 of file vpMe.h.
References mask_size.
Referenced by vpMeSite::convolution(), from_json, to_json, and vpMeSite::track().
|
inline |
Get the minimum allowed sample step. Useful to specify a lower bound when the sample step is changed.
Definition at line 243 of file vpMe.h.
References min_samplestep.
|
inline |
Get the minimum image contrast allowed to detect a contour.
Definition at line 249 of file vpMe.h.
References mu1.
Referenced by to_json, and vpMeSite::track().
|
inline |
Get the maximum image contrast allowed to detect a contour.
Definition at line 255 of file vpMe.h.
References mu2.
Referenced by to_json, and vpMeSite::track().
|
inline |
Get how many discretizied points are used to track the feature.
Definition at line 261 of file vpMe.h.
References ntotal_sample.
|
inline |
Return the number of points to track.
Definition at line 267 of file vpMe.h.
References points_to_track.
|
inline |
Return the seek range on both sides of the reference pixel.
Definition at line 273 of file vpMe.h.
References range.
Referenced by from_json, to_json, and vpMeSite::track().
|
inline |
Get the minimum distance in pixel between two discretized points.
Definition at line 397 of file vpMe.h.
References sample_step.
Referenced by to_json.
|
inline |
|
inline |
Return the likelihood threshold used to determine if the moving edge is valid or not.
Definition at line 288 of file vpMe.h.
References threshold.
Referenced by from_json, to_json, and vpMeSite::track().
| void vpMe::initMask | ( | ) |
Initialise the array of matrices with the defined size and the number of matrices to create.
Definition at line 329 of file vpMe.cpp.
References mask, mask_size, and n_mask.
Referenced by from_json, operator=(), operator=(), setMaskNumber(), setMaskSize(), and vpMe().
Move operator.
Definition at line 411 of file vpMe.cpp.
References anglestep, initMask(), mask, mask_sign, mask_size, min_samplestep, mu1, mu2, n_mask, ntotal_sample, points_to_track, range, sample_step, strip, threshold, and vpMe().
Copy operator.
Definition at line 384 of file vpMe.cpp.
References anglestep, initMask(), mask, mask_sign, mask_size, min_samplestep, mu1, mu2, n_mask, ntotal_sample, points_to_track, range, sample_step, strip, threshold, and vpMe().
| void vpMe::print | ( | ) |
Print using std::cout moving edges settings.
Definition at line 348 of file vpMe.cpp.
References mask_size, min_samplestep, mu1, mu2, n_mask, NORMALIZED_THRESHOLD, range, sample_step, strip, and threshold.
|
inline |
|
inline |
Set the likelihood threshold type used to determine if the moving edge is valid or not.
| likelihood_threshold_type | : Likelihood threshold type. It is recommended to use NORMALIZED_THRESHOLD and set the threshold using setThreshold() with a value corresponding to the minimal luminance contrast to consider that can handle values in range [0 ; 255]. |
Definition at line 445 of file vpMe.h.
Referenced by from_json.
| void vpMe::setMaskNumber | ( | const unsigned int & | a | ) |
Set the number of mask applied to determine the object contour. The number of mask determines the precision of the normal of the edge for every sample. If precision is 2deg, then there are 360/2 = 180 masks.
| a | : the number of mask. |
Definition at line 445 of file vpMe.cpp.
References anglestep, initMask(), and n_mask.
Referenced by from_json.
|
inline |
| void vpMe::setMaskSize | ( | const unsigned int & | a | ) |
Set the mask size (in pixel) used to compute the image gradient and determine the object contour. The mask size defines the size of the convolution mask used to detect an edge.
| a | : new mask size. |
Definition at line 452 of file vpMe.cpp.
References initMask(), and mask_size.
Referenced by from_json.
|
inline |
Set the minimum allowed sample step. Useful to specify a lower bound when the sample step is changed.
| min | : new minimum sample step. |
Definition at line 346 of file vpMe.h.
References min_samplestep.
Referenced by from_json.
|
inline |
Set the minimum image contrast allowed to detect a contour.
| mu_1 | : new mu1. |
Definition at line 353 of file vpMe.h.
Referenced by from_json.
|
inline |
Set the maximum image contrast allowed to detect a contour.
| mu_2 | : new mu2. |
Definition at line 360 of file vpMe.h.
Referenced by from_json.
|
inline |
Set how many discretizied points are used to track the feature.
| nb | : new total number of sample. |
Definition at line 367 of file vpMe.h.
References ntotal_sample.
Referenced by from_json.
|
inline |
Set the number of points to track.
| n | : new number of points to track. |
Definition at line 376 of file vpMe.h.
References points_to_track.
Referenced by from_json.
|
inline |
Set the seek range on both sides of the reference pixel.
| r | : new range. |
Definition at line 383 of file vpMe.h.
References range.
Referenced by from_json.
|
inline |
Set the minimum distance in pixel between two discretized points.
| s | : new sample_step. |
Definition at line 390 of file vpMe.h.
References sample_step.
|
inline |
|
inline |
Set the likelihood threshold used to determined if the moving edge is valid or not.
| t | : Threshold to consider. Two different cases need to be considered depending on the likelihood threshold type that can be set using setLikelihoodThresholdType() or get using getLikelihoodThresholdType(). The default likelihood threshold type is set to OLD_THRESHOLD to keep compatibility with ViSP previous releases, but it is recommended to use rather the NORMALIZED_THRESHOLD type like in the following sample code. When doing so, the threshold is more easy to set since it corresponds to the minimal luminance contrast to consider with values in range [0 ; 255]. |
When the likelihood threshold type is set by default to OLD_THRESHOLD like in the next example, values of the likelihood threshold depends on the minimal luminance contrast to consider and the mask size that can be set using setMaskSize() and retrieved using getMaskSize().
The previous sample code is similar to the next one:
Definition at line 435 of file vpMe.h.
References threshold.
Referenced by from_json.
|
friend |
Retrieve a vpMe object from a JSON representation.
JSON content (key: type):
Example:
| j | JSON representation to convert |
| me | converted object |
Definition at line 523 of file vpMe.h.
References from_json, getLikelihoodThresholdType(), getMaskSign(), getMaskSize(), getMinSampleStep(), getNbTotalSample(), getPointsToTrack(), getRange(), getStrip(), getThreshold(), initMask(), setAngleStep(), setLikelihoodThresholdType(), setMaskNumber(), setMaskSign(), setMaskSize(), setMinSampleStep(), setMu1(), setMu2(), setNbTotalSample(), setPointsToTrack(), setRange(), setStrip(), setThreshold(), and vpMe().
Referenced by from_json.
|
friend |
Convert a vpMe object to a JSON representation.
| j | resulting json object |
| me | the object to convert |
Definition at line 505 of file vpMe.h.
References getLikelihoodThresholdType(), getMaskNumber(), getMaskSign(), getMaskSize(), getMinSampleStep(), getMu1(), getMu2(), getNbTotalSample(), getPointsToTrack(), getRange(), getSampleStep(), getStrip(), getThreshold(), to_json, and vpMe().
Referenced by to_json.
| unsigned int vpMe::anglestep |
Definition at line 147 of file vpMe.h.
Referenced by getAngleStep(), operator=(), operator=(), setAngleStep(), setMaskNumber(), vpMe(), and vpMe().
| vpMatrix* vpMe::mask |
Definition at line 166 of file vpMe.h.
Referenced by getMask(), initMask(), operator=(), operator=(), vpMe(), vpMe(), and ~vpMe().
| int vpMe::mask_sign |
Definition at line 148 of file vpMe.h.
Referenced by getMaskSign(), operator=(), operator=(), setMaskSign(), vpMe(), and vpMe().
| unsigned int vpMe::mask_size |
Convolution masks' size in pixels (masks are square),
Definition at line 156 of file vpMe.h.
Referenced by getMaskSize(), initMask(), operator=(), operator=(), print(), setMaskSize(), vpMe(), and vpMe().
| double vpMe::min_samplestep |
Contrast continuity parameter (right boundary).
Definition at line 146 of file vpMe.h.
Referenced by checkSamplestep(), getMinSampleStep(), operator=(), operator=(), print(), setMinSampleStep(), vpMe(), and vpMe().
| double vpMe::mu1 |
Old likelihood ratio threshold (to be avoided) or easy-to-use normalized threshold: minimal contrast.
Definition at line 144 of file vpMe.h.
Referenced by getMu1(), operator=(), operator=(), print(), vpMe(), and vpMe().
| double vpMe::mu2 |
Contrast continuity parameter (left boundary).
Definition at line 145 of file vpMe.h.
Referenced by getMu2(), operator=(), operator=(), print(), vpMe(), and vpMe().
| unsigned int vpMe::n_mask |
The number of convolution masks available for tracking ; defines resolution.
Definition at line 160 of file vpMe.h.
Referenced by getMaskNumber(), initMask(), operator=(), operator=(), print(), setMaskNumber(), vpMe(), and vpMe().
| int vpMe::ntotal_sample |
Distance between sampled points in pixels.
Definition at line 151 of file vpMe.h.
Referenced by getNbTotalSample(), operator=(), operator=(), setNbTotalSample(), vpMe(), and vpMe().
| int vpMe::points_to_track |
Definition at line 152 of file vpMe.h.
Referenced by getPointsToTrack(), operator=(), operator=(), setPointsToTrack(), vpMe(), and vpMe().
| unsigned int vpMe::range |
Definition at line 149 of file vpMe.h.
Referenced by getRange(), operator=(), operator=(), print(), setRange(), vpMe(), and vpMe().
| double vpMe::sample_step |
Seek range - on both sides of the reference pixel.
Definition at line 150 of file vpMe.h.
Referenced by checkSamplestep(), getSampleStep(), operator=(), operator=(), print(), setSampleStep(), vpMe(), and vpMe().
| int vpMe::strip |
Definition at line 165 of file vpMe.h.
Referenced by getStrip(), operator=(), operator=(), print(), setStrip(), vpMe(), and vpMe().
| double vpMe::threshold |
Definition at line 143 of file vpMe.h.
Referenced by getThreshold(), operator=(), operator=(), print(), setThreshold(), vpMe(), and vpMe().