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;
297 for (
int i = 0; i < 5; i++)
302 double mu02,
double a,
double b,
double c)
335 for (
int i = 0; i < 2; i++)
354 for (
int i = 2; i < 5; i++)
368 unsigned int thickness)
const 396 unsigned int thickness)
const void buildFrom(double x, double y, double mu20, double mu11, double mu02)
void init()
Default initialization.
Implementation of a matrix and operations on matrices.
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
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)
Class to define colors available for display functionnalities.
void stack(const vpMatrix &A)
vpMatrix interaction(unsigned int select=FEATURE_ALL)
compute the interaction matrix from a subset a the possible features
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 display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
static double sqr(double x)
void set_xy(double x, double y)
static unsigned int selectMu20()
void setMu(double mu20, double mu11, double mu02)
Generic class defining intrinsic camera parameters.
void setABC(double A, double B, double C)
void print(unsigned int select=FEATURE_ALL) const
print the name of the feature
static const unsigned int FEATURE_LINE[32]
vpColVector error(const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL)
void resize(unsigned int i, bool flagNullify=true)
vpBasicFeatureDeallocatorType deallocate
Implementation of column vector and the associated operations.
vpFeatureEllipse * duplicate() const
Feature duplication.
static unsigned int selectX()
Class that defines 2D ellipse visual feature.
unsigned int nbParameters
Number of parameters needed to compute the interaction matrix.
vpColVector s
State of the visual feature.
static unsigned int selectMu02()