-
Notifications
You must be signed in to change notification settings - Fork 1
/
kinframe.py
46 lines (38 loc) · 882 Bytes
/
kinframe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import glob
import os
import shutil
def getfilelist(f=None):
"""Reads in meta data"""
if (f==None):
os.chdir("/data/1/")
kin = []
meta = []
accel = []
for file in glob.glob("kin_*.txt"):
kin.append(file)
for file in glob.glob("meta_*.txt"):
meta.append(file)
for file in glob.glob("accel_*.txt"):
accel.append(file)
#print "Kin is: "+str(kin)
#print "Meta is: "+str(meta)
return (kin,meta,accel)
def framecut(f):
FCUT = 200;
"""cut out beginning and end frames"""
kindata = open(f[0],'r')
lines = kindata.readlines()
kindata.close()
flength = len(lines)
print flength
lines = lines[FCUT:(flength-FCUT)]
flength = len(lines)
print flength
kindata = open(f[0],'w')
for line in lines:
kindata.write(line);
kindata.close
if __name__ == '__main__':
print "Cleaning Kinect Frame Data...."
kin,meta,accel = getfilelist()
framecut(kin)