Beispiel #1
0
    def __init__(self, screen_w, screen_h, screen_x, screen_y, proc_width,
                 proc_height, mask_img, model, keys, keys_to_onehot,
                 onehot_names):
        self.screen_w = screen_w
        self.screen_h = screen_h
        self.screen_x = screen_x
        self.screen_y = screen_y
        self.proc_width = proc_width
        self.proc_height = proc_height
        self.keys = keys
        self.keys_to_onehot = keys_to_onehot
        self.onehot_names = onehot_names
        self.paused = False
        self.mask = cv2.imread(mask_img, cv2.IMREAD_GRAYSCALE)
        self.model = model
        if self.mask is None:
            print "Image mask not found"
            exit(1)
        elif self.mask.shape[1] != proc_width or self.mask.shape[
                0] != proc_height:
            print "Image mask has invalid size"
            exit(1)
        self.scc = MyUtils.ScreenCapture({
            'width': screen_w,
            'top': screen_y,
            'height': screen_h,
            'left': screen_x
        })

        cv2.namedWindow("input", cv2.WINDOW_NORMAL)
Beispiel #2
0
 def start(self, interval, normalized_keys):
     self.scc = MyUtils.ScreenCapture({
         'width': self.screen_w,
         'top': self.screen_y,
         'height': self.screen_h,
         'left': self.screen_x
     })
     self.interval = interval
     self.last_time = time.time()
     self.normalized_keys = normalized_keys
     self.trainData = []
     self.loadRawData()
     self.paused = False