示例#1
0
def getLimbTransforms(joints1, joints2):

    n_limbs = len(limbs)
    n_joints = joints1.shape[0]

    Ms = np.zeros((2, 3, 10))
    ctr = 0
    for i in xrange(n_limbs):

        n_joints_for_limb = len(limbs[i])
        p1 = np.zeros((n_joints_for_limb, 2))
        p2 = np.zeros((n_joints_for_limb, 2))

        for j in xrange(n_joints_for_limb):
            p1[j, :] = [joints1[limbs[i][j], 0], joints1[limbs[i][j], 1]]
            p2[j, :] = [joints2[limbs[i][j], 0], joints2[limbs[i][j], 1]]

        tform = transformations.make_similarity(p2, p1, False)
        Ms[:, :, ctr] = np.array([[tform[1], -tform[3], tform[0]],
                                  [tform[3], tform[1], tform[2]]])
        ctr += 1
        '''
		if(i >= 1 and i <= 4):
			tform = transformations.make_similarity(p2,p1,True)	
			Ms[:,:,ctr] = np.array([[tform[1],tform[3],tform[0]],[tform[3],-tform[1],tform[2]]])
			ctr+=1
		'''

        #M = np.array([[tform[1], tform[2], tform[0]],[tform[5],tform[6],tform[4]]])
        #Ms[:,:,i] = M

    return Ms
示例#2
0
def get_limb_transforms(limbs, joints1, joints2):
    n_limbs = len(limbs)

    Ms = np.zeros((2, 3, n_limbs))

    for i in range(n_limbs):
        n_joints_for_limb = len(limbs[i])
        p1 = np.zeros((n_joints_for_limb, 2))
        p2 = np.zeros((n_joints_for_limb, 2))

        for j in range(n_joints_for_limb):
            p1[j, :] = [joints1[limbs[i][j], 0], joints1[limbs[i][j], 1]]
            p2[j, :] = [joints2[limbs[i][j], 0], joints2[limbs[i][j], 1]]

        tform = transformations.make_similarity(p2, p1, False)
        Ms[:, :, i] = np.array([[tform[1], -tform[3], tform[0]],
                                [tform[3], tform[1], tform[2]]])

    return Ms