VAT  3.0
Video Analysis Tool
SuperpixelModel.h
1 #ifndef SUPERPIXELMODEL_H
2 #define SUPERPIXELMODEL_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 
12 class Datapool;
13 
15 public:
16  enum Bound {
17  B_LEFT,
18  B_RIGHT,
19  B_TOP,
20  B_BOTTOM,
21  };
22 
24 
25  virtual ~SuperpixelModel();
26 
27  //IMPLEMENT!! Initializes the model attributes and dynamics for the interface.
28  //The function is called by the interface constructor
29  virtual void initInstanceAttributes();
30 
31  //IMPLEMENT!! Initializes the visible model attributes for the interface.
32  //The function is called by the interface constructor
33  virtual void initDynamicsAttributes();
34 
35  //IMPLEMENT!! Copy function for specific data from the instance (general_copy calls it after copying base info)
36  virtual void copy(SpReliabilitySingleModelInterface);
37 
38  //IMPLEMENT!! Copy general structures and parameters of specific model
39  virtual void copy_structure(SpReliabilitySingleModelInterface);
40 
41  //IMPLEMENT!! sets parameters from xml file
42  virtual void setParameters(QDomNode &i_parameters);
43 
44  //IMPLEMENT!! sets activation criteria for each model: reliability on input (distance, bad data),
45  // needs (occlusion, priority),
46  //sets priority of models (hierarchy).
47  //Checked before update phase
48  virtual void activate(Blob *);
49 
50  //IMPLEMENT!! initializes every activated model, according to their own input (region-blob-segments schema)
51  //Executed only once at the begginning of single model creation (after 'copy_structure' and 'copy' methods
52  //are used to copy the information).
53  virtual void init();
54 
55  //IMPLEMENT!! updates activated model instance attributes for current frame
56  virtual void updateInstance(Blob *);
57 
58  //IMPLEMENT!! updates every activated model dynamics
59  virtual void updateDynamics();
60 
61  //IMPLEMENT!! feedback process for depurating information based on dependant models.
62  //It should be programmed checking the presence of different models that can
63  //improve the estimation of model attributes.
64  virtual void feedback();
65 
66  //IMPLEMENT!! sets global probability for the model (how good is the model)
67  virtual void setProbabilityAndReliability();
68 
69  //IMPLEMENT!! sets blob enclosing the model in forward process (update)
70  virtual void setForwardBlobInterface();
71 
72  //IMPLEMENT!! sets blob enclosing the model in backward process (feedback)
73  virtual void setBackwardBlobInterface();
74 
75  //OPTIONAL
76  virtual bool draw(QPainter &painter);
77 
78  virtual bool draw(QPainter &painter, int r, int g, int b);
79 
80  //Initialize dynamics attribute with instance value
81  void initAttribute(ReliabilityDynamicsAttribute &d, AttributeDupletValue &i);
82 
83  //Attribute update, with minimal attribute value constraint
84  void updateMinConstrainedAttribute(const QString &name, ReliabilityDynamicsAttribute &d, double min);
85 
86  //Standard attribute update, with no attribute value constraints
87  void updateAttribute(const QString &name, ReliabilityDynamicsAttribute &d);
88 
89  void updateAttributeDynamics(double data, double RData, double acuity,
90  double estimate, double currentCooling, AttributeTripletValue &att);
91 
92  void updateAttributeDynamicsNoData(double estimate, double acuity, double currentCooling,
94 
95  double projectAttributeValue(ReliabilityDynamicsAttribute &, double &R);
96 
97  virtual Rectangle<int> getEstimator(double &R);
98 
99  //Reliability by parameter
100 /* double getLeftReliability(BoundingBox &r);
101  double getRightReliability(BoundingBox &r);
102  double getBottomReliability(BoundingBox &r);
103  double getTopReliability(BoundingBox &r);
104 
105  double contrastGaussianMean(int x, int y, QImage &cn);
106  double contrastGaussianMeanFG(int x, int y, QImage *cn, QImage *fg);
107  void addLocalBoundPoints(BoundingBox &r, Bound bound);
108 
109  double m_minimalAttributeVelocityReliability;
110  double m_minimalAttributeAccelerationReliability;
111  double m_minimalWidth;
112  double m_minimalHeight;
113  int m_pixelAcuity;
114  bool m_useReliability;
115  bool m_useContrastReliability;
116 
117 */
118  //Desired number of superpixels. Note that the actual number may be smaller due to restrictions (depending on the image size and num_levels).
119  //Use getNumberOfSuperpixels() to get the actual number.
120  int m_superpixelnumber;
121  //Number of block levels. The more levels, the more accurate is the segmentation, but needs more memory and CPU time.
122  int m_num_levels;
123  //Use prior – enable 3x3 shape smoothing term if >0. A larger value leads to smoother shapes. prior must be in the range [0, 5].
124  int m_use_prior;
125  //Number of histogram bins.
126  int m_histogram_bins;
127  //If true, iterate each block level twice for higher accuracy.
128  bool m_double_step;
129  //Number of pixel level iterations. Higher number improves the result.
130  int m_num_iterations;
131 
132  //Size factor: multiplier for blob size, to calculate the superpixel segmentation
133  double m_sfactor;
134 
135  bool m_showId;
136  bool m_blackId;
137 };
138 
139 typedef QSharedPointer<SuperpixelModel> SpSuperpixelModel;
140 
141 
142 #endif // SUPERPIXELMODEL_H
Definition: reliabilityattribute.h:101
Definition: reliabilitysinglemodelinterface.h:96
Definition: SuperpixelModel.h:14
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: blob.h:79
Definition: BackgroundRecLigth.h:20