leapc-python-bindings
leapc-python-bindings copied to clipboard
clarification on the data types
Hi,
I wanted to use the leap motion controller to collect the ground truth for finger pose estimation project. What are the rotation values for each joint/bone data type? can I assume they are radian values? and from what frame of reference?
Hi @rufaelfekadu,
As these python binds are just a python version of the LeapC API, a lot of information can be found in our LeapC docs: https://docs.ultraleap.com/api-reference/tracking-api/index.html
But to answer your specific questions, angles are indeed in radians and all bone rotations are quaternions in world-space relative the tracking camera.
Hope this helps.
Hi @JamesProvan-UL, sorry to bother you! Can I directly obtain the joint angle of my each joint? I notice that I can only get the position(x, y, z) of each joint.
Hi @gemcollector, you can access the rotation of each joint too using code such as:
hand.digits[digit_index].bones[joint_index].rotation
but this is a quaternion and is in world space relative to the camera origin rather than relative to the previous joint.
To get angle between the joints, you can either get a vector between the joints and then perform a calculation to find the angle between the vectors, or you will need to transform a rotation quaternion to be relative to a previous bone's rotation quaternion so you then know the relative rotation between the two.
I haven't done this myself so don't have any code to share, but that would be how I'd go about solving it.
You can convert the rotation quaternion into Euler angles using code such as this: https://automaticaddison.com/how-to-convert-a-quaternion-into-euler-angles-in-python/.
Thanks for your quick reply! make sense! I will try to implement them.
I have another question. In the previous version, it seems that I can get the whole joint data via data.data, which will return a (21, 3) vectors. Is there any function that I can obtain all joint vectors in the current version? And how many joint positions I can obtain in total?
Thanks!
Closing this issue as the original question has been answered. Please open a new issue for your request.