Mercurial Hosting > traffic-intelligence
comparison scripts/compute-clearmot.py @ 823:f6790357f53b
corrected bug for replay, replaying now from (potentially distorted) video
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 27 Jun 2016 16:19:06 -0400 |
parents | 3aa6102ccc12 |
children | 6b474db46b45 |
comparison
equal
deleted
inserted
replaced
817:b9ec0cc2677d | 823:f6790357f53b |
---|---|
21 parser.add_argument('-f', dest = 'firstInstant', help = 'first instant for measurement', required = True, type = int) | 21 parser.add_argument('-f', dest = 'firstInstant', help = 'first instant for measurement', required = True, type = int) |
22 parser.add_argument('-l', dest = 'lastInstant', help = 'last instant for measurement', required = True, type = int) | 22 parser.add_argument('-l', dest = 'lastInstant', help = 'last instant for measurement', required = True, type = int) |
23 parser.add_argument('--offset', dest = 'nFramesOffsetAnnotations', help = 'number of frames to offset the ground truth annotations', type = int) | 23 parser.add_argument('--offset', dest = 'nFramesOffsetAnnotations', help = 'number of frames to offset the ground truth annotations', type = int) |
24 parser.add_argument('--displayOffset', dest = 'nFramesOffsetDisplay', help = 'number of frames to offset annotations and objects for display', type = int) | 24 parser.add_argument('--displayOffset', dest = 'nFramesOffsetDisplay', help = 'number of frames to offset annotations and objects for display', type = int) |
25 parser.add_argument('--display', dest = 'display', help = 'display the ground truth to object matches (graphically)', action = 'store_true') | 25 parser.add_argument('--display', dest = 'display', help = 'display the ground truth to object matches (graphically)', action = 'store_true') |
26 parser.add_argument('--undistort', dest = 'undistort', help = 'undistort the video (because features have been extracted that way)', action = 'store_true') | |
27 parser.add_argument('--intrinsic', dest = 'intrinsicCameraMatrixFilename', help = 'name of the intrinsic camera file') | |
28 parser.add_argument('--distortion-coefficients', dest = 'distortionCoefficients', help = 'distortion coefficients', nargs = '*', type = float) | |
29 parser.add_argument('--undistorted-multiplication', dest = 'undistortedImageMultiplication', help = 'undistorted image multiplication', type = float) | |
30 | |
26 parser.add_argument('-i', dest = 'videoFilename', help = 'name of the video file (for display)') | 31 parser.add_argument('-i', dest = 'videoFilename', help = 'name of the video file (for display)') |
27 args = parser.parse_args() | 32 args = parser.parse_args() |
28 | 33 |
29 if args.homographyFilename is not None: | 34 if args.homographyFilename is not None: |
30 homography = loadtxt(args.homographyFilename) | 35 homography = loadtxt(args.homographyFilename) |
68 for k in matches: | 73 for k in matches: |
69 shifted[k] = {t+offset:v for t, v in matches[k].iteritems()} | 74 shifted[k] = {t+offset:v for t, v in matches[k].iteritems()} |
70 return shifted | 75 return shifted |
71 | 76 |
72 if args.display: | 77 if args.display: |
73 if args.nFramesOffsetDisplay is not None: | 78 if args.undistort and args.intrinsicCameraMatrixFilename is not None: |
74 firstInstant = args.firstInstant+args.nFramesOffsetDisplay | 79 intrinsicCameraMatrix = loadtxt(args.intrinsicCameraMatrixFilename) |
75 lastInstant = args.lastInstant+args.nFramesOffsetDisplay | 80 else: |
76 for a in annotations: | 81 intrinsicCameraMatrix = None |
77 a.shiftTimeInterval(args.nFramesOffsetDisplay) | 82 firstInstant = args.firstInstant |
78 for o in objects: | 83 lastInstant = args.lastInstant |
79 o.shiftTimeInterval(args.nFramesOffsetDisplay) | 84 cvutils.displayTrajectories(args.videoFilename, objects, {}, inv(homography), firstInstant, lastInstant, annotations = annotations, undistort = args.undistort, intrinsicCameraMatrix = intrinsicCameraMatrix, distortionCoefficients = args.distortionCoefficients, undistortedImageMultiplication = args.undistortedImageMultiplication, gtMatches = gtMatches, toMatches = toMatches) |
80 gtMatches = shiftMatches(gtMatches, args.nFramesOffsetDisplay) | |
81 toMatches = shiftMatches(toMatches, args.nFramesOffsetDisplay) | |
82 cvutils.displayTrajectories(args.videoFilename, objects, {}, inv(homography), firstInstant, lastInstant, annotations = annotations, gtMatches = gtMatches, toMatches = toMatches)#, rescale = args.rescale, nFramesStep = args.nFramesStep, saveAllImages = args.saveAllImages, undistort = (undistort or args.undistort), intrinsicCameraMatrix = intrinsicCameraMatrix, distortionCoefficients = distortionCoefficients, undistortedImageMultiplication = undistortedImageMultiplication) | |
83 | |
84 #print('Ground truth matches') | 85 #print('Ground truth matches') |
85 #print(gtMatches) | 86 #print(gtMatches) |
86 #print('Object matches') | 87 #print('Object matches') |
87 #rint toMatches | 88 #rint toMatches |