26 #ifndef __CONIC2D_HH__
27 #define __CONIC2D_HH__
29 #include <bias_config.h>
30 #include <Base/Common/W32Compat.hh>
33 #include <Base/Debug/Error.hh>
34 #include <Base/Debug/Debug.hh>
35 #include <Base/Math/Matrix3x3.hh>
36 #include <Base/Geometry/HomgPoint2D.hh>
37 #include <Base/Geometry/HomgPoint2DCov.hh>
38 #include <Base/Geometry/HomgLine2D.hh>
40 #define CONIC2D_TYPE double
42 #define D_CONIC2D_TAN 0x00000001
44 #define GAUSS2D_CONFIDENCE_20_PERCENT 0.66
45 #define GAUSS2D_CONFIDENCE_39_PERCENT 1.00
46 #define GAUSS2D_CONFIDENCE_50_PERCENT 1.18
47 #define GAUSS2D_CONFIDENCE_68_PERCENT 1.52
48 #define GAUSS2D_CONFIDENCE_90_PERCENT 2.15
49 #define GAUSS2D_CONFIDENCE_95_PERCENT 2.45
50 #define GAUSS2D_CONFIDENCE_99_PERCENT 3.04
56 template <
class T>
class Image;
95 bool IsEllipse()
const;
98 bool IsParabola()
const;
101 bool IsHyperbola()
const;
104 bool IsSingleLine()
const;
107 bool IsDoubleLine()
const;
110 bool IsPoint()
const;
113 bool IsEmpty()
const;
117 bool IsProper()
const;
120 ConicType GetConicType()
const;
124 void SetPointAndCovariance(
const HomgPoint2D& center,
126 const double& dScale =
127 GAUSS2D_CONFIDENCE_39_PERCENT);
145 return ( point2D *((*
this)*point2D) ); }
149 inline bool Normalize() {
double d=(*this)[0][0]+(*this)[1][1];
150 if (fabs(d)<DOUBLE_EPSILON)
return false; (*this) /= d;
return true;}
157 void SetEllipse(
const HomgPoint2D& Center,
const double& dAngle,
158 const double& radius_a,
const double& radius_b);
179 double& radius_b)
const;
184 bool GetEllipseParameters(
double center[2],
185 double a[2],
double b[2])
const;
190 int GetLines(std::vector<HomgLine2D>& lines)
const;
213 bool EllipsoidSilhouetteToGauss(
const double& ProbBorder,
215 double& NormalizationFactor);
233 bool UseSVD =
false);
243 bool IntersectsCircle(
const HomgPoint2D& C,
double Radius)
const;
246 Conic2D GetDualConic(
bool UseSVD =
false)
const;
251 unsigned int GetSignature()
const;
266 int IntersectConicProper(
const Conic2D& otherconic,
267 std::vector<HomgPoint2D>& intersectionPoints)
275 int IntersectConic(
const Conic2D& otherconic,
276 std::vector<HomgPoint2D>& intersectionPoints)
const;
284 std::vector<HomgPoint2D>& intersectionPoints)
const;
322 double GetDiscriminant()
const;
336 default:BIASERR(
"Undefined ConicType !"); BIASABORT;
MatrixInitType
can be passed to matrix constructors to init the matrix with the most often used values ...
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
class representing the covariance matrix of a homogenous point 2D
class BIASGeometryBase_EXPORT HomgPoint2DCov
is a 'fixed size' quadratic matrix of dim.
Conic2D & operator=(const Matrix< CONIC2D_TYPE > &m)
Conic2D(const MatrixInitType &i)
set default matrix values
Conic2D()
default constructor sets all fields to zero
A quadric as a 4x4 matrix describing a surface in 3d projective space defined by a quadratic equation...
class BIASImageBase_EXPORT Image
double LocatePoint(const HomgPoint2D &point2D) const
determines if the point is inside/on/outside the conic
Ellipse in 2D with dfifferent representations.
a line l = (a b c)^T is a form of the implicit straight line equation 0 = a*x + b*y + c if homogenize...
class BIASGeometry_EXPORT PMatrix
is a 'fixed size' quadratic matrix of dim.
std::ostream & operator<<(std::ostream &os, const Array2D< T > &arg)
matrix class with arbitrary size, indexing is row major.
class BIASMathBase_EXPORT Matrix2x2
Matrix3x3< T > & operator=(const Matrix3x3< T > &mat)
assignment operator
Conic2D(const Matrix< CONIC2D_TYPE > &m)
copy constructor uses Conic2D::operator=
describes a projective 3D -> 2D mapping in homogenous coordinates
bool Normalize()
sets mean of first 2 diag elements to positive value, so that LocatePoint(x)<0 means x is in conic ...
Conic2D(const Matrix3x3< CONIC2D_TYPE > &m)
copy constructor uses Conic2D::operator=
A 3x3 matrix representing a conic (cone/plane intersection)