33 #include <opencv2/opencv.hpp>    36 #include <ScolPlugin.h>    47 #include <boost/unordered_map.hpp>    48 #include <boost/unordered_set.hpp>    49 #include <boost/lexical_cast.hpp>    50 #include <boost/algorithm/string.hpp>       51 #include <boost/thread/thread.hpp>    52 #include <boost/bind.hpp>    65 #define SCOL_PI       3.14159265358979323846f    73 template <
class DERIVATED_CLASS> 
class Singleton;
    90 typedef std::list<KinectUser*> KinectUserList;
    91 typedef std::set<unsigned int> OpenNIUserList;
    92 typedef std::map<unsigned int, KinectDevice*> KinectDeviceMap;
   116   Matrix3 (
float fEntry00, 
float fEntry01, 
float fEntry02,
   117                   float fEntry10, 
float fEntry11, 
float fEntry12,
   118                   float fEntry20, 
float fEntry21, 
float fEntry22)
   133   inline float* operator[] (
size_t iRow)
 const   135     return (
float*)m[iRow];
   138   bool operator== (
const Matrix3& rkMatrix) 
const;
   139   inline bool operator!= (
const Matrix3& rkMatrix)
 const   141                 return !operator==(rkMatrix);
   160   static void DrawContour(cv::Mat &img, 
const vector<cv::Point> &contour, 
const cv::Scalar &color) {
   161           vector<vector<cv::Point>> contours;
   162           contours.push_back(contour);
   163           drawContours(img, contours, -1, color);
   166   static float getAngle(cv::Point i, cv::Point j, cv::Point k)
   168     float x1 = 
static_cast<float>(i.x);
   169     float y1 = 
static_cast<float>(i.y);
   170     float x2 = 
static_cast<float>(j.x);
   171     float y2 = 
static_cast<float>(j.y);
   172     float x3 = 
static_cast<float>(k.x);
   173     float y3 = 
static_cast<float>(k.y);
   174     float d12 = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);
   175     float d13 = (x3-x1)*(x3-x1) + (y3-y1)*(y3-y1);
   176     float d23 = (x2-x3)*(x2-x3) + (y2-y3)*(y2-y3);
   177     float theta = acos((d13-d12-d23)/(-2*sqrt(d12)*sqrt(d23)));
   178     return theta * 180.0f / 3.14159265f;
   181   static cv::Point2i getCentroid(cv::Point i, cv::Point j, cv::Point k)
   189     int x = (x1+x2+x3)/3;
   190     int y = (y1+y2+y3)/3;
   191     return cv::Point2i(x, y);
   194   static double Convexity(
const vector<cv::Point> &contour) {
   195           cv::Mat contourMat(contour);
   198           cv::convexHull(contourMat, hull);
   201           vector<cv::Point> hullContour;
   203           for (
int i=0; i<n; i++) {
   204                   hullContour.push_back(contour[hull[i]]);
   207           cv::Mat hullContourMat(hullContour);
   209     return (cv::contourArea(contourMat) / cv::contourArea(hullContourMat));
   212   static void MatAverage(vector<cv::Mat>& frames, cv::Mat& mean)
   214           cv::Mat1d acc(mean.size());
   215           cv::Mat1d frame(mean.size());
   217           for (
unsigned int i=0; i<frames.size(); i++)
   219             frames[i].convertTo(frame, CV_64FC1);
   223           acc = acc / frames.size();
   225           acc.convertTo(mean, CV_16SC1);
   228   static void VecAverage(vector<vector<cv::Point>>& dots, vector<cv::Point>& mean)
   230     vector<cv::Point> acc;
   231     vector<int> countacc;
   233           for (
unsigned int i=0; i<dots.size(); i++)
   235             for (
unsigned int j=0; j<dots[i].size(); j++)
   239           acc.push_back(dots[i][j]);
   240           countacc.push_back(1);
   244           acc[j] = cv::Point(dots[i][j].x + acc[j].x, dots[i][j].y + acc[j].y);
   245           countacc[j] = countacc[j] + 1;
   250     for (
unsigned int i=0; i<acc.size(); i++)
   252       acc[i] = cv::Point((acc[i].x / countacc[i]), (acc[i].y / countacc[i]));
   258   static float sqr(
float a) 
   263   static void OrderPoints(vector<vector<cv::Point>>& dots, vector<vector<cv::Point>>& mean)
   265     vector<vector<cv::Point>> cdots = dots;
 
User generator handling. . 
 
Image generator handling. . 
 
Depth generator handling. . 
 
Kinect device handling. . 
 
Handle DeviceManager type. .