KINECT STATS GENERATOR FOR SPORTS VISUALISATION  1.0
PlayerData Class Reference

Statistics container specific to players. More...

#include <PlayerData.h>

+ Collaboration diagram for PlayerData:

List of all members.

Public Member Functions

 PlayerData ()
 constructor
 ~PlayerData ()
 dtor
void setPlayerBallPts (std::vector< std::vector< cv::Point3f > > &_inputPointSetsInWorld)
 sets player specific tracked points
void setPlayerImpactPtIndices (std::vector< std::vector< int > > &_inputDepthIndices)
 sets player depth index lookup values for tracked points
void setPlayerDataProcessedFlag ()
 flag set to inform vz windows that processing has finished
std::vector< cv::Point > & getPlayerImpactPtsAllRallies ()
 returns all impact points in rally specific vectors
std::vector< std::vector
< cv::Point3f > > & 
getPlayerBallPtsAll ()
 returns all tracked points for the player
std::vector< std::vector< int > > & getPlayerImpactPtIndices ()
 returns all depth index value for current player
float getPercentageDistributionData (int _width, int _height, WHICH_QUADRANT _whichQuadrant)
 returns percentage data
std::vector< cv::Point > & getQuadSpecificPoints (WHICH_QUADRANT _whichQuad)
 returns court specific points
std::vector< cv::Point3f > & getBarGraphVertices (cv::Point _inputTopXY, int _width, int _height, int _gridResolution)
 returns all height graph vertices
std::vector< std::vector
< cv::Point3f > > & 
getPlayerInterpolatedBallPtsAll (float _inputDistanceFrmKinectToPlayArea)
 returns all points of trajectory interpolation
std::vector< cv::Point3f > & getPlayerImpactPtsIn3DAllRallies ()
 returns all impact points in rally specific vectors in World Coordinates
std::vector< float > & getPlayerSpeedData (float _inputDistanceFrmKinectToPlayArea)
 returns all speed points
std::vector< float > & getRevolutionsPerMinute (float _inputDiameterInMeters, float _inputDistanceFrmKinectToPlayArea)
 returns all rpm points
bool checkDataProcessed ()
 returns true if data processed

Private Member Functions

void calculatePlayerImpactPtsFromIndices ()
 calculates the actual player impact points from the available data and the indices this will be called by all the stats modules when needed

Private Attributes

TwoDStatsGenerationm_twoDStatsGenerator
 2D statistics utility instance
ThreeDStatsGenerationm_threeDStatsGenerator
 3D statistics utility instance
bool m_dataProcessed
 data processed flag checked by the stats window often to see if data has been processed by the procecssing utility so that stats window can then query player's impact points and draws it this flag will be set by the processing utility once data is being filled into each player's vector attirbutes ballpts and deepestptindices
std::vector< std::vector
< cv::Point3f > > 
m_playerBallPts
 a multidimensional vector to store sets of balls points against sets of rallies
std::vector< std::vector< int > > m_playerDeepestPtIndices
 a multidimensional vector to store sets of deepest point/impact point indices against sets of corresponding rallies
std::vector< cv::Point > m_playerImpactPtsAllRallies
 depth points in pixels
std::vector< cv::Point3f > m_playerImpactPtsAllRalliesIn3D
 depth points in 3D
float m_bottomLeftPercentage
 percentage distribution data from bottom left clockwise
float m_topLeftPercentage
float m_topRightPercentage
float m_bottomRightPercentage
std::vector< cv::Point > m_playerImpactPtsBottomLeft
 quad specific data points
std::vector< cv::Point > m_playerImpactPtsTopLeft
std::vector< cv::Point > m_playerImpactPtsTopRight
std::vector< cv::Point > m_playerImpactPtsBottomRight
std::vector< cv::Point3f > m_barGraphVertices
 ht graph vertices
std::vector< std::vector
< cv::Point3f > > 
m_playerInterpolatedBallPts
 a multidimensional vector to store sets of INTERPOLATED BALL POINTS against rallies...as this is interpolated data it would be in ascending order within specific sets sets here means, we classify each set based on the impact points
std::vector< float > m_speedData
 vector holding the velocity data at the impact points
std::vector< float > m_rpmData
 vector holding the rpm data at the impact points

Detailed Description

Statistics container specific to players.

Definition at line 31 of file PlayerData.h.


Constructor & Destructor Documentation


Member Function Documentation

calculates the actual player impact points from the available data and the indices this will be called by all the stats modules when needed

returns true if data processed

Definition at line 301 of file PlayerData.cpp.

References m_dataProcessed.

{
    return m_dataProcessed;
}

+ Here is the caller graph for this function:

std::vector< cv::Point3f > & PlayerData::getBarGraphVertices ( cv::Point  _inputTopXY,
int  _width,
int  _height,
int  _gridResolution 
)

