36#ifndef VP_ME_ELLIPSE_H
37#define VP_ME_ELLIPSE_H
39#include <visp3/core/vpColVector.h>
40#include <visp3/core/vpMatrix.h>
42#include <visp3/core/vpImagePoint.h>
43#include <visp3/me/vpMeSite.h>
44#include <visp3/me/vpMeTracker.h>
46#include <visp3/core/vpColor.h>
47#include <visp3/core/vpImage.h>
52#if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
156 const unsigned int index_0 = 0;
157 const unsigned int index_1 = 1;
158 const unsigned int index_2 = 2;
159 nij[index_0] =
m_n20;
160 nij[index_1] =
m_n11;
161 nij[index_2] =
m_n02;
178 const unsigned int index_0 = 0;
179 const unsigned int index_1 = 1;
180 const unsigned int index_2 = 2;
281#if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
283 bool trackCircle =
false,
bool trackArc =
false)
286 bool trackCircle =
false,
bool trackArc =
false)
289#if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
290 if (!opt_ips.has_value())
292 if (opt_ips ==
nullptr)
299 if (opt_ips->size() != 0) {
305 const unsigned int nForCircle = 3;
317 std::cout <<
"First and third points specify the extremities of the arc of circle (clockwise)" << std::endl;
319 for (
unsigned int k = 0; k < n; ++k) {
320 std::cout <<
"Click point " << (k + 1) <<
"/" << n <<
" on the circle " << std::endl;
322 const unsigned int crossSize = 10;
325 std::cout << (*opt_ips)[k] << std::endl;
330 std::cout <<
"First and fifth points specify the extremities of the arc of ellipse (clockwise)" << std::endl;
332 for (
unsigned int k = 0; k < n; ++k) {
333 std::cout <<
"Click point " << (k + 1) <<
"/" << n <<
" on the ellipse " << std::endl;
335 const unsigned int crossSize = 10;
338 std::cout << (*opt_ips)[k] << std::endl;
362 bool trackArc =
false);
379 const vpImagePoint *pt2 =
nullptr,
bool trackCircle =
false);
385 void printParameters()
const;
410 else if (threshold > 1) {
441 const double &E,
const double &smallalpha,
const double &highalpha,
461 const double &E,
const double &smallalpha,
const double &highalpha,
464#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
470 const double &E,
const double &smallalpha,
const double &highalpha,
477 const double &E,
const double &smallalpha,
const double &highalpha,
Implementation of column vector and the associated operations.
Class to define RGB colors available for display functionalities.
static const vpColor green
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
static void flush(const vpImage< unsigned char > &I)
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.
double m_n20
Second order centered and normalized moments .
double m_arcEpsilon
Epsilon value used to check if arc angles are the same.
void leastSquareRobustEllipse(const double &um, const double &vm, unsigned int &k, vpColVector &w)
void computePointOnEllipse(const double angle, vpImagePoint &iP)
double getHighestAngle() const
vpImagePoint m_iPc
The coordinates of the ellipse center.
double getSmallestAngle() const
void leastSquareRobustCircle(const double &um, const double &vm, unsigned int &k, vpColVector &w)
double m_vc
Value of v coordinate of iPc.
unsigned int m_numberOfGoodPoints
Number of correct points tracked along the ellipse.
unsigned int plugHoles(const vpImage< unsigned char > &I)
double m_uc
Value of u coordinate of iPc.
bool m_trackCircle
Track a circle (true) or an ellipse (false).
void setEndpoints(const vpImagePoint &pt1, const vpImagePoint &pt2)
double m_m00
Ellipse area.
vpImagePoint getSecondEndpoint() const
vpImagePoint getFirstEndpoint() const
void setThresholdRobust(double threshold)
vpColVector get_ABE() const
unsigned int getNumberOfGoodPoints() const
std::list< double > m_angleList
Stores the value in increasing order of the angle on the ellipse for each vpMeSite.
bool m_trackArc
Track an arc of ellipse/circle (true) or a complete one (false).
double m_a
is the semi major axis of the ellipse.
void initTracking(const vpImage< unsigned char > &I, std::optional< std::vector< vpImagePoint > > &opt_ips, bool trackCircle=false, bool trackArc=false)
vpImagePoint getCenter() const
unsigned int leastSquareRobust(const vpImage< unsigned char > &I)
void leastSquare(const vpImage< unsigned char > &I, const std::vector< vpImagePoint > &iP)
double m_b
is the semi minor axis of the ellipse.
double computeTheta(const vpImagePoint &iP) const
vpColVector get_nij() const
double m_se
Value of sin(e).
double m_n02
Second order centered and normalized moments .
unsigned int getExpectedDensity() const
unsigned int m_expectedDensity
Expected number of points to track along the ellipse.
double m_n11
Second order centered and normalized moments .
double m_ce
Value of cos(e).
double m_thresholdWeight
Threshold on the weights for the robust least square.
double computeAngleOnEllipse(const vpImagePoint &pt) const
void initTracking(const vpImage< unsigned char > &I)
virtual void sample(const vpImage< unsigned char > &image, bool doNotTrack=false)=0
void track(const vpImage< unsigned char > &I)
vpMeTracker & operator=(vpMeTracker &meTracker)
void display(const vpImage< unsigned char > &I)