美文网首页
minimal-hand iknet quaternion to

minimal-hand iknet quaternion to

作者: Reyuwei | 来源:发表于2021-09-01 02:40 被阅读0次

    Add this function to https://github.com/CalciferZh/minimal-hand/blob/master/hand_mesh.py
    Inspired by https://github.com/CalciferZh/minimal-hand/issues/80

    @staticmethod
    def convert_iknet_pose(ik_quat):
        ### ik_quat: (21, 4) IKNET output
        ### ret_axangle: (16, 3) MANO pose axis-angle, not exactly the same, but quite similar        
        mat = []
        for j in range(MANOHandJoints.n_joints):
            mat.append(transforms3d.quaternions.quat2mat(ik_quat[j]))
        mat = np.stack(mat, 0)
        
        result_axangle = [None] * MANOHandJoints.n_joints
        result_mat = [None] * MANOHandJoints.n_joints
        for j in range(MANOHandJoints.n_joints):
            parent = MANOHandJoints.parents[j]
            if parent is not None:
                matJ = mat[j]
                matP = mat[parent]
                rel_mat = np.linalg.inv(matP) @ matJ
                axis, ang = transforms3d.axangles.mat2axangle(rel_mat)
                result_axangle[parent] = axis*ang
                result_mat[parent] = rel_mat
        axis, ang = transforms3d.axangles.mat2axangle(mat[0])
        result_axangle[0] = axis*ang
        result_axangle = np.stack(result_axangle[:16])
        return result_axangle
    

    Compare

    • red - with quaternion and hand_mesh
    • gray - with axis-angle and mano_layer


      wireframe.png
      geometry.png

    相关文章

      网友评论

          本文标题:minimal-hand iknet quaternion to

          本文链接:https://www.haomeiwen.com/subject/nratwltx.html