VAT  3.0
Video Analysis Tool
Datapool.h
1 #ifndef __DATAPOOL_H__
2 #define __DATAPOOL_H__
3 
4 
5 #include <QImage>
6 #ifdef __COMPILE_QT5__
7  #include <QtWidgets/QTextEdit>
8 #else
9  #include<QTextEdit>
10 #endif
11 #include "opencvCompatibilityVersion.h"
12 #include <deque>
13 #include <map>
14 #include "src/calibration.h"
15 #include "src/blob.h"
16 #include "src/hullmodel.h"
17 #include "src/object.h"
18 #include "src/ModelInterface.h"
19 #include "src/ImageHeader.h"
20 #include "src/MobileObject.h"
21 #include "src/MobileObject2D.h"
22 #include "src/RMMT/RMMMobileObject.h"
23 #include "src/rlesegment.h"
24 #include "src/IncrementalEventLearning.h"
25 #include "src/degumodel.h"
26 #include "MODELS/DeguTrackingModel.h"
27 #include "src/groundtruth.h"
28 #include "src/rectangle.h"
29 #include "src/templateclass.h"
30 #include "src/footballConstants.h"
31 #include "src/footballscenemodel.h"
32 #include "src/gtstructures.h"
33 
39 class Datapool: public QObject {
40  Q_OBJECT
41  public:
42  Datapool();
43  ~Datapool();
44  static QVector<QRgb> *setGrayScaleTable();
45  static QVector<QRgb> *setThermalTable();
46  static void deleteTables();
47 
48  void appendToLog(const QString&);
49  static QString getCurrentDateTimeString();
50  void pauseApp();
51  void clear();
52  void init();
53  //Data:
54  //Frame number from acquisition module
59 
60  //Program modules configuration
61  std::vector<QString> moduleSequenceNames;
62  std::vector<double> moduleSequenceMSTime;
63  std::vector<double> moduleSequenceMeanTime;
64  std::vector<double> moduleSequenceVarTime;
65  std::vector<int> moduleSequenceMinTime;
66  std::vector<int> moduleSequenceMaxTime;
67  double totalTime;
68 
78 
79  //Scene information
84  std::map<ObjectType, SpModelInterface> objectModels;
85  footballSceneModel *fSceneModel;
86 
87  //Current Image Frame
91  QImage *currentImage;
92 
96  cv::Mat currentImageMat;
97 
102 
107 
111  cv::Mat fgImageMat;
112 
116  cv::Mat featureMapMat;
117 
118 
123  QImage *previousImage;
124 
129 
142 
143  //Variables Fredes Caro - CV 2014-1------------------------------------
153  QImage *NewImage;
154  QImage *NewImage2;
163  //Fin Variables Fredes Caro - CV 2014-1------------------------------------
168  QImage *skeletonImage; //Barrientos Nettle - CV 2014-1
172  QImage *filteredImage; //Barrientos Nettle - CV 2014-1
173 
178  QImage *foregroundSampledImage; //Barrientos Nettle - CV 2014-1
179 
180  //Current Gray Image Frame
184  QImage *grayImage;
185 
186  //Image header with date/time information
191 
192  //Background Image
196  QImage *bgImage;
197 
198  //Mask Image
202  QImage *maskImage;
203 
204  //Calibration Matrix
208  cv::Mat cameraMatrix;
212  cv::Mat distCoeffs;
216  std::vector<cv::Mat> rvecs;
220  std::vector<cv::Mat> tvecs;
221 
222  //Reliability segmentation results
223 
227  QImage *featureMap;
228 
232  QImage *reliabilityMap;
233 
238 
239  //Segmentation results
243  QImage *fgImage;
244 
249 
254 
258  std::map<QString, double> tunedParametersSet;
259 
264 
268  std::map<QString, double> bestParametersSet;
269 
274 
275  //Segmentation results
276  QImage *groundtruthFgImage; //Indexed8
277 
281  QImage *groundtruthImage; //Acquired ARGB32
282 
283  //Regional segmentation results
284  QImage *currentDiffImage; //difference w/r to previous image in (t) and (t-1)
285  QImage *previousDiffImage;//difference w/r to previous image in (t-1) and (t-2)
289  QImage *rFgImage; //RGB888
290 
291  //Personality
295  QImage *personalityPCAImage; //RGB888
296 
297  //RLE segments of FG image, ordered by row
301  std::map<int, std::deque<RLESegment> > RLEFGImage;
302 
303  //RLE regions of FG image, ordered by labels
307  std::map<int, RLERegion> RLERegions;
308 
309  //Incremental Learning Information
310  miles::SpIncrementalEventLearning eventLearning;
311  miles::SpLearningAttributes availableAttributes;
312  std::map<unsigned long, std::map<int, miles::SpLevelData> > levelData;
313  std::map<unsigned long, std::map<long int, double> > Pr;
314 
315 
316  //MODELS
317 
318  //Football Models
319  std::map< ColorModelType , gaussianMixtureColorModel> GMCmodels;
320  appHistType apparienceHist;
321  clusters2D_BOF clustersChroma;
322  clusters1D_BOF clustersLuma;
323  clusters3D_BOF clustersLuv;
324  std::vector<playerCandidate> plCandidates;
325 
326  //Blob list
330  std::vector<Blob> blobs;
331 
332  //Line list
336  std::vector<cv::Vec2f> lines;
340  std::vector<cv::Vec4i> lines2;
341 
342  //std::vector<HullModel> hulls; //Convex hull, with OpenCV classes
343  //Object list
347  std::deque<SpMobileObject> objects;
348 
352  std::deque<SpMobileObject2D> objects2D;
356  std::deque<SpRMMMobileObject> RMMobjects;
357 
363 
367  std::deque<SpHullModel> hulls;
368 
372  std::map<int, Object> fake_objects;
373 
374  //TEMP
375  std::map<QString, DeguTrackingModel *> modelsToFollow;
376 
381  QImage *temporalVariance; //from temporal variance module
382 
383  //Event list
384  //std::deque<Event> events;
385 
386  //OTHER GLOBAL INFORMATION:
387  //Current configuration file name
391  QString m_config_file;
392 
393  //Color table for grayscale image
397  static QVector<QRgb> *grayScaleTable;
398 
399  //Color table for thermal image
400  static QVector<QRgb> *thermalTable;
401 
402  //For Degu detection
407 
408  //For Personality Module
412  QImage *persoImage;
413 
414  //For Superpixel modules (to see if it will be the unique interface)
415  //Buffer with labels for each pixel of the current image
420  //Number of labels found on image
425 
426  //Labels for superpixel, for each blob, plus information about the considered bounding region.
430  std::vector<cv::Mat> blobSuperpixelLabels;
431 
435  std::vector<Rectangle<int> > blobSuperpixelBoundingRegion;
439  std::vector<int> blobSuperpixelNumber;
440 
441 
447 
448  //GTModule
449  std::string connectionQuery; //Contiene direccion y puerto
450  std::string username;
451  std::string password;
452  std::string dbName;
453  QList<classType> classes;
454  QList<boundingBox> boxes;
455  QString currentFile; //AcquisitionModule, nombre del archivo que se esta procesando.
456 
457  signals:
458  void logString(QString);
459  void pause();
460 };
461 
462 
463 #endif
std::map< QString, double > tunedParametersSet
Stores the current parameter values in the cycle.
Definition: Datapool.h:258
bool cycleActivated
flag used for segmentation cycle. Specifies to consider a cyclic frame sequence.
Definition: Datapool.h:128
QImage * rFgImage
Used for Regional Regmentation results. Format RGB 8 bits each channel.
Definition: Datapool.h:289
std::vector< cv::Mat > rvecs
rvecs. Results of calibration
Definition: Datapool.h:216
std::map< int, std::deque< RLESegment > > RLEFGImage
RLE segments of foreground image, ordered by row.
Definition: Datapool.h:301
std::vector< Rectangle< int > > blobSuperpixelBoundingRegion
Stores information about the considered bounding region (Used by Superpixel modules) ...
Definition: Datapool.h:435
bool runModules
Definition: Datapool.h:446
QImage * currentImage
Reference to current Image given by the acquisition module.
Definition: Datapool.h:91
QImage * maskImage
Mask image used for segmentation.
Definition: Datapool.h:202
SceneModel * sceneModel
A reference to an object of class SceneModel. Stores information of the scene.
Definition: Datapool.h:83
QImage * temporalVariance
used by temporalVarianceBGModule
Definition: Datapool.h:381
QImage * featureMap
Results of reliability segmentation. Format Indexed 8 bits.
Definition: Datapool.h:227
QImage * persoImage
Image used by personality module.
Definition: Datapool.h:412
ImageHeader * currentHeader
Reference to the image header (with date and time information) from the acquisition module...
Definition: Datapool.h:190
long processedFrames
Link to modules structure.
Definition: Datapool.h:77
QImage * previousDepthImage
Reference to a previous Depth Image given by AcquisitionDepthModule. This is used when is explicitly ...
Definition: Datapool.h:152
Definition: ImageHeader.h:11
int frameNumber
Number of the current frame assigned by the acquisition module.
Definition: Datapool.h:58
std::map< QString, double > bestParametersSet
Stores the best parameters reached at current cycle.
Definition: Datapool.h:268
std::vector< cv::Mat > tvecs
tvecs. Results of calibration
Definition: Datapool.h:220
bool postedBestParameters
Establishes if best parameters have been found and then finish the search of them.
Definition: Datapool.h:273
std::vector< Blob > blobs
A blob list.
Definition: Datapool.h:330
Groundtruth groundtruth
Stores pairs groundtruth-object in a sequence of frames.
Definition: Datapool.h:362
QImage * groundtruthImage
Stores segmentation results in ARGB32 format by an aquisition module.
Definition: Datapool.h:281
Definition: footballscenemodel.h:34
int superpixel_numlabels
Number of labels found on image by Superpixel modules.
Definition: Datapool.h:424
QString m_config_file
Current configuration file path.
Definition: Datapool.h:391
QImage * currentDepthImage
Reference to current Depth Image given by AcquisitionDepthModule.
Definition: Datapool.h:147
QImage * bgImage
Background Image given by BackgroundInitialization module.
Definition: Datapool.h:196
std::vector< cv::Mat > blobSuperpixelLabels
Labels for superpixel.
Definition: Datapool.h:430
cv::Mat cameraMatrix
Calibration Matrix.
Definition: Datapool.h:208
Definition: calibration.h:51
std::deque< SpMobileObject > objects
Object list. List generally used by tracking modules.
Definition: Datapool.h:347
QImage * colouredFgImage
Image where foreground of diferent methods are draw using their own defined colour.
Definition: Datapool.h:248
Definition: groundtruth.h:30
QImage * reliabilityMap
Results of reliability segmentation. Format Indexed 8 bits.
Definition: Datapool.h:232
cv::Mat currentImageMatYUV
Reference to current YUV Image in Mat format: set by setMatImagesModule.
Definition: Datapool.h:101
std::deque< SpHullModel > hulls
A convex gull model, using OpenCV classes.
Definition: Datapool.h:367
bool firstOfCycle
flag used for segmentation cycle. Used to identify the first frame in a processing cycle for a cyclic...
Definition: Datapool.h:141
static QVector< QRgb > * grayScaleTable
Color table for grayscale image.
Definition: Datapool.h:397
cv::Mat fgImageMat
Foreground Image in Mat CV_8UC1 format: set by setMatImagesModule.
Definition: Datapool.h:111
std::vector< int > blobSuperpixelNumber
Numeric identifier for each blob.
Definition: Datapool.h:439
std::map< int, Object > fake_objects
Definition: Datapool.h:372
QImage * skeletonImage
skeletonImage
Definition: Datapool.h:168
int * superpixel_labels
A buffer with labels for each pixel of the current image (Used by Superpixel modules) ...
Definition: Datapool.h:419
std::vector< cv::Vec4i > lines2
Line list given by HMTracking module.
Definition: Datapool.h:340
std::deque< SpMobileObject2D > objects2D
2D Objects list.
Definition: Datapool.h:352
DeguModel * degu
Degu model for its detection.
Definition: Datapool.h:406
An object of this class is instantiated at main code, and this object is used by every class to push ...
Definition: Datapool.h:39
QImage * previousImage
Reference to a previous Image given by the acquisition module. This is used when is explicitly specif...
Definition: Datapool.h:123
QImage * empiricalReliabilityMap
Results of reliability segmentation. Format Indexed 8 bits.
Definition: Datapool.h:237
QImage * foregroundSampledImage
foregroundSampledImage
Definition: Datapool.h:178
ImageHeader * currentDepthHeader
Reference to the image header (with date and time information) from AcquisitionDepthModule.
Definition: Datapool.h:158
std::vector< cv::Vec2f > lines
Line list given by HMTracking module.
Definition: Datapool.h:336
cv::Mat currentImageMat
Reference to current RGB Image in Mat format: set by setMatImagesModule.
Definition: Datapool.h:96
cv::Mat featureMapMat
Reliability segmentation in Mat CV_8UC1 format.
Definition: Datapool.h:116
cv::Mat currentImageMatY
Current Y Image in Mat CV_8UC1 format: set by setMatImagesModule.
Definition: Datapool.h:106
int * labelMatrix
Array that represents the image data of labels for connected components (with same images size)...
Definition: Datapool.h:253
cv::Mat distCoeffs
Calibration Matrix.
Definition: Datapool.h:212
std::deque< SpRMMMobileObject > RMMobjects
The list of object results from using ReliabilityMultiModelTrackingModule.
Definition: Datapool.h:356
bool tuningEnded
Flag for indicate the end of parameter tuning.
Definition: Datapool.h:263
QImage * grayImage
Reference to the current gray image frame. Used to store gray code image.
Definition: Datapool.h:184
QImage * fgImage
Foreground image that contains segmentation results (format: Indexed 8 bits).
Definition: Datapool.h:243
QImage * personalityPCAImage
Personality PCA image used by Personality Module. Image format RGB 8 bit each channel.
Definition: Datapool.h:295
int frameDepthNumber
Number of the current depth frame assigned by the acquisition module.
Definition: Datapool.h:162
Definition: degumodel.h:35
QImage * filteredImage
Filtered Image given by Filter Module.
Definition: Datapool.h:172
std::map< int, RLERegion > RLERegions
RLE regions of foreground image, ordered by label.
Definition: Datapool.h:307