def loadFile(self, filename): """ """ self.options = pvg_config(filename) self.updateTable() self.parent.sb.SetStatusText('Loaded file %s' % filename) return True
def loadFile(self, filename): debugprt(self, currentframe(), pgm, 'begin ') # debug """ """ print('$$$$$$ filename = ', filename) self.options = pvg_config(filename) print("$$$$$$ options = ", self.options) self.updateTable() print("$$$$$$ table updated") self.parent.sb.SetStatusText('Loaded file %s' % filename) print("$$$$$$ status bar message changed") debugprt(self, currentframe(), pgm, 'end ') # return True
parser.add_option('--snapshot', action="store_true", default=False, dest='snapshot', help="Save a snapshot to file") parser.add_option('--printinfo', action="store_true", default=False, dest='printinfo', help="Print some debug info about the camera") (options, args) = parser.parse_args() if options.configfile and options.monitor: opts = pvg_config(options.configfile) mon = int(options.monitor) _, source, track, mask_file, track_type, isSDMonitor = opts.GetMonitor( mon) resolution = opts.GetOption('FullSize') output_file = options.output_file or '' elif options.source: resolution = (800, 600) source = options.source # integer or filename or dirname track = options.mask_file and options.track_type mask_file = options.mask_file or splitext(options.source)[0] + '.msk' track_type = options.track_type output_file = options.output_file or splitext( options.source)[0] + '.txt'
parser.add_option('-m', '--monitor', dest='monitor', metavar="MON", help="Config mode | Load monitor MON from configfile") parser.add_option('-i', '--input', dest='source', metavar="SOURCE", help="File mode | Specify a source (camera number, file or folder)") parser.add_option('-k', '--mask', dest='mask_file', metavar="MASKFILE", help="File mode | Specify a maskfile to be used with file.") parser.add_option('-t', '--tracktype', dest='track_type', metavar="TT", help="File mode | Specify track type: 0, distance; 1, trikinetics; 2, coordinates") parser.add_option('-o', '--output', dest='outputFile', metavar="OUTFILE", help="All modes | Specify an output file where to store tracking results. A Mask must be loaded") parser.add_option('--showmask', action="store_true", default=False, dest='showROIs', help="Show the area limiting the ROIs") parser.add_option('--showpath', action="store_true", default=False, dest='showpath', help="Show the last steps of each fly as white line") parser.add_option('--showtime', action="store_true", default=False, dest='showtime', help="Show the frame timestamp") parser.add_option('--record', action="store_true", default=False, dest='record', help="Record the resulting video as avi file") parser.add_option('--trackonly', action="store_true", default=False, dest='trackonly', help="Does only the tracking, without showing the video") (options, args) = parser.parse_args() if options.configfile and options.monitor: opts = pvg_config(options.configfile) mon = int(options.monitor) _,source,track,mask_file,track_type,isSDMonitor = opts.GetMonitor(mon) resolution = opts.GetOption('FullSize') outputFile = options.outputFile or '' elif options.source: resolution = (640, 480) source = options.source # integer or filename or dirname track = options.mask_file and options.track_type mask_file = options.mask_file or splitext(options.source)[0]+'.msk' track_type = options.track_type outputFile = options.outputFile or splitext(options.source)[0]+'.txt' else:
if __name__ == '__main__': parser = optparse.OptionParser(usage='%prog [options] [argument]', version='%prog version 1.0') parser.add_option('-c', '--config', dest='config_file', metavar="CONFIG_FILE", help="The full path to the config file to open") (options, args) = parser.parse_args() configfile = options.config_file if configfile is None: print ('You need to specify the path to a config file') parser.print_help() exit(-1) try: option_file = pvg_config(configfile) except: print ('Problem with configuration file %s.' % configfile) exit(-1) monitorsData = option_file.getMonitorsData() print ( "Found %s monitors." % len(monitorsData) ) for mn in monitorsData: m = monitorsData[mn] at = acquireObject(mn, m['source'], m['resolution'], m['mask_file'], m['track'], m['track_type'], m['dataFolder']) at.keepGoing = True at.start() print ( "%s: Acquisition for monitor %s started." % ( time.ctime(), mn ))
parser.add_option('-c', '--config', dest='config_file', metavar="CONFIG_FILE", help="The full path to the config file to open") (options, args) = parser.parse_args() configfile = options.config_file if configfile is None: print('You need to specify the path to a config file') parser.print_help() exit(-1) try: option_file = pvg_config(configfile) except: print('Problem with configuration file %s.' % configfile) exit(-1) monitorsData = option_file.getMonitorsData() print("Found %s monitors." % len(monitorsData)) for mn in monitorsData: m = monitorsData[mn] at = acquireObject(mn, m['source'], m['resolution'], m['mask_file'], m['track'], m['track_type'], m['dataFolder']) at.start() print("%s: Acquisition for monitor %s started." % (ctime(), mn))