44 #include <visp3/visual_features/vpBasicFeature.h> 45 #include <visp3/visual_features/vpFeatureEllipse.h> 48 #include <visp3/core/vpException.h> 49 #include <visp3/visual_features/vpFeatureException.h> 52 #include <visp3/core/vpDebug.h> 55 #include <visp3/core/vpMath.h> 57 #include <visp3/core/vpFeatureDisplay.h> 101 if (
flags[i] ==
false) {
104 vpTRACE(
"Warning !!! The interaction matrix is computed but x was " 108 vpTRACE(
"Warning !!! The interaction matrix is computed but y was " 112 vpTRACE(
"Warning !!! The interaction matrix is computed but mu20 " 116 vpTRACE(
"Warning !!! The interaction matrix is computed but mu11 " 120 vpTRACE(
"Warning !!! The interaction matrix is computed but mu02 " 124 vpTRACE(
"Warning !!! The interaction matrix is computed but A was " 128 vpTRACE(
"Warning !!! The interaction matrix is computed but B was " 132 vpTRACE(
"Warning !!! The interaction matrix is computed but C was " 136 vpTRACE(
"Problem during the reading of the variable flags");
150 double Z = 1 / (A * xc + B * yc + C);
158 H[0][2] = xc / Z + A * mu20 + B * mu11;
159 H[0][3] = xc * yc + mu11;
172 H[0][2] = yc / Z + A * mu11 + B * mu02;
174 H[0][4] = -xc * yc - mu11;
184 H[0][0] = -2 * (A * mu20 + B * mu11);
186 H[0][2] = 2 * ((1 / Z + A * xc) * mu20 + B * xc * mu11);
187 H[0][3] = 2 * (yc * mu20 + xc * mu11);
188 H[0][4] = -4 * mu20 * xc;
198 H[0][0] = -A * mu11 - B * mu02;
199 H[0][1] = -A * mu20 - B * mu11;
200 H[0][2] = A * yc * mu20 + (3 / Z - C) * mu11 + B * xc * mu02;
201 H[0][3] = 3 * yc * mu11 + xc * mu02;
202 H[0][4] = -yc * mu20 - 3 * xc * mu11;
203 H[0][5] = mu02 - mu20;
213 H[0][1] = -2 * (A * mu11 + B * mu02);
214 H[0][2] = 2 * ((1 / Z + B * yc) * mu02 + A * yc * mu11);
215 H[0][3] = 4 * yc * mu02;
216 H[0][4] = -2 * (yc * mu11 + xc * mu02);
233 ex[0] =
s[0] - s_star[0];
240 ey[0] =
s[1] - s_star[1];
246 ex[0] =
s[2] - s_star[2];
253 ey[0] =
s[3] - s_star[3];
259 ey[0] =
s[4] - s_star[4];
273 std::cout <<
"Ellipse: " << std::endl;
275 std::cout <<
" x=" <<
s[0] << std::endl;
278 std::cout <<
" y=" <<
s[1] << std::endl;
280 std::cout <<
" mu20=" <<
s[2] << std::endl;
282 std::cout <<
" mu11=" <<
s[3] << std::endl;
284 std::cout <<
" mu02=" <<
s[4] << std::endl;
285 std::cout <<
"A = " << A <<
" B = " << B <<
" C = " << C << std::endl;
298 for (
int i = 0; i < 5; i++)
303 const double mu02,
const double a,
const double b,
const double c)
336 for (
int i = 0; i < 2; i++)
355 for (
int i = 2; i < 5; i++)
369 unsigned int thickness)
const 397 unsigned int thickness)
const void init()
Default initialization.
Implementation of a matrix and operations on matrices.
void set_x(const double x)
static void displayEllipse(double x, double y, double mu20, double mu11, double m02, const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1)
void stack(const double &d)
void print(const unsigned int select=FEATURE_ALL) const
print the name of the feature
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true, const bool recopy_=true)
Class to define colors available for display functionnalities.
void stack(const vpMatrix &A)
void setMu(const double mu20, const double mu11, const double mu02)
unsigned int dim_s
Dimension of the visual feature.
static unsigned int selectY()
static unsigned int selectMu11()
vpFeatureEllipse()
Default constructor.
class that defines what is a visual feature
void set_xy(const double x, const double y)
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
static double sqr(double x)
static unsigned int selectMu20()
Generic class defining intrinsic camera parameters.
void setABC(const double A, const double B, const double C)
static const unsigned int FEATURE_LINE[32]
vpBasicFeatureDeallocatorType deallocate
void set_y(const double y)
Implementation of column vector and the associated operations.
vpMatrix interaction(const unsigned int select=FEATURE_ALL)
compute the interaction matrix from a subset a the possible features
vpFeatureEllipse * duplicate() const
Feature duplication.
void buildFrom(const double x, const double y, const double mu20, const double mu11, const double mu02)
static unsigned int selectX()
Class that defines 2D ellipse visual feature.
vpColVector error(const vpBasicFeature &s_star, const unsigned int select=FEATURE_ALL)
unsigned int nbParameters
Number of parameters needed to compute the interaction matrix.
vpColVector s
State of the visual feature.
void resize(const unsigned int i, const bool flagNullify=true)
static unsigned int selectMu02()