예제 #1
0
파일: cameo.py 프로젝트: natthapach/Cameo
  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()
예제 #2
0
 def __init__(self):
     self._windowManager = WindowManager('Cameo', self.eventhandler)
     self._captureManager = CaptureManager(
         windowmanager=self._windowManager, ismirrorpreview=True)
     self._curveFilter = filters.BGRCrossProcess()
     self._kernelFilter = filters.AbossEffect()
     self._shrpenimage = filters.SharpenFilter()
     self._facetracker = FaceDetect()
예제 #3
0
    def __init__(self):
        self._windowManager = WindowManager('Cameo', self.onKeypress)

        self._captureManager = CaptureManager(
            cv2.VideoCapture(0), self._windowManager, True)

        self._curveFilter = filters.BGRPortraCurveFilter()
        self._conv_filter = filters.SharpenFilter()
        self._face_tracker = FaceTracker()
        self._should_draw_debug_rects = False
예제 #4
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()
예제 #5
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
예제 #6
0
파일: cameo.py 프로젝트: yudeqang/Cameo
 def __init__(self):
     self._windowManger = WindowManger('Cameo', self.oneKeypress)
     self._captureManger = CaptureManger(cv2.VideoCapture(0),
                                         self._windowManger, True)
     self._filter = filters.SharpenFilter()  # 锐化
예제 #7
0
파일: cameo.py 프로젝트: ai-cv/rq
 def __init__(self):
     self._windowManager = WindowManager('Cameo', self.onKeypress)
     self._captureManager = CaptureManager(cv2.VideoCapture(0),
                                           self._windowManager, True)
     # self._curveFilter = filters.BGRPortraCurveFilter()
     self._curveFilter = filters.SharpenFilter()
예제 #8
0
# high_gray = (95,11,241)
# # create masks
# yellow_mask = cv2.inRange(hsv, low_yellow, high_yellow )
# cv2.imshow("SELECT WALL YELLOW", yellow_mask)
#
# gray_mask = cv2.inRange(hsv, low_gray, high_gray)
# cv2.imshow("SELECT WALL GRAY", gray_mask)
# # combine masks
# combined_mask = cv2.bitwise_or(yellow_mask, gray_mask)
# #wall = cv2.bitwise_and(img,img, mask = combined_mask)
# cv2.imshow("SELECT WALL", combined_mask)

#fl.strokeEdges(img, img, 2,5)

kernel = np.array([[-1, -1, -1], [-1, 9, -1], [-1, -1, -1]])

# myfilter = fl.VConvolutionFilter(kernel)
# myfilter.apply(img, img)

fl.SharpenFilter().apply(img, img)
cv2.imshow("Sharpen", img)
cv2.imwrite('XB.png', img)
#fl.FindEdgesFilter().apply(img, img)
#fl.BlurFilter().apply(img, img)
# fl.EmbossFilter().apply(img, img)
# cv2.imshow("Emboss", img)

# img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV);
# cv2.imshow("Candy", cv2.Canny(img, 640, 640))
cv2.waitKey()
cv2.destroyAllWindows()
예제 #9
0
파일: img.py 프로젝트: MoeexT/open-cv
#! py -3
# -*- coding: utf-8 -*-

import cv2
import numpy
import filters
from scipy import ndimage

img = cv2.imread("screen_shot.png")
img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
filter_ = filters.SharpenFilter()
kernel = filter_.kernel
print(kernel)
ker = ndimage.convolve(img, kernel)
blurred = cv2.GaussianBlur(img, (11, 11), 0)
g_hpf = img - blurred
cv2.imshow("find-edges", ker)
cv2.imshow("g_hpf", g_hpf)
cv2.waitKey()
cv2.destroyAllWindows()