A monitor that knows your faces.
The camera keeps detecting motion. When motion is detected, the authorized face must be detected within a buffer time to release the alarm; otherwise, the buzzer will ring, and Pi will send images by e-mail.
SMTP function must be installed, which is not contained in python functions. Refer to the reference below to setup the SMTP server. Other modules that are required are:
click==6.7Flask==0.12.2itsdangerous==0.24Jinja2==2.9.6MarkupSafe==1.0picamera==1.13Werkzeug==0.12.2numpy==1.13.1opencv-python==4.0.0





First, you have to register your face into the machine. By uploading your photos (recommended less than 2K in both width and length) into the dataset/ directory. You should create a new folder named as your name and put your photos into the folder. e.g.
dataset/Mike/IMG_0001.JPGdataset/Mike/IMG_0002.JPGdataset/Mike/IMG_0003.JPGdataset/Kevin/IMG_0045.JPGdataset/Kevin/IMG_0049.JPGdataset/Kevin/IMG_0148.JPGAfter that, execute python3 encode_faces.py to encode faces into a single file. Then this file will be used by the following face detection module
In mail.txt, you can set your own mail. Note that FROM/TO/Subject rows must be included; otherwise the mail may fail to be sent out.
Last, execute python3 app.py to run all the functions including http streaming, motion detection, face detection, LED and buzzer alarm, and mail alarm
camera_opencv.py,
ALARM_BUFFER: buffer time after motion is detected. This value can be set larger if false alarm is too frequentAUTH_BUFFER: buffer time after face detection to prevent frequent face detection which may sometimes be annoying. Set this value lower if miss happens.ALARM_DURATION: max time that alarm will last.mail.txt,
FROM: the sender name that will be presented by the mail receiverTO: the receiver mail addressBCC: BCC address if neededReply-To: the reply-to address for this mailSubject: the subject of this maildataset/, create your own folders with your name as folder name, containing photos of yours