45 #include <visp3/visual_features/vpBasicFeature.h>
46 #include <visp3/visual_features/vpFeatureEllipse.h>
49 #include <visp3/core/vpException.h>
50 #include <visp3/visual_features/vpFeatureException.h>
53 #include <visp3/core/vpDebug.h>
56 #include <visp3/core/vpMath.h>
60 #include <visp3/core/vpFeatureDisplay.h>
114 if (
flags[i] ==
false)
118 vpTRACE(
"Warning !!! The interaction matrix is computed but x was not set yet");
121 vpTRACE(
"Warning !!! The interaction matrix is computed but y was not set yet");
124 vpTRACE(
"Warning !!! The interaction matrix is computed but mu20 was not set yet");
127 vpTRACE(
"Warning !!! The interaction matrix is computed but mu11 was not set yet");
130 vpTRACE(
"Warning !!! The interaction matrix is computed but mu02 was not set yet");
133 vpTRACE(
"Warning !!! The interaction matrix is computed but A was not set yet");
136 vpTRACE(
"Warning !!! The interaction matrix is computed but B was not set yet");
139 vpTRACE(
"Warning !!! The interaction matrix is computed but C was not set yet");
142 vpTRACE(
"Problem during the reading of the variable flags");
156 double Z = 1/(A*xc + B*yc + C) ;
167 H[0][2] = xc/Z + A*mu20 + B*mu11;
168 H[0][3] = xc*yc + mu11;
183 H[0][2] = yc/Z + A*mu11 + B*mu02;
185 H[0][4] = -xc*yc - mu11;
195 H[0][0] = -2*(A*mu20+B*mu11);
197 H[0][2] = 2*((1/Z+A*xc)*mu20+B*xc*mu11) ;
198 H[0][3] = 2*(yc*mu20+xc*mu11);
199 H[0][4] = -4*mu20*xc;
209 H[0][0] = -A*mu11-B*mu02;
210 H[0][1] = -A*mu20-B*mu11;
211 H[0][2] = A*yc*mu20+(3/Z-C)*mu11+B*xc*mu02;
212 H[0][3] = 3*yc*mu11+xc*mu02;
213 H[0][4] = -yc*mu20-3*xc*mu11;
224 H[0][1] = -2*(A*mu11+B*mu02);
225 H[0][2] = 2*((1/Z+B*yc)*mu02+A*yc*mu11);
227 H[0][4] = -2*(yc*mu11 +xc*mu02) ;
240 const unsigned int select)
248 ex[0] =
s[0] - s_star[0] ;
256 ey[0] =
s[1] - s_star[1] ;
263 ex[0] =
s[2] - s_star[2] ;
271 ey[0] =
s[3] - s_star[3] ;
278 ey[0] =
s[4] - s_star[4] ;
296 std::cout <<
"Ellipse: " << std::endl ;
298 std::cout <<
" x=" <<
s[0] <<std::endl ;;
300 std::cout <<
" y=" <<
s[1] <<std::endl ;
302 std::cout <<
" mu20=" <<
s[2] <<std::endl ;
304 std::cout <<
" mu11=" <<
s[3] <<std::endl ;
306 std::cout <<
" mu02=" <<
s[4] <<std::endl ;
307 std::cout <<
"A = "<<A <<
" B = "<<B <<
" C = "<<C << std::endl ;
313 const double mu20,
const double mu11,
323 for(
int i = 0; i < 5; i++)
flags[i] =
true;
329 const double mu20,
const double mu11,
331 const double a,
const double b,
const double c)
366 for(
int i = 0; i < 2; i++)
flags[i] =
true;
387 for(
int i = 2; i < 5; i++)
flags[i] =
true;
406 unsigned int thickness )
const
417 cam, I, color, thickness) ;
440 unsigned int thickness )
const
451 cam, I, color, thickness) ;
void init()
Default initialization.
Implementation of a matrix and operations on matrices.
bool * flags
Ensure that all the parameters needed to compute the iteraction matrix are set.
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 resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=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)
vpFeatureEllipse * duplicate() const
Feature duplication.
static double sqr(double x)
void print(const unsigned int select=FEATURE_ALL) const
print the name of the feature
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 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)
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
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()