Пример #1
0
 def _inst_event(self, ev_type, **kw):
     if ev_type == "fatal_error":
         self.abort()
     elif ev_type == "inst_ok":
         audio.say("ok")
     elif ev_type == "inst_fail":
         audio.say("failure")
Пример #2
0
    def stop(self):
        audio.say("Stopping Calibration")
        logger.info('Stopping Calibration')
        self.screen_marker_state = 0
        self.active = False
        self.close_window()
        self.button.status_text = ''

        cal_pt_cloud = calibrate.preprocess_data(self.pupil_list,
                                                 self.ref_list)

        logger.info("Collected %s data points." % len(cal_pt_cloud))

        if len(cal_pt_cloud) < 20:
            logger.warning("Did not collect enough data.")
            return

        cal_pt_cloud = np.array(cal_pt_cloud)
        map_fn, params = calibrate.get_map_from_cloud(cal_pt_cloud,
                                                      self.world_size,
                                                      return_params=True)
        np.save(os.path.join(self.g_pool.user_dir, 'cal_pt_cloud.npy'),
                cal_pt_cloud)

        #replace current gaze mapper with new
        self.g_pool.plugins.add(Simple_Gaze_Mapper(self.g_pool, params))
Пример #3
0
 def stop(self):
     audio.say("Stopping Calibration")
     logger.info("Stopping Calibration")
     self.active = False
     self.finish_calibration()
     self.g_pool.quickbar.remove(self.calib_button)
     self.notify_all({'subject': 'calibration.stopped'})
Пример #4
0
    def start(self):
        # ##############
        # DEBUG
        # self.stop()

        audio.say("Starting Calibration")
        logger.info("Starting Calibration")
        self.sites = [
            (0.25, 0.5),
            (0, 0.5),
            (0.0, 1.0),
            (0.5, 1.0),
            (1.0, 1.0),
            (1.0, 0.5),
            (1.0, 0.0),
            (0.5, 0.0),
            (0.0, 0.0),
            (0.75, 0.5),
        ]

        self.active_site = 0
        self.active = True
        self.ref_list = []
        self.pupil_list = []
        self.clicks_to_close = 5
        self.open_window("Calibration")
Пример #5
0
def say(oclock):
    """say the time in English"""
    c = oclock
    if c > 12:
        c -= 12
    cs = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve'][c]
    audio.say("it's " + cs + " o'clock.")
Пример #6
0
    def start(self):
        if not self.g_pool.capture.online:
            logger.error("Calibration required world capture video input.")
            return
        audio.say("Starting Calibration")
        logger.info("Starting Calibration")
        if self.g_pool.detection_mapping_mode == '3d':
            self.sites = [  (.5, .5),
                            (0.,1.),(1.,1.),
                            (1., 0.),(0.,0.)]

        else:
            self.sites = [  
                            (0., .70), (.25, .70),  (.5, .70), (.75, .70), (1.,.70),
                            (0,.5), (.25, .5),(.5,.5), (.75,.5),(1.,.5),
                            (0,.35), (.25, .35),(.5,.35), (.75,.35),(1.,.35),
                            (0.,.25), (.25, .25), (.5, .25), (.75, .25), (1., .25),
                            (0.2,0.), (.8,0.)
                       ]



        self.calGlint = self.g_pool.calGlint
        self.active_site = 0
        self.active_site = self.sites.pop(0)
        self.active = True
        self.ref_list = []
        self.pupil_list = []
        self.glint_list = []
        self.glint_pupil_list =[]
        self.clicks_to_close = 5
        self.open_window("Calibration")
Пример #7
0
 def start(self):
     self.notify_all({'subject': 'calibration.started'})
     audio.say("Starting Calibration")
     logger.info("Starting Calibration")
     self.active = True
     self.ref_list = []
     self.pupil_list = []
Пример #8
0
 def start(self):
     super().start()
     audio.say("Starting {}".format(self.mode_pretty))
     logger.info("Starting {}".format(self.mode_pretty))
     self.active = True
     self.ref_list = []
     self.pupil_list = []
