Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/processing.py @ 1072:c67f8c36ebc7
interaction extraction
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 19 Jul 2018 01:44:11 -0400 |
parents | 092bd9c7deaf |
children |
comparison
equal
deleted
inserted
replaced
1071:58994b08be42 | 1072:c67f8c36ebc7 |
---|---|
16 speeds[o.num] = np.mean(objspeeds) # km/h | 16 speeds[o.num] = np.mean(objspeeds) # km/h |
17 else: | 17 else: |
18 objectsNotInZone.append(o) | 18 objectsNotInZone.append(o) |
19 return speeds, objectsNotInZone | 19 return speeds, objectsNotInZone |
20 | 20 |
21 def extractVideoSequenceSpeeds(dbFilename, siteName, nObjects, startTime, frameRate, minUserDurationSeconds, aggMethods, aggCentiles): | 21 def extractVideoSequenceSpeeds(dbFilename, siteName, nObjects, startTime, frameRate, minDuration, aggMethods, aggCentiles): |
22 data = [] | 22 data = [] |
23 d = startTime.date() | 23 d = startTime.date() |
24 t1 = startTime.time() | 24 t1 = startTime.time() |
25 minUserDuration = minUserDurationSeconds*frameRate | |
26 print('Extracting speed from '+dbFilename) | 25 print('Extracting speed from '+dbFilename) |
27 aggFunctions, tmpheaders = utils.aggregationMethods(aggMethods, aggCentiles) | 26 aggFunctions, tmpheaders = utils.aggregationMethods(aggMethods, aggCentiles) |
28 objects = storage.loadTrajectoriesFromSqlite(dbFilename, 'object', nObjects) | 27 objects = storage.loadTrajectoriesFromSqlite(dbFilename, 'object', nObjects) |
29 for o in objects: | 28 for o in objects: |
30 if o.length() > minUserDuration: | 29 if o.length() > minDuration: |
31 row = [siteName, d, utils.framesToTime(o.getFirstInstant(), frameRate, t1), o.getUserType()] | 30 row = [siteName, d, utils.framesToTime(o.getFirstInstant(), frameRate, t1), o.getUserType()] |
32 tmp = o.getSpeeds() | 31 tmp = o.getSpeeds() |
33 for method,func in aggFunctions.items(): | 32 for method,func in aggFunctions.items(): |
34 aggSpeeds = frameRate*3.6*func(tmp) | 33 aggSpeeds = frameRate*3.6*func(tmp) |
35 if method == 'centile': | 34 if method == 'centile': |