35#include <visp3/core/vpConfig.h>
45#include <visp3/core/vpMeterPixelConversion.h>
46#include <visp3/core/vpPixelMeterConversion.h>
47#include <visp3/core/vpPlane.h>
48#include <visp3/mbt/vpMbtDistanceCircle.h>
49#include <visp3/vision/vpPose.h>
50#include <visp3/visual_features/vpFeatureBuilder.h>
51#include <visp3/visual_features/vpFeatureEllipse.h>
63 : name(), index(0), cam(), me(nullptr), wmean(1), featureEllipse(), isTrackedCircle(true),
meEllipse(nullptr),
circle(nullptr),
153 bool doNotTrack,
const vpImage<bool> *mask,
const int &initRange)
163 std::cout <<
"Problem when projecting circle\n";
168 unsigned int initRange_;
170 initRange_ = defaultRange;
173 initRange_ =
static_cast<unsigned int>(initRange);
179 int oldInitRange = me->getInitRange();
180 me->setInitRange(initRange_);
186 double n20_p, n11_p, n02_p;
188 meEllipse->initTracking(I, ic, n20_p, n11_p, n02_p, doNotTrack);
189 me->setInitRange(oldInitRange);
193 me->setInitRange(oldInitRange);
209 int oldInitRange = me->getInitRange();
210 me->setInitRange(defaultRange);
224 me->setInitRange(oldInitRange);
237 int oldInitRange = me->getInitRange();
238 me->setInitRange(defaultRange);
247 std::cout <<
"Problem when projecting circle\n";
252 double n20_p, n11_p, n02_p;
254 meEllipse->updateParameters(I, ic, n20_p, n11_p, n02_p);
261 me->setInitRange(oldInitRange);
302 bool displayFullModel)
307 double n20_p = params[2];
308 double n11_p = params[3];
309 double n02_p = params[4];
326 bool displayFullModel)
331 double n20_p = params[3];
332 double n11_p = params[4];
333 double n02_p = params[5];
343 std::vector<std::vector<double> > features;
346 for (std::list<vpMeSite>::const_iterator it =
meEllipse->getMeList().begin(); it !=
meEllipse->getMeList().end();
349#if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_98)
350 std::vector<double> params = { 0,
353 static_cast<double>(p_me.
getState())
356 std::vector<double> params;
360 params.push_back(
static_cast<double>(p_me.
getState()));
363 features.push_back(params);
384 std::vector<double> params;
386 if ((
isvisible && isTrackedCircle) || displayFullModel) {
394 std::cout <<
"Cannot project the circle";
398 double n20_p, n11_p, n02_p;
401 params.push_back(center.
get_i());
402 params.push_back(center.
get_j());
403 params.push_back(n20_p);
404 params.push_back(n11_p);
405 params.push_back(n02_p);
467 std::cout <<
"Problem projection circle\n";
472 vpMatrix H1 = featureEllipse.interaction();
480 double n20 =
circle->p[2];
481 double n11 =
circle->p[3];
482 double n02 =
circle->p[4];
486 for (std::list<vpMeSite>::const_iterator it =
meEllipse->getMeList().begin(); it !=
meEllipse->getMeList().end();
490 H[0] = 2 * (n11 * (y - yg) + n02 * (xg - x));
491 H[1] = 2 * (n20 * (yg - y) + n11 * (x - xg));
493 H[3] = 2 * (yg * (x - xg) + y * xg + 4.0 * n11 - x * y);
496 for (
unsigned int k = 0; k < 6; k++)
497 L[j][k] = H[0] * H1[0][k] + H[1] * H1[1][k] + H[2] * H1[2][k] + H[3] * H1[3][k] + H[4] * H1[4][k];
Generic class defining intrinsic camera parameters.
Class that defines a 3D circle in the object frame and allows forward projection of a 3D circle in th...
Class to define RGB colors available for display functionalities.
static void displayEllipse(const vpImage< unsigned char > &I, const vpImagePoint ¢er, const double &coef1, const double &coef2, const double &coef3, bool use_normalized_centered_moments, const vpColor &color, unsigned int thickness=1, bool display_center=false, bool display_arc=false)
static void flush(const vpImage< unsigned char > &I)
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition of the vpImage class member functions.
static double sqr(double x)
Implementation of a matrix and operations on matrices.
void setMovingEdge(vpMe *Me)
void updateMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
std::vector< std::vector< double > > getFeaturesForDisplay()
vpColVector error
The error vector.
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
vpPoint * p1
The center of the circle.
unsigned int nbFeature
The number of moving edges.
virtual ~vpMbtDistanceCircle()
vpMatrix L
The interaction matrix.
void trackMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo)
vpCircle * circle
The circle to track.
void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const vpPoint &_p3, double r)
vpPoint * p2
A point on the plane containing the circle.
bool isvisible
Indicates if the circle is visible or not.
void displayMovingEdges(const vpImage< unsigned char > &I)
void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)
bool Reinit
Indicates if the circle has to be reinitialized.
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpImage< bool > *mask=nullptr)
bool initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, bool doNotTrack, const vpImage< bool > *mask=nullptr, const int &initRange=1U)
double radius
The radius of the circle.
int index_polygon
Index of the faces which contain the line.
void initInteractionMatrixError()
vpPoint * p3
An other point on the plane containing the circle.
std::vector< double > getModelForDisplay(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, bool displayFullModel=false)
vpMbtMeEllipse * meEllipse
The moving edge containers.
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'....
vpMeSiteState getState() const
double get_ifloat() const
double get_jfloat() const
static void convertEllipse(const vpCameraParameters &cam, const vpSphere &sphere, vpImagePoint ¢er_p, double &n20_p, double &n11_p, double &n02_p)
static void convertPoint(const vpCameraParameters &cam, const double &u, const double &v, double &x, double &y)
This class defines the container for a plane geometrical structure.
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
double get_oX() const
Get the point oX coordinate in the object frame.
double get_oZ() const
Get the point oZ coordinate in the object frame.
double get_oY() const
Get the point oY coordinate in the object frame.
Implementation of row vector and the associated operations.
#define vpDEBUG_ENABLE(level)
const unsigned int defaultRange