Mercurial Hosting > traffic-intelligence
diff python/moving.py @ 929:be28a3538dc9
work in progress on projection
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 12 Jul 2017 18:00:53 -0400 |
parents | 063d1267585d |
children | 8ac7f61c6e4f |
line wrap: on
line diff
--- a/python/moving.py Wed Jul 12 01:24:31 2017 -0400 +++ b/python/moving.py Wed Jul 12 18:00:53 2017 -0400 @@ -1578,16 +1578,17 @@ # project feature positions if self.hasFeatures(): for f in self.getFeatures(): - f.projectedPositions = cvutils.projectArray(homography, f.getPositions().asArray(), intrinsicCameraMatrix, distortionCoefficients) + pp = cvutils.projectArray(homography, f.getPositions().asArray(), intrinsicCameraMatrix, array(distortionCoefficients)).tolist() + f.positions = Trajectory(pp) self.userTypes = {} - def classifyUserTypeHoGSVMAtInstant(self, img, instant, homography, width, height, px, py, minNPixels, rescaleSize, orientations, pixelsPerCell, cellsPerBlock, blockNorm): + def classifyUserTypeHoGSVMAtInstant(self, img, instant, width, height, px, py, minNPixels, rescaleSize, orientations, pixelsPerCell, cellsPerBlock, blockNorm): '''Extracts the image box around the object (of square size max(width, height) of the box around the features, with an added px or py for width and height (around the box)) computes HOG on this cropped image (with parameters rescaleSize, orientations, pixelsPerCell, cellsPerBlock) and applies the SVM model on it''' - croppedImg = cvutils.imageBox(img, self, instant, homography, width, height, px, py, minNPixels) + croppedImg = cvutils.imageBox(img, self, instant, width, height, px, py, minNPixels) if croppedImg is not None and len(croppedImg) > 0: hog = cvutils.HOG(croppedImg, rescaleSize, orientations, pixelsPerCell, cellsPerBlock, blockNorm, visualize=False, normalize=False) self.userTypes[instant] = int(self.appearanceClassifier.predict(hog))