VAT  3.0
Video Analysis Tool
setDegu.h
1 #ifndef SETDEGU_H
2 #define SETDEGU_H
3 
4 #include <QPainter>
5 
6 #include "drawInterface.h"
7 #include "src/hullmodel.h"
8 
9 class setDegu: public drawInterface {
10 public:
11  setDegu(Datapool *i_data);
12 
13  ~setDegu();
14 
15  //Set module configuration parameters
16  bool setParameters(QDomNode &config);
17 
18  //Initialization after reading parameters
19  bool init();
20 
21  //Function executed at each frame
22  bool draw(QImage **image);
23 
24  bool paint(QImage *image);
25  void displayShowHull(QPainter &painter, SpHullModel hull);
26  void displayShowAxis(QPainter &painter, SpHullModel hull);
27  void displayShowNormals(QPainter &painter, SpHullModel hull);
28  void displayShowHead(QPainter &painter, DeguModel *d, int offX, int offY);
29  void displayShowTrajectory(QPainter &painter, std::deque< point2D<int> > &trajectory);
30 
31 
32 
33  static bool movementFound(cv::Mat f, int wsize, int i0, int j0);
34  static bool movementFound(cv::Mat f, int wsize, int i0, int j0, cv::Rect roi);
35  static double histogramDistance(cv::MatND h1, cv::MatND h2);
36  static double distanceToSegment(int i1, int i2, std::vector<cv::Point> &contour);
37  static bool lineSegmentIntersection(cv::Point3f &line,
38  cv::Point2f &p1, cv::Point2f &p2, cv::Point2f &r);
39  static bool getGeneralLineForm(cv::Point2f p1, cv::Point2f p2,
40  cv::Point3f &rline);
41  static bool getGeneralLineForm(float x, float y, float dx, float dy,
42  cv::Point3f &rline);
43 
44 
45  //Get intersection points r1 and r2 between line 'rline' and contour 'hull' (oriented to
46  //convex hull). If non NULL n1 and n2 pointers, are used to store indexes of contour segments
47  //where intersections were found (to be used later on pixel distance function construction).
48  static int getContourToLineIntersection(std::vector<cv::Point> &hull,
49  cv::Point3f &rline,
50  cv::Point2f &r1, cv::Point2f &r2,
51  int *n1 = NULL, int *n2 = NULL);
52 
53  //Fills a segments vector with moving pixel bounds for each normal on the axis
54  void getNormalIntersections(cv::Mat &f, cv::Rect &roi, std::vector<cv::Point> &hull,
55  cv::Point2f &r1, cv::Point2f &r2, int n1, int n2,
56  float dx, float dy, std::vector< segment2D<float> > &segs,
57  std::vector< segment2D<float> > &hull_segs);
58 
59  //Sets the moving segment for one normal
60  void setForegroundSegment(cv::Mat &f, cv::Rect &roi, std::vector<cv::Point> &hull,
61  segment2D<float> &seg, segment2D<float> &hseg, float x, float y,
62  float dx, float dy, int &I1, int &I2);
63 
64  //Gets the intersection betweel a line and a contour, in current or next contour
65  //segment.
66  static int getContourToLineIntersectionIndexed(std::vector<cv::Point> &polygon,
67  cv::Point3f &rline,
68  cv::Point2f &r1, cv::Point2f &r2,
69  int &n1, int &n2);
70 
71  //Counts foreground pixels on a window
72  static int movementCount(cv::Mat f, int wsize, int i0, int j0, cv::Rect roi);
73 
74 
75 
76 };
77 
78 #endif // SETDEGU_H
Definition: geometric.h:103
Definition: drawInterface.h:23
An object of this class is instantiated at main code, and this object is used by every class to push ...
Definition: Datapool.h:39
Definition: setDegu.h:9
Definition: degumodel.h:35