Kinect Body Tracking  1.0
 All Classes Functions
shahqaan.kinect.ExtendedSkeletons Class Reference

Inherits shahqaan.kinect.Skeletons.

Public Member Functions

void draw (Graphics2D g2d)
 
- Public Member Functions inherited from shahqaan.kinect.Skeletons
int getXRes ()
 
int getYRes ()
 
void update ()
 

Static Public Member Functions

static ExtendedSkeletons getInstance (AbstractDrawable drawable, AbstractLoggable loggable, AbstractTrackable tracker)
 

Protected Member Functions

void finalize ()
 
void updateJoint (HashMap< SkeletonJoint, SkeletonJointPosition > skel, int userID, SkeletonJoint joint)
 
- Protected Member Functions inherited from shahqaan.kinect.Skeletons
void updateJoint (HashMap< SkeletonJoint, SkeletonJointPosition > skel, int userID, SkeletonJoint joint)
 
Point3D getJointPos (HashMap< SkeletonJoint, SkeletonJointPosition > skel, SkeletonJoint j)
 

Additional Inherited Members

- Protected Attributes inherited from shahqaan.kinect.Skeletons
UserGenerator userGen
 
DepthGenerator depthGen
 
SkeletonCapability skelCap
 
PoseDetectionCapability poseDetectionCap
 
String calibPoseName = null
 
HashMap< Integer, HashMap
< SkeletonJoint,
SkeletonJointPosition > > 
userSkels
 
Context context
 
DepthMetaData depthMD
 
boolean isRunning
 

Detailed Description

Definition at line 14 of file ExtendedSkeletons.java.

Member Function Documentation

void shahqaan.kinect.ExtendedSkeletons.draw ( Graphics2D  g2d)

Calls AbstractDrawable.drawSkeleton() Draws on g2d

Parameters
g2dGraphics2D instance received from paint

Definition at line 85 of file ExtendedSkeletons.java.

85  {
86  try {
87  if (true) {
88  int[] userIDs = userGen.getUsers();
89  for (int i = 0; i < userIDs.length; ++i) {
90  g2d.setColor(Color.white);
91  if (skelCap.isSkeletonCalibrating(userIDs[i])) {
92  // test to avoid occasional crashes with isSkeletonTracking()
93  }
94  else if (skelCap.isSkeletonTracking(userIDs[i])) {
95  drawable.drawSkeleton(g2d, userSkels.get(userIDs[i]), this);
96  }
97  }
98  }
99  //else { // Draw graph of body states
100  /*
101  g2d.setColor(Color.red);
102  // Draw labels
103  g2d.drawString("N/A", 20, 450);
104  g2d.drawString("Forward", 20, 410);
105  g2d.drawString("Backward", 20, 370);
106  g2d.drawString("Bent", 20, 330);
107  g2d.drawString("Straight", 20, 290);
108  g2d.drawString("Upward", 20, 250);
109  g2d.drawString("Lifted Upward", 20, 210);
110  g2d.drawString("Crossed", 20, 170);
111  g2d.drawString("Open", 20, 130);
112 
113  g2d.drawString("Body", 50, 470);
114  g2d.drawString("Head", 150, 470);
115  g2d.drawString("Shoulder", 250, 470);
116  g2d.drawString("Chest", 350, 470);
117  g2d.drawString("Arms", 450, 470);
118  g2d.drawString("Knees", 550, 470);
119 
120 
121 
122  g2d.setColor(Color.blue);
123  // width = 550
124  // height = 400
125  g2d.drawLine(50, 450, 600, 450);
126  g2d.drawLine(50, 450, 50, 50);
127 
128  int prevX = 0;
129  int prevY = 0;
130  g2d.setColor(Color.black); */
131  /*
132  for (int i = 0 ; i < 6 ; i++) {
133 
134  g2d.drawLine(
135  50 + prevX, (450 - prevY),
136  50 + (i * 100), (450 - (40 * ExtendedSkeletons.bodyState[i])));
137  prevX = 100 * i;
138  prevY = 40 * ExtendedSkeletons.bodyState[i];
139  }
140 
141  g2d.setColor(Color.red);
142  this.classify();
143  */
144  //}
145  } catch (StatusException e) {
146  System.out.println(e);
147  }
148  }
void shahqaan.kinect.ExtendedSkeletons.finalize ( )
protected

Subtracts 1 from count

Definition at line 74 of file ExtendedSkeletons.java.

74  {
75  ExtendedSkeletons.count--;
76  }
static ExtendedSkeletons shahqaan.kinect.ExtendedSkeletons.getInstance ( AbstractDrawable  drawable,
AbstractLoggable  loggable,
AbstractTrackable  tracker 
)
static
Parameters
drawableAbstractDrawable instance passed to this class
loggableAbstractLoggable instance passed to this class
trackerAbstractTracker instance passed to this class
Returns
ExtendedSkeletons instance if none exists already

Definition at line 36 of file ExtendedSkeletons.java.

39  {
40 
41  if (ExtendedSkeletons.count <= 0) {
42  ExtendedSkeletons.count++;
43  return new ExtendedSkeletons(drawable, loggable, tracker);
44  }
45  else {
46  return null;
47  }
48 
49  }
void shahqaan.kinect.ExtendedSkeletons.updateJoint ( HashMap< SkeletonJoint, SkeletonJointPosition >  skel,
int  userID,
SkeletonJoint  joint 
)
protected

Logs in another thread Calls updateJoint() of Skeletons Calls tracker.track()

Parameters
skelHashMap<SkeletonJoint, SkeletonJointPosition>
userIDint current user id
jointSkeletonJoint

Definition at line 163 of file ExtendedSkeletons.java.

164  {
165  Thread t = null;
166  if (loggable != null) {
167  final HashMap<SkeletonJoint, SkeletonJointPosition> currentSkel = new HashMap<>(skel);
168  final ExtendedSkeletons context = this;
169  t = new Thread(new Runnable() {
170  @Override
171  public void run() {
172  loggable.log(context, currentSkel);
173  }
174 
175  });
176  t.start();
177  }
178  super.updateJoint(skel, userID, joint);
179  this.tracker.track(this, skel);
180  if (loggable != null) {
181  try {
182  if (t != null) {
183  t.join();
184  }
185  } catch (InterruptedException ex) {
186  Logger.getLogger(ExtendedSkeletons.class.getName()).log(Level.SEVERE, null, ex);
187  }
188  }
189  }

The documentation for this class was generated from the following file: