def DrawSkeletons()

in renderer/glViewer.py [0:0]


def DrawSkeletons():
    # global g_colors
    global g_skeletons, g_frameIdx#, g_normals
    global g_speech,g_speechGT
    global g_bApplyRootOffset
    global g_bodyNormals
    if g_skeletons is None:
        return

    #for humanIdx in range(g_skeletons.shape[0]):
    for humanIdx in range(len(g_skeletons)):

        if g_onlyDrawHumanIdx>=0 and humanIdx!=g_onlyDrawHumanIdx:
            continue
       
        if(g_frameIdx >= g_skeletons[humanIdx]['skeleton'].shape[1]):
            continue

        #     continue

        skel = g_skeletons[humanIdx]['skeleton'][:, g_frameIdx]
        skel_type = g_skeletons[humanIdx]['type']
        skel_color = g_skeletons[humanIdx]['color']

        if skel_color is None:
            skel_color = g_colors[humanIdx % len(g_colors)]

        if g_bApplyRootOffset:
            skel = skel.copy()
            #skel[0::3] = skel[0::3]+ 70 *humanIdx
            skel[0::3] = skel[0::3]+ ROOT_OFFSET_DIST *humanIdx


        #If type is not specified
        if skel_type == None:   
            if skel.shape[0]==78:       #SMPlCOCO19 + headtop (19) + (leftFoot --toe20 pink21 heel22) + (rightFoot--toe23-pink24-heel25)
                drawbody_SMPLCOCO_TotalCap26(skel, [0,255,0])
            elif skel.shape[0]==57:
                drawbody_SMC19(skel, skel_color) #Panoptic Studio (SMC19) with 19 joints. Note SMC21 includes headtop
            
            elif skel.shape[0]==42: #LSP14joints also used in HMR
                drawbody_LSP14(skel, skel_color)
            elif skel.shape[0]==51: #simpler human36m (17joints)
                drawbody_joint17_human36m(skel, [0,255,0])#skel_color)
            elif skel.shape[0]==72: #SMPL LBS skeleton
                drawbody_joint24_smplLBS(skel, skel_color)
            elif skel.shape[0]==96: #human36m (32joints)
                drawbody_joint32_human36m(skel, skel_color)
            elif skel.shape[0]==66: #Holden's converted form (21joints)
                drawbody_joint22(skel, skel_color)
            elif skel.shape[0]==93: #CMU Mocap Raw data (31joints)
                drawbody_joint31(skel, skel_color)
            elif skel.shape[0]==186: #Adam model (62 joints: 22 for body 20x2 for fingers)
                drawbody_jointAdam(skel, skel_color)
            elif skel.shape[0]==189: #MTC skeleton from Hand2Body paper vis
                drawbody_jointMTC86(skel, skel_color)
            
            elif skel.shape[0]==54: #OpenPose 18
                drawbody_jointOpenPose18(skel, skel_color)

            elif skel.shape[0]==147: #SPIN 49 (25 openpose +  24 superset)
                drawbody_jointSpin49(skel, skel_color)
            else:
                drawbody_joint_ptOnly(skel, skel_color)

        elif skel_type == "smplcoco":
            drawbody_SMPLCOCO19(skel, skel_color)   #from HMR, SMPL->COCO19 regression. Same as MTC20's first 19.
        elif skel_type == "spin":
                if skel.shape[0]==72: #SPIN 24 (without openpose, 24 superset)
                    drawbody_jointSpin24(skel, skel_color)
                elif skel.shape[0]==147: #SPIN 49 (25 openpose +  24 superset)
                    drawbody_jointSpin49(skel, skel_color)
                else:
                    assert False
        #finger
        elif skel_type == "hand_smplx":
            if skel.shape[0]==63: #SPIN 49 (25 openpose +  24 superset)
                drawhand_joint21(skel, skel_color, type=skel_type)
            else:
                assert False

        elif skel_type == "hand_panopticdb":
            if skel.shape[0]==63: #SPIN 49 (25 openpose +  24 superset)
                drawhand_joint21(skel, skel_color, type=skel_type)
            else:
                assert False
                
        if g_bodyNormals is not None and len(g_bodyNormals)> humanIdx:

            if g_bodyNormals[humanIdx].shape[1]<=g_frameIdx:
                print("Warning: g_bodyNormals[humanIdx].shape[2]<=g_frameId")
                continue

            normal3D = g_bodyNormals[humanIdx][:,g_frameIdx]  #3x1
            #drawbodyNormal(normal3D, skel, [255, 0, 0])
            rootPt = skel[(0*3):(0*3+3)]

            if skel.shape[0]==66:
                i=12
                rootPt = skel[(3*i):(3*i+3)]
            # drawNormal(normal3D, rootPt, [0, 255, 255])
            #drawNormal(normal3D, rootPt, [255, 0, 0])

            # if g_onlyDrawHumanIdx>=0 and humanIdx!=g_onlyDrawHumanIdx:
            drawNormal(normal3D, rootPt, [0, 255, 0])