comparison scripts/classify-objects.py @ 685:94b291a5f933 dev

several updates for display
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 05 Jun 2015 17:13:28 +0200
parents 6d2ece4aed7c
children cdee6a3a47b4
comparison
equal deleted inserted replaced
684:6d2ece4aed7c 685:94b291a5f933
10 10
11 # TODO add mode detection live 11 # TODO add mode detection live
12 12
13 parser = argparse.ArgumentParser(description='The program processes indicators for all pairs of road users in the scene') 13 parser = argparse.ArgumentParser(description='The program processes indicators for all pairs of road users in the scene')
14 parser.add_argument('--cfg', dest = 'configFilename', help = 'name of the configuration file', required = True) 14 parser.add_argument('--cfg', dest = 'configFilename', help = 'name of the configuration file', required = True)
15 parser.add_argument('-n', dest = 'nObjects', help = 'number of objects to classify', type = int, default = None)
15 parser.add_argument('--plot-speed-distributions', dest = 'plotSpeedDistribution', help = 'simply plots the distributions used for each user type', action = 'store_true') 16 parser.add_argument('--plot-speed-distributions', dest = 'plotSpeedDistribution', help = 'simply plots the distributions used for each user type', action = 'store_true')
16 parser.add_argument('--max-speed-distribution-plot', dest = 'maxSpeedDistributionPlot', help = 'if plotting the user distributions, the maximum speed to display', type = float, default = 50.) 17 parser.add_argument('--max-speed-distribution-plot', dest = 'maxSpeedDistributionPlot', help = 'if plotting the user distributions, the maximum speed to display', type = float, default = 50.)
17 #parser.add_argument('-u', dest = 'undistort', help = 'undistort the video (because features have been extracted that way)', action = 'store_true') 18 #parser.add_argument('-u', dest = 'undistort', help = 'undistort the video (because features have been extracted that way)', action = 'store_true')
18 #parser.add_argument('-f', dest = 'firstFrameNum', help = 'number of first frame number to display', type = int) 19 #parser.add_argument('-f', dest = 'firstFrameNum', help = 'number of first frame number to display', type = int)
19 #parser.add_argument('--last-frame', dest = 'lastFrameNum', help = 'number of last frame number to save (for image saving, no display is made)', type = int) 20 #parser.add_argument('--last-frame', dest = 'lastFrameNum', help = 'number of last frame number to save (for image saving, no display is made)', type = int)
58 plt.legend() 59 plt.legend()
59 plt.title('Probability Density Function') 60 plt.title('Probability Density Function')
60 plt.show() 61 plt.show()
61 sys.exit() 62 sys.exit()
62 63
63 objects = storage.loadTrajectoriesFromSqlite(params.databaseFilename, 'object') 64 objects = storage.loadTrajectoriesFromSqlite(params.databaseFilename, 'object', args.nObjects, withFeatures = True)
64 features = storage.loadTrajectoriesFromSqlite(params.databaseFilename, 'feature') 65 #features = storage.loadTrajectoriesFromSqlite(params.databaseFilename, 'feature')
65 intervals = [] 66 intervals = []
66 for obj in objects: 67 for obj in objects:
67 obj.setFeatures(features) 68 #obj.setFeatures(features)
68 intervals.append(obj.getTimeInterval()) 69 intervals.append(obj.getTimeInterval())
69 timeInterval = moving.unionIntervals(intervals) 70 timeInterval = moving.unionIntervals(intervals)
70 71
71 capture = cv2.VideoCapture(params.videoFilename) 72 capture = cv2.VideoCapture(params.videoFilename)
72 width = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)) 73 width = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH))