leapc-python-bindings icon indicating copy to clipboard operation
leapc-python-bindings copied to clipboard

clarification on the data types

Open rufaelfekadu opened this issue 1 year ago • 1 comments

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?

rufaelfekadu avatar Jan 03 '24 09:01 rufaelfekadu

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.

JamesProvan-UL avatar Jan 26 '24 10:01 JamesProvan-UL

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.

gemcollector avatar Jun 14 '24 15:06 gemcollector

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/.

JamesProvan-UL avatar Jun 14 '24 16:06 JamesProvan-UL

Thanks for your quick reply! make sense! I will try to implement them.

gemcollector avatar Jun 14 '24 16:06 gemcollector

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!

gemcollector avatar Jun 14 '24 16:06 gemcollector

Closing this issue as the original question has been answered. Please open a new issue for your request.

RodolpheHoudas-UL avatar Jun 25 '24 14:06 RodolpheHoudas-UL