VAT  3.0
Video Analysis Tool
BlobLRBTFromBGSubstractionModel.h
1 #ifndef BLOBLRBTFROMBGSUBSTRACTIONMODEL_H
2 #define BLOBLRBTFROMBGSUBSTRACTIONMODEL_H
3 
4 #include <QDomNode>
5 #include <QImage>
6 #include <vector>
7 #include <QSharedPointer>
8 
9 #include <opencv2/core.hpp>
10 
11 #include "reliabilitysinglemodelinterface.h"
12 #include "src/blob.h"
13 
14 class Datapool;
15 
17 public:
18  enum Bound {
19  B_LEFT,
20  B_RIGHT,
21  B_TOP,
22  B_BOTTOM,
23  };
24 
26 
28 
29  //IMPLEMENT!! Initializes the model attributes and dynamics for the interface.
30  //The function is called by the interface constructor
31  virtual void initInstanceAttributes();
32 
33  //IMPLEMENT!! Initializes the visible model attributes for the interface.
34  //The function is called by the interface constructor
35  virtual void initDynamicsAttributes();
36 
37  //IMPLEMENT!! Copy function for specific data from the instance (general_copy calls it after copying base info)
38  virtual void copy(SpReliabilitySingleModelInterface);
39 
40  //IMPLEMENT!! Copy general structures and parameters of specific model
41  virtual void copy_structure(SpReliabilitySingleModelInterface);
42 
43  //IMPLEMENT!! sets parameters from xml file
44  virtual void setParameters(QDomNode &i_parameters);
45 
46  //IMPLEMENT!! sets activation criteria for each model: reliability on input (distance, bad data),
47  // needs (occlusion, priority),
48  //sets priority of models (hierarchy).
49  //Checked before update phase
50  virtual void activate(Blob *);
51 
52  //IMPLEMENT!! initializes every activated model, according to their own input (region-blob-segments schema)
53  //Executed only once at the begginning of single model creation (after 'copy_structure' and 'copy' methods
54  //are used to copy the information).
55  virtual void init();
56 
57  //IMPLEMENT!! updates activated model instance attributes for current frame
58  virtual void updateInstance(Blob *);
59 
60  //IMPLEMENT!! updates every activated model dynamics
61  virtual void updateDynamics();
62 
63  //IMPLEMENT!! feedback process for depurating information based on dependant models.
64  //It should be programmed checking the presence of different models that can
65  //improve the estimation of model attributes.
66  virtual void feedback();
67 
68  //IMPLEMENT!! sets global probability for the model (how good is the model)
69  virtual void setProbabilityAndReliability();
70 
71  //IMPLEMENT!! sets blob enclosing the model in forward process (update)
72  virtual void setForwardBlobInterface();
73 
74  //IMPLEMENT!! sets blob enclosing the model in backward process (feedback)
75  virtual void setBackwardBlobInterface();
76 
77  //OPTIONAL
78  virtual bool draw(QPainter &painter);
79 
80  virtual bool draw(QPainter &painter, int r, int g, int b);
81 
82  //Initialize dynamics attribute with instance value
83  void initAttribute(ReliabilityDynamicsAttribute &d, AttributeDupletValue &i);
84 
85  //Attribute update, with minimal attribute value constraint
86  void updateMinConstrainedAttribute(const QString &name, ReliabilityDynamicsAttribute &d, double min);
87 
88  //Standard attribute update, with no attribute value constraints
89  void updateAttribute(const QString &name, ReliabilityDynamicsAttribute &d);
90 
91  void updateAttributeDynamics(double data, double RData, double acuity,
92  double estimate, double currentCooling, AttributeTripletValue &att);
93 
94  void updateAttributeDynamicsNoData(double estimate, double acuity, double currentCooling,
96 
97  double projectAttributeValue(ReliabilityDynamicsAttribute &, double &R);
98 
99  virtual Rectangle<int> getEstimator(double &R);
100 
101  //Reliability by parameter
102  double getLeftReliability(BoundingBox &boundingBox);
103  double getRightReliability(BoundingBox &boundingBox);
104  double getBottomReliability(BoundingBox &boundingBox);
105  double getTopReliability(BoundingBox &boundingBox);
106 
107  double contrastGaussianMean(int x, int y, QImage &cn);
108  double contrastGaussianMeanFG(int x, int y, QImage *cn, QImage *fg);
109  void addLocalBoundPoints(BoundingBox &r, Bound bound, float reliability);
110 
111  double m_minimalAttributeVelocityReliability;
112  double m_minimalAttributeAccelerationReliability;
113  double m_minimalWidth;
114  double m_minimalHeight;
115  int m_pixelAcuity;
116  bool m_useReliability;
117  bool m_useFeatureMap;
118 
119  int *GF;
120  double GFactor;
121 
122  bool m_showId;
123  bool m_blackId;
124  bool m_build2DBoundReliabilityImage;
125  QImage boundsReliability;
126  double localMaxBound;
127  bool currentBoundImageOK;
128  std::map< int, std::map<int, double> > localBoundList;
129 
130  std::vector<float> leftBoundListRel;
131  std::vector<cv::Point2d> leftBoundListPos;
132  std::vector<float> rightBoundListRel;
133  std::vector<cv::Point2d> rightBoundListPos;
134  std::vector<float> topBoundListRel;
135  std::vector<cv::Point2d> topBoundListPos;
136  std::vector<float> bottomBoundListRel;
137  std::vector<cv::Point2d> bottomBoundListPos;
138 
139 // int xbound, ybound;
140 };
141 
142 typedef QSharedPointer<BlobLRBTFromBGSubstractionModel> SpBlobLRBTFromBGSubstractionModel;
143 
144 
145 #endif // BLOB2DFROMBGSUBSTRACTIONMODEL_H
Definition: BlobLRBTFromBGSubstractionModel.h:16
Definition: reliabilityattribute.h:101
Definition: reliabilitysinglemodelinterface.h:96
Definition: reliabilityattribute.h:10
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: reliabilityattribute.h:76
Definition: gtstructures.h:32
Definition: blob.h:79
Definition: BackgroundRecLigth.h:20