Hi all,
I drawn the palm position by the circle on image as the photo below.
To convert 3D coordinate to 2D coordinate, you can use as below:
float hSlope = -(tip.getX() + cameraOffset * (2 * image.id() - 1))/tip.getY();
float vSlope = tip.getZ()/tip.getY();
The following example draws circles over the finger tips in the image.
float cameraOffset = 20; //Physical x-axis offset of cameras in millimeters
Frame frame = controller.frame();
if(frame.isValid()){
ImageList images = frame.images();
for(Image image : images)
{
FingerList fingers = frame.fingers();
for(Finger finger : fingers){
Vector tip = finger.tipPosition();
// Calculate the slope of the tip position
float hSlope = -(tip.getX() + cameraOffset * (2 * image.id() - 1))/tip.getY();
float vSlope = tip.getZ()/tip.getY();
// Get the pixel location using the tip slope
Vector pixelLocation = image.warp(new Vector(hSlope, vSlope, 0f));
//Draw ellipse at the specified pixel over the raw image (uses Processing API)
fill(color(127, 0, 255));
int originX = 640 * image.id();
ellipse(pixelLocation.getX() + originX, pixelLocation.getY(), 10, 10);
}
}
}
More details in here:
https://developer-archive.leapmotion.com/documentation/java/devguide/Leap_Images.html
Best Regards,