comparison python/moving.py @ 993:e8eabef7857c

update to OpenCV3 for python
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 16 May 2018 21:06:52 -0400
parents f026ce2af637
children 8118c6b77d7c
comparison
equal deleted inserted replaced
992:2cd1ce245024 993:e8eabef7857c
1639 computes HOG on this cropped image (with parameters rescaleSize, orientations, pixelsPerCell, cellsPerBlock) 1639 computes HOG on this cropped image (with parameters rescaleSize, orientations, pixelsPerCell, cellsPerBlock)
1640 and applies the SVM model on it''' 1640 and applies the SVM model on it'''
1641 croppedImg = cvutils.imageBox(img, self, instant, width, height, px, py, minNPixels) 1641 croppedImg = cvutils.imageBox(img, self, instant, width, height, px, py, minNPixels)
1642 if croppedImg is not None and len(croppedImg) > 0: 1642 if croppedImg is not None and len(croppedImg) > 0:
1643 hog = cvutils.HOG(croppedImg, rescaleSize, orientations, pixelsPerCell, cellsPerBlock, blockNorm) 1643 hog = cvutils.HOG(croppedImg, rescaleSize, orientations, pixelsPerCell, cellsPerBlock, blockNorm)
1644 self.userTypes[instant] = int(self.appearanceClassifier.predict(hog)) 1644 self.userTypes[instant] = self.appearanceClassifier.predict(hog.reshape(1,hog.size))
1645 else: 1645 else:
1646 self.userTypes[instant] = userType2Num['unknown'] 1646 self.userTypes[instant] = userType2Num['unknown']
1647 1647
1648 def classifyUserTypeHoGSVM(self, pedBikeCarSVM = None, width = 0, height = 0, homography = None, images = None, bikeCarSVM = None, pedBikeSpeedTreshold = float('Inf'), bikeCarSpeedThreshold = float('Inf'), minSpeedEquiprobable = -1, speedProbabilities = None, aggregationFunc = median, maxPercentUnknown = 0.5, nInstantsIgnoredAtEnds = 0, px = 0.2, py = 0.2, minNPixels = 800, rescaleSize = (64, 64), orientations = 9, pixelsPerCell = (8,8), cellsPerBlock = (2,2)): 1648 def classifyUserTypeHoGSVM(self, pedBikeCarSVM = None, width = 0, height = 0, homography = None, images = None, bikeCarSVM = None, pedBikeSpeedTreshold = float('Inf'), bikeCarSpeedThreshold = float('Inf'), minSpeedEquiprobable = -1, speedProbabilities = None, aggregationFunc = median, maxPercentUnknown = 0.5, nInstantsIgnoredAtEnds = 0, px = 0.2, py = 0.2, minNPixels = 800, rescaleSize = (64, 64), orientations = 9, pixelsPerCell = (8,8), cellsPerBlock = (2,2)):
1649 '''Agregates SVM detections in each image and returns probability 1649 '''Agregates SVM detections in each image and returns probability