VAT  3.0
Video Analysis Tool
sampleshadowsoccer.h
1 #ifndef SAMPLESHADOWSOCCER_H
2 #define SAMPLESHADOWSOCCER_H
3 
4 #include <map>
5 #include <string>
6 #include <QImage>
7 #include "Datapool.h"
8 #include "ModuleInterface.h"
9 #include <QDir>
10 #include "SegmentationTool.h"
11 
12 #include <opencv2/video/background_segm.hpp>
13 #include "opencv2/opencv.hpp"
14 
16 {
17 public:
20 
21  //Set module configuration parameters
22  bool setParameters(QDomNode& config);
23 
24  //Initialization after reading parameters
25  bool init();
26 
27  //Function executed at each frame
28  bool run();
29 
30  //update parameters at runtime.
31  bool updateParameters();
32 
33  //Spatial Filter
34  void spatialFilter();
35 
36  //Labeling Nodes Skeletons
37  void labelingNodes(cv::Mat &skeletons);
38  void updateConnections(int new_v, int old_v, std::map<int, int> &con);
39 
40  void filterLeafs(int *labelmatrix);
41 
42  void PrintShadowSamplePoints();
43  void PrintShadowFeatures();
44 
45 private:
46  void setLabel();
47 
48  void SampleShadow();
49  void SampleForeground();
50  cv::Mat asSamplesVectors(std::vector<std::vector<int> > Features);
51 
53 
54  cv::Mat frame; //current frame
55  cv::Mat resizeF;
56  cv::Mat fgMask;//fg mask generated by MOG method
57  cv::Mat skel;//Skeleton Image
58  cv::Mat thinnedSkel;//Skeleton Image
59  cv::Mat connectivityMap; //Map whit connectivity of nodes
60  cv::Mat foregroundSam; //Image for foreground samples
61 
62  cv::Ptr<cv::BackgroundSubtractor> mog;
63 
64  QImage *current;
65 
66  int threshold; //Classification Shadow Threshold
67  int maxShadowFeatures; //Cantidad Máxima de Features de Sombra detectar
68  int maxForegroundFeatures; //Cantidad Máxima de Features de Foreground a detectard
69  bool endTrain; //Flag que indica si finalizo el entrenamiento
70  bool setExtofFeatures; //Flag que indica si se quiere realizar extracción de caracteristicas
71 
72  cv::Mat _means_S ;
73  cv::Mat _weights_S ;
74  std::vector<cv::Mat> _covs_S;
75 
76  cv::Mat _means_F;
77  cv::Mat _weights_F ;
78  std::vector<cv::Mat> _covs_F ;
79 
80  std::vector<bool> excluded_zone; //Define zones of intersections
81  std::vector<CvPoint> intersections;
82  std::vector<CvPoint> SsamplePoints; //Shadow Sample Points
83  std::vector<CvPoint> FsamplePoints; //Foreground Sample Points
84 
85  //Classify pixel whit tri-variate mixture
86  // true = foreground false = shadow
87  std::vector<bool> classifyPixel;
88 
89  std::vector<std::vector<int> > sFeatures; //Shadow Feature Vectors
90  std::vector<std::vector<int> > fFeatures; //Foreground Feature Vectors
91 };
92 
93 #endif // SAMPLESHADOWSOCCER_H
Definition: sampleshadowsoccer.h:15
Definition: ModuleInterface.h:43
The SegmentationTool class is used to generate Chromatic Segmentation.
Definition: SegmentationTool.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