Пример #1
0
    def __init__(self, i_viola_scale=0.5, i_img_resize_scale=1.0):

        self.__params = {'filter_size': 0, 'viola_scale': i_viola_scale}
        self.__normaliser = IplImageNormaliser()
        self.__normaliser.setParams(i_resize_scale=i_img_resize_scale,
                                    i_filter_size=self.__params['filter_size'],
                                    i_eq=False,
                                    i_roi=None)
        self.__roi_detector = ViolaJonesRoi(
            i_scale=self.__params['viola_scale'])
Пример #2
0
                if i_n_jitter > 0:
                    y = numpy.vstack([y, transforms[j]])
        o_images = x
        o_transforms = y
        o_n_jittered = n_jittered
        return (o_images, o_transforms, o_n_jittered)


if __name__ == "__main__":
    from PyQt4 import QtCore, QtGui
    from sys import stdin, exit, argv
    from qt_image_display import ImageDisplay
    from roi_detector import ViolaJonesRoi

    data = image_utils.Video2Numpy("recordings/calibration.avi", 1)
    detector = ViolaJonesRoi()
    #Compute a region of interest automatically
    face_roi = detector.compute(data)
    eye_roi = detector.convertFace2EyeRoi(face_roi)
    detector.setRoi(eye_roi)
    (min_row, min_col, max_row, max_col) = eye_roi

    roi = image_utils.Numpy2CvRect(min_row, min_col, max_row, max_col)
    #Setup normaliser
    normaliser = IplImageNormaliser()
    normaliser.setParams(i_resize_scale=1.,
                         i_filter_size=0,
                         i_eq=False,
                         i_roi=roi)
    center = cv.cvPoint2D32f(roi.x + roi.width / 2, roi.y + roi.height / 2)
    normaliser.setAffineTransform(center, i_scale=1., i_rot_angle=0)