Mercurial > hg > nsaunier > traffic-intelligence
comparison python/utils.py @ 381:387cc0142211
script to replay event annotations
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 19 Jul 2013 11:58:35 -0400 |
| parents | 2e6b8610bcaa |
| children | 6d26dcc7bba0 |
comparison
equal
deleted
inserted
replaced
| 380:adfd4f70ee1d | 381:387cc0142211 |
|---|---|
| 152 h = int(floor(seconds/3600.)) | 152 h = int(floor(seconds/3600.)) |
| 153 seconds = seconds - h*3600 | 153 seconds = seconds - h*3600 |
| 154 m = int(floor(seconds/60)) | 154 m = int(floor(seconds/60)) |
| 155 seconds = seconds - m*60 | 155 seconds = seconds - m*60 |
| 156 return time(h, m, seconds) | 156 return time(h, m, seconds) |
| 157 | |
| 158 def timeToFrames(t, frameRate): | |
| 159 return frameRate*(t.hour*3600+t.minute*60+t.second) | |
| 157 | 160 |
| 158 def sortXY(X,Y): | 161 def sortXY(X,Y): |
| 159 'returns the sorted (x, Y(x)) sorted on X' | 162 'returns the sorted (x, Y(x)) sorted on X' |
| 160 D = {} | 163 D = {} |
| 161 for x, y in zip(X,Y): | 164 for x, y in zip(X,Y): |
