Mercurial Hosting > traffic-intelligence
diff scripts/classify-objects.py @ 807:52aa03260f03 opencv3
reversed all code to OpenCV 2.4.13
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 10 Jun 2016 15:26:19 -0400 |
parents | 8eb8a6bd70e8 |
children | 21f10332c72b |
line wrap: on
line diff
--- a/scripts/classify-objects.py Fri Jun 10 12:29:58 2016 -0400 +++ b/scripts/classify-objects.py Fri Jun 10 15:26:19 2016 -0400 @@ -4,7 +4,7 @@ import numpy as np import sys, argparse -from cv2.ml import SVM_RBF, SVM_C_SVC +#from cv2.ml import SVM_RBF, SVM_C_SVC import cv2 from scipy.stats import norm, lognorm @@ -12,8 +12,8 @@ parser = argparse.ArgumentParser(description='The program processes indicators for all pairs of road users in the scene') parser.add_argument('--cfg', dest = 'configFilename', help = 'name of the configuration file', required = True) -parser.add_argument('--kernel', dest = 'kernelType', help = 'kernel type for the support vector machine (SVM)', default = SVM_RBF, type = long) -parser.add_argument('--svm', dest = 'svmType', help = 'SVM type', default = SVM_C_SVC, type = long) +parser.add_argument('--kernel', dest = 'kernelType', help = 'kernel type for the support vector machine (SVM)', default = cv2.SVM_RBF, type = long) +parser.add_argument('--svm', dest = 'svmType', help = 'SVM type', default = cv2.SVM_C_SVC, type = long) parser.add_argument('-d', dest = 'databaseFilename', help = 'name of the Sqlite database file (overrides the configuration file)') parser.add_argument('-i', dest = 'videoFilename', help = 'name of the video file (overrides the configuration file)') parser.add_argument('-n', dest = 'nObjects', help = 'number of objects to classify', type = int, default = None) @@ -79,8 +79,8 @@ timeInterval = moving.TimeInterval.unionIntervals(intervals) capture = cv2.VideoCapture(videoFilename) -width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)) -height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)) +width = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)) +height = int(capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)) pastObjects = [] if params.undistort: # setup undistortion @@ -88,7 +88,7 @@ if capture.isOpened(): ret = True frameNum = timeInterval.first - capture.set(cv2.CAP_PROP_POS_FRAMES, frameNum) + capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, frameNum) lastFrameNum = timeInterval.last while ret and frameNum <= lastFrameNum: