LiveFit
Track and plot projectiles for in-class demonstration
TrackingBall.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 TRACKINGBALL_HPP
21 #define TRACKINGBALL_HPP
22 
23 #include <opencv2/core.hpp>
24 
25 #include <QPoint>
26 
31 {
33  cv::Mat mMeasVec;
35  cv::Point2f mCenter;
37  float mRadius;
39  cv::Rect mRect;
40 
41 public:
43  TrackingBall();
45  TrackingBall(std::vector<cv::Point> contour);
46 
48  cv::Mat getMeas() const;
49 
51  double x() const;
53  double y() const;
55  double width() const;
57  double height() const;
59  double r() const;
60 
62  QPoint center() const;
64  QPoint tl() const;
65 
67  cv::Rect rect() const;
68 };
69 
70 #endif // TRACKINGBALL_HPP
QPoint center() const
Get the center of the ball mass.
Definition: TrackingBall.cpp:77
cv::Rect rect() const
Get the bounding rect for the ball.
Definition: TrackingBall.cpp:28
cv::Mat getMeas() const
Get the measurement vector.
Definition: TrackingBall.cpp:47
double r() const
Get the radius of the bounding circle.
Definition: TrackingBall.cpp:72
TrackingBall()
Construct an empty TrackingBall.
Definition: TrackingBall.cpp:24
cv::Mat mMeasVec
The measurement vector (KF spotting input)
Definition: TrackingBall.hpp:33
float mRadius
The radius of the ball mass.
Definition: TrackingBall.hpp:37
A ball which has been tracked by the software.
Definition: TrackingBall.hpp:30
double y() const
Get the y coordinate of the center.
Definition: TrackingBall.cpp:57
cv::Point2f mCenter
The center of the ball mass.
Definition: TrackingBall.hpp:35
QPoint tl() const
Top left corner of the bounding rect.
Definition: TrackingBall.cpp:82
double x() const
Get the x coordinate of the center.
Definition: TrackingBall.cpp:52
cv::Rect mRect
A Rect which encompasses the ball mass.
Definition: TrackingBall.hpp:39
double width() const
Get the width of the bounding rect.
Definition: TrackingBall.cpp:62
double height() const
Get the height of the bounding rect.
Definition: TrackingBall.cpp:67