Пример #9
0
 def start(self):
     self.active = True
     audio.say("Starting Calibration")
     logger.info("Starting Calibration")
     self.notify_all({'subject':'calibration.started'})
     self.pupil_list = []
     self.ref_list = []
 def start(self):
     audio.say("Starting Calibration")
     self.global_calibrate.value = True
     self.shared_pos[:] = 0,0
     self.active = True
     self._bar.remove("start")
     self._bar.add_button("stop", self.stop, key='c')
Пример #11
0
    def start_server(self, new_address):
        self.thread_pipe.send_string("Bind", flags=zmq.SNDMORE)
        self.thread_pipe.send_string(new_address)
        response = self.thread_pipe.recv_string()
        msg = self.thread_pipe.recv_string()
        if response == "Bind OK":
            host, port = msg.split(":")
            self.host = host
            self.port = int(port)
            return

        # fail logic
        logger.error(msg)

        # for service we shut down
        if self.g_pool.app == "service":
            audio.say("Error: Port already in use.")
            self.notify_all({"subject": "service_process.should_stop"})
            return

        # for capture we try to bind to a arbitrary port on the first external interface
        else:
            self.thread_pipe.send_string("Bind", flags=zmq.SNDMORE)
            self.thread_pipe.send_string("tcp://*:*")
            response = self.thread_pipe.recv_string()
            msg = self.thread_pipe.recv_string()
            if response == "Bind OK":
                host, port = msg.split(":")
                self.host = host
                self.port = int(port)
            else:
                logger.error(msg)
                raise Exception("Could not bind to port")
Пример #12
0
    def start(self):
        if not self.g_pool.capture.online:
            logger.error("Calibration required world capture video input.")
            return
        audio.say("Starting Calibration")
        logger.info("Starting Calibration")
        if self.g_pool.detection_mapping_mode == '3d':
            self.sites = [  (.5, .5),
                            (0.,1.),(1.,1.),
                            (1., 0.),(0.,0.)]

        else:
            self.sites = [  (.25, .5), (0,.5),
                        (0.,1.),(.5,1.),(1.,1.),
                        (1.,.5),
                        (1., 0.),(.5, 0.),(0.,0.),
                        (.75,.5)]


        self.active_site = self.sites.pop(0)
        self.active = True
        self.ref_list = []
        self.pupil_list = []
        self.clicks_to_close = 5
        self.open_window("Calibration")
Пример #13
0
    def start_server(self, new_address):
        self.thread_pipe.send_multipart(('Bind', "tcp://" + new_address))
        response, msg = self.thread_pipe.recv_multipart()
        if response == 'Bind OK':
            host, port = msg.split(':')
            self.host = host
            self.port = port
            return

        #fail logic
        logger.error(msg)

        #for service we shut down
        if self.g_pool.app == 'service':
            audio.say("Error: Port already in use.")
            self.notify_all({'subject': 'service_process.should_stop'})
            return

        #for capture we try to bind to a arbitrary port on the first external interface
        else:
            self.thread_pipe.send_multipart(('Bind', "tcp://*:*"))
            response, msg = self.thread_pipe.recv_multipart()
            if response == 'Bind OK':
                host, port = msg.split(':')
                self.host = host
                self.port = port
            else:
                logger.error(msg)
                raise Exception("Could not bind to port")
Пример #14
0
    def start(self):
        if not self.g_pool.capture.online:
            logger.error("{} requireds world capture video input.".format(
                self.mode_pretty))
            return
        super().start()
        audio.say("Starting {}".format(self.mode_pretty))
        logger.info("Starting {}".format(self.mode_pretty))

        if self.g_pool.detection_mapping_mode == '3d':
            if self.mode == 'calibration':
                self.sites = [(.5, .5), (0., 1.), (1., 1.), (1., 0.), (0., 0.)]
            else:
                self.sites = [(.25, .5), (.5, .25), (.75, .5), (.5, .75)]
        else:
            if self.mode == 'calibration':
                self.sites = [(.25, .5), (0, .5), (0., 1.), (.5, 1.), (1., 1.),
                              (1., .5), (1., 0.), (.5, 0.), (0., 0.),
                              (.75, .5)]
            else:
                self.sites = [(.5, .5), (.25, .25), (.25, .75), (.75, .75),
                              (.75, .25)]

        self.active_site = self.sites.pop(0)
        self.active = True
        self.ref_list = []
        self.pupil_list = []
        self.clicks_to_close = 5
        self.open_window(self.mode_pretty)
