Mercurial Hosting > traffic-intelligence
diff scripts/merge-features.py @ 837:e01cabca4c55
minor modifications to merge-features
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 06 Jul 2016 10:58:18 -0400 |
parents | 7058a40a4bbc |
children | 75530d8c0090 |
line wrap: on
line diff
--- a/scripts/merge-features.py Wed Jul 06 10:18:35 2016 -0400 +++ b/scripts/merge-features.py Wed Jul 06 10:58:18 2016 -0400 @@ -8,8 +8,8 @@ parser = argparse.ArgumentParser(description='The program merges feature trajectories recorded from the same site synchronously between start and end time.') parser.add_argument('-i', dest = 'metadataFilename', help = 'name of the metadata file', required = True) parser.add_argument('-n', dest = 'siteId', help = 'site id or site name', required = True) -parser.add_argument('--start', dest = 'startTime', help = 'time to start merging features (format %Y-%m-%d %H:%M:%S, eg 2011-06-22 10:00:39)') # if not provided, take common time interval -parser.add_argument('--end', dest = 'endTime', help = 'time to stop merging features (format %Y-%m-%d %H:%M:%S, eg 2011-06-22 10:00:39)') +parser.add_argument('-f', dest = 'startTime', help = 'time to start merging features (format %Y-%m-%d %H:%M:%S, eg 2011-06-22 10:00:39)') # if not provided, take common time interval +parser.add_argument('-l', dest = 'endTime', help = 'time to stop merging features (format %Y-%m-%d %H:%M:%S, eg 2011-06-22 10:00:39)') parser.add_argument('-o', dest = 'outputDBFilename', help = 'name of the output SQLite file', required = True) args = parser.parse_args() @@ -75,10 +75,7 @@ try: vsConnection = sqlite3.connect(dirname+os.path.sep+videoSequence.getDatabaseFilename()) vsCursor = vsConnection.cursor() - if commonTimeInterval.first < videoSequence.startTime: - firstFrameNum = -(videoSequence.startTime-commonTimeInterval.first).seconds*frameRate - else: - firstFrameNum = (commonTimeInterval.first-videoSequence.startTime).seconds*frameRate + firstFrameNum = utils.deltaFrames(videoSequence.startTime, commonTimeInterval.first, frameRate) lastFrameNum = (commonTimeInterval.last-videoSequence.startTime).seconds*frameRate # positions table vsCursor.execute('SELECT * FROM positions WHERE frame_number BETWEEN {} AND {} ORDER BY trajectory_id'.format(firstFrameNum, lastFrameNum))