Mercurial Hosting > traffic-intelligence
diff scripts/init-tracking.py @ 1021:16932cefabc1
work on paths in line with new configurations from tracker
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 05 Jun 2018 17:02:28 -0400 |
parents | 933670761a57 |
children | cc5cb04b04b0 |
line wrap: on
line diff
--- a/scripts/init-tracking.py Tue Jun 05 14:33:31 2018 -0400 +++ b/scripts/init-tracking.py Tue Jun 05 17:02:28 2018 -0400 @@ -11,6 +11,7 @@ parser = argparse.ArgumentParser(description='The program initilizes the files for tracking: copy tracking.cfg, sets up with the video filename, generates a frame image (frame.png) and prints the next commands') parser.add_argument('-i', dest = 'videoFilename', help = 'filename of the video sequence', required = True) +parser.add_argument('-n', dest = 'nFrames', help = 'number of frames to extract', type = int) args = parser.parse_args() @@ -45,12 +46,19 @@ print('Configuration file classifier.cfg successfully copied to the current directory') # extract image from video -image = getImagesFromVideo(args.videoFilename, saveImage = True, outputPrefix = 'frame') +if args.nFrames is not None: + image = getImagesFromVideo(args.videoFilename, 0, args.nFrames, saveImage = True, outputPrefix = 'frame') +else: + image = getImagesFromVideo(args.videoFilename, saveImage = True, outputPrefix = 'frame') print('first video frame successfully copied to the current directory') # next commands -print('--------------------------------------\nHere are a sample of the next command to compute the homography,\ntrack features, group them in objects and display object trajectories\n--------------------------------------') -print('compute_homography -i [frame.png] -w [world_image] -n [npoints] -u [unit_per_pixel]') +print('''-------------------------------------- +Here are a sample of the next command to compute the homography, +track features, group them in objects and display object trajectories +--------------------------------------''') +print('compute-homography -i [frame.png] -w [world_image] -n [npoints] -u [unit_per_pixel]') +print('(beware of camera distortion)') print('feature-based-tracking tracking.cfg --tf') print('feature-based-tracking tracking.cfg --gf') print('display-trajectories --cfg tracking.cfg -t object')