Пример #15
0
    def start_server(self,new_address):
        #addes needs to be a byte array for zmq
        new_address = new_address.encode('utf-8')

        self.thread_pipe.send_multipart(('Bind',"tcp://"+new_address))
        response,msg = self.thread_pipe.recv_multipart()
        if response == 'Bind OK' :
            host,port = msg.split(':')
            self.host = host
            self.port = port
            return

        #fail logic
        logger.error(msg)

        #for service we shut down
        if self.g_pool.app == 'service':
            audio.say("Error: Port already in use.")
            self.notify_all({'subject':'service_process.should_stop'})
            return

        #for capture we try to bind to a arbitrary port on the first external interface
        else:
            self.thread_pipe.send_multipart(('Bind',"tcp://*:*"))
            response,msg = self.thread_pipe.recv_multipart()
            if response == 'Bind OK' :
                host,port = msg.split(':')
                self.host = host
                self.port = port
            else:
                logger.error(msg)
                raise Exception("Could not bind to port")
Пример #16
0
    def start(self):
        # ##############
        # DEBUG
        #self.stop()

        audio.say("Starting Calibration")
        logger.info("Starting Calibration")
        if self.g_pool.detection_mapping_mode == '3d':
            self.sites = [  (.5, .5),
                            (0.,1.),(1.,1.),
                            (1., 0.),(0.,0.)]

        else:
            self.sites = [  (.25, .5), (0,.5),
                        (0.,1.),(.5,1.),(1.,1.),
                        (1.,.5),
                        (1., 0.),(.5, 0.),(0.,0.),
                        (.75,.5)]


        self.active_site = self.sites.pop(0)
        self.active = True
        self.ref_list = []
        self.pupil_list = []
        self.clicks_to_close = 5
        self.open_window("Calibration")
Пример #17
0
    def start_server(self, new_address):
        self.thread_pipe.send_string("Bind", flags=zmq.SNDMORE)
        self.thread_pipe.send_string(new_address)
        response = self.thread_pipe.recv_string()
        msg = self.thread_pipe.recv_string()
        if response == "Bind OK":
            host, port = msg.split(":")
            self.host = host
            self.port = int(port)
            return

        # fail logic
        logger.error(msg)

        # for service we shut down
        if self.g_pool.app == "service":
            audio.say("Error: Port already in use.")
            self.notify_all({"subject": "service_process.should_stop"})
            return

        # for capture we try to bind to a arbitrary port on the first external interface
        else:
            self.thread_pipe.send_string("Bind", flags=zmq.SNDMORE)
            self.thread_pipe.send_string("tcp://*:*")
            response = self.thread_pipe.recv_string()
            msg = self.thread_pipe.recv_string()
            if response == "Bind OK":
                host, port = msg.split(":")
                self.host = host
                self.port = int(port)
            else:
                logger.error(msg)
                raise Exception("Could not bind to port")
Пример #18
0
    def stop(self):
        audio.say("Stopping  {}".format(self.mode_pretty))
        logger.info('Stopping  {}'.format(self.mode_pretty))
        self.screen_marker_state = 0
        self.active = False
        self.button.status_text = ''

        logger.info("Calibration took {} seconds.".format(self.end_time -
                                                          self.start_time))

        if self.mode == 'calibration':
            # Store array of logged finger positions to a file
            if self.finger_log_enabled:
                file = open(
                    'finger_calibration_points_' +
                    time.strftime('%Y-%m-%d_%H:%M:%S', time.gmtime()) + '.txt',
                    'w')
                file.write('\n'.join(str(e[0]) for e in self.finger_log))
                file.close()
            finish_calibration(self.g_pool, self.pupil_list, self.ref_list)
        elif self.mode == 'accuracy_test':
            if self.finger_log_enabled:
                file = open(
                    'finger_accuracy_test_points_' +
                    time.strftime('%Y-%m-%d_%H:%M:%S', time.gmtime()) + '.txt',
                    'w')
                file.write('\n'.join(str(e[0]) for e in self.finger_log))
                file.close()
            self.finish_accuracy_test(self.pupil_list, self.ref_list)
        super().stop()
