in tools/vis_utils.py [0:0]
def extend_to_3d_skeleton_simple(ptcloud, sticks, line_resol=10, rgb=None):
H36M_TO_MPII_PERM = [3, 2, 1, 4, 5, 6,
0, 8, 9, 10, 16, 15, 14, 11, 12, 13]
rgb_now = rgb.T if rgb is not None else None
ptcloud_now = ptcloud.T
ptcloud = ptcloud.T
rgb = rgb.T if rgb is not None else rgb
if ptcloud_now.shape[1] == 16: # MPII
sticks_new = []
for stick in sticks:
if stick[0] in H36M_TO_MPII_PERM and stick[1] in H36M_TO_MPII_PERM:
s1 = H36M_TO_MPII_PERM.index(int(stick[0]))
s2 = H36M_TO_MPII_PERM.index(int(stick[1]))
sticks_new.append([s1, s2])
sticks = sticks_new
for sticki, stick in enumerate(sticks):
alpha = np.linspace(0, 1, line_resol)[:, None]
linepoints = ptcloud[stick[0], :][None, :] * alpha + \
ptcloud[stick[1], :][None, :] * (1. - alpha)
ptcloud_now = np.concatenate((ptcloud_now, linepoints), axis=0)
if rgb is not None:
linergb = rgb[stick[0], :][None, :] * alpha + \
rgb[stick[1], :][None, :] * (1.-alpha)
rgb_now = np.concatenate(
(rgb_now, linergb.astype(np.int32)), axis=0)
if rgb is not None:
rgb_now = rgb_now.T
return ptcloud_now.T, rgb_now