Kinect 3D Touch
in
Contributed Library Questions
•
6 months ago
Hi Everyone,
I am using SimpleOpenNi with processing 2.08b. I want to know how to calculate the distance between two objects ? Here in this case I want to calculate the distance between hand and a object.
The first picture shows that depthmap of the scene
Actually what I want to do is that if somehow I can check if I am touching any object or not. Here what I did, I have hand coordinates ( handPosition.x, handPosition.y, handPosition.z) and from the rgb frame ( frame = kinect.rgbImage(); ) I am detecting the depth of the pixel at (handPosition.x, handPosition.y)
-------------------------------------------
// I have a frame size(640,480);
-----------------------
int[] depthvalues = kinect.depth();
int loc = handPosition.x + handPosition.y * 480
int mm = depthvalues[loc];
-------------
if ( abs(mm - handPosition.z ) < threshold )
{
println("You have touched an object");
}
------------------
Problems: handPosition.z gives me some 3 digit values where as mm gives me some 6 digit values. I dont understand why this is happening?
Somewhere I read the handPosition does not repsensts real depth coordinates. it has been converted using this fucntion " convertRealWorldToProjective "
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);
}
1