Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SkeletonData.h

Go to the documentation of this file.
00001 #ifndef _SKELETONDATA_H_
00002 #define _SKELETONDATA_H_
00003 
00004 #include <vector>
00005 #include <iostream>
00006 
00007 #ifdef HAVE_OPENNI
00008 #include <XnTypes.h>
00009 #endif
00010 
00011 
00012 #include "BaseData.h"    // superclass
00013 #include "Point.h"       // Point data member
00014 #include "Sketch.h"
00015 
00016 namespace DualCoding {
00017 
00018 #ifndef HAVE_OPENNI
00019   typedef unsigned int XnSkeletonJoint;
00020 #endif
00021 
00022   class ShapeRoot;
00023 
00024   class Skeleton {
00025   public:
00026 #ifdef HAVE_OPENNI
00027     static const unsigned int NumSkelJoints = XN_SKEL_RIGHT_FOOT;
00028 #else
00029     static const unsigned int NumSkelJoints = 24;
00030 #endif
00031     Point joints[NumSkelJoints+1];
00032 
00033     bool validJoint(unsigned int i) const {
00034       return (i <= NumSkelJoints) && 
00035   (joints[i].coordX() != 0.0 || joints[i].coordY() != 0.0 || joints[i].coordZ() != 0.0);
00036     }
00037   };
00038 
00039   class SkeletonData : public BaseData {
00040   public:
00041 
00042     //! Constructor
00043     SkeletonData(ShapeSpace& _space, const Skeleton& _skeleton);
00044 
00045     //! Constructor for manually building Skeleton instances in local or world maps
00046     SkeletonData(ShapeSpace& _space, const Point &_center, const Skeleton& _skeleton);
00047 
00048     //! Copy constructor
00049     SkeletonData(const SkeletonData &other);
00050 
00051     //! Destructor
00052     ~SkeletonData() {};
00053 
00054     static ShapeType_t getStaticType() { return skeletonDataType; }
00055 
00056     DATASTUFF_H(SkeletonData);
00057   
00058     const Skeleton& getSkeleton() const { return skeleton; }
00059 
00060     //! Centroid. (Virtual in BaseData.)
00061     Point getCentroid() const { return center; } 
00062     void setCentroid(const Point& other) { center.setCoords(other); }
00063   
00064     //! returns the bounding box of the Skeleton object
00065     virtual BoundingBox2D getBoundingBox() const;
00066 
00067     //! Bounding box points
00068     Point getTopLeft() const { return Point(); }  //**** FIX THIS HACK: 4 lines ****
00069     Point getTopRight() const { return Point(); }
00070     Point getBottomLeft() const { return Point(); }
00071     Point getBottomRight() const { return Point(); }
00072 
00073     //! Match Skeleton objects based on their parameters.  (Virtual in BaseData.)
00074     virtual bool isMatchFor(const ShapeRoot& other) const;
00075 
00076     virtual bool isAdmissible() const { return true; }
00077 
00078     virtual bool updateParams(const ShapeRoot& other, bool force=false);
00079 
00080     //! Print information about this shape. (Virtual in BaseData.)
00081     virtual void printParams() const;
00082   
00083     //! Transformations. (Virtual in BaseData.)
00084     void applyTransform(const fmat::Transform& Tmat, const ReferenceFrameType_t newref=unspecified);
00085   
00086     //! Project to ground
00087     virtual void projectToGround(const fmat::Transform& camToBase, const PlaneEquation& groundplane);
00088 
00089     virtual unsigned short getDimension() const { return 3; }
00090   
00091     //! Properties functions.
00092     //@{
00093     //@}
00094 
00095   protected:
00096     //! The skeleton represented by this shape
00097     Skeleton skeleton;
00098     Point center;
00099 
00100   private:
00101     //! Render into a sketch space and return pointer. (Private.)
00102     virtual Sketch<bool>* render() const;
00103     SkeletonData& operator=(const SkeletonData&); //!< don't call
00104   };
00105 
00106 
00107 } // namespace
00108 
00109 #endif

DualCoding 5.1CVS
Generated Mon May 9 04:56:27 2016 by Doxygen 1.6.3