LiveFit
Track and plot projectiles for in-class demonstration
Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
KFBallTracker Class Reference

Contains most of the logic for live-tracking objects. More...

#include <KFBallTracker.hpp>

Inheritance diagram for KFBallTracker:
Inheritance graph
[legend]
Collaboration diagram for KFBallTracker:
Collaboration graph
[legend]

Public Slots

void setClipShape (QPolygonF shape)
 Set the clipping shape for tracking.
 
void toggleClip (bool clip)
 Set whether we should clip tracking.
 

Signals

void ballSpotted (TrackingBall)
 Emit a TrackingBall when a ball is spotted in the frame.
 
void ballPredicted (KFPrediction)
 Emit a KFPrediction when the KF makes a prediction about the ball location.
 
void ballLost ()
 Emitted when the ball is lost.
 
void personSpotted (QRect)
 Emitted when a person is spotted; unused.
 
void threshReady (const cv::Mat &, enum ColorSpace)
 Emitted when a thresh image is ready to be converted.
 
void contourReady (const cv::Mat &, enum ColorSpace)
 Emitted when a contour image is ready to be converted.
 
void blurReady (const cv::Mat &, enum ColorSpace)
 Emitted when a blur image is ready to be converted.
 

Public Member Functions

 KFBallTracker (QObject *parent=0)
 Default constructor.
 
QMap< double, TrackingBallprocessNextFrame (cv::Mat &frame, int t)
 Process the next frame, possibly finding balls and updating state.
 
void updateTimeState (double t)
 Update the internal time state of the tracker.
 
double kalmanDistance (cv::Mat measurement)
 Kalman distance; see BallFilter.kalmanDistance(); unused. More...
 
void setBlurSize (double blurSize)
 Set mBlurSize.
 
void setThreshVal (double thresh)
 Set mThreshVal.
 
void setMinRadius (double radius)
 Set mMinRadius.
 
void setMaxRadius (double radius)
 Set mMaxRadius.
 
void setXYCovariance (double sigma)
 Set the covariance of x and y values of ball for KF.
 
void setGravConstant (double g)
 Set the acceleration due to gravity of the mBallFilter.
 

Protected Member Functions

QList< cv::Rect > findPeople (cv::Mat &frame)
 Find people in a frame; unused. More...
 
QMap< double, TrackingBallfindBalls (cv::Mat &frame, QList< cv::Rect > ignores)
 Find balls in a frame, ignoring the region ignores.
 
QMap< double, TrackingBallfindMovementThresh (cv::Mat threshDiff, QList< cv::Rect > ignores)
 Find any movement in a thresholded image, ignoring the region ignores.
 
void updateTrackFailure ()
 Called to alert that we did not find a ball in this frame.
 
void updateTrackSuccess (TrackingBall ball)
 Called to alert that we found ball ball in this frame.
 
bool ballIsLost ()
 Whether the ball is currently lost.
 
bool ballFound ()
 Whether we currently are tracking a found ball.
 
void updateFrameState (cv::Mat *frame)
 Update the internal state of the frame.
 
double scoreContour (TrackingBall ball, cv::Mat &threshDiff)
 Given a TrackingBall ball in threshDiff, score its likelihood to be our tracking ball.
 

Private Attributes

int mBlobRad
 Unused.
 
int mLatency
 Unused.
 
BallTrackingFilter mBallFilter
 Tracking filter for ball objects in the frame.
 
PersonTrackingFilter mPersonFilter
 Tracking filter for people in the frame (to ignore!); unused.
 
QVector< cv::Mat > mFrameHistory
 History of frames possibly used for tracking (eg 3-way-diff)
 
cv::Mat mOldDiff
 Previous frame diff of history (stored to avoid a duplicate diff)
 
double mBlurSize
 Strength of the Gaussian blur in the blur step of preprocessing.
 
double mThreshVal
 Minimum white value for the thresholding step.
 
double mMinRadius
 Minimum radius of blobs to consider.
 
double mMaxRadius
 Maximum radius of blobs to consider.
 
QPolygonF mClipShape
 If mClipTrack, only consider blobs within this polygon.
 
bool mClipTrack = false
 Whether to only consider blobs in mClipShape.
 

Detailed Description

Contains most of the logic for live-tracking objects.

Recieves a frame (as cv::Mat) and uses it (and its own internal state) to identify a moving projectile ball and emit them (as TrackingBall and as KFPrediction)

Member Function Documentation

QList< cv::Rect > KFBallTracker::findPeople ( cv::Mat &  frame)
protected

Find people in a frame; unused.

double KFBallTracker::kalmanDistance ( cv::Mat  measurement)

Kalman distance; see BallFilter.kalmanDistance(); unused.


The documentation for this class was generated from the following files: