39#include <visp3/visual_features/vpBasicFeature.h>
40#include <visp3/visual_features/vpFeatureEllipse.h>
43#include <visp3/core/vpException.h>
44#include <visp3/visual_features/vpFeatureException.h>
47#include <visp3/core/vpDebug.h>
50#include <visp3/core/vpMath.h>
52#include <visp3/core/vpFeatureDisplay.h>
94 if (
flags[i] ==
false) {
97 vpTRACE(
"Warning !!! The interaction matrix is computed but x was "
101 vpTRACE(
"Warning !!! The interaction matrix is computed but y was "
105 vpTRACE(
"Warning !!! The interaction matrix is computed but n20 "
109 vpTRACE(
"Warning !!! The interaction matrix is computed but n11 "
113 vpTRACE(
"Warning !!! The interaction matrix is computed but n02 "
117 vpTRACE(
"Warning !!! The interaction matrix is computed but A was "
121 vpTRACE(
"Warning !!! The interaction matrix is computed but B was "
125 vpTRACE(
"Warning !!! The interaction matrix is computed but C was "
129 vpTRACE(
"Problem during the reading of the variable flags");
142 double Zinv = A * xc + B * yc + C;
150 H[0][2] = xc * Zinv + 4.0 * (A * n20 + B * n11);
151 H[0][3] = xc * yc + 4.0 * n11;
164 H[0][2] = yc * Zinv + 4.0 * (A * n11 + B * n02);
166 H[0][4] = -xc * yc - 4.0 * n11;
176 H[0][0] = -2.0 * (A * n20 + B * n11);
178 H[0][2] = 2 * ((Zinv + A * xc) * n20 + B * xc * n11);
179 H[0][3] = 2 * (yc * n20 + xc * n11);
180 H[0][4] = -4 * n20 * xc;
190 H[0][0] = -A * n11 - B * n02;
191 H[0][1] = -A * n20 - B * n11;
192 H[0][2] = A * yc * n20 + (3 * Zinv - C) * n11 + B * xc * n02;
193 H[0][3] = 3 * yc * n11 + xc * n02;
194 H[0][4] = -yc * n20 - 3 * xc * n11;
205 H[0][1] = -2 * (A * n11 + B * n02);
206 H[0][2] = 2 * ((Zinv + B * yc) * n02 + A * yc * n11);
207 H[0][3] = 4 * yc * n02;
208 H[0][4] = -2 * (yc * n11 + xc * n02);
225 ex[0] =
s[0] - s_star[0];
232 ey[0] =
s[1] - s_star[1];
238 ex[0] =
s[2] - s_star[2];
245 ey[0] =
s[3] - s_star[3];
251 ey[0] =
s[4] - s_star[4];
266 std::cout <<
"Ellipse: " << std::endl;
268 std::cout <<
" x=" <<
s[0] << std::endl;
270 std::cout <<
" y=" <<
s[1] << std::endl;
272 std::cout <<
" n20=" <<
s[2] << std::endl;
274 std::cout <<
" n11=" <<
s[3] << std::endl;
276 std::cout <<
" n02=" <<
s[4] << std::endl;
277 std::cout <<
"A = " << A <<
" B = " << B <<
" C = " << C << std::endl;
288 for (
int i = 0; i < 5; ++i) {
328 for (
int i = 0; i < 2; i++)
354 for (
int i = 2; i < 5; i++)
358#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
378 unsigned int thickness)
const
400 unsigned int thickness)
const
444#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
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.
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)
static VP_DEPRECATED unsigned int selectMu20()
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.
static VP_DEPRECATED unsigned int selectMu02()
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.
VP_DEPRECATED void setMu(double mu20, double mu11, double mu02)
static unsigned int select_n20()
static VP_DEPRECATED unsigned int selectMu11()
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)
Definition of the vpImage class member functions.
static double sqr(double x)
Implementation of a matrix and operations on matrices.
void stack(const vpMatrix &A)