Mercurial Hosting > traffic-intelligence
comparison scripts/learn-motion-patterns.py @ 870:1535251a1f40
change consistent with method added to MovingObject
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 03 Feb 2017 16:15:06 -0500 |
parents | a414a7d58483 |
children | 8e8ec4ece66e |
comparison
equal
deleted
inserted
replaced
869:eb2f8ce2b39d | 870:1535251a1f40 |
---|---|
35 objects = storage.loadTrajectoriesFromSqlite(args.databaseFilename, trajectoryType, withFeatures = (args.trajectoryType == 'objectfeatures'), objectNumbers = args.nTrajectories, timeStep = args.positionSubsamplingRate) | 35 objects = storage.loadTrajectoriesFromSqlite(args.databaseFilename, trajectoryType, withFeatures = (args.trajectoryType == 'objectfeatures'), objectNumbers = args.nTrajectories, timeStep = args.positionSubsamplingRate) |
36 | 36 |
37 if args.trajectoryType == 'objectfeatures': | 37 if args.trajectoryType == 'objectfeatures': |
38 features = [] | 38 features = [] |
39 for o in objects: | 39 for o in objects: |
40 tmp = utils.sortByLength(o.getFeatures(), reverse = True) | 40 o.getNLongestFeatures(args.maxNObjectFeatures) |
41 features += tmp[:min(len(tmp), args.maxNObjectFeatures)] | |
42 objects = features | 41 objects = features |
43 | 42 |
44 trajectories = [o.getPositions().asArray().T for o in objects] | 43 trajectories = [o.getPositions().asArray().T for o in objects] |
45 | 44 |
46 lcss = utils.LCSS(metric = args.metric, epsilon = args.epsilon) | 45 lcss = utils.LCSS(metric = args.metric, epsilon = args.epsilon) |