Пример #19
0
 def start(self):
     super().start()
     audio.say("Starting {}".format(self.mode_pretty))
     logger.info("Starting {}".format(self.mode_pretty))
     self.active = True
     self.ref_list = []
     self.pupil_list = []
Пример #20
0
 def _inst_event(self, ev_type, **kw):
     if ev_type == "fatal_error":
         self.abort()
     elif ev_type == "inst_ok":
         audio.say("ok")
     elif ev_type == "inst_fail":
         audio.say("failure")
Пример #21
0
 def stop(self):
     audio.say("Stopping Calibration")
     logger.info("Stopping Calibration")
     self.active = False
     self.button.status_text = ''
     finish_calibration(self.g_pool,self.pupil_list,self.ref_list)
     # Mohammad: send a notification that calibration stopped to be caught by CRowd eye plugin
     self.notify_all( {'subject':'cal_stopped'} )
Пример #22
0
 def calculate(self):
     self.calculated = True
     rms, camera_matrix, dist_coefs, rvecs, tvecs = cv2.calibrateCamera(np.array(self.obj_points), np.array(self.img_points),self.g_pool.capture.frame_size)
     logger.info("Calibrated Camera, RMS:%s"%rms)
     np.save(os.path.join(self.g_pool.user_dir,'camera_matrix.npy'), camera_matrix)
     np.save(os.path.join(self.g_pool.user_dir,"dist_coefs.npy"), dist_coefs)
     audio.say("Camera calibrated. Calibration saved to user folder")
     logger.info("Camera calibrated. Calibration saved to user folder")
Пример #23
0
 def stop(self):
     audio.say("Stopping Calibration")
     logger.info("Stopping Calibration")
     self.screen_marker_state = 0
     self.active = False
     # self.close_window()
     self.button.status_text = ""
     finish_calibration(self.g_pool, self.pupil_list, self.ref_list)
Пример #24
0
 def stop(self):
     audio.say("Stopping Calibration")
     logger.info('Stopping Calibration')
     self.screen_marker_state = 0
     self.active = False
     #self.close_window()
     self.button.status_text = ''
     finish_calibration(self.g_pool, self.pupil_list, self.ref_list)
 def stop(self):
     audio.say("Stopping Calibration")
     self.screen_marker_state = 0
     self.shared_screen_marker_state.value = 0
     self.global_calibrate.value = False
     self.reset()
     self.publish()
     self.active = False
Пример #26
0
    def stop(self):
        audio.say("Stopping Calibration")
        logger.info("Stopping Calibration")
        self.notify_all({'subject':'calibration.stopped'})
        self.active = False
        if self.button:
            self.button.status_text = ''

        pupil_list = self.pupil_list
        ref_list = self.ref_list
        hmd_video_frame_size = self.hmd_video_frame_size

        g_pool = self.g_pool

        pupil0 = [p for p in pupil_list if p['id']==0]
        pupil1 = [p for p in pupil_list if p['id']==1]

        ref0 = [r for r in ref_list if r['id']==0]
        ref1 = [r for r in ref_list if r['id']==1]

        matched_pupil0_data = calibrate.closest_matches_monocular(ref0,pupil0)
        matched_pupil1_data = calibrate.closest_matches_monocular(ref1,pupil1)

        if matched_pupil0_data:
            cal_pt_cloud = calibrate.preprocess_2d_data_monocular(matched_pupil0_data)
            map_fn0,inliers0,params0 = calibrate.calibrate_2d_polynomial(cal_pt_cloud,hmd_video_frame_size,binocular=False)
            if not inliers0.any():
                self.notify_all({'subject':'calibration.failed','reason':solver_failed_to_converge_error_msg})
                return
        else:
            logger.warning('No matched ref<->pupil data collected for id0')
            params0 = None

        if matched_pupil1_data:
            cal_pt_cloud = calibrate.preprocess_2d_data_monocular(matched_pupil1_data)
            map_fn1,inliers1,params1 = calibrate.calibrate_2d_polynomial(cal_pt_cloud,hmd_video_frame_size,binocular=False)
            if not inliers1.any():
                self.notify_all({'subject':'calibration.failed','reason':solver_failed_to_converge_error_msg})
                return
        else:
            logger.warning('No matched ref<->pupil data collected for id1')
            params1 = None

        if params0 and params1:
            g_pool.plugins.add(Dual_Monocular_Gaze_Mapper,args={'params0':params0,'params1':params1})
            method = 'dual monocular polynomial regression'
        elif params0:
            g_pool.plugins.add(Monocular_Gaze_Mapper,args={'params':params0})
            method = 'monocular polynomial regression'
        elif params1:
            g_pool.plugins.add(Monocular_Gaze_Mapper,args={'params':params1})
            method = 'monocular polynomial regression'
        else:
            logger.error('Calibration failed for both eyes. No data found')
            self.notify_all({'subject':'calibration.failed','reason':not_enough_data_error_msg})
            return

        self.notify_all({'subject':'calibration.successful','method':method})
