def main(): with open('pitch-type.csv', 'r') as f: reader = csv.reader(f) for type in reader: # read data AlignedDataLists = [] # [csvfile index][joint index][time][dim] csvfiles = type[2:] Dir = type[0] name = Dir.split('/')[-2] # read all data and hold it to DataList refpath = referenceReader(name + '-' + type[1] + '.csv', Dir, superDir=name) #print(refpath) refData = csvReader(refpath, type[0]) #refData.show() #exit() for csvfile in csvfiles: if csvfile == refpath: continue inpData = csvReader(csvfile, Dir) DP_ = DP(refData, inpData, verbose=False, ignoreWarning=True) DP_.calc() # aligned alignedData = DP_.aligned() AlignedDataLists.append(np.array(list(alignedData.values()))) AlignedDataLists = np.array(AlignedDataLists) #print(AlignedDataLists.shape) (9, 39, 1587, 3) # calculate mean mean = np.mean(AlignedDataLists, axis=0) #(39, 1587, 3) meanData = Data(interpolate='linear') meanData.setvalues('mean movement', x=mean[:, :, 0], y=mean[:, :, 1], z=mean[:, :, 2], jointNames=list(refData.joints.keys())) variance = np.var(AlignedDataLists, axis=0) #(39, 1587, 3) std = np.std(AlignedDataLists, axis=0) colors = std2color(std) #meanData.show(colors=colors) # save file and bone meanData.save(os.path.join( 'result', name, '{0}-{1}-mean.MP4'.format(name, type[1])), fps=240, colors=colors, saveonly=True)
from dp.data import Data for i in range(1, 7 + 1): data = Data() data.set_from_trc('./trc/IMAMURA/IMAMURA{0:02d}.trc'.format(i), lines='volleyball') data.save('__video/IMAMURA{0:02d}.mp4'.format(i), fps=60, saveonly=True) exit() for i in range(8, 34 + 1): data = Data() data.set_from_trc('./trc/IMAMURA/IMAMURA{0:02d}.trc'.format(i), lines='volleyball') data.save('__video/IMAMURA{0:02d}.mp4'.format(i), fps=60, saveonly=True) for i in range(35, 36 + 1): data = Data() data.set_from_trc('./trc/IMAMURA/IMAMURA{0:02d}.trc'.format(i), lines='volleyball') data.save('__video/IMAMURA{0:02d}.mp4'.format(i), fps=60, saveonly=True)