Mercurial > hg > nsaunier > traffic-intelligence
diff scripts/merge-features.py @ 1012:01db14e947e4
resolved
| author | Wendlasida |
|---|---|
| date | Fri, 01 Jun 2018 10:47:49 -0400 |
| parents | 933670761a57 |
| children | cc5cb04b04b0 |
line wrap: on
line diff
--- a/scripts/merge-features.py Fri Jun 01 10:43:23 2018 -0400 +++ b/scripts/merge-features.py Fri Jun 01 10:47:49 2018 -0400 @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 import sys, argparse, os.path, sqlite3 import cvutils, utils, moving, storage @@ -40,7 +40,7 @@ timeIntervals[cv] = moving.TimeInterval.unionIntervals([v.getTimeInterval() for v in videoSequences[cv]]) # intersection of the time interval (union) for each camera view -commonTimeInterval = timeIntervals.values()[0] +commonTimeInterval = list(timeIntervals.values())[0] for inter in timeIntervals.values()[1:]: commonTimeInterval = moving.TimeInterval.intersection(commonTimeInterval, inter) commonTimeInterval = moving.TimeInterval.intersection(commonTimeInterval, processInterval) @@ -71,8 +71,8 @@ newTrajectoryId = -1 # first frame num is commonTimeInterval -for cv, vs in videoSequences.iteritems(): - print cv.idx, cv.description +for cv, vs in videoSequences.items(): + print(cv.idx, cv.description) for videoSequence in vs: try: vsConnection = sqlite3.connect(dirname+os.path.sep+videoSequence.getDatabaseFilename()) @@ -93,7 +93,7 @@ for row in vsCursor: outCursor.execute(storage.insertTrajectoryQuery('velocities'), (featureIdCorrespondences[row[0]], row[1]-firstFrameNum, row[2], row[3])) # saving the id correspondences - for oldId, newId in featureIdCorrespondences.iteritems(): + for oldId, newId in featureIdCorrespondences.items(): outCursor.execute("INSERT INTO feature_correspondences (trajectory_id, source_dbname, db_trajectory_id) VALUES ({},\"{}\",{})".format(newId, videoSequence.name, oldId)) outConnection.commit() except sqlite3.OperationalError as error:
