VAT  3.0
Video Analysis Tool
colorModel.h
1 #ifndef COLORMODEL_H
2 #define COLORMODEL_H
3 
4 #include <QDomNode>
5 #include <QImage>
6 #include <vector>
7 #include <QSharedPointer>
8 
9 #include "reliabilitysinglemodelinterface.h"
10 #include "src/blob.h"
11 #include "Blob2DFromBGSubstractionModel.h"
12 
13 class Datapool;
14 
16 public:
17  ColorModel(int buffer_size);
18 
19  virtual ~ColorModel();
20 
21  //IMPLEMENT!! Initializes the model attributes for the interface.
22  //The function is called by the interface constructor
23  virtual void initInstanceAttributes();
24 
25  //IMPLEMENT!! Initializes the dynamics model attributes for the interface.
26  //The function is called by the interface constructor
27  virtual void initDynamicsAttributes();
28 
29  //IMPLEMENT!! Copy function for specific data from the instance (general_copy calls it after copying base info)
30  virtual void copy(SpReliabilitySingleModelInterface);
31 
32  //IMPLEMENT!! Copy general structures and parameters of specific model, without considering instance specific data
33  virtual void copy_structure(SpReliabilitySingleModelInterface);
34 
35  //IMPLEMENT!! sets parameters from xml file
36  virtual void setParameters(QDomNode &i_parameters);
37 
38  //IMPLEMENT!! sets activation criteria for each model: reliability on input (distance, bad data),
39  // needs (occlusion, priority),
40  //sets priority of models (hierarchy).
41  //Checked before update phase
42  virtual void activate(BoundingBox &);
43 
44  //IMPLEMENT!! initializes every activated model, according to their own input (region-blob-segments schema)
45  //Executed only once at the begginning of single model creation (after 'copy_structure' and 'copy' methods
46  //are used to copy the information).
47  virtual void init();
48 
49  //IMPLEMENT!! updates activated model instance attributes for current frame, and returns the set of detected/enriched objects.
50  // It notifies if roi (bounding box, or segmentation) changes compared to the input, for reprocessing.
51  virtual bool updateInstance(BoundingBox &, std::set<SpRMMHypothesis, hypothesesOrderedByBestProbabilityOperator> &);
52 
53  //IMPLEMENT!! updates activated model instance attributes for current frame and object, and returns the detected/enriched object.
54  // It notifies if roi (bounding box, or segmentation) changes compared to the input, for reprocessing.
55  // This function does NOT generate mobiles or hypotheses. It processes attributes for the current object.
56  // This function could be used by updateInstance to generate mobile information, for the generated mobiles.
57  // IT MUST INSERT A NEW ModelInstanceDataPack IN instances buffer and update ginfo attribute of the ModelInstanceDataPack
58  // properly (see ModelInstanceGeneralPack).
59  // IF CALLED INSIDE ONE METHOD OF THIS CLASS, IT MUST INCLUDE A CALL TO METHOD: updateCurrentGeneralInfo();
60  // ALSO WHEN CREATING NEW OBJECTS (IT MUST BE CALLED FOR THE CREATED OBJECT).
61  virtual void updateSingleInstance(BoundingBox &);
62 
63  //IMPLEMENT!! updates model dynamics, based on instances information: work on post_dynamics structure
64  virtual void updateModelDynamics();
65 
66  //Visualization
67  //virtual void printInstances();
68 
69  //virtual void printDynamics();
70 
71  //virtual void printGeneral();
72 
73  //virtual void printGeneral(std::ostream& out);
74 
75  //virtual bool draw(QImage *image);
76 
77  virtual bool draw(QPainter &painter, int r, int g, int b);
78 
79  //Starts dynamics in multimodel and calls specific model dynamics with updateModelDynamics();
80  //void updateDynamics();
81 
82  //sets global probability P for the model (how good is the model)
83  //sets global reliability R for the model (how good is the data used in the model)
84  virtual void setProbabilityAndReliability();
85 
86  //sets data pack general information of the model in forward process (update)
87  virtual void setForwardInterface();
88 
89  //Get 2D central bounding box point from the model
90  //virtual void setTrajectory2D(double &, double &, double &);
91 
92  //Estimates the bounding box size and position for next
93  //frame according to its own dynamics model
94  //It also sets Reliability R of the model estimation.
95  //The function defaults to the 'binterface' bounding box.
96  //Nevertheless, a better implementation really depending on the
97  //specific dynamics model is expected.
98  //virtual BoundingBox getEstimator(double &R);
99 
100 
101  //funciones de color
102  void makeHistoryGraph(BoundingBox &roi, cv::Mat &Hues, cv::Mat &GrayScale, cv::Mat &Croma, cv::Mat &Luma);
103  void checkHistory(cv::Mat &Hues, cv::Mat &GrayScale);
104 
105  float grayRatio;
106 
107 
108  bool drawHisto(QPainter &painter);
109 
110  int mobileIDToDraw;
111 };
112 
113 
114 #endif // COLORMODEL_H
virtual void updateModelDynamics()
Definition: colorModel.cpp:131
virtual void setProbabilityAndReliability()
Definition: colorModel.cpp:228
Definition: colorModel.h:15
bool drawHisto(QPainter &painter)
Definition: colorModel.cpp:442
Definition: reliabilitysinglemodelinterface.h:96
An object of this class is instantiated at main code, and this object is used by every class to push ...
Definition: Datapool.h:39
void checkHistory(cv::Mat &Hues, cv::Mat &GrayScale)
Definition: colorModel.cpp:419