-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKFPrediction.hpp
87 lines (76 loc) · 2.75 KB
/
KFPrediction.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
/*
* 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 KFPREDICTION_HPP
#define KFPREDICTION_HPP
#include <opencv2/core.hpp>
#include <QPoint>
#include <QRect>
/**
* @brief Object which represents a prediction from the Kalman filter.
*
* Essentially decorates state data, but also holds onto the dT
* from the previous timestep
*/
class KFPrediction
{
/** Bounding box of this prediction */
QRectF mBbox;
/** <dx/dt, dy/dt> vector */
QPointF mJet;
/** Time at which this prediction was recorded */
double mT;
/** Change in time from step prior to detection */
double mDt;
/** Whether this prediction is based on a track or not */
bool mSeen;
/** Measure of confidence; KF distance to expected location */
double mConfidence;
public:
KFPrediction();
/**
* @brief Create a KFPrediction from prediction data
* @param kfStatePre KF Predicted state
* @param kfCov KF Covariance matrix
* @param t Current time state at prediction
* @param dt Previous change in time between states
* @param seen Whether the ball was spotted or not
*/
explicit KFPrediction(cv::Mat kfStatePre, cv::Mat kfCov, double t, double dt, bool seen);
/** Copy constructor */
KFPrediction(const KFPrediction &k);
/** Get the bounding box */
QRectF bbox() const { return mBbox; }
/** Get the jet */
QPointF jet() const { return mJet; }
/** Get the timestep change */
double dt() const { return mDt; }
/** Get the time of prediction */
double t() const {return mT; }
/** Get whether the ball was seen */
bool seen() const { return mSeen; }
/** Get the confidence of this prediction */
double confidence() const { return mConfidence; }
/** Set the center of the bounding box of this prediction */
void setCenter(QPointF pos) { mBbox.moveCenter(pos); }
/** Set the top left of the bounding box */
void setTopLeft(QPointF pos) { mBbox.setTopLeft(pos); }
/** Set the bottom right of the bounding box */
void setBottomRight(QPointF pos) { mBbox.setBottomRight(pos); }
};
#endif // KFPREDICTION_HPP