ellipse_refinement.h
Go to the documentation of this file.
1 
7 #ifndef TUW_ELLIPSE_REFINEMENT_H
8 #define TUW_ELLIPSE_REFINEMENT_H
9 
10 #include <vector>
11 #include <opencv2/core/core.hpp>
12 
13 namespace tuw
14 {
15 
17 {
18 public:
19 
20 
21  class Parameter
22  {
23  public:
24  int border;
25  double min_gradient;
26  Parameter(int _border=3, double _min_gradient=30)
27  : border(_border), min_gradient(_min_gradient) {}
28  };
29 
30 
31  class Ellipse
32  {
33  private:
34 
35  double a2, b2, a4, b4; // a^2 etc., stored for Distance()
36  double x2,y2;
37  public:
38  int id;
39  // ellipse position [px]
40  double x, y;
41  // ellipse long/short axis length [px]
42  double a, b;
43  // ellipse rotation in radiants [rad]
44  double phi;
45  // mean fit error
46  double fit_error;
47  // ellipse support
48  double support;
49 
52  Ellipse();
55  Ellipse(const Ellipse &e);
56 
64  void setEllipse(const double &_x, const double &_y, const double &_a, const double &_b, const double &_phi);
65 
70  void setEllipse(const cv::RotatedRect& rect);
71 
76  void get(cv::RotatedRect &r);
77 
83  double ellipseCircumference(double a, double b);
84 
88  bool insideEllipse(double _a, double _b, double _x0, double _y0, double _phi, double _x, double _y) const;
89 
90  unsigned ellipseSupport(const std::vector<cv::Point2f> &points, double inl_dist, std::vector<bool> &inl_idx);
91 
92  bool computeAndSetGeomFromConic(double A, double B, double C, double D, double E, double F);
93 
94  };
95 private:
96 
97  std::vector<cv::Point2d> pointsToUse;
98 
99 public:
101 
102  EllipseRefinement(const Parameter &_param = Parameter());
104 
111  bool refine(const cv::Mat_<short> &im_dx, const cv::Mat_<short> &im_dy, const std::vector<cv::Point2f> &points, Ellipse &ellipse);
112 };
113 
114 }
115 
116 #endif //TUW_ELLIPSE_REFINEMENT_H
EllipseRefinement(const Parameter &_param=Parameter())
Parameter(int _border=3, double _min_gradient=30)
bool refine(const cv::Mat_< short > &im_dx, const cv::Mat_< short > &im_dy, const std::vector< cv::Point2f > &points, Ellipse &ellipse)
TFSIMD_FORCE_INLINE const tfScalar & x() const
std::vector< cv::Point2d > pointsToUse


tuw_ellipses
Author(s): Markus Bader
autogenerated on Mon Jun 10 2019 15:42:10