Download "haarcascade_frontalface_default.xml" from haarcascade
3. Start Testing Face Detection
use "opencv-face-testing.ipynb" to check if openCV is working or not
# Choose an image to detect faces inframe=cv2.imread('swagato.jpeg')
# Iterate forever over frameswhileTrue:
# Read the current frame# successful_frame_read, frame = webcam.read()# Must convert to grayscalegrayscaled_img=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
....
We can see the static image is detected by green rectangle
# Iterate forever over frameswhileTrue:
# Read the current framesuccessful_frame_read, frame=webcam.read()
# Must convert to grayscalegrayscaled_img=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
....
now, uncomment the line which we commented in previous step, to fetch live image with webcam
webcam application will pop up and one rectangle will show up when we run the notebook like above.
using haarcascade classifier we are detecting faces
if we press 'q', the webcam window will be closed.
4. Collect Data
run "face-data-collect.ipynb" to collect data as .npy or numpy files
It will first ask name of the person and the face data will be recorded as a numpy file followd by this
file will be saved at "data" directory
5. Perform Face Recognition
run "face-recognition" to test face recognition
About
This module gets first trained by the pre-trained haar-cascade classifier, then using collected face data, it recognizes the user.