def frameToArray(frame): start = 1 vecs = np.zeros(shape=(int((frame.shape[0]-1)/3), 3)) for itr, end in enumerate(range(4, frame.shape[0]+3, 3)): vecs[itr] = np.array(frame[start:end]) start = end return vecs