VAT  3.0
Video Analysis Tool
PoppeFootball.h
1 #ifndef POPPEFOOTBALLMODULE_H
2 #define POPPEFOOTBALLMODULE_H
3 
4 #include <map>
5 #include <string>
6 #include <QImage>
7 #include "Datapool.h"
8 #include "ModuleInterface.h"
9 #include <QDir>
10 #include <vector>
11 
12 #include "opencv2/opencv.hpp"
13 #include "opencv2/highgui/highgui.hpp"
14 #include "opencv2/imgproc/imgproc.hpp"
15 #include "opencv2/legacy/legacy.hpp"
16 
17 // Our own Qt-CV shared image format.
18 #include "../custom_utils/commonimage.h"
19 #include "../custom_utils/codebookmodel.h"
20 
21 #define PFVERBOSEMSG(A) \
22  if(verbose){ \
23  AppendToLog(QString("[POPPEFOOTBALL] ").append(A)); \
24  qDebug() << QString("[POPPEFOOTBALL] ").append(A); \
25  }
26 
27 #define VALIDXMLPARAMMSG(A,B) \
28  if(formatok){ \
29  PFVERBOSEMSG(A) \
30  }else{ \
31  PFVERBOSEMSG(B) \
32  }
33 
34 enum morph_operation
35 {
36  MORPHOP_ERODE,
37  MORPHOP_DILATE
38 };
39 enum morph_element_type
40 {
41  MORPHELEM_CIRCLE,
42  MORPHELEM_SQUARE,
43  MORPHELEM_CROSS
44 };
45 
47 {
48  morph_operation op;
49  morph_element_type type;
50  uint elemsize;
51 };
52 
103 {
104 public:
105  PoppeFootball(Datapool *i_data);
106  ~PoppeFootball();
107 
108  //Set module configuration parameters
109  bool setParameters(QDomNode& config);
110 
111  //Initialization after reading parameters
112  bool init();
113 
114  //Function executed at each frame
115  bool run();
116 
117  //update parameters at runtime.
118  bool updateParameters();
119 
120  /*
121  *************************************************************************
122  *************************************************************************
123  */
124 
125  // Run operation functions
126  void retrieveFGMask();
127 
128  void prepareStructuralElem(cv::Mat& output, morpho_param par);
129 
130  // Colorpicker
131  cv::Scalar colorName(QString colorcode, bool* convsuccess = NULL);
132  cv::Scalar colorToHSV(cv::Scalar BGRinput);
133 
134 private:
135  // Config parameters
136  bool verbose;
137  int param_segm_learningframes;
138  double param_segm_learnagain_percentage_low;
139  double param_segm_learnagain_percentage_high;
140  std::vector<morpho_param> param_segm_morphology_ops;
141  int param_segm_morphologysize;
142  std::vector<uchar> param_segm_codebook_startingconditions; // Expected to be of 9 parameters.
143 
144  // A shadow for the current image, to be used with our CodebookModel.
145  CommonImage currentimage_shadow;
146  cv::Mat currentimage_mat;
147 
148  // Foreground extraction
149  cv::Mat fgmask_raw;
150  CommonImage fgmask; // The pointer in the datapool points to this.
151 
152  // Codebook Segmentation model
153  CodebookModel cbmodel;
154 
155  // Frame number in the segmentation
156  int seg_nframe;
157 
158  // Some string for verbose reasons.
159  QString logverbose;
160 };
161 
162 #endif // POPPEFOOTBALLMODULE_H
Definition: PoppeFootball.h:102
Definition: ModuleInterface.h:43
The CommonImage class This is a class made to solve the headache you&#39;ll probably get when working bot...
Definition: commonimage.h:21
An object of this class is instantiated at main code, and this object is used by every class to push ...
Definition: Datapool.h:39
The CodebookModel class This is a class made to interface (some way or another) the way OpenCV handle...
Definition: codebookmodel.h:15
Definition: PoppeFootball.h:46