changeset 1007:192de96e5255

solved config filename bug
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 03 Jun 2018 14:14:13 -0400
parents 2cf861106d17
children a5f2309bb1ff
files python/cvutils.py scripts/process.py
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/python/cvutils.py	Sun Jun 03 00:44:35 2018 -0400
+++ b/python/cvutils.py	Sun Jun 03 14:14:13 2018 -0400
@@ -312,7 +312,7 @@
         if dryRun:
             print(cmd)
         else:
-            run(cmd, shell = True)
+            run(cmd)
         
     def displayTrajectories(videoFilename, objects, boundingBoxes = {}, homography = None, firstFrameNum = 0, lastFrameNumArg = None, printFrames = True, rescale = 1., nFramesStep = 1, saveAllImages = False, nZerosFilenameArg = None, undistort = False, intrinsicCameraMatrix = None, distortionCoefficients = None, undistortedImageMultiplication = 1., annotations = [], gtMatches = {}, toMatches = {}, colorBlind = False):
         '''Displays the objects overlaid frame by frame over the video '''
--- a/scripts/process.py	Sun Jun 03 00:44:35 2018 -0400
+++ b/scripts/process.py	Sun Jun 03 14:14:13 2018 -0400
@@ -25,6 +25,8 @@
 parser.add_argument('--process', dest = 'process', help = 'data to process', choices = ['feature', 'object', 'classification', 'interaction'])
 parser.add_argument('--display', dest = 'display', help = 'data to display (replay over video)', choices = ['feature', 'object', 'classification', 'interaction'])
 parser.add_argument('--analyze', dest = 'analyze', help = 'data to analyze (results)', choices = ['feature', 'object', 'classification', 'interaction'])
+parser.add_argument('--dry', dest = 'dryRun', help = 'dry run of processing', action = 'store_true')
+parser.add_argument('--nthreads', dest = 'nProcesses', help = 'number of processes to run in parallel', type = int, default = 1)
 
 # need way of selecting sites as similar as possible to sql alchemy syntax
 # override tracking.cfg from db
@@ -33,7 +35,6 @@
 
 # info of metadata
 
-parser.add_argument('--nthreads', dest = 'nProcesses', help = 'number of processes to run in parallel', type = int, default = 1)
 
 args = parser.parse_args()
 # files are relative to metadata location
@@ -71,15 +72,15 @@
     else:
         pool = Pool(args.nProcesses)
         for vs in videoSequences:
-            if not (parentDir/vs.getDatabaseFilename()).exists():
+            if not (parentDir/vs.getDatabaseFilename()).exists() or args.process == 'object':
                 if args.configFilename is None:
                     configFilename = str(parentDir/vs.cameraView.getTrackingConfigurationFilename())
                 else:
                     configFilename = args.configFilename
                 if vs.cameraView.cameraType is None:
-                    pool.apply_async(cvutils.tracking, args = (configFilename, args.process == 'object', str(parentDir.absolute()/vs.getVideoSequenceFilename()), str(parentDir.absolute()/vs.getDatabaseFilename()), str(parentDir.absolute()/vs.cameraView.getHomographyFilename()), str(parentDir.absolute()/vs.cameraView.getMaskFilename()), False, None, None))
+                    pool.apply_async(cvutils.tracking, args = (configFilename, args.process == 'object', str(parentDir.absolute()/vs.getVideoSequenceFilename()), str(parentDir.absolute()/vs.getDatabaseFilename()), str(parentDir.absolute()/vs.cameraView.getHomographyFilename()), str(parentDir.absolute()/vs.cameraView.getMaskFilename()), False, None, None, args.dryRun))
                 else:
-                    pool.apply_async(cvutils.tracking, args = (configFilename, args.process == 'object', str(parentDir.absolute()/vs.getVideoSequenceFilename()), str(parentDir.absolute()/vs.getDatabaseFilename()), str(parentDir.absolute()/vs.cameraView.getHomographyFilename()), str(parentDir.absolute()/vs.cameraView.getMaskFilename()), True, vs.cameraView.cameraType.intrinsicCameraMatrix, vs.cameraView.cameraType.distortionCoefficients))
+                    pool.apply_async(cvutils.tracking, args = (configFilename, args.process == 'object', str(parentDir.absolute()/vs.getVideoSequenceFilename()), str(parentDir.absolute()/vs.getDatabaseFilename()), str(parentDir.absolute()/vs.cameraView.getHomographyFilename()), str(parentDir.absolute()/vs.cameraView.getMaskFilename()), True, vs.cameraView.cameraType.intrinsicCameraMatrix, vs.cameraView.cameraType.distortionCoefficients, args.dryRun))
             else:
                 print('SQLite already exists: {}'.format(parentDir/vs.getDatabaseFilename()))
         pool.close()