summaryrefslogtreecommitdiffstats
path: root/data/segment.py
blob: a2cfdb72afa3612dec5e5d01ad4aaee6804895be (plain)
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
#!/usr/bin/python

import time
import sys
import math
import copy

frames = [0,0,0,0,0,0,0,0,0,0]
pframes = [0,0,0,0,0,0,0,0,0,0]
pframe = 0
lines = [[],[],[],[],[],[],[],[],[],[]]
num = 1

for arg in sys.argv[1:]:
    sk_file = open(arg)
    for line in sk_file:
        frame, id, joint, state, x, y, z, dx, dy = line.strip().split(',')
        if frame != 'Frame':
            id = int(id)
            frame = int(frame)
            if frame != pframe:
                for i in range(len(frames)):
                    if frames[i] > 0 and pframe > pframes[i]+1:
                        #print str(frames[i])
			if frames[i] >= 50 and frames[i] <= 100:
				for l in lines[i]:
					print str(num)+','+l
				num += 1
                        frames[i] = 0
			lines[i] = []
                pframe = frame
            if pframes[id] != frame:
                frames[id] += 1
                pframes[id] = frame 
	    lines[id] += [line.strip()]