KINECT STATS GENERATOR FOR SPORTS VISUALISATION  1.0
TwoDStatsGeneration Class Reference

Generates all 2D stats for this application. More...

#include <TwoDStatsGeneration.h>

List of all members.

Public Member Functions

 TwoDStatsGeneration ()
 ctor
 ~TwoDStatsGeneration ()
 dtor
void calculatePlayerImpactPtsFromIndices (std::vector< std::vector< cv::Point3f > > &_inputPlayerBallPts, std::vector< std::vector< int > > &_playerDeepestPtIndices, std::vector< cv::Point > &o_playerImpactPtsAllRallies)
 calculates the actual player impact points from the available data and the indices this will be called by the player class whenever it needs data into impact points vector
void generatePercentageDistribution (int _widthBounds, int _heightBounds, std::vector< cv::Point > &_playerImpactPtsAllRallies, int _whichQuadrant, std::vector< cv::Point > &o_specificQuadPts, float &o_percentage)
 given sets of dimensions of the field of play, this would fill up a specific percentage value representing the the corresponding field of play percentage so one set of dimension, returning one percentage value

Detailed Description

Generates all 2D stats for this application.

Definition at line 18 of file TwoDStatsGeneration.h.


Constructor & Destructor Documentation

ctor

Definition at line 8 of file TwoDStatsGeneration.cpp.

{

}

dtor

Definition at line 13 of file TwoDStatsGeneration.cpp.

{

}

Member Function Documentation

void TwoDStatsGeneration::calculatePlayerImpactPtsFromIndices ( std::vector< std::vector< cv::Point3f > > &  _inputPlayerBallPts,
std::vector< std::vector< int > > &  _playerDeepestPtIndices,
std::vector< cv::Point > &  o_playerImpactPtsAllRallies 
)

calculates the actual player impact points from the available data and the indices this will be called by the player class whenever it needs data into impact points vector

Parameters:
[in]_inputPlayerBallPtsrepresents tracked pts
[in]_playerDeepestPtIndicesrepresents depth look up pts
[out]o_playerImpactPtsAllRalliesrepresents depth pts

Definition at line 18 of file TwoDStatsGeneration.cpp.

{
    if(_playerDeepestPtIndices.size() != 0)
    {
        for(int i = 0;i<_playerDeepestPtIndices.size();i++)
        {
            for(int j=0;j<_playerDeepestPtIndices[i].size();j++)
            {

                // if the impact point index is not -1, then there is an impact point for this rally
                if(_playerDeepestPtIndices[i][j] != -1)
                {
                    o_playerImpactPtsAllRallies.push_back(cv::Point((int)(_inputPlayerBallPts[i][_playerDeepestPtIndices[i][j]]).x,(int)(_inputPlayerBallPts[i][_playerDeepestPtIndices[i][j]]).y));
                }
                else
                {
                    std::cout<<"No impact point for Rally number:"<<i<<"..so skipping to next rally.\n";
                }

            }
        }
    }
    else
    {
        std::cout<<"No data in indices array for the player.\n";
    }
}

+ Here is the caller graph for this function:

void TwoDStatsGeneration::generatePercentageDistribution ( int  _widthBounds,
int  _heightBounds,
std::vector< cv::Point > &  _playerImpactPtsAllRallies,
int  _whichQuadrant,
std::vector< cv::Point > &  o_specificQuadPts,
float &  o_percentage 
)

given sets of dimensions of the field of play, this would fill up a specific percentage value representing the the corresponding field of play percentage so one set of dimension, returning one percentage value

Parameters:
[in]_widthBoundsrepresents width of TT table
[in]_heightBoundsrepresents height of TT table
[in]_whichQuadrantrepresents court sides
[out]o_specificQuadPtsrepresents retrieved quad specific pts
[out]o_percentagerepresents retrieved quad specific percentages

Definition at line 50 of file TwoDStatsGeneration.cpp.

{

    switch(_whichQuadrant)
    {
        //bottom left
        case 0:
        {
            for(int i=0;i<_playerImpactPtsAllRallies.size();i++)
            {
                if((_playerImpactPtsAllRallies[i].x <= _widthBounds) && (_playerImpactPtsAllRallies[i].y <= _heightBounds))
                {
                    // if it falls into the requested quadrant then fill in the buffer
                    o_specificQuadPts.push_back(_playerImpactPtsAllRallies[i]);
                }
            }
            break;
        }
        // top left
        case 1:
        {
            for(int i=0;i<_playerImpactPtsAllRallies.size();i++)
            {
                if((_playerImpactPtsAllRallies[i].x <= _widthBounds) && (_playerImpactPtsAllRallies[i].y >= _heightBounds))
                {
                    // if it falls into the requested quadrant then fill in the buffer
                    o_specificQuadPts.push_back(_playerImpactPtsAllRallies[i]);
                }
            }
            break;

        }
        // top right
        case 2:
        {
            for(int i=0;i<_playerImpactPtsAllRallies.size();i++)
            {
                if((_playerImpactPtsAllRallies[i].x > _widthBounds) && (_playerImpactPtsAllRallies[i].y > _heightBounds))
                {
                    // if it falls into the requested quadrant then fill in the buffer
                    o_specificQuadPts.push_back(_playerImpactPtsAllRallies[i]);
                }
            }
        break;

        }
        // bottom right
        case 3:
        {
            for(int i=0;i<_playerImpactPtsAllRallies.size();i++)
            {
                if((_playerImpactPtsAllRallies[i].x > _widthBounds) && (_playerImpactPtsAllRallies[i].y < _heightBounds))
                {
                    // if it falls into the requested quadrant then fill in the buffer
                    o_specificQuadPts.push_back(_playerImpactPtsAllRallies[i]);
                }
            }
            break;

        }
    }


    o_percentage = (float)((float)o_specificQuadPts.size()/(float)_playerImpactPtsAllRallies.size());
    o_percentage = o_percentage * 100;

}

+ Here is the caller graph for this function:


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