VAT  3.0
Video Analysis Tool
PlayerDetection.h
1 #ifndef PLAYERDETECTION_H
2 #define PLAYERDETECTION_H
3 
4 #include "Datapool.h"
5 #include "ModuleInterface.h"
6 #include "src/blob.h"
7 #include "src/templateclass.h"
8 
9 typedef struct mapStruct mapMapStruct;
10 struct mapStruct
11 {
12  mapStruct( float _maxVal, float _minVal, float _diff , QString _name) :
13  maxVal(_maxVal), minVal(_minVal),diff(_diff),name(_name){}
14  mapStruct() : maxVal(0.0), minVal(1000.0), diff(0.0), name("UNK"){}
15 
16  float maxVal;
17  float minVal;
18  float diff;
19  float alpha, beta;
20  float probValue;
21  QString name;
22 
23 };
24 
26 {
27 public:
28  PlayerDetection(Datapool *i_data);
29  ~PlayerDetection();
30  //Set module configuration parameters
31  bool setParameters(QDomNode& config);
32 
33  //Initialization after reading parameters
34  bool init();
35 
36  //Function executed at each frame
37  bool run();
38 
39  //update parameters at runtime.
40  bool updateParameters();
41 
42  bool getCentersForMultipleClasses(int x_leftBlob, int x_rightBlob, int y_topBlob, int y_bottomBlob);
43 
44  BoundingBox setRectModel(cv::Point center);
45 
46 private:
47  //Mapas de Probabilidad
48  cv::Mat compactnessMap;
49  cv::Mat heightMap;
50  cv::Mat widthMap;
51  cv::Mat probMap;
52  std::map<soccerClass, cv::Mat> colorMapTeam_Map; //Mapa de Probabilidad de Color
53  std::map<soccerClass, cv::Mat> probability_Map; //Mapa de Probabilidad 32 bits un canal
54 
55  //Directorio donde se encuentran las tablas del modelo de color para cada parte del cuerpo
56  std::map<soccerClass, bool > classesIncluded;
57  templateClass *Template;
58  soccerClass team; //Define la clase a la que pertenece la instancia
59 
60  QVector<QRgb> colorTable;//Tabla de Color para dibujar los mapas de probabilidad
61 
62  int candidate_to_draw;
63  int currentBlob_id;//Id for current Analized Blob
64 
65  bool drawFlag;
66 
67  //Parametros que faltan por setear
68  int thresholdPeakImage;
69 
70  cv::Mat obtainDistancesIntegralImage(const cv::Mat &frame, cv::Rect roi,soccerClass team, playerPart part);
71 
72  //Color Maps
73  //0: Red 1 : Blue
74  QImage matToQImageOneColor(const cv::Mat& mat);
75 
76  void writeMapToSCV(cv::Mat data, QString name);
77 
78  void setTemplateColors();
79 
80  std::map<soccerClass,std::vector<cv::Point> > centers;
81 
82  //Functions to find de Maximun values for center of players
83  std::vector<cv::Point> bhContoursCenter(const std::vector<std::vector<cv::Point>>& contours,bool centerOfMass,int contourIdx=-1);
84  std::vector<cv::Point> bhFindLocalMaximum(cv::Mat _src, QString name = "UNK");
85 
86  std::vector<int> getExtendedRegion(int blob_xleft, int blob_xright, int blob_ytop, int blob_ybottom);
87 
88  void obtainIntegralImagesForTemplate(soccerClass team, cv::Rect rect);
89 
90  cv::Rect setPlayerSizeAt(int j, int i, int upPart, int height, int width);
91  double getHeightMapProbValue(int i, int top, int bottom, int topPart, int bottomPart, int type);
92  std::vector<int> getForegroundLimitPoints(const uchar *data,int bpl, int blob_xleft, int blob_xright, int blob_ytop, int blob_ybottom);
93  void mapSetParamStepOne(mapStruct &vT);
94  void mapSetParamStepTwo(mapStruct &vT);
95  void showMaps(int objectId, double scaleFactor);
96  void showImageGroup(std::vector<cv::Mat> imagesToShow, QString windowName);
97  double getWidthMapProbValue(int j, int left, int right, int ratio, int type);
98  double getLimitPointsProbValue(int val_int, int pi_int, int pf_int, int p1_int, int p2_int, double maxVal, double minVal);
99 
100 
101 };
102 
103 #endif // PLAYERDETECTION_H
Definition: ModuleInterface.h:43
Definition: PlayerDetection.h:25
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: templateclass.h:40
Definition: playermodelfromprobabilitymaps.h:11
Definition: BackgroundRecLigth.h:20