Mercurial Hosting > traffic-intelligence
comparison scripts/replay-event-annotation.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 | |
children | ba813f148ade |
comparison
equal
deleted
inserted
replaced
380:adfd4f70ee1d | 381:387cc0142211 |
---|---|
1 #! /usr/bin/env python | |
2 | |
3 import sys, argparse | |
4 | |
5 import storage, cvutils, utils | |
6 | |
7 import matplotlib.pylab as pylab | |
8 import matplotlib.pyplot as plt | |
9 import numpy as np | |
10 | |
11 | |
12 annotations = pylab.csv2rec(sys.argv[1]) | |
13 | |
14 frameRate = 30 | |
15 dirname = "/home/nicolas/Research/Data/montreal/infractions-pietons/" | |
16 videoDirnames = {'amherst': '2011-06-22-sherbrooke-amherst/', | |
17 'iberville': '2011-06-28-sherbrooke-iberville/'} | |
18 | |
19 # for amherst, subtract 40 seconds: add a delta | |
20 | |
21 for annotation in annotations: | |
22 video = annotation['video_name'].lower() | |
23 print('{} {}'.format(annotation['conflict_start_time'], annotation['conflict_end_time'])) | |
24 print(annotation['road_user_1']+' '+annotation['road_user_2']+' '+annotation['conflict_quality']) | |
25 print(annotation['comments']) | |
26 cvutils.playVideo(dirname+videoDirnames[video]+video+'-{}.avi'.format(annotation['video_start_time']), utils.timeToFrames(annotation['conflict_start_time'], frameRate), frameRate, True, False, annotation['road_user_1']+' '+annotation['road_user_2']+' '+annotation['conflict_quality']) |