hassony2 / manopth

MANO layer for PyTorch, generating hand meshes as a differentiable layer
GNU General Public License v3.0
601 stars 104 forks source link

Left MANO hand model #25

Closed CVStack closed 2 years ago

CVStack commented 2 years ago

Thank you for sharing the code.

When using the left mano model, i find that the finger of hand is bended in the opposite direction of hand palm when the rotation value is positive.

I know that the finger is bended in the direction of hand palm when the rotation value is positive.

Is this normal?

Thank you. (The below image is the output of left hand mesh when the rotation value is positive.)

image

dimtzionas commented 2 years ago

Hi Hansoo,

Yes, you need to apply an "opposite" rotation. Think of the left and right hands as belonging to a full body in a T-pose -- they look in opposite directions and they are kind of "mirrored".

Best, dimitris

On Tue, Aug 2, 2022 at 8:23 AM Hansoo Park @.***> wrote:

Thank you for sharing the code.

When using the left mano model, i find that the finger of hand is bended in the opposite direction of hand palm when the rotation value is positive.

I know that the finger is bended in the direction of hand palm when the rotation value is positive.

Is this normal?

Thank you. (The below image is the output of left hand mesh when the rotation value is positive.)

[image: image] https://user-images.githubusercontent.com/38209962/182305924-ebac65b2-803e-4c2f-9a50-309f6887688b.png

— Reply to this email directly, view it on GitHub https://github.com/hassony2/manopth/issues/25, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5KTMEJYNBPGEOBF4XZVPDVXC5HPANCNFSM55J4XKEA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

CVStack commented 2 years ago

Thank you! Your comment is very helpful to understand it.

Is it right to apply "opposite" to the all of rotation component(yaw, pitch, roll)?

dimtzionas commented 2 years ago
import numpy as np

def right2left_aangle(right_aangle):
    from cv2 import Rodrigues as Rod
    xmirror = np.asarray([[-1, 0, 0], [0, 1, 0], [0, 0, 1]])
    return(Rod((xmirror.dot(Rod(right_aangle)[0])).dot(xmirror))[0].ravel())

def fullrightpose2leftpose(rightpose):
    return(np.asarray([right2left_aangle(right_aangle)
                       for right_aangle in rightpose.reshape(-1, 3)]).ravel())

leftpose = fullrightpose2leftpose(rightpose)

OK, the above might help you. This is a copy from an old script that seems to do what you need for mirroring the right-hand axis-angle rotations to get the "opposite" left-hand ones. rightpose is a vector containing the serialized rotation parameters in the full-pose space (i.e., 3 values per joint).

As intuition please think in terms of your own body; raise your arms in a T-Pose and bend the pointer finger of your left & right hand towards the floor. This might make more intuitive what you need to do in terms of code :)

You might have to play around a bit while visualizing the result until you nail it.

I hope this helps!

CVStack commented 2 years ago

Oh!!! I understood completely with your code!! Thank you so much!!

:+1: