41 #include <visp3/visual_features/vpBasicFeature.h>
42 #include <visp3/visual_features/vpFeatureEllipse.h>
45 #include <visp3/core/vpException.h>
46 #include <visp3/visual_features/vpFeatureException.h>
49 #include <visp3/core/vpDebug.h>
52 #include <visp3/core/vpMath.h>
54 #include <visp3/core/vpFeatureDisplay.h>
96 if (
flags[i] ==
false) {
99 vpTRACE(
"Warning !!! The interaction matrix is computed but x was "
103 vpTRACE(
"Warning !!! The interaction matrix is computed but y was "
107 vpTRACE(
"Warning !!! The interaction matrix is computed but n20 "
111 vpTRACE(
"Warning !!! The interaction matrix is computed but n11 "
115 vpTRACE(
"Warning !!! The interaction matrix is computed but n02 "
119 vpTRACE(
"Warning !!! The interaction matrix is computed but A was "
123 vpTRACE(
"Warning !!! The interaction matrix is computed but B was "
127 vpTRACE(
"Warning !!! The interaction matrix is computed but C was "
131 vpTRACE(
"Problem during the reading of the variable flags");
144 double Zinv = A * xc + B * yc + C;
152 H[0][2] = xc * Zinv + 4.0 * (A * n20 + B * n11);
153 H[0][3] = xc * yc + 4.0 * n11;
166 H[0][2] = yc * Zinv + 4.0 * (A * n11 + B * n02);
168 H[0][4] = -xc * yc - 4.0 * n11;
178 H[0][0] = -2.0 * (A * n20 + B * n11);
180 H[0][2] = 2 * ((Zinv + A * xc) * n20 + B * xc * n11);
181 H[0][3] = 2 * (yc * n20 + xc * n11);
182 H[0][4] = -4 * n20 * xc;
192 H[0][0] = -A * n11 - B * n02;
193 H[0][1] = -A * n20 - B * n11;
194 H[0][2] = A * yc * n20 + (3 * Zinv - C) * n11 + B * xc * n02;
195 H[0][3] = 3 * yc * n11 + xc * n02;
196 H[0][4] = -yc * n20 - 3 * xc * n11;
207 H[0][1] = -2 * (A * n11 + B * n02);
208 H[0][2] = 2 * ((Zinv + B * yc) * n02 + A * yc * n11);
209 H[0][3] = 4 * yc * n02;
210 H[0][4] = -2 * (yc * n11 + xc * n02);
227 ex[0] =
s[0] - s_star[0];
234 ey[0] =
s[1] - s_star[1];
240 ex[0] =
s[2] - s_star[2];
247 ey[0] =
s[3] - s_star[3];
253 ey[0] =
s[4] - s_star[4];
268 std::cout <<
"Ellipse: " << std::endl;
270 std::cout <<
" x=" <<
s[0] << std::endl;
273 std::cout <<
" y=" <<
s[1] << std::endl;
275 std::cout <<
" n20=" <<
s[2] << std::endl;
277 std::cout <<
" n11=" <<
s[3] << std::endl;
279 std::cout <<
" n02=" <<
s[4] << std::endl;
280 std::cout <<
"A = " << A <<
" B = " << B <<
" C = " << C << std::endl;
291 for (
int i = 0; i < 5; ++i) {
331 for (
int i = 0; i < 2; i++)
355 for (
int i = 2; i < 5; i++)
359 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
366 void vpFeatureEllipse::setMu(
double mu20,
double mu11,
double mu02) {
setMoments(mu20, mu11, mu02); }
379 unsigned int thickness)
const
401 unsigned int thickness)
const
445 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
452 VP_DEPRECATED
unsigned int vpFeatureEllipse::selectMu20() {
return FEATURE_LINE[2]; }
459 VP_DEPRECATED
unsigned int vpFeatureEllipse::selectMu11() {
return FEATURE_LINE[3]; }
466 VP_DEPRECATED
unsigned int vpFeatureEllipse::selectMu02() {
return FEATURE_LINE[4]; }
class that defines what is a visual feature
vpColVector s
State of the visual feature.
unsigned int nbParameters
Number of parameters needed to compute the interaction matrix.
unsigned int dim_s
Dimension of the visual feature.
static const unsigned int FEATURE_LINE[32]
vpBasicFeatureDeallocatorType deallocate
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
void resize(unsigned int i, bool flagNullify=true)
Class to define RGB colors available for display functionalities.
static void displayEllipse(double x, double y, double n20, double n11, double n02, const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1)
Class that defines 2D ellipse visual feature.
void print(unsigned int select=FEATURE_ALL) const VP_OVERRIDE
Print the name of the feature.
static unsigned int selectX()
vpFeatureEllipse & buildFrom(const double &x, const double &y, const double &n20, const double &n11, const double &n02)
void init() VP_OVERRIDE
Default initialization.
vpFeatureEllipse()
Default constructor.
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const VP_OVERRIDE
static unsigned int selectY()
void setABC(double A, double B, double C)
vpFeatureEllipse * duplicate() const VP_OVERRIDE
Feature duplication.
static unsigned int select_n20()
void setMoments(double n20, double n11, double n02)
vpMatrix interaction(unsigned int select=FEATURE_ALL) VP_OVERRIDE
compute the interaction matrix from a subset a the possible features
static unsigned int select_n02()
static unsigned int select_n11()
vpColVector error(const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL) VP_OVERRIDE
void set_xy(double x, double y)
static double sqr(double x)
Implementation of a matrix and operations on matrices.
void stack(const vpMatrix &A)