VAT  3.0
Video Analysis Tool
HMTrackingModule.h
1 #ifndef HMTRACKINGMODULE_H
2 #define HMTRACKINGMODULE_H
3 
4 #include <QImage>
5 #include <QDir>
6 #include <opencv2/imgproc/imgproc.hpp>
7 #include <vector>
8 #include <cmath>
9 #include <QColor>
10 
11 #include "Datapool.h"
12 #include "ModuleInterface.h"
13 #include "src/asmOpenCV.h"
14 
15 #include "opencv2/opencv.hpp"
16 #include <opencv/highgui.h>
17 #include <map>
18 #include <string>
19 #include "image_display.h"
20 
21 typedef std::vector<int> hist;
22 
23 using namespace std;
24 
26 {
27 public:
28  HMTrackingModule(Datapool* i_data);
30 
31  //Set module configuration parameters
32  bool setParameters(QDomNode& config);
33 
34  //Initialization after reading parameters
35  bool init();
36 
37  //Function executed at each frame
38  bool run();
39 
40  //update parameters at runtime.
41  bool updateParameters();
42 
43 private:
44  //Module parameters
45  bool firstTime;
46  float alpha, beta;
47  QImage ROI_mask;
48 
49  //Threshold Parameters
50  float A_p[4];//, G_p, B_p, GL_p; // histogram intensity peaks
51  float A_t[4];//, G_t, B_t, GL_t; // intensity thresholds
52 
53  void HackROI(const QImage currIm);
54 
55  //float R_u, G_u, B_u, GL_u; // histogram intensity mean
56  //float R_std, G_std, B_std, GL_std; //histogram standar deviation
57 
58  //Calculates Intensity Histograms per channel
59  vector<hist> calculateHistograms(const QImage img);
60 
61  //Calculates first and second statistical moments of the intesity histograms
62  vector<float> calculateMoments(vector<hist> channels);
63 
64  //Calculate channels peaks using paper proposed criterias
65  void calculatePeaks(vector<hist> channels);
66 
67  //Calculate thresholds
68  void calculateThresholds(vector<hist> ch);
69 
70  //Store grass area of the image on bgImage using a binary classifier
71  QImage GrassClassifier(const QImage currIm);
72 
73  //Get the line on the grass selection usign Hough Transform
74  QImage Line_detect(const QImage CurrentImage, const QImage Grassimage);
75 
76  //Aplly a filter
77  void ApplyFilter(QImage *f_in, QImage *f_out);
78 
79  //Dilate image
80  void applydilate(QImage * f_in, QImage * fg_out);
81 
82  //Detect image
83  void Hough_Transform(QImage *f_in);
84 
85  //Discard low gradient
86  QImage DLowIntGrad(const QImage src);
87 
88  //Get the foreground
89  QImage ForeGround(const QImage curr, const QImage bg);
90 
91 };
92 
93 #endif // HMTRACKINGMODULE_H
Definition: HMTrackingModule.h:25
Definition: ModuleInterface.h:43
An object of this class is instantiated at main code, and this object is used by every class to push ...
Definition: Datapool.h:39