comparison python/moving.py @ 904:8f60ecfc2f06

work in progress, almost ready
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 22 Jun 2017 18:08:46 -0400
parents 1fc901d983ed
children 3a06007a4bb7
comparison
equal deleted inserted replaced
903:81ee5aaf213d 904:8f60ecfc2f06
1581 '''Extracts the image box around the object 1581 '''Extracts the image box around the object
1582 (of square size max(width, height) of the box around the features, 1582 (of square size max(width, height) of the box around the features,
1583 with an added px or py for width and height (around the box)) 1583 with an added px or py for width and height (around the box))
1584 computes HOG on this cropped image (with parameters rescaleSize, orientations, pixelsPerCell, cellsPerBlock) 1584 computes HOG on this cropped image (with parameters rescaleSize, orientations, pixelsPerCell, cellsPerBlock)
1585 and applies the SVM model on it''' 1585 and applies the SVM model on it'''
1586 croppedImg, yCropMin, yCropMax, xCropMin, xCropMax = cvutils.imageBox(img, self, instant, homography, width, height, px, py, minNPixels) 1586 croppedImg = cvutils.imageBox(img, self, instant, homography, width, height, px, py, minNPixels)
1587 if croppedImg is not None and len(croppedImg) > 0: 1587 if croppedImg is not None and len(croppedImg) > 0:
1588 hog = cvutils.HOG(croppedImg, rescaleSize, orientations, pixelsPerCell, cellsPerBlock, blockNorm, visualize=False, normalize=False) 1588 hog = cvutils.HOG(croppedImg, rescaleSize, orientations, pixelsPerCell, cellsPerBlock, blockNorm, visualize=False, normalize=False)
1589 self.userTypes[instant] = int(self.appearanceClassifier.predict(hog)) 1589 self.userTypes[instant] = int(self.appearanceClassifier.predict(hog))
1590 else: 1590 else:
1591 self.userTypes[instant] = userType2Num['unknown'] 1591 self.userTypes[instant] = userType2Num['unknown']