Esempio n. 1
0
 def __init__(self, capture=None, face_img_path=None, should_mirror=False):
     self._window_manager = WindowManager(self.on_keypress)
     self._capture_manager = CaptureManager(cv2.VideoCapture(0)) \
             if capture is None else CaptureManager(capture)
     self._window_name = 'FaceOff'
     self._should_mirror = should_mirror
     self._face_tracker = FaceTracker()
     self._show_face_rect = False
     self._swap_face = True
     self._template_face = None
     if face_img_path is not None:
         self._template_face = cv2.imread(face_img_path)
Esempio n. 2
0
    def __init__(self):
        self._thread_mode = True

        self._windowManager = WindowManager('Minimum Viable Product',
                                            self.on_keypress)

        self._amount_frames = 0
        self._success_finding_contours = 0
        # DroidCam URL
        # url = 'http://192.168.55.78:4747/video'
        url = 0
        self._captureManager = CaptureManager(
            cv2.VideoCapture(url), self._windowManager, False)
Esempio n. 3
0
    def __init__(self, window_manager):
        self._record_face = 0
        self._record_count = 0
        self._stopped = True
        self._processed = False

        self._amount_frames = 0
        self._success_finding_contours = 0
        self._original_capture = None

        self._data = dict()

        # DroidCam URL
        # url = 'http://192.168.55.51:4747/video'
        url = 0
        self._capture_manager = CaptureManager(cv2.VideoCapture(url))
        self._window_manager = window_manager
Esempio n. 4
0
  def test_manager(self):
    sniffer = BaseSnifferDevice()
    manager = CaptureManager(controller=sniffer)
    time.sleep(1)
    for t in range(2):
      manager.start_new_task('test%d' % t, 'test owner', 'localhost')
      time.sleep(2)
      manager.stop_task('test%d' % t)

    time.sleep(1)
    manager.start_new_task('long test', 'test owner', 'localhost')
    time.sleep(60)
    manager.stop_task('long test')
    time.sleep(1)

    for task in manager.get_finished_tasks():
      print('Finished: id %s, start %s, stop %s' % (task.id, task.start_time, task.stop_time))
      for trace in manager.get_trace_list_by_task_id(task.id):
        print('- T: %s' % trace)

    manager.shutdown()
    time.sleep(2)
Esempio n. 5
0
    filename = 'cap-%s-%s.btt' % (
        time.strftime('%y%m%d_%H%M%S', time.localtime(start_time)),
        time.strftime('%y%m%d_%H%M%S', time.localtime(stop_time)))
    return filename


def _epoch_time_to_human_readable(timestamp):
    return time.strftime('%x %X', time.localtime(timestamp))


def _task_list_to_string(task_list):
    str_list = []
    for task in task_list:
        task_dict = task.to_dict()
        str_list.append(task_dict)
    return str_list


def sigint_handler(signal, frame):
    print('Shutting down service.')
    capture_manager.shutdown()

    sys.exit(0)


if __name__ == "__main__":
    signal.signal(signal.SIGINT, sigint_handler)
    sniffer = EllisysController()
    capture_manager = CaptureManager(sniffer, split_interval=600)
    app.run(host='0.0.0.0', port=5000)