From bf9977e1c36548ff5f337540724423111b31aeb0 Mon Sep 17 00:00:00 2001 From: Feier Zhang Date: Mon, 12 Oct 2020 16:59:52 -0400 Subject: [PATCH] Upload face detection method --- Facial_Recognition_Software.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Facial_Recognition_Software.py b/Facial_Recognition_Software.py index a3cfdebfc..cf9058869 100644 --- a/Facial_Recognition_Software.py +++ b/Facial_Recognition_Software.py @@ -1,16 +1,19 @@ import cv2 import numpy as np -import sys,os,glob,numpy +import sys,os,numpy +from glob import glob from skimage import io #read test photo -img = cv2.imread("C:/Users/fayer/OneDrive - University of Ottawa/CEG 4912/Project Test/data/photo4.jpg") +pwd = sys.path[0] +img = cv2.imread(pwd + "/Facial_test_images/photo2.jpg") + color = (0, 255, 0) grey = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) -classfier = cv2.CascadeClassifier("C:/Users/fayer/OneDrive - University of Ottawa/CEG 4912/Project Test/model/haarcascade_frontalface_alt2.xml") +classfier = cv2.CascadeClassifier(pwd + "/Facial_models/haarcascade_frontalface_alt2.xml") faceRects = classfier.detectMultiScale(grey, scaleFactor=1.2, minNeighbors=3, minSize=(32, 32))