returns all height graph vertices

Definition at line 182 of file PlayerData.cpp.

References TwoDStatsGeneration::calculatePlayerImpactPtsFromIndices(), ThreeDStatsGeneration::generatePitchDensityGraphData(), m_barGraphVertices, m_playerBallPts, m_playerDeepestPtIndices, m_playerImpactPtsAllRallies, m_threeDStatsGenerator, and m_twoDStatsGenerator.

{

    if(m_barGraphVertices.size() != 0)
    {
        return m_barGraphVertices;
    }

    else
    {
        // call calculate if rally points empty
        if(m_playerImpactPtsAllRallies.size() == 0)
        {

            //calculatePlayerImpactPtsFromIndices();

            m_twoDStatsGenerator->calculatePlayerImpactPtsFromIndices(m_playerBallPts,m_playerDeepestPtIndices,
                                                                      m_playerImpactPtsAllRallies);
        }

        m_threeDStatsGenerator->generatePitchDensityGraphData(_inputTopXY,_width,_height,_gridResolution,m_playerImpactPtsAllRallies,
                                                              m_barGraphVertices);

        return m_barGraphVertices;
    }
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float PlayerData::getPercentageDistributionData ( int  _width,
int  _height,
WHICH_QUADRANT  _whichQuadrant 
)

returns percentage data

Definition at line 104 of file PlayerData.cpp.

References ALL, BOTTOM_LEFT, BOTTOM_RIGHT, TwoDStatsGeneration::calculatePlayerImpactPtsFromIndices(), TwoDStatsGeneration::generatePercentageDistribution(), m_bottomLeftPercentage, m_bottomRightPercentage, m_playerBallPts, m_playerDeepestPtIndices, m_playerImpactPtsAllRallies, m_playerImpactPtsBottomLeft, m_playerImpactPtsBottomRight, m_playerImpactPtsTopLeft, m_playerImpactPtsTopRight, m_topLeftPercentage, m_topRightPercentage, m_twoDStatsGenerator, TOP_LEFT, and TOP_RIGHT.

{

    float tempPercentage = 0.0;

    // call calculate if rally points empty

    if(m_playerImpactPtsAllRallies.size() == 0)
    {

        //calculatePlayerImpactPtsFromIndices();

        m_twoDStatsGenerator->calculatePlayerImpactPtsFromIndices(m_playerBallPts,m_playerDeepestPtIndices,
                                                                  m_playerImpactPtsAllRallies);
    }

    switch(_whichQuadrant)
    {
        case BOTTOM_LEFT:
        {
            m_twoDStatsGenerator->generatePercentageDistribution(_width,_height,m_playerImpactPtsAllRallies,BOTTOM_LEFT,
                                                                 m_playerImpactPtsBottomLeft,m_bottomLeftPercentage);
            tempPercentage = m_bottomLeftPercentage;
            break;
        }
        case TOP_LEFT:
        {
            m_twoDStatsGenerator->generatePercentageDistribution(_width,_height,m_playerImpactPtsAllRallies,TOP_LEFT,
                                                                m_playerImpactPtsTopLeft,m_topLeftPercentage);
            tempPercentage = m_topLeftPercentage;
            break;
        }
        case TOP_RIGHT:
        {
            m_twoDStatsGenerator->generatePercentageDistribution(_width,_height,m_playerImpactPtsAllRallies,TOP_RIGHT,
                                                                m_playerImpactPtsTopRight,m_topRightPercentage);
            tempPercentage = m_topRightPercentage;
            break;
        }
        case BOTTOM_RIGHT:
        {
            m_twoDStatsGenerator->generatePercentageDistribution(_width,_height,m_playerImpactPtsAllRallies,BOTTOM_RIGHT,
                                                                m_playerImpactPtsBottomRight,m_bottomRightPercentage);
            tempPercentage = m_bottomRightPercentage;
            break;
        }
        case ALL:
        {
            // in case data is needed for all quads, caller has to call this function 4 times
            // and save the returning floats separately
            break;
        }
    }

    return tempPercentage;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< std::vector< cv::Point3f > > & PlayerData::getPlayerBallPtsAll ( )

returns all tracked points for the player

Definition at line 67 of file PlayerData.cpp.

References m_playerBallPts.

{
    return m_playerBallPts;
}

+ Here is the caller graph for this function:

std::vector< std::vector< int > > & PlayerData::getPlayerImpactPtIndices ( )

returns all depth index value for current player

Definition at line 72 of file PlayerData.cpp.

References m_playerDeepestPtIndices.

std::vector< cv::Point > & PlayerData::getPlayerImpactPtsAllRallies ( )

returns all impact points in rally specific vectors

Definition at line 77 of file PlayerData.cpp.

References TwoDStatsGeneration::calculatePlayerImpactPtsFromIndices(), m_playerBallPts, m_playerDeepestPtIndices, m_playerImpactPtsAllRallies, and m_twoDStatsGenerator.

{
    // we first check if we have already calculated impact points, if so return,
    // else calculate it now
    if(m_playerImpactPtsAllRallies.size() != 0)
    {
        return m_playerImpactPtsAllRallies;
    }
    else
    {
        //calculatePlayerImpactPtsFromIndices();

        m_twoDStatsGenerator->calculatePlayerImpactPtsFromIndices(m_playerBallPts,m_playerDeepestPtIndices,
                                                                  m_playerImpactPtsAllRallies);
        return m_playerImpactPtsAllRallies;
    }
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< cv::Point3f > & PlayerData::getPlayerImpactPtsIn3DAllRallies ( )

returns all impact points in rally specific vectors in World Coordinates

Definition at line 248 of file PlayerData.cpp.

References ThreeDStatsGeneration::calculatePlayerImpactPtsIn3DFromIndices(), m_playerBallPts, m_playerDeepestPtIndices, m_playerImpactPtsAllRalliesIn3D, and m_threeDStatsGenerator.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< std::vector< cv::Point3f > > & PlayerData::getPlayerInterpolatedBallPtsAll ( float  _inputDistanceFrmKinectToPlayArea)

returns all points of trajectory interpolation

Definition at line 210 of file PlayerData.cpp.

References ThreeDStatsGeneration::generateInterpolatedDataForAllRallies(), m_playerBallPts, m_playerDeepestPtIndices, m_playerInterpolatedBallPts, m_speedData, and m_threeDStatsGenerator.

{
    if(m_playerInterpolatedBallPts.size() != 0)
    {
        return m_playerInterpolatedBallPts;
    }
    else
    {
        m_threeDStatsGenerator->generateInterpolatedDataForAllRallies(m_playerBallPts,m_playerDeepestPtIndices,
                                                                      _inputDistanceFrmKinectToPlayArea,
                                                                      m_playerInterpolatedBallPts,m_speedData);

       // m_threeDStatsGenerator->generateInterpolatedDataForAllRalliesWithoutImpact(m_playerBallPts,m_playerInterpolatedBallPts);

        return m_playerInterpolatedBallPts;
    }
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< float > & PlayerData::getPlayerSpeedData ( float  _inputDistanceFrmKinectToPlayArea)

returns all speed points

Definition at line 229 of file PlayerData.cpp.

References ThreeDStatsGeneration::generateInterpolatedDataForAllRallies(), m_playerBallPts, m_playerDeepestPtIndices, m_playerInterpolatedBallPts, m_speedData, and m_threeDStatsGenerator.

{
    // this will be available only when interpolatedballpts function is called
    // as that is where speed data is filled

    //so if interpolatedballpts vec is empty, call the getinterpballpts function
    // and then check if speed data not empty and then return the speeddata vec
    if(m_playerInterpolatedBallPts.size() == 0)
    {
        m_threeDStatsGenerator->generateInterpolatedDataForAllRallies(m_playerBallPts,m_playerDeepestPtIndices,
                                                                      _inputDistanceFrmKinectToPlayArea,
                                                                      m_playerInterpolatedBallPts,m_speedData);
    }
    //if(m_speedData.size() != 0)
    {
        return m_speedData;
    }
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< cv::Point > & PlayerData::getQuadSpecificPoints ( WHICH_QUADRANT  _whichQuad)

returns court specific points

Definition at line 161 of file PlayerData.cpp.

References BOTTOM_LEFT, BOTTOM_RIGHT, m_playerImpactPtsBottomLeft, m_playerImpactPtsBottomRight, m_playerImpactPtsTopLeft, m_playerImpactPtsTopRight, TOP_LEFT, and TOP_RIGHT.

{

    if(_whichQuad == BOTTOM_LEFT)
    {
        return m_playerImpactPtsBottomLeft;
    }
    else if(_whichQuad == TOP_LEFT)
    {
        return m_playerImpactPtsTopLeft;
    }
    else if(_whichQuad == TOP_RIGHT)
    {
        return m_playerImpactPtsTopRight;
    }
    else if(_whichQuad == BOTTOM_RIGHT)
    {
        return m_playerImpactPtsBottomRight;
    }
}

+ Here is the caller graph for this function:

std::vector< float > & PlayerData::getRevolutionsPerMinute ( float  _inputDiameterInMeters,
float  _inputDistanceFrmKinectToPlayArea 
)

returns all rpm points

Definition at line 262 of file PlayerData.cpp.

References ThreeDStatsGeneration::generateInterpolatedDataForAllRallies(), m_playerBallPts, m_playerDeepestPtIndices, m_playerInterpolatedBallPts, m_rpmData, m_speedData, and m_threeDStatsGenerator.

{

    // this make sures speed data is generated first
    // which would then feed into rpm calculations
    if(m_playerInterpolatedBallPts.size() == 0)
    {
        m_threeDStatsGenerator->generateInterpolatedDataForAllRallies(m_playerBallPts,m_playerDeepestPtIndices,
                                                                      _inputDistanceFrmKinectToPlayArea,
                                                                      m_playerInterpolatedBallPts,m_speedData);
    }

    if(m_rpmData.size() != 0)
    {
       return m_rpmData;
    }

    else
    {
        for(int i=0;i<m_speedData.size();i++)
        {
            // this produces revolutions per minute
            // input diameter and speed data are in meters scale
            float tempRPM = (m_speedData[i] * 60)/(3.14 * _inputDiameterInMeters);
            std::cout<<"repm calculated:"<<tempRPM<<"\n";
            m_rpmData.push_back(tempRPM);
        }

        return m_rpmData;
    }

}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PlayerData::setPlayerBallPts ( std::vector< std::vector< cv::Point3f > > &  _inputPointSetsInWorld)

sets player specific tracked points

Parameters:
[in]_inputPointSetsInWorldtracked pts in world coords

Definition at line 57 of file PlayerData.cpp.

References m_playerBallPts.

{
    m_playerBallPts = _inputPointSetsInWorld;
}

+ Here is the caller graph for this function:

flag set to inform vz windows that processing has finished

Definition at line 296 of file PlayerData.cpp.

References m_dataProcessed.

{
    m_dataProcessed = true;
}

+ Here is the caller graph for this function:

void PlayerData::setPlayerImpactPtIndices ( std::vector< std::vector< int > > &  _inputDepthIndices)

sets player depth index lookup values for tracked points

Parameters:
[in]_inputDepthIndicesmulti dimensional lookup table

Definition at line 62 of file PlayerData.cpp.

References m_playerDeepestPtIndices.

{
    m_playerDeepestPtIndices = _inputDepthIndices;
}

+ Here is the caller graph for this function:


Member Data Documentation

std::vector<cv::Point3f> PlayerData::m_barGraphVertices [private]

ht graph vertices

Definition at line 123 of file PlayerData.h.

percentage distribution data from bottom left clockwise

Definition at line 116 of file PlayerData.h.

Definition at line 116 of file PlayerData.h.

data processed flag checked by the stats window often to see if data has been processed by the procecssing utility so that stats window can then query player's impact points and draws it this flag will be set by the processing utility once data is being filled into each player's vector attirbutes ballpts and deepestptindices

Definition at line 101 of file PlayerData.h.

std::vector<std::vector<cv::Point3f> > PlayerData::m_playerBallPts [private]

a multidimensional vector to store sets of balls points against sets of rallies

Definition at line 104 of file PlayerData.h.

std::vector<std::vector<int> > PlayerData::m_playerDeepestPtIndices [private]

a multidimensional vector to store sets of deepest point/impact point indices against sets of corresponding rallies

Definition at line 108 of file PlayerData.h.

std::vector<cv::Point> PlayerData::m_playerImpactPtsAllRallies [private]

depth points in pixels

Definition at line 111 of file PlayerData.h.

std::vector<cv::Point3f> PlayerData::m_playerImpactPtsAllRalliesIn3D [private]

depth points in 3D

Definition at line 113 of file PlayerData.h.

std::vector<cv::Point> PlayerData::m_playerImpactPtsBottomLeft [private]

quad specific data points

Definition at line 119 of file PlayerData.h.

std::vector<cv::Point> PlayerData::m_playerImpactPtsBottomRight [private]

Definition at line 120 of file PlayerData.h.

std::vector<cv::Point> PlayerData::m_playerImpactPtsTopLeft [private]

Definition at line 119 of file PlayerData.h.

std::vector<cv::Point> PlayerData::m_playerImpactPtsTopRight [private]

Definition at line 120 of file PlayerData.h.

std::vector<std::vector<cv::Point3f> > PlayerData::m_playerInterpolatedBallPts [private]

a multidimensional vector to store sets of INTERPOLATED BALL POINTS against rallies...as this is interpolated data it would be in ascending order within specific sets sets here means, we classify each set based on the impact points

Definition at line 130 of file PlayerData.h.

std::vector<float> PlayerData::m_rpmData [private]

vector holding the rpm data at the impact points

Definition at line 137 of file PlayerData.h.

std::vector<float> PlayerData::m_speedData [private]

vector holding the velocity data at the impact points

Definition at line 134 of file PlayerData.h.

3D statistics utility instance

Definition at line 91 of file PlayerData.h.

Definition at line 116 of file PlayerData.h.

Definition at line 116 of file PlayerData.h.

2D statistics utility instance

Definition at line 89 of file PlayerData.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator