コード例 #1
0
def recognition(frame):
    cascade = face_cascade()

    frame = filter.grayscale(frame)

    minSize = (cfg.get_options('size'), cfg.get_options('size'))

    faces = cascade.detectMultiScale(
        frame,
        scaleFactor=cfg.get_options('scaleFactor'),
        minNeighbors=cfg.get_options('minNeighbors'),
        minSize=minSize,
        flags=cv2.CASCADE_SCALE_IMAGE)

    return frame, faces
コード例 #2
0
def image(gray, width, height):
    return cv2.resize(gray, (width, height),
                      interpolation=cfg.get_options('interpolation'))
コード例 #3
0
def scale(frame):
    alt = int(frame.shape[0] / frame.shape[1] * cfg.get_options('resize'))
    return image(frame, cfg.get_options('resize'), alt)
コード例 #4
0
def compare(gray, rect):
    factor = cfg.get_options('size')
    (x, y, w, h) = rect
    gray = image(gray[y:y + h, x:x + w], factor, factor)
    return gray
コード例 #5
0
ファイル: draw.py プロジェクト: thiagozampieri/gaia-loginface
def text(frame, text, rect):
    (x, y, w, h) = rect   
    cv2.rectangle(frame, (x - 1, y - 25), (x + 2 + w, y), cfg.get_options('color'), cv2.FILLED)
    cv2.putText(frame, text, (x + 6, y - 6), cv2.FONT_HERSHEY_DUPLEX, 0.5, (0, 0, 0), cfg.get_options('filled'))
コード例 #6
0
ファイル: draw.py プロジェクト: thiagozampieri/gaia-loginface
def rectangle(frame, rect):
    color = cfg.get_options('color')
    (x, y, w, h) = rect
    cv2.rectangle(frame, (x, y), (x + w, y + h), color, cfg.get_options('filled'))
コード例 #7
0
def face_cascade():
    return cv2.CascadeClassifier(cfg.get_options('classificator'))