Mercurial Hosting > traffic-intelligence
comparison scripts/display-trajectories.py @ 364:a50a69e04c2a
script modification so that command line arguments take precedence over config file
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 12 Jul 2013 02:29:49 -0400 |
parents | 7b865f4174aa |
children | 1917db662aa7 |
comparison
equal
deleted
inserted
replaced
363:68861b52a319 | 364:a50a69e04c2a |
---|---|
15 parser.add_argument('-o', dest = 'homography', help = 'name of the image to world homography') | 15 parser.add_argument('-o', dest = 'homography', help = 'name of the image to world homography') |
16 parser.add_argument('-f', dest = 'firstFrameNum', help = 'number of first frame number to display', default = 0, type = int) | 16 parser.add_argument('-f', dest = 'firstFrameNum', help = 'number of first frame number to display', default = 0, type = int) |
17 | 17 |
18 args = parser.parse_args() | 18 args = parser.parse_args() |
19 | 19 |
20 homography = None | |
20 if args.configFilename: # consider there is a configuration file | 21 if args.configFilename: # consider there is a configuration file |
21 params = utils.TrackingParameters() | 22 params = utils.TrackingParameters() |
22 params.loadConfigFile(args.configFilename) | 23 params.loadConfigFile(args.configFilename) |
23 videoFilename = params.videoFilename | 24 videoFilename = params.videoFilename |
24 databaseFilename = params.databaseFilename | 25 databaseFilename = params.databaseFilename |
25 homography = inv(params.homography) | 26 homography = inv(params.homography) |
26 firstFrameNum = params.firstFrameNum | 27 firstFrameNum = params.firstFrameNum |
27 else: | 28 |
29 if args.videoFilename != None: | |
28 videoFilename = args.videoFilename | 30 videoFilename = args.videoFilename |
31 if args.databaseFilename != None: | |
29 databaseFilename = args.databaseFilename | 32 databaseFilename = args.databaseFilename |
30 homography = None | 33 if args.homography != None: |
31 if args.homography: | 34 homography = inv(loadtxt(args.homography)) |
32 homography = inv(loadtxt(args.homography)) | 35 if args.firstFrameNum != None: |
33 firstFrameNum = args.firstFrameNum | 36 firstFrameNum = args.firstFrameNum |
34 | 37 |
35 objects = storage.loadTrajectoriesFromSqlite(databaseFilename, args.trajectoryType) | 38 objects = storage.loadTrajectoriesFromSqlite(databaseFilename, args.trajectoryType) |
36 cvutils.displayTrajectories(videoFilename, objects, homography, firstFrameNum) | 39 cvutils.displayTrajectories(videoFilename, objects, homography, firstFrameNum) |