Пример #27
0
    def stop(self):
        audio.say("Stopping Calibration")
        logger.info("Stopping Calibration")
        self.notify_all({'subject':'calibration.stopped'})
        self.active = False
        if self.button:
            self.button.status_text = ''

        pupil_list = self.pupil_list
        ref_list = self.ref_list
        hmd_video_frame_size = self.hmd_video_frame_size

        g_pool = self.g_pool

        pupil0 = [p for p in pupil_list if p['id']==0]
        pupil1 = [p for p in pupil_list if p['id']==1]

        ref0 = [r for r in ref_list if r['id']==0]
        ref1 = [r for r in ref_list if r['id']==1]

        matched_pupil0_data = calibrate.closest_matches_monocular(ref0,pupil0)
        matched_pupil1_data = calibrate.closest_matches_monocular(ref1,pupil1)

        if matched_pupil0_data:
            cal_pt_cloud = calibrate.preprocess_2d_data_monocular(matched_pupil0_data)
            map_fn0,inliers0,params0 = calibrate.calibrate_2d_polynomial(cal_pt_cloud,hmd_video_frame_size,binocular=False)
            if not inliers0.any():
                self.notify_all({'subject':'calibration.failed','reason':solver_failed_to_converge_error_msg})
                return
        else:
            logger.warning('No matched ref<->pupil data collected for id0')
            params0 = None

        if matched_pupil1_data:
            cal_pt_cloud = calibrate.preprocess_2d_data_monocular(matched_pupil1_data)
            map_fn1,inliers1,params1 = calibrate.calibrate_2d_polynomial(cal_pt_cloud,hmd_video_frame_size,binocular=False)
            if not inliers1.any():
                self.notify_all({'subject':'calibration.failed','reason':solver_failed_to_converge_error_msg})
                return
        else:
            logger.warning('No matched ref<->pupil data collected for id1')
            params1 = None

        if params0 and params1:
            g_pool.plugins.add(Dual_Monocular_Gaze_Mapper,args={'params0':params0,'params1':params1})
            method = 'dual monocular polynomial regression'
        elif params0:
            g_pool.plugins.add(Monocular_Gaze_Mapper,args={'params':params0})
            method = 'monocular polynomial regression'
        elif params1:
            g_pool.plugins.add(Monocular_Gaze_Mapper,args={'params':params1})
            method = 'monocular polynomial regression'
        else:
            logger.error('Calibration failed for both eyes. No data found')
            self.notify_all({'subject':'calibration.failed','reason':not_enough_data_error_msg})
            return

        self.notify_all({'subject':'calibration.successful','method':method})
 def recognized_callback(self, gID):
     print "Recognized Callback", gID
     if self.sound:
         try:
             audio.say("Geeste " + str(gID))
         except:
             pass
     self.body.clear()
     self.body.text([10,20], unicode(str(gID)), font=u'LatinBold19')
 def stop(self):
     audio.say("Stopping Calibration")
     self.global_calibrate.value = False
     self.shared_pos[:] = 0,0
     self.smooth_pos = 0,0
     self.counter = 0
     self.active = False
     self._bar.remove("stop")
     self._bar.add_button("start", self.stop, key='c')
Пример #30
0
 def start(self,hmd_video_frame_size,outlier_threshold):
     self.active = True
     audio.say("Starting Calibration")
     logger.info("Starting Calibration")
     self.notify_all({'subject':'calibration.started'})
     self.pupil_list = []
     self.ref_list = []
     self.hmd_video_frame_size = hmd_video_frame_size
     self.outlier_threshold = outlier_threshold
Пример #31
0
 def start(self, hmd_video_frame_size, outlier_threshold):
     self.active = True
     audio.say("Starting Calibration")
     logger.info("Starting Calibration")
     self.notify_all({'subject': 'calibration.started'})
     self.pupil_list = []
     self.ref_list = []
     self.hmd_video_frame_size = hmd_video_frame_size
     self.outlier_threshold = outlier_threshold
Пример #32
0
def about():
    try:
        audio.say(u'Smart Clock, Version One point zero ')
    except:
        pass
    appuifw.note(
        u"SmartClock \nVersion 1.0\n\nCreated By Taha M \nThe Series 60 Weblog",
        "info")
    appuifw.note(u"For updates and more info, visit series-sixty.blogspot.com")
 def start(self):
     audio.say("Starting Calibration")
     logger.info("Starting Calibration")
     self.active = True
     self.ref_list = []
     self.pupil_list = []
     self.glint_pupil_list =[]
     self.glint_list =[]
     self.calGlint = self.g_pool.calGlint
Пример #34
0
 def stop(self):
     self.notify_all({'subject':'calibration.stopped'})
     audio.say("Stopping Calibration")
     logger.info('Stopping Calibration')
     self.screen_marker_state = 0
     self.active = False
     #self.close_window()
     self.button.status_text = ''
     finish_calibration(self.g_pool,self.pupil_list,self.ref_list)
Пример #35
0
    def endOfPlay(self, prevStat, newStat, error):
        if error == 0:
          if newStat == audio.EOpen and prevStat == audio.EPlaying:
            currentBookPartIndex = self.currentBook.currentBookPartIndex
            if currentBookPartIndex < len(self.currentBook.bookParts) - 1:        	    
                self.SetCurrentBookPart(currentBookPartIndex + 1)
	        self.Play()
            else:
                audio.say(u"Congradulations, you finished yet another book.")
Пример #36
0
 def calculate(self):
     self.calculated = True
     camera_matrix, dist_coefs = _calibrate_camera(np.asarray(self.img_points),
                                                 np.asarray(self.obj_points),
                                                 (self.img_shape[1], self.img_shape[0]))
     np.save(os.path.join(self.g_pool.user_dir,'camera_matrix.npy'), camera_matrix)
     np.save(os.path.join(self.g_pool.user_dir,"dist_coefs.npy"), dist_coefs)
     audio.say("Camera calibrated. Calibration saved to user folder")
     logger.info("Camera calibrated. Calibration saved to user folder")
Пример #37
0
 def recognized_callback(self, gID):
     print "Recognized Callback", gID
     if self.sound:
         try:
             audio.say("Geeste " + str(gID))
         except:
             pass
     self.body.clear()
     self.body.text([10, 20], unicode(str(gID)), font=u'LatinBold19')
Пример #38
0
def scan():
	hosts = wlantools.scan()
	s=u""
	for i in hosts:
		if i['SecurityMode']=="Open":
			say.play()
			audio.say(u"network found" + i['SSID'])
			s=s+i['SSID']+u"\n"
			appuifw.note(s, 'info')
	timer.after(120, scan)
    def stop(self):
        audio.say("Stopping Calibration")
        logger.info("Stopping Calibration")
        self.active = False
        self.button.status_text = ''

        base_dir = self.g_pool.user_dir.rsplit(os.path.sep,1)[0]
        dir = makeCalibDir(base_dir)

        finish_calibration(self.g_pool,self.pupil_list,self.ref_list, dir = dir)
Пример #40
0
 def stop(self):
     # TODO: redundancy between all gaze mappers -> might be moved to parent class
     audio.say("Stopping Calibration")
     logger.info("Stopping Calibration")
     self.smooth_pos = 0,0
     self.counter = 0
     self.close_window()
     self.active = False
     self.button.status_text = ''
     finish_calibration(self.g_pool,self.pupil_list,self.ref_list)
Пример #41
0
 def stop(self):
     audio.say("Stopping Calibration")
     logger.info("Stopping Calibration")
     self.active = False
     self.finish_calibration()
     try:
         self.g_pool.quickbar.remove(self.calib_button)
     except AttributeError:
         pass  # quickbar and calib_button are not defined in Service
     self.notify_all({'subject': 'calibration.stopped'})
 def stop(self):
     audio.say("Stopping  {}".format(self.mode_pretty))
     logger.info("Stopping  {}".format(self.mode_pretty))
     self.active = False
     self.button.status_text = ""
     if self.mode == "calibration":
         finish_calibration(self.g_pool, self.pupil_list, self.ref_list)
     elif self.mode == "accuracy_test":
         self.finish_accuracy_test(self.pupil_list, self.ref_list)
     super().stop()
Пример #43
0
 def stop(self):
     # TODO: redundancy between all gaze mappers -> might be moved to parent class
     audio.say("Stopping Calibration")
     logger.info("Stopping Calibration")
     self.smooth_pos = 0, 0
     self.counter = 0
     self.close_window()
     self.active = False
     self.button.status_text = ''
     finish_calibration(self.g_pool, self.pupil_list, self.ref_list)
 def stop(self):
     self.button.status_text = ''
     audio.say('Stopping  {}'.format(self.mode_pretty))
     logger.info('Stopping  {}'.format(self.mode_pretty))
     self.active = False
     if self.mode == 'calibration':
         finish_calibration(self.g_pool, self.pupil_list, self.ref_list)
     elif self.mode == 'accuracy_test':
         self.finish_accuracy_test(self.pupil_list, self.ref_list)
     super().stop()
 def start(self):
     super().start()
     audio.say("Starting {}".format(self.mode_pretty))
     logger.info("Startingo {}".format(self.mode_pretty))
     self.active = True
     self.ref_list = []
     self.pupil_list = []
     self.ts_filename = os.path.join(self.base_dir, f"marker_center.csv")
     print('BASE DIR: ' + self.ts_filename)
     self.ts_file = open(self.ts_filename, 'a+')
Пример #46
0
 def start(self, hmd_video_frame_size, outlier_threshold):
     audio.say("Starting Calibration")
     logger.info("Starting Calibration")
     self.active = True
     self.pupil_list = []
     self.ref_list = []
     self.hmd_video_frame_size = hmd_video_frame_size
     self.outlier_threshold = outlier_threshold
     self.g_pool.quickbar.insert(0, self.calib_button)
     self.notify_all({'subject': 'calibration.started'})
Пример #47
0
 def stop(self):
     audio.say("Stopping  {}".format(self.mode_pretty))
     logger.info("Stopping  {}".format(self.mode_pretty))
     self.active = False
     self.button.status_text = ""
     if self.mode == "calibration":
         finish_calibration(self.g_pool, self.pupil_list, self.ref_list)
     elif self.mode == "accuracy_test":
         self.finish_accuracy_test(self.pupil_list, self.ref_list)
     super().stop()
Пример #48
0
 def stop(self):
     audio.say("Stopping Calibration")
     logger.info("Stopping Calibration")
     self.active = False
     self.finish_calibration()
     try:
         self.g_pool.quickbar.remove(self.calib_button)
     except AttributeError:
         pass  # quickbar and calib_button are not defined in Service
     self.notify_all({"subject": "calibration.stopped"})
Пример #49
0
    def start(self):
        if not self.g_pool.capture.online:
            logger.error("This calibration requires world capture video input.")
            return
        super().start()
        audio.say("Starting Fingertip Calibration")
        logger.info("Starting Fingertip Calibration")

        self.active = True
        self.ref_list = []
        self.pupil_list = []
Пример #50
0
 def start(self):
     audio.say("Starting Accuracy Test")
     logger.info("Starting Accuracy_Test")
     self.sites = [(.5, .5), (0, .5), (0., 1), (.5, 1), (1., 1.), (1, .5),
                   (1., 0), (.5, 0), (0, 0.), (.5, .5), (.5, .5)]
     self.sites = np.random.random((10, 2)).tolist() + self.sites
     self.active_site = 0
     self.active = True
     self.ref_list = []
     self.gaze_list = []
     self.open_window()
Пример #51
0
 def check_recent_products(self):
     probableProduct = self.recent_products_queue.most_common()
     if not probableProduct is None:
         product, count = probableProduct[0]
         print probableProduct
         if count >= 2:
             print '********************************BUY:', product
             self.socket.send(product)
             audio.say('purchased' + product)
             self.recent_products_queue.clear()
             return
Пример #52
0
 def check_recent_products(self):
   probableProduct = self.recent_products_queue.most_common()
   if not probableProduct is None:
     product, count = probableProduct[0]
     print probableProduct
     if count >= 2:
       print '********************************BUY:', product
       self.socket.send(product)
       audio.say('purchased' + product)
       self.recent_products_queue.clear()
       return
Пример #53
0
 def stop(self):
     # TODO: redundancy between all gaze mappers -> might be moved to parent class
     audio.say("Stopping Fingertip Calibration")
     logger.info('Stopping Fingertip Calibration')
     self.active = False
     self.button.status_text = ''
     if self.mode == 'calibration':
         finish_calibration.finish_calibration(self.g_pool, self.pupil_list, self.ref_list)
     elif self.mode == 'accuracy_test':
         self.finish_accuracy_test(self.pupil_list, self.ref_list)
     super().stop()
Пример #54
0
    def start(self):
        if not self.g_pool.capture.online:
            logger.error("Calibration required world capture video input.")
            return
        audio.say("Starting Calibration")
        logger.info("Starting Calibration")

        self.active = True
        self.ref_list = []
        self.pupil_list = []
        self.clicks_to_close = 5
        self.open_window("Calibration")
Пример #55
0
    def start(self):
        audio.say("Starting Calibration")
        logger.info("Starting Calibration")
        self.sites = [(.25, .5), (0, .5), (0., 1.), (.5, 1.), (1., 1.),
                      (1., .5), (1., 0.), (.5, 0.), (0., 0.), (.75, .5)]

        self.active_site = 0
        self.active = True
        self.ref_list = []
        self.pupil_list = []
        self.clicks_to_close = 5
        self.open_window("Calibration")
Пример #56
0
 def calculate(self):
     self.calculated = True
     rms, camera_matrix, dist_coefs, rvecs, tvecs = cv2.calibrateCamera(
         np.array(self.obj_points), np.array(self.img_points),
         self.g_pool.capture.frame_size)
     logger.info("Calibrated Camera, RMS:%s" % rms)
     np.save(os.path.join(self.g_pool.user_dir, 'camera_matrix.npy'),
             camera_matrix)
     np.save(os.path.join(self.g_pool.user_dir, "dist_coefs.npy"),
             dist_coefs)
     audio.say("Camera calibrated. Calibration saved to user folder")
     logger.info("Camera calibrated. Calibration saved to user folder")
Пример #57
0
 def stop(self):
     # TODO: redundancy between all gaze mappers -> might be moved to parent class
     audio.say("Stopping Calibration")
     logger.info("Stopping Calibration")
     self.smooth_pos = 0,0
     self.counter = 0
     self.close_window()
     self.active = False
     self.button.status_text = ''
     finish_calibration(self.g_pool,self.pupil_list,self.ref_list)
     # Mohammad: send a notification that calibration stopped to be caught by CRowd eye plugin
     self.notify_all( {'subject':'cal_stopped'} )
Пример #58
0
 def stop(self):
     audio.say("Stopping  {}".format(self.mode_pretty))
     logger.info('Stopping  {}'.format(self.mode_pretty))
     self.screen_marker_state = 0
     self.active = False
     # self.close_window()
     self.button.status_text = ''
     if self.mode == 'calibration':
         finish_calibration(self.g_pool, self.pupil_list, self.ref_list)
     elif self.mode == 'accuracy_test':
         self.finish_accuracy_test(self.pupil_list, self.ref_list)
     super().stop()