LiveFit
Track and plot projectiles for in-class demonstration
KFPrediction.hpp
1 /*
2  * LiveFit
3  * Copyright (C) 2016 The University of Georgia
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef KFPREDICTION_HPP
21 #define KFPREDICTION_HPP
22 
23 #include <opencv2/core.hpp>
24 
25 #include <QPoint>
26 #include <QRect>
27 
35 {
37  QRectF mBbox;
39  QPointF mJet;
40 
42  double mT;
44  double mDt;
46  bool mSeen;
47 
49  double mConfidence;
50 
51 public:
52  KFPrediction();
61  explicit KFPrediction(cv::Mat kfStatePre, cv::Mat kfCov, double t, double dt, bool seen);
63  KFPrediction(const KFPrediction &k);
64 
66  QRectF bbox() const { return mBbox; }
68  QPointF jet() const { return mJet; }
70  double dt() const { return mDt; }
72  double t() const {return mT; }
74  bool seen() const { return mSeen; }
76  double confidence() const { return mConfidence; }
77 
79  void setCenter(QPointF pos) { mBbox.moveCenter(pos); }
80 
82  void setTopLeft(QPointF pos) { mBbox.setTopLeft(pos); }
84  void setBottomRight(QPointF pos) { mBbox.setBottomRight(pos); }
85 };
86 
87 #endif // KFPREDICTION_HPP
QRectF bbox() const
Get the bounding box.
Definition: KFPrediction.hpp:66
QPointF mJet
<dx/dt, dy/dt> vector
Definition: KFPrediction.hpp:39
QPointF jet() const
Get the jet.
Definition: KFPrediction.hpp:68
double dt() const
Get the timestep change.
Definition: KFPrediction.hpp:70
double t() const
Get the time of prediction.
Definition: KFPrediction.hpp:72
double mDt
Change in time from step prior to detection.
Definition: KFPrediction.hpp:44
void setCenter(QPointF pos)
Set the center of the bounding box of this prediction.
Definition: KFPrediction.hpp:79
bool mSeen
Whether this prediction is based on a track or not.
Definition: KFPrediction.hpp:46
double mConfidence
Measure of confidence; KF distance to expected location.
Definition: KFPrediction.hpp:49
void setTopLeft(QPointF pos)
Set the top left of the bounding box.
Definition: KFPrediction.hpp:82
void setBottomRight(QPointF pos)
Set the bottom right of the bounding box.
Definition: KFPrediction.hpp:84
Object which represents a prediction from the Kalman filter.
Definition: KFPrediction.hpp:34
bool seen() const
Get whether the ball was seen.
Definition: KFPrediction.hpp:74
double confidence() const
Get the confidence of this prediction.
Definition: KFPrediction.hpp:76
QRectF mBbox
Bounding box of this prediction.
Definition: KFPrediction.hpp:37
double mT
Time at which this prediction was recorded.
Definition: KFPrediction.hpp:42