KINECT STATS GENERATOR FOR SPORTS VISUALISATION  1.0
BallTrackingUtility.h
Go to the documentation of this file.
00001 #ifndef BALLTRACKINGUTILITY_H
00002 #define BALLTRACKINGUTILITY_H
00003 
00004 /*
00005   LICENSING: You are free to use any part of this project provided I am informed about it via email
00006   at santoshwins@hotmail.com and referenced appropriately in your works
00007   */
00008 
00009 // must be included after our stuff becuase GLEW needs to be first
00010 #include "KinectInterface.h"
00011 #include "ScreenQuad.h"
00012 #include "QuadCurveFitUtility.h"
00013 #include <ngl/Text.h>
00014 
00015 #include <QTime>
00016 #include <QEvent>
00017 #include <QResizeEvent>
00018 
00027 
00028 class BallPointsProcessing;
00029 
00030 class BallTrackingUtility:public QObject
00031 {
00032     Q_OBJECT        // must include this if you use Qt signals/slots
00033 
00034     private :
00035 
00036         //----------------------------------------------------------------------------------------------------------------------
00038         //----------------------------------------------------------------------------------------------------------------------
00039         cv::Mat m_rgb, m_gray;
00040 
00041         //---------------------------------------------------------------------------------------------------------------------
00043         //----------------------------------------------------------------------------------------------------------------------
00044         cv::Mat m_nextBuffer,m_prevBuffer, m_diffBuffer, m_bufferDepthRaw, m_bufferDepthRaw1;
00045 
00046         //----------------------------------------------------------------------------------------------------------------------
00048         //----------------------------------------------------------------------------------------------------------------------
00049         float m_depthinm[640*480];
00050 
00051         //----------------------------------------------------------------------------------------------------------------------
00053         //----------------------------------------------------------------------------------------------------------------------
00054         std::vector<cv::Moments> m_momentList;
00055 
00056         //----------------------------------------------------------------------------------------------------------------------
00058         //----------------------------------------------------------------------------------------------------------------------
00059         cv::Mat canny_output;
00060 
00061         //----------------------------------------------------------------------------------------------------------------------
00063         //----------------------------------------------------------------------------------------------------------------------
00064         std::vector<std::vector<cv::Point> > contours;
00065 
00066         //----------------------------------------------------------------------------------------------------------------------
00068         //----------------------------------------------------------------------------------------------------------------------
00069         cv::Mat hierarchy;
00070 
00071         //----------------------------------------------------------------------------------------------------------------------
00073         //----------------------------------------------------------------------------------------------------------------------
00074         double area,rectArea;
00075 
00076         //----------------------------------------------------------------------------------------------------------------------
00078         //----------------------------------------------------------------------------------------------------------------------
00079         std::vector<cv::Moments> mu;
00080 
00081         //----------------------------------------------------------------------------------------------------------------------
00083         //----------------------------------------------------------------------------------------------------------------------
00084         std::vector<cv::Point2f> mc;
00085 
00086         //----------------------------------------------------------------------------------------------------------------------
00089         //----------------------------------------------------------------------------------------------------------------------
00090         double m_binaryLowerThresh,m_binaryMaxVal,m_cannyLowerThresh,m_cannyHigherThresh,m_contourAreaThresh,m_diffAreaThresh;
00091 
00092         //----------------------------------------------------------------------------------------------------------------------
00095         //----------------------------------------------------------------------------------------------------------------------
00096         int m_ellipsesize,m_blurSize,m_noOfTimesToDialate, m_masterRigCheck;
00097 
00098         //----------------------------------------------------------------------------------------------------------------------
00100         //----------------------------------------------------------------------------------------------------------------------
00101         QTimer *m_updateTimer;
00102 
00103         //---------------------------------------------------------------------------------------------------------------------
00105         //----------------------------------------------------------------------------------------------------------------------
00106         BallPointsProcessing *m_ballPointProcessing;
00107 
00108     protected:
00109 
00110 
00111     public :
00112         //----------------------------------------------------------------------------------------------------------------------
00114         //----------------------------------------------------------------------------------------------------------------------
00115         BallTrackingUtility(
00116                            );
00117 
00118         //----------------------------------------------------------------------------------------------------------------------
00121         //----------------------------------------------------------------------------------------------------------------------
00122         BallTrackingUtility(BallPointsProcessing *_inputBallProcessingUtility);
00123 
00124         //----------------------------------------------------------------------------------------------------------------------
00126         //----------------------------------------------------------------------------------------------------------------------
00127         ~BallTrackingUtility();
00128 
00129     private :
00132         void mouseMoveEvent (
00133                            QMouseEvent * _event
00134                             );
00138 
00139         void mousePressEvent (
00140                               QMouseEvent *_event
00141                              );
00142 
00146         void mouseReleaseEvent (
00147                               QMouseEvent *_event
00148                              );
00150 
00151         void timerEvent(
00152                         QTimerEvent *_event
00153                        );
00154 
00155 public slots:
00156 
00157   //----------------------------------------------------------------------------------------------------------------------
00160   //----------------------------------------------------------------------------------------------------------------------
00161   void setBinaryLowerThresh(double _lowerThresh);
00162 
00163 
00164 
00165   void setStructuringElementSize(int _size);
00166 
00167 
00168   void setBlurSize(int _size);
00169 
00170 
00171   void setCannyLowerThresh(double _lowerThresh);
00172 
00173 
00174 
00175   void setCannyHigherThresh(double _higherThresh);
00176 
00177 
00178 
00179   void setNumerOfDialtions(int _numberOfDialtions);
00180 
00181 
00182   void setContourAreaThresh(double _contourAreaThresh);
00183 
00184 
00185   void setDifferenceInAreaThresh(double _diffAreaThresh);
00186 
00187 
00188   void setMasterRigCheck(int _masterRigCheck);
00189 
00190   //----------------------------------------------------------------------------------------------------------------------
00192   //----------------------------------------------------------------------------------------------------------------------
00193   void trackBall();
00194 
00195 };
00196 
00197 #endif // BALLTRACKINGUTILITY_H
 All Classes Files Functions Variables Enumerations Enumerator