49 #include <visp/vpBasicFeature.h>
50 #include <visp/vpFeatureEllipse.h>
53 #include <visp/vpException.h>
54 #include <visp/vpMatrixException.h>
55 #include <visp/vpFeatureException.h>
58 #include <visp/vpDebug.h>
61 #include <visp/vpMath.h>
65 #include <visp/vpFeatureDisplay.h>
119 if (
flags[i] ==
false)
123 vpTRACE(
"Warning !!! The interaction matrix is computed but x was not set yet");
126 vpTRACE(
"Warning !!! The interaction matrix is computed but y was not set yet");
129 vpTRACE(
"Warning !!! The interaction matrix is computed but mu20 was not set yet");
132 vpTRACE(
"Warning !!! The interaction matrix is computed but mu11 was not set yet");
135 vpTRACE(
"Warning !!! The interaction matrix is computed but mu02 was not set yet");
138 vpTRACE(
"Warning !!! The interaction matrix is computed but A was not set yet");
141 vpTRACE(
"Warning !!! The interaction matrix is computed but B was not set yet");
144 vpTRACE(
"Warning !!! The interaction matrix is computed but C was not set yet");
147 vpTRACE(
"Problem during the reading of the variable flags");
161 double Z = 1/(A*xc + B*yc + C) ;
172 H[0][2] = xc/Z + A*mu20 + B*mu11;
173 H[0][3] = xc*yc + mu11;
188 H[0][2] = yc/Z + A*mu11 + B*mu02;
190 H[0][4] = -xc*yc - mu11;
200 H[0][0] = -2*(A*mu20+B*mu11);
202 H[0][2] = 2*((1/Z+A*xc)*mu20+B*xc*mu11) ;
203 H[0][3] = 2*(yc*mu20+xc*mu11);
204 H[0][4] = -4*mu20*xc;
214 H[0][0] = -A*mu11-B*mu02;
215 H[0][1] = -A*mu20-B*mu11;
216 H[0][2] = A*yc*mu20+(3/Z-C)*mu11+B*xc*mu02;
217 H[0][3] = 3*yc*mu11+xc*mu02;
218 H[0][4] = -yc*mu20-3*xc*mu11;
229 H[0][1] = -2*(A*mu11+B*mu02);
230 H[0][2] = 2*((1/Z+B*yc)*mu02+A*yc*mu11);
232 H[0][4] = -2*(yc*mu11 +xc*mu02) ;
245 const unsigned int select)
253 ex[0] =
s[0] - s_star[0] ;
261 ey[0] =
s[1] - s_star[1] ;
268 ex[0] =
s[2] - s_star[2] ;
276 ey[0] =
s[3] - s_star[3] ;
283 ey[0] =
s[4] - s_star[4] ;
291 std::cout <<std::endl << me << std::endl ;
297 std::cout <<std::endl << me << std::endl ;
311 std::cout <<
"Ellipse: " << std::endl ;
313 std::cout <<
" x=" <<
s[0] <<std::endl ;;
315 std::cout <<
" y=" <<
s[1] <<std::endl ;
317 std::cout <<
" mu20=" <<
s[2] <<std::endl ;
319 std::cout <<
" mu11=" <<
s[3] <<std::endl ;
321 std::cout <<
" mu02=" <<
s[4] <<std::endl ;
322 std::cout <<
"A = "<<A <<
" B = "<<B <<
" C = "<<C << std::endl ;
328 const double mu20,
const double mu11,
338 for(
int i = 0; i < 5; i++)
flags[i] =
true;
344 const double mu20,
const double mu11,
346 const double A,
const double B,
const double C)
381 for(
int i = 0; i < 2; i++)
flags[i] =
true;
402 for(
int i = 2; i < 5; i++)
flags[i] =
true;
421 unsigned int thickness )
const
432 cam, I, color, thickness) ;
455 unsigned int thickness )
const
466 cam, I, color, thickness) ;
void init()
basic construction
Definition of the vpMatrix class.
bool * flags
Ensure that all the parameters needed to compute the iteraction matrix are set.
void resize(const unsigned int nrows, const unsigned int ncols, const bool nullify=true)
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)
Class to define colors available for display functionnalities.
void setMu(const double mu20, const double mu11, const double mu02)
unsigned int dim_s
Dimension of the visual feature.
error that can be emited by ViSP classes.
static unsigned int selectY()
static unsigned int selectMu02()
vpFeatureEllipse()
basic constructor
class that defines what is a visual feature
void set_xy(const double x, const double y)
static unsigned int selectX()
vpFeatureEllipse * duplicate() const
feature duplication
static unsigned int selectMu11()
static double sqr(double x)
void print(const unsigned int select=FEATURE_ALL) const
print the name of the feature
Generic class defining intrinsic camera parameters.
void setABC(const double A, const double B, const double C)
static vpMatrix stackMatrices(const vpMatrix &A, const vpMatrix &B)
Stack two Matrices C = [ A B ]^T.
vpBasicFeatureDeallocatorType deallocate
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
void set_y(const double y)
static unsigned int selectMu20()
Class that provides a data structure for the column vectors as well as a set of operations on these v...
vpMatrix interaction(const unsigned int select=FEATURE_ALL)
compute the interaction matrix from a subset a the possible features
error that can be emited by the vpMatrix class and its derivates
void buildFrom(const double x, const double y, const double mu20, const double mu11, const double mu02)
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)