-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrackVideoWidget.hpp
97 lines (82 loc) · 3.08 KB
/
TrackVideoWidget.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
* LiveFit
* Copyright (C) 2016 The University of Georgia
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef TRACKVIDEOWIDGET_H
#define TRACKVIDEOWIDGET_H
#define UL_CORNER 0
#define BL_CORNER 1
#define BR_CORNER 2
#define UR_CORNER 3
#include "KFPrediction.hpp"
#include "TrackingBall.hpp"
#include "ui_TrackVideoWidget.h"
#include <opencv2/core.hpp>
#include <QWidget>
/**
* @brief Displays a video stream and tracking data.
*
* Allows manipulation of
* projector corners (where they should be in frame)
*/
class TrackVideoWidget : public QWidget
{
Q_OBJECT
/** A list of raw ball contour data in the frame */
QList<TrackingBall> mBalls;
/** A list of KF prediction data in the frame */
QList<KFPrediction> mPreds;
public:
explicit TrackVideoWidget(QWidget *parent = 0);
/** Refresh the corners (ie send signal that corners changed to listeners) */
void updateCorners();
/** Return the list of projector corners in image coordinates */
QList<QPoint> getCorners();
signals:
/** Signal sent whenever the widget is resized */
void resized(QSize size);
/** Signal sent whenever the corners of the projector in frame change */
void cornersChanged(std::vector<cv::Point2f>);
public slots:
/** Set the current display image of the widget to image */
void setImage(const QImage &image);
/** Set all 4 corners of the projector screen (in-frame coordinates) */
void setCorners(QList<QPoint> corners);
/** Called when the UL corner widget is dropped at point */
void ulCornerDropped(QPoint point);
/** Called when the BL corner widget is dropped at point */
void blCornerDropped(QPoint point);
/** Called when the BR corner widget is dropped at point */
void brCornerDropped(QPoint point);
/** Called when the UR corner widget is dropped at point */
void urCornerDropped(QPoint point);
/** Push the TrackingBall ball to the list of balls */
void pushBall(TrackingBall ball);
/** Push the KFPrediction pred to the list of predictions */
void pushPred(KFPrediction pred);
protected:
/** Called on paint event; drawing logic goes here (Draw frame, points, etc) */
void paintEvent(QPaintEvent* event);
/** Called on resize event; */
void resizeEvent(QResizeEvent *event);
private:
/** UI data edited in QDesigner; see TrackVideoWidget.ui */
Ui::trackVideoWidget ui;
/** Current video frame to be displayed by widget */
QImage currentFrame;
};
#endif // TRACKVIDEOWIDGET_HPP