Mercurial Hosting > traffic-intelligence
diff scripts/display-trajectories.py @ 1245:371c718e57d7
interface updates
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 08 Feb 2024 16:10:54 -0500 |
parents | cc5cb04b04b0 |
children | 2397de73770d |
line wrap: on
line diff
--- a/scripts/display-trajectories.py Thu Feb 08 15:04:56 2024 -0500 +++ b/scripts/display-trajectories.py Thu Feb 08 16:10:54 2024 -0500 @@ -1,6 +1,7 @@ #! /usr/bin/env python3 import sys, argparse +from math import inf from numpy.linalg import inv from numpy import loadtxt @@ -18,7 +19,7 @@ parser.add_argument('--undistorted-multiplication', dest = 'undistortedImageMultiplication', help = 'undistorted image multiplication', type = float) parser.add_argument('-u', dest = 'undistort', help = 'undistort the video (because features have been extracted that way)', action = 'store_true') parser.add_argument('-f', dest = 'firstFrameNum', help = 'number of first frame number to display', type = int) -parser.add_argument('-l', dest = 'lastFrameNum', help = 'number of last frame number to save (for image saving, no display is made)', type = int) +parser.add_argument('-l', dest = 'lastFrameNum', help = 'number of last frame number to save (for image saving, no display is made)', type = int, default = inf) parser.add_argument('-r', dest = 'rescale', help = 'rescaling factor for the displayed image', default = 1., type = float) parser.add_argument('-s', dest = 'nFramesStep', help = 'number of frames between each display', default = 1, type = int) parser.add_argument('-n', dest = 'nObjects', help = 'number of objects to display', type = int) @@ -26,7 +27,6 @@ parser.add_argument('--nzeros', dest = 'nZerosFilenameArg', help = 'number of digits in filenames', type = int) args = parser.parse_args() - params, videoFilename, databaseFilename, invHomography, intrinsicCameraMatrix, distortionCoefficients, undistortedImageMultiplication, undistort, firstFrameNum = storage.processVideoArguments(args) if args.homographyFilename is not None: @@ -39,6 +39,8 @@ undistortedImageMultiplication = args.undistortedImageMultiplication if args.firstFrameNum is not None: firstFrameNum = args.firstFrameNum +if args.lastFrameNum is not None: + lastFrameNum = args.lastFrameNum if args.nObjects is not None: nObjects = args.nObjects else: @@ -46,4 +48,4 @@ objects = storage.loadTrajectoriesFromSqlite(databaseFilename, args.trajectoryType, nObjects) boundingBoxes = storage.loadBoundingBoxTableForDisplay(databaseFilename) -cvutils.displayTrajectories(videoFilename, objects, boundingBoxes, invHomography, firstFrameNum, args.lastFrameNum, rescale = args.rescale, nFramesStep = args.nFramesStep, saveAllImages = args.saveAllImages, nZerosFilenameArg = args.nZerosFilenameArg, undistort = (undistort or args.undistort), intrinsicCameraMatrix = intrinsicCameraMatrix, distortionCoefficients = distortionCoefficients, undistortedImageMultiplication = undistortedImageMultiplication) +cvutils.displayTrajectories(videoFilename, objects, boundingBoxes, invHomography, firstFrameNum, lastFrameNum, rescale = args.rescale, nFramesStep = args.nFramesStep, saveAllImages = args.saveAllImages, nZerosFilenameArg = args.nZerosFilenameArg, undistort = (undistort or args.undistort), intrinsicCameraMatrix = intrinsicCameraMatrix, distortionCoefficients = distortionCoefficients, undistortedImageMultiplication = undistortedImageMultiplication)