20 #ifndef KFBALLTRACKER_HPP 21 #define KFBALLTRACKER_HPP 23 #include "BallTrackingFilter.hpp" 24 #include "ColorSpace.hpp" 25 #include "KFPrediction.hpp" 26 #include "KalmanFilterPlus.hpp" 27 #include "PersonTrackingFilter.hpp" 28 #include "TrackingBall.hpp" 34 #include <opencv2/core.hpp> 35 #include <opencv2/video/tracking.hpp> 37 #define SETT_DEF_BLOB_BLUR 3.0 38 #define SETT_DEF_BLOB_THRESH 4.0 39 #define SETT_DEF_BLOB_MINRAD 2.0 40 #define SETT_DEF_BLOB_MAXRAD 20.0 41 #define SETT_DEF_BLOB_GRAV 470.0 124 void threshReady(
const cv::Mat &,
enum ColorSpace);
128 void blurReady(
const cv::Mat &,
enum ColorSpace);
140 QMap<double, TrackingBall>
findBalls(cv::Mat &frame, QList<cv::Rect> ignores);
142 QMap<double, TrackingBall>
findMovementThresh(cv::Mat threshDiff, QList<cv::Rect> ignores);
161 #endif // KFBALLTRACKER_HPP void updateTrackSuccess(TrackingBall ball)
Called to alert that we found ball ball in this frame.
Definition: KFBallTracker.cpp:179
void contourReady(const cv::Mat &, enum ColorSpace)
Emitted when a contour image is ready to be converted.
QMap< double, TrackingBall > findBalls(cv::Mat &frame, QList< cv::Rect > ignores)
Find balls in a frame, ignoring the region ignores.
Definition: KFBallTracker.cpp:192
QVector< cv::Mat > mFrameHistory
History of frames possibly used for tracking (eg 3-way-diff)
Definition: KFBallTracker.hpp:65
A TrackingFilter which contains the necessary logic to find people in frames.
Definition: PersonTrackingFilter.hpp:29
void blurReady(const cv::Mat &, enum ColorSpace)
Emitted when a blur image is ready to be converted.
void setGravConstant(double g)
Set the acceleration due to gravity of the mBallFilter.
Definition: KFBallTracker.hpp:110
A TrackingFilter with some specifics for tracking a ball in flight.
Definition: BallTrackingFilter.hpp:45
void setClipShape(QPolygonF shape)
Set the clipping shape for tracking.
Definition: KFBallTracker.cpp:72
void setXYCovariance(double sigma)
Set the covariance of x and y values of ball for KF.
Definition: KFBallTracker.cpp:67
QMap< double, TrackingBall > findMovementThresh(cv::Mat threshDiff, QList< cv::Rect > ignores)
Find any movement in a thresholded image, ignoring the region ignores.
Definition: KFBallTracker.cpp:114
KFBallTracker(QObject *parent=0)
Default constructor.
Definition: KFBallTracker.cpp:32
double kalmanDistance(cv::Mat measurement)
Kalman distance; see BallFilter.kalmanDistance(); unused.
void updateTrackFailure()
Called to alert that we did not find a ball in this frame.
Definition: KFBallTracker.cpp:165
double scoreContour(TrackingBall ball, cv::Mat &threshDiff)
Given a TrackingBall ball in threshDiff, score its likelihood to be our tracking ball.
Definition: KFBallTracker.cpp:62
double mMaxRadius
Maximum radius of blobs to consider.
Definition: KFBallTracker.hpp:77
void setMaxRadius(double radius)
Set mMaxRadius.
Definition: KFBallTracker.hpp:104
bool mClipTrack
Whether to only consider blobs in mClipShape.
Definition: KFBallTracker.hpp:82
void updateTimeState(double t)
Update the internal time state of the tracker.
Definition: KFBallTracker.cpp:187
BallTrackingFilter mBallFilter
Tracking filter for ball objects in the frame.
Definition: KFBallTracker.hpp:60
double mThreshVal
Minimum white value for the thresholding step.
Definition: KFBallTracker.hpp:72
double mBlurSize
Strength of the Gaussian blur in the blur step of preprocessing.
Definition: KFBallTracker.hpp:70
int mBlobRad
Unused.
Definition: KFBallTracker.hpp:55
void setGravConstant(double gravConstant)
Set the acceleration due to gravity.
Definition: BallTrackingFilter.cpp:23
void ballSpotted(TrackingBall)
Emit a TrackingBall when a ball is spotted in the frame.
void threshReady(const cv::Mat &, enum ColorSpace)
Emitted when a thresh image is ready to be converted.
bool ballFound()
Whether we currently are tracking a found ball.
void setMinRadius(double radius)
Set mMinRadius.
Definition: KFBallTracker.hpp:102
A ball which has been tracked by the software.
Definition: TrackingBall.hpp:30
Contains most of the logic for live-tracking objects.
Definition: KFBallTracker.hpp:50
Object which represents a prediction from the Kalman filter.
Definition: KFPrediction.hpp:34
int mLatency
Unused.
Definition: KFBallTracker.hpp:57
void personSpotted(QRect)
Emitted when a person is spotted; unused.
QList< cv::Rect > findPeople(cv::Mat &frame)
Find people in a frame; unused.
Definition: KFBallTracker.cpp:82
bool ballIsLost()
Whether the ball is currently lost.
QMap< double, TrackingBall > processNextFrame(cv::Mat &frame, int t)
Process the next frame, possibly finding balls and updating state.
Definition: KFBallTracker.cpp:43
void ballPredicted(KFPrediction)
Emit a KFPrediction when the KF makes a prediction about the ball location.
void updateFrameState(cv::Mat *frame)
Update the internal state of the frame.
double mMinRadius
Minimum radius of blobs to consider.
Definition: KFBallTracker.hpp:75
void setBlurSize(double blurSize)
Set mBlurSize.
Definition: KFBallTracker.hpp:97
void toggleClip(bool clip)
Set whether we should clip tracking.
Definition: KFBallTracker.cpp:77
PersonTrackingFilter mPersonFilter
Tracking filter for people in the frame (to ignore!); unused.
Definition: KFBallTracker.hpp:62
void ballLost()
Emitted when the ball is lost.
void setThreshVal(double thresh)
Set mThreshVal.
Definition: KFBallTracker.hpp:99
cv::Mat mOldDiff
Previous frame diff of history (stored to avoid a duplicate diff)
Definition: KFBallTracker.hpp:67
QPolygonF mClipShape
If mClipTrack, only consider blobs within this polygon.
Definition: KFBallTracker.hpp:80