FastTrack 6.1.0
Tracks multiples objects dealing with occlusion and identities.
interactive.h
1/*
2This file is part of Fast Track.
3
4 FastTrack is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 FastTrack is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with FastTrack. If not, see <https://www.gnu.org/licenses/>.
16*/
17
18#ifndef INTERACTIVE_H
19#define INTERACTIVE_H
20
21#include <stdio.h>
22#include <stdlib.h>
23#include <time.h>
24#include <QAction>
25#include <QDateTime>
26#include <QDesktopServices>
27#include <QDir>
28#include <QDirIterator>
29#include <QElapsedTimer>
30#include <QEventLoop>
31#include <QFile>
32#include <QFileDialog>
33#include <QFuture>
34#include <QMainWindow>
35#include <QMap>
36#include <QMessageBox>
37#include <QMetaType>
38#include <QNetworkAccessManager>
39#include <QNetworkReply>
40#include <QNetworkRequest>
41#include <QPainter>
42#include <QResizeEvent>
43#include <QScrollArea>
44#include <QScrollBar>
45#include <QSettings>
46#include <QString>
47#include <QStyleFactory>
48#include <QTableWidget>
49#include <QTableWidgetItem>
50#include <QTimer>
51#include <QUrl>
52#include <QWidget>
53#include <QtConcurrent/QtConcurrentRun>
54#include "autolevel.h"
55#include "data.h"
56#include "opencv2/highgui/highgui.hpp"
57#include "opencv2/imgproc/imgproc.hpp"
58#include "replay.h"
59#include "tracking.h"
60#include "videoreader.h"
61
62using namespace std;
63using namespace cv;
64
65namespace Ui {
66class Interactive;
67}
68
69class Interactive : public QMainWindow {
70 Q_OBJECT
71
72 public:
73 explicit Interactive(QWidget *parent = nullptr);
75
76 private slots:
77 void openFolder();
78
79 void display(int index, int scale = 0);
80 void display(const QImage &image);
81 void display(const UMat &image);
82
83 void zoomIn();
84 void zoomOut();
85
86 void getParameters();
87
88 void previewTracking();
89 void track();
90
91 void computeBackground();
92 void selectBackground();
93
94 bool eventFilter(QObject *target, QEvent *event);
95 void crop();
96 void reset();
97
98 void saveSettings();
99 void loadParameters(QString path);
100 void level();
101
102 private:
103 Ui::Interactive *ui;
104 int currentLayout;
105 QLabel *counterLabel;
106 QAction *replayAction;
107 QString memoryDir;
111 QMap<QString, QString> parameters;
112 QString path;
114 QString dir;
118 QPair<QPoint, QPoint> clicks;
119 QPointF panReferenceClick;
120 QPointF zoomReferencePosition;
121 Rect roi;
122 QPixmap resizedPix;
123 vector<Point3i> colorMap;
124 double currentZoom;
125 Replay *replay;
126 VideoReader *video;
127 bool videoStatus;
128
129 QString style;
130 QString color;
131 int layout;
132 bool isExpert;
134 signals:
135 void message(QString message);
136 void log(QMap<QString, QString> log);
137 void status(QString messsage);
138 void modeChanged(bool isSimple);
139};
140#endif // INTERACTIVE_H
The Interactive widget provides an environment to use the tracking widget in an interactive environme...
Definition: interactive.h:69
QMap< QString, QString > parameters
Definition: interactive.h:111
void loadParameters(QString path)
Reads a parameter file, updates parameters.
Definition: interactive.cpp:1187
void reset()
Resets the region of interest. Triggered by the reset button.
Definition: interactive.cpp:1107
void zoomOut()
Zooms out the display.
Definition: interactive.cpp:708
void previewTracking()
Does a tracing analysis on a sub-part of the image sequence defined by the user. Triggered when previ...
Definition: interactive.cpp:854
QSize cropedImageSize
Definition: interactive.h:110
~Interactive()
Destructors.
Definition: interactive.cpp:1131
void selectBackground()
Opens a dialogue to select a background image. Triggered when ui->backgroundSelectButton is pressed.
Definition: interactive.cpp:790
void saveSettings()
Saves the settings.
Definition: interactive.cpp:1141
Tracking * tracking
Definition: interactive.h:115
void zoomIn()
Zooms in the display.
Definition: interactive.cpp:693
Interactive(QWidget *parent=nullptr)
Constructs the interactive object derived from a QMainWindow object.
Definition: interactive.cpp:41
void computeBackground()
Computes and displays the background image in the display. Triggered when the backgroundComputeButton...
Definition: interactive.cpp:746
QString backgroundPath
Definition: interactive.h:113
UMat background
Definition: interactive.h:116
QSize originalImageSize
Definition: interactive.h:109
void level()
Level the parameters.
Definition: interactive.cpp:1152
void track()
Does a tracking analysis. Triggered when the trackButton is clicked.
Definition: interactive.cpp:903
QSize resizedFrame
Definition: interactive.h:108
bool isBackground
Definition: interactive.h:117
void crop()
Crops the image from a rectangle drawed by the user with the mouse on the display....
Definition: interactive.cpp:1072
void display(int index, int scale=0)
Displays the image at index in the image sequence in the ui.
Definition: interactive.cpp:614
QString dir
Definition: interactive.h:114
QString memoryDir
Definition: interactive.h:107
bool isExpert
Definition: interactive.h:132
void openFolder()
Asks the path to a folder where an image sequence is stored. Setups the ui and resets the class attri...
Definition: interactive.cpp:515
void getParameters()
Gets all the tracking parameters from the ui and updates the parameter map that will be passed to the...
Definition: interactive.cpp:825
bool eventFilter(QObject *target, QEvent *event)
Manages all the mouse inputs in the display.
Definition: interactive.cpp:965
Definition: replay.h:73
This class is intended to execute a tracking analysis on an image sequence. It is initialized with th...
Definition: tracking.h:60
This class is intended to abstract the opening of a video, it can load image sequence and video with ...
Definition: videoreader.h:34