Mercurial Hosting > traffic-intelligence
changeset 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 | b9ec0cc2677d |
children | 28526917a583 |
files | scripts/compute-clearmot.py |
diffstat | 1 files changed, 12 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/compute-clearmot.py Mon Jun 20 10:56:41 2016 -0400 +++ b/scripts/compute-clearmot.py Mon Jun 27 16:19:06 2016 -0400 @@ -23,6 +23,11 @@ parser.add_argument('--offset', dest = 'nFramesOffsetAnnotations', help = 'number of frames to offset the ground truth annotations', type = int) parser.add_argument('--displayOffset', dest = 'nFramesOffsetDisplay', help = 'number of frames to offset annotations and objects for display', type = int) parser.add_argument('--display', dest = 'display', help = 'display the ground truth to object matches (graphically)', action = 'store_true') +parser.add_argument('--undistort', dest = 'undistort', help = 'undistort the video (because features have been extracted that way)', action = 'store_true') +parser.add_argument('--intrinsic', dest = 'intrinsicCameraMatrixFilename', help = 'name of the intrinsic camera file') +parser.add_argument('--distortion-coefficients', dest = 'distortionCoefficients', help = 'distortion coefficients', nargs = '*', type = float) +parser.add_argument('--undistorted-multiplication', dest = 'undistortedImageMultiplication', help = 'undistorted image multiplication', type = float) + parser.add_argument('-i', dest = 'videoFilename', help = 'name of the video file (for display)') args = parser.parse_args() @@ -70,17 +75,13 @@ return shifted if args.display: - if args.nFramesOffsetDisplay is not None: - firstInstant = args.firstInstant+args.nFramesOffsetDisplay - lastInstant = args.lastInstant+args.nFramesOffsetDisplay - for a in annotations: - a.shiftTimeInterval(args.nFramesOffsetDisplay) - for o in objects: - o.shiftTimeInterval(args.nFramesOffsetDisplay) - gtMatches = shiftMatches(gtMatches, args.nFramesOffsetDisplay) - toMatches = shiftMatches(toMatches, args.nFramesOffsetDisplay) - 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) - + if args.undistort and args.intrinsicCameraMatrixFilename is not None: + intrinsicCameraMatrix = loadtxt(args.intrinsicCameraMatrixFilename) + else: + intrinsicCameraMatrix = None + firstInstant = args.firstInstant + lastInstant = args.lastInstant + 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) #print('Ground truth matches') #print(gtMatches) #print('Object matches')