Ejemplo n.º 1
0
  def run(self) :
    self._isRun = True
    sharpenFilter = filters.SharpenFilter()
    findEdgesFilter = filters.FindEdgesFilter()
    embossFilter = filters.EmbossFilter()
    cannyFilter = filters.CannyFilter(100, 200)
    faceDetector = detectors.FaceDetector()

    while self._isRun :
      self._captureManager.enterFrame()
      frame = self._captureManager.frame

      # filter
      sharpen = sharpenFilter.apply(frame)
      findEdges = findEdgesFilter.apply(frame)
      emboss = embossFilter.apply(frame)
      canny = cannyFilter.apply(frame)
      faceDetect = faceDetector.detect(frame)

      # display
      self._windowManager.show("origin", frame)
      self._windowManager.show("sharpen", sharpen)
      self._windowManager.show("find edges", findEdges)
      self._windowManager.show("emboss", emboss)
      self._windowManager.show("canny", canny)
      self._windowManager.show("Face detector", faceDetect)

      self._captureManager.exitFrame()
      
      self._windowManager.processEvents()
Ejemplo n.º 2
0
 def __init__(self):
     self._windowManager = WindowManager('Cameo',
                                          self.onKeypress)
     self._captureManager = CaptureManager(
         cv2.VideoCapture(0), self._windowManager, True)
     #self._curveFilter = filters.BGRPortraCurveFilter()
     self._EmbossFilter = filters.EmbossFilter()
     self._SharpenFilter = filters.SharpenFilter()
     self._AverageBlur = filters.AverageBlur()
     self._FindEdgesFilger = filters.FindEdgesFilter()
Ejemplo n.º 3
0
    def on_keypress(self, keycode):
        if keycode == const.KEY_CODE_SPACE:
            # Take a screenshot
            self._capture_controller.write_image(const.SCREENSHOT_FILENAME)

        elif keycode == const.KEY_CODE_TAB:
            # Start/stop recording a video
            if not self._capture_controller.is_writing_video:
                self._capture_controller.start_writing_video(
                    const.SCREENCAST_FILENAME)
            else:
                self._capture_controller.stop_writing_video()

        elif keycode == const.KEY_CODE_ESCAPE:
            # Quit
            self._window.destroy()

        elif keycode == const.KEY_CODE_0:
            # Restore default settings
            self._filter = None
            self._draw_contours = False
            self._draw_lines = False
            self._draw_corners = False

        elif keycode == const.KEY_CODE_1:
            self._filter = filters.SharpenFilter(
            ) if self._filter is None else None

        elif keycode == const.KEY_CODE_2:
            self._filter = filters.BlurFilter(
            ) if self._filter is None else None

        elif keycode == const.KEY_CODE_3:
            self._filter = filters.EdgesFilter(
            ) if self._filter is None else None

        elif keycode == const.KEY_CODE_4:
            self._filter = filters.StrokeEdgesFilter(
            ) if self._filter is None else None

        elif keycode == const.KEY_CODE_5:
            self._filter = filters.EmbossFilter(
            ) if self._filter is None else None

        elif keycode == const.KEY_CODE_6:
            self._draw_contours = not self._draw_contours

        elif keycode == const.KEY_CODE_7:
            self._draw_lines = not self._draw_lines

        elif keycode == const.KEY_CODE_8:
            self._draw_corners = not self._draw_corners

        elif keycode == const.KEY_CODE_9:
            pass
Ejemplo n.º 4
0
 def __init__(self):
     self.shootcount = 1
     self.castcount = 1
     self.mean = None
     self.sigma = None
     self._windowManager = WindowManager('REAL', self.onKeypress)
     self._captureManager = CaptureManager(cv2.VideoCapture(0),
                                           self._windowManager,
                                           shouldMirrorPreview=True)
     #shouldMirrorPreview can convert the image into its mirrored image
     #self._curveFilter = filters.SharpFilter()
     self._curveFilter = filters.EmbossFilter()
Ejemplo n.º 5
0
 def __init__(self):
     self._windowManager = WindowManager('Cameo', self.onKeypress)
     self._captureManager = CaptureManager(cv2.VideoCapture(0),
                                           self._windowManager, True)
     self._curveFilter = filters.EmbossFilter()
Ejemplo n.º 6
0
 def __init__(self):
     self._winMng = WindowMng('Cameo', self.onKeypress)
     self._captureMng = CaptureMng(cv2.VideoCapture(0), self._winMng, True)
     #self._curveFilter = filters.FindEdgesFilter()
     self._curveFilter = filters.EmbossFilter()
Ejemplo n.º 7
0
 def __init__(self):
     self._window_manager = WindowManager('Cameo', self.on_key_press)
     self._capture_manager = CaptureManager(cv2.VideoCapture(0), self._window_manager, True)
     self._face_tracker = FaceTracker()
     self._should_draw_debug_rects = False
     self._curve_filter = filters.EmbossFilter()  # can use any of applied filters