def flandmark_init(model=MODEL):
    flandmark = PyFlandmark(model, False)

    # Initialize featurePool
    bw = flandmark.getBaseWindowSize()
    featurePool = PyFeaturePool(bw[0], bw[1], None)
    featurePool.addFeatuaddSparseLBPfeatures()

    flandmark.setFeaturePool(featurePool)

    return flandmark
Esempio n. 2
0
"""

import sys
sys.path.append("D:/GitHub/clandmark/install/share/clandmark/python/")

from py_flandmark import PyFlandmark
from py_featurePool import PyFeaturePool

#flandmark = PyFlandmark("D:/GitHub/clandmark/matlab_interface/models/FDPM.xml", False)
flandmark = PyFlandmark("D:/GitHub/clandmark/matlab_interface/models/CDPM.xml", False)

bw = flandmark.getBaseWindowSize()
featurePool = PyFeaturePool(bw[0], bw[1], None)
featurePool.addFeatuaddSparseLBPfeatures()

flandmark.setFeaturePool(featurePool)

import time
import numpy as np
import cv2

def rgb2gray(rgb):
	"""
	converts rgb array to grey scale variant
	accordingly to fomula taken from wiki
	(this function is missing in python)
	"""	
	return np.dot(rgb[...,:3], [0.299, 0.587, 0.144])

cascPath = "D:/GitHub/clandmark/data/haarcascade_frontalface_alt.xml"
faceCascade = cv2.CascadeClassifier(cascPath)
    featurePool.addFeatuaddSparseLBPfeatures()

    flandmark.setFeaturePool(featurePool)

    return flandmark


if __name__ == '__main__':

    # flandmark = flandmark_init()
    flandmark = PyFlandmark(MODEL, False)
    # Initialize featurePool
    bw = flandmark.getBaseWindowSize()
    featurePool = PyFeaturePool(bw[0], bw[1], None)
    featurePool.addFeatuaddSparseLBPfeatures()
    flandmark.setFeaturePool(featurePool)

    faceCascade = cv2.CascadeClassifier(CV_CASCADE_PATH)

    video_capture = cv2.VideoCapture(CAM_ID)

    while True:
        # Capture frame-by-frame
        ret, frame = video_capture.read()

        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
        arr = rgb2gray(frame)

        faces = faceCascade.detectMultiScale(gray,
                                             scaleFactor=1.1,
                                             minNeighbors=5,