lixiny / manotorch

MANO in pyTORCH (anatomical constraints, anchors, etc)
GNU General Public License v3.0
178 stars 13 forks source link

Apply transformation to hand model #7

Closed YorkWang-Go closed 1 year ago

YorkWang-Go commented 1 year ago

Thanks for your great work! I want to apply transformation including translation and rotation to the hand model parameterized by manotorch, and keep the shape of the hand unchanged. I know that I can change the hand_tsl paramaters to apply translation, but how to apply rotation by just change the 61 paramaters, given euler angles?

lixiny commented 1 year ago

If you want to apply the rotation on the wrist (the root of the MANO kinematic tree), you can simply left-multiply your $R$ to the first 3x3 rotation matrix in MANO's pose parameter.

If you want to apply the rotation of each joint, you can follow the simple_compose demo at here.

Best, Lixin

YorkWang-Go commented 1 year ago

I want to transform the hand from local frame to world frame and keep the hand shape unchanged. Then is applying the rotation on the wrist enough?

lixiny commented 1 year ago

If I correctly understood your question,

Each 'pose' in the MANO pose_parameters, (one rotation in axis-angle form), is defined as the rotation between the joint itself (as child) and its parent.

In other words, if you want to get the pose of the level:3 joint in the world frame, you need to multiply the parent of the level:3, the parent of the parent,... up to the root (wrist) rotation for successive left multiplication. This operation is implemented in manotorch: here

Hence, if you want to change the coordinate frame, but keep the pose and shape of hand unchanged, you only need to left-multiply the transformation to the wrist joint.

This kind of transformation is widely used in our code. For example: rotate_smpl_pose

YorkWang-Go commented 1 year ago

Yes, I left-multiplied the transformation to the wrist joint, and it worked! Thanks for your help!