FastTrack 6.1.0
Tracks multiples objects dealing with occlusion and identities.
Loading...
Searching...
No Matches
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 <QActionGroup>
26#include <QDateTime>
27#include <QDesktopServices>
28#include <QDir>
29#include <QDirIterator>
30#include <QElapsedTimer>
31#include <QEventLoop>
32#include <QFile>
33#include <QFileDialog>
34#include <QFuture>
35#include <QFutureWatcher>
36#include <QHash>
37#include <QMainWindow>
38#include <QMessageBox>
39#include <QMetaType>
40#include <QMimeData>
41#include <QNetworkAccessManager>
42#include <QNetworkReply>
43#include <QNetworkRequest>
44#include <QPainter>
45#include <QResizeEvent>
46#include <QScrollArea>
47#include <QScrollBar>
48#include <QSettings>
49#include <QSharedPointer>
50#include <QStandardPaths>
51#include <QString>
52#include <QStyleFactory>
53#include <QTableWidget>
54#include <QTableWidgetItem>
55#include <QTimer>
56#include <QUrl>
57#include <QWidget>
58#include <QtConcurrent/QtConcurrentRun>
59#include "autolevel.h"
60#include "data.h"
61#include "opencv2/highgui/highgui.hpp"
62#include "opencv2/imgproc/imgproc.hpp"
63#include "replay.h"
64#include "tracking.h"
65#include "videoreader.h"
66
67using namespace std;
68using namespace cv;
69
70namespace Ui {
71class Interactive;
72}
73
74class Interactive : public QMainWindow {
75 Q_OBJECT
76
77 public:
78 explicit Interactive(QWidget *parent = nullptr);
79 Interactive(const Interactive &T) = delete;
80 Interactive &operator=(const Interactive &T) = delete;
81 Interactive &operator=(Interactive &&T) = delete;
82 Interactive(Interactive &&T) = delete;
84
85 private slots:
86 void openFolder(QString path = QString());
87
88 void display(int index, int scale = 0);
89 void display(const QImage &image);
90 void display(const cv::UMat &image, QImage::Format format = QImage::Format_RGB888);
91
92 void getParameters();
93
94 void previewTracking();
95 void track();
96
97 void computeBackground();
98 void selectBackground();
99
100 bool eventFilter(QObject *target, QEvent *event) override;
101 void crop();
102 void reset();
103
104 void saveSettings();
105 void loadParameters(const QString &path);
106 void level();
107
108 private:
109 Ui::Interactive *ui;
110 QLabel *counterLabel;
111 QAction *replayAction;
112 QString memoryDir;
115 QHash<QString, QString> parameters;
116 QString path;
118 QString dir;
122 QPair<QPointF, QPointF> clicks;
123 Rect roi;
124 QPixmap resizedPix;
125 vector<Point3i> colorMap;
126 VideoReader *video;
127 Replay *replay;
128 bool videoStatus;
129
130 QString style;
131 QString color;
132 bool isExpert;
133 QSettings *settingsFile;
134
135 protected:
136 void dropEvent(QDropEvent *dropEvent) override;
137 void dragEnterEvent(QDragEnterEvent *event) override;
138
139 signals:
140 void message(QString message);
141 void log(QHash<QString, QString> log);
142 void status(QString messsage);
143 void modeChanged(bool isSimple);
144};
145#endif // INTERACTIVE_H
void openFolder(QString path=QString())
Asks the path to a folder where an image sequence is stored. Setups the ui and resets the class attri...
Definition interactive.cpp:466
void reset()
Resets the region of interest. Triggered by the reset button.
Definition interactive.cpp:1031
void previewTracking()
Does a tracking analysis on a sub-part of the image sequence defined by the user. Triggered when prev...
Definition interactive.cpp:824
QSize cropedImageSize
Definition interactive.h:114
bool eventFilter(QObject *target, QEvent *event) override
Manages all the mouse inputs in the display.
Definition interactive.cpp:937
~Interactive()
Destructors.
Definition interactive.cpp:1057
void selectBackground()
Opens a dialogue to select a background image. Triggered when ui->backgroundSelectButton is pressed.
Definition interactive.cpp:757
void saveSettings()
Saves the settings.
Definition interactive.cpp:1067
Tracking * tracking
Definition interactive.h:119
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:681
QString backgroundPath
Definition interactive.h:117
UMat background
Definition interactive.h:120
QSize originalImageSize
Definition interactive.h:113
void level()
Level the parameters.
Definition interactive.cpp:1077
QHash< QString, QString > parameters
Definition interactive.h:115
void track()
Does a tracking analysis. Triggered when the trackButton is clicked.
Definition interactive.cpp:874
void loadParameters(const QString &path)
Reads a parameter file, updates parameters.
Definition interactive.cpp:1120
void dragEnterEvent(QDragEnterEvent *event) override
Accepts all the drag enter event.
Definition interactive.cpp:1174
bool isBackground
Definition interactive.h:121
void crop()
Crops the image from a rectangle drawed by the user with the mouse on the display....
Definition interactive.cpp:993
void display(int index, int scale=0)
Displays the image at index in the image sequence in the ui.
Definition interactive.cpp:576
QString dir
Definition interactive.h:118
void dropEvent(QDropEvent *dropEvent) override
Gets drop events that have url and try to open the file.
Definition interactive.cpp:1163
QString memoryDir
Definition interactive.h:112
bool isExpert
Definition interactive.h:132
void getParameters()
Gets all the tracking parameters from the ui and updates the parameter map that will be passed to the...
Definition interactive.cpp:795
Definition replay.h:72
This class is intended to execute a tracking analysis on an image sequence. It is initialized with th...
Definition tracking.h:63
This class is intended to abstract the opening of a video, it can load image sequence and video with ...
Definition videoreader.h:36