MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / foot_detect

Function foot_detect

mGPT/data/humanml/scripts/motion_process.py:43–59  ·  view source on GitHub ↗
(positions, thres)

Source from the content-addressed store, hash-verified

41 """ Get Foot Contacts """
42
43 def foot_detect(positions, thres):
44 velfactor, heightfactor = np.array([thres, thres]), np.array([3.0, 2.0])
45
46 feet_l_x = (positions[1:, fid_l, 0] - positions[:-1, fid_l, 0]) ** 2
47 feet_l_y = (positions[1:, fid_l, 1] - positions[:-1, fid_l, 1]) ** 2
48 feet_l_z = (positions[1:, fid_l, 2] - positions[:-1, fid_l, 2]) ** 2
49 # feet_l_h = positions[:-1,fid_l,1]
50 # feet_l = (((feet_l_x + feet_l_y + feet_l_z) < velfactor) & (feet_l_h < heightfactor)).astype(np.float64)
51 feet_l = ((feet_l_x + feet_l_y + feet_l_z) < velfactor).astype(np.float64)
52
53 feet_r_x = (positions[1:, fid_r, 0] - positions[:-1, fid_r, 0]) ** 2
54 feet_r_y = (positions[1:, fid_r, 1] - positions[:-1, fid_r, 1]) ** 2
55 feet_r_z = (positions[1:, fid_r, 2] - positions[:-1, fid_r, 2]) ** 2
56 # feet_r_h = positions[:-1,fid_r,1]
57 # feet_r = (((feet_r_x + feet_r_y + feet_r_z) < velfactor) & (feet_r_h < heightfactor)).astype(np.float64)
58 feet_r = (((feet_r_x + feet_r_y + feet_r_z) < velfactor)).astype(np.float64)
59 return feet_l, feet_r
60
61 #
62 feet_l, feet_r = foot_detect(positions, feet_thre)

Callers 2

extract_featuresFunction · 0.85
process_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected