Touch Detection using SimpleOpenNI Library
in
Integration and Hardware
•
4 months ago
Hi everyone,
I have been trying to detect a 'touch' of an object by hand using the SimpleOpenNI Library. I am tracking the hand using the code provided in the book "Making Things See". Find code attached below. The hand tracking is working fine but as soon as I take my hand close to any object to touch it, the tracker fails and the function OnDestroyHands is invoked. This is irrespective of occlusion, out of bounds or anything else. Since my entire project is based on detecting the 'touch', can somebody please suggest a good solution?
P.S. I read in an NITE Algorithms pdf that for the hand tracker to work nicely, avoid touching any other objects!
Hand Tracking Code: (only the major functions are stated here)
http://my.safaribooksonline.com/book/hardware/arduino/9781449321918/4dot-working-with-the-skeleton-data/id2906557#X2ludGVybmFsX0h0bWxWaWV3P3htbGlkPTk3ODE0NDkzMjE5MTglMkZpZDI4OTY1
MTQmcXVlcnk9bXVsdGlwbGUlMjBoYW5k
MTQmcXVlcnk9bXVsdGlwbGUlMjBoYW5k
// ----------------------------------------------------------------- //
void onCreateHands(int handId, PVector position, float time) { kinect.convertRealWorldToProjective(position, position); handPositions.add(position);
}
void onUpdateHands(int handId, PVector position, float time) { kinect.convertRealWorldToProjective(position, position); handPositions.add(position);
}
void onDestroyHands(int handId, float time) { handPositions.clear(); kinect.addGesture("RaiseHand");
}
// ----------------------------------------------------------------- //
void onRecognizeGesture(String strGesture, PVector idPosition, PVector endPosition) {
kinect.startTrackingHands(endPosition);
kinect.removeGesture("RaiseHand");
}
1