in renderer/viewer2D.py [0:0]
def Vis_Skeleton_2D_foot(pt2d, pt2d_visibility = None, image = None, bVis = False, color=None):
pt2d = np.reshape(pt2d,(-1,2)) #Just in case. Make sure (32, 2)
#Draw via opencv
if not isinstance(image, np.ndarray):#not image: #If no image is given, generate Blank image
image = np.ones((1000,1000,3),np.uint8) *255
radius = 4
#SMPL 24 joints used for LBS
link2D = [ [0,1],[1,2], #root-> torso -> head
[3,4], [4,5] ]
bLeft = [ 1,1,
0, 0]
# for i in np.arange( len(link) ):
for k in np.arange( len(pt2d) ):
if pt2d_visibility is None:
cv2.circle(image, (int(pt2d[k][0]), int(pt2d[k][1]) ), radius, (0,255,0),-1)
else:
if pt2d_visibility[k]:
cv2.circle(image, (int(pt2d[k][0]), int(pt2d[k][1]) ), radius, (0,255,0),-1)
for k in np.arange( len(link2D) ):
parent = link2D[k][0]
child = link2D[k][1]
if color is not None:
c = color
else:
if bLeft[k]:
c = (0,0,255)#BGR, RED
else:
c = (0,0,0)
if pt2d_visibility is None:
cv2.line(image, (int(pt2d[parent][0]), int(pt2d[parent][1])), (int(pt2d[child][0]), int(pt2d[child][1])), c, radius - 2)
else:
if pt2d_visibility[parent] and pt2d_visibility[child]:
cv2.line(image, (int(pt2d[parent][0]), int(pt2d[parent][1])), (int(pt2d[child][0]), int(pt2d[child][1])), c, radius - 2)
if bVis:
ImShow(image)
return image