def compute_feature_9_per_frame(frame): jid = 15 foot = np.asarray([frame[3 * jid], frame[3 * jid + 1], frame[3 * jid + 2]]) jid = 0 root = np.asarray([frame[3 * jid], frame[3 * jid + 1], frame[3 * jid + 2]]) distance = distance_between(foot, root) return distance / 10
def calculate_speed(frames, time_step, jid): array = [] old_position = np.asarray([frames[0][3 * jid], frames[0][3 * jid + 1], frames[0][3 * jid + 2]]) for i in range(1, len(frames)): new_position = np.asarray([frames[i][3 * jid], frames[i][3 * jid + 1], frames[i][3 * jid + 2]]) distance = distance_between(new_position, old_position) / 10 array.append(distance / time_step) old_position = new_position.copy() array = np.asarray(array) return np.mean(array)