CCTV with face detection program using simple webcam (can also be used for raspberry pi cameras although needs some adjustments).
Made with OpenCV, dlib, and pickle encryption.
Made with Python 3.9.7 using Visual Studio Code (Windows 10) in a virtual environment. Little bit of GUI is made with Tkinter.
?=Generated by pipreqs=?
face_recognition==1.3.0
imutils==0.5.4
opencv_python==4.5.5.62
Everything was installed using pip.
Note:
- face_recognition module.
- dlib wheel used.
NOTE: If you're downloading all of the files and folders, please delete the "dataset" folder before running the program for a cleaner directory.
- (optional) Setup a virtual environment.
python -m venv venv
- Activate the virtual environment.
.\venv\Scripts\Activate.ps1
- Install imutils with pip.
pip install imutils
- Install opencv with pip.
pip install opencv-python
- Install dlib from wheel according to python version.
pip install dlib-19.22.99-cp39-cp39-win_amd64.whl
- Install face recognition module with pip.
pip install face_recognition
- Download "main_gui" and "scripts" folder and put them in the root directory.
Directory tree example:
folder/
...main_gui/
...scripts/
...venv/
- Run main_gui/main_menu.py from the root directory.
python main_gui/main_menu.py
Uses smtplib, mime, and datetime modules.
- Function for adding email into the emails list file with the name 'emails.txt' in scripts/files folder.
- Function for deleteing email from the emails list file.
- Function for sending an email to every email in the emails list file.
Uses imutils, OpenCV, os, argparse, face recognition, and pickle modules.
- Determine detection method (HOG or CNN, default: CNN) for the pickle file which stores face embeddings.
- Determine what is the name for the pickle file (currently set to model.pickle) and will be stored in the same directory of encode_faces.py.
CNN: more accurate, requires more processing power and memory resources.
HOG: less accurate, requires less processing power and memory resources (use this on raspberry pi).
Uses imutils, OpenCV, time, argparse, face recognition, and pickle modules.
- Determine which cascade file to be used (uses the available cascade files from OpenCV).
- Determine which pickle file to be used.
- Shows a video output in a new window which has realtime face detection.
- Stores the detected faces' name in a file named 'detected_names.txt' in scripts/files folder.
If an unknown face is detected, an "Unknown!" text will appear.
If a known face is detected, the name of that face will appear.
Uses Tkinter, OpenCV, time, and os modules.
- Waits for user input for the name of the face.
- Makes a new folder to store data (photo of a face) inside folder "dataset".
- Captures/snapshots a frame from a video input to take a photo.
- The amount of photos to be captured can be changed (the time it takes to finish will also change accordingly).
- Photos are stored in 224x224 resolution with BGR color format.
Uses Tkinter, OpenCV, time, and os modules. Whole GUI code made by myself.
(still uses a bit of cli input)
- Waits for user input for the name of the face.
- Makes a new folder to store data (photo of a face) inside folder "dataset".
- Captures/snapshots a frame from a video input to take a photo.
- The amount of photos to be captured can be changed (the time it takes to finish will also change accordingly).
- Photos are stored in 224x224 resolution with BGR color format.
Uses OpenCV module.
- Checks if a camera source is present.
- Displays video output from a camera device.
Uses Tkinter module for GUI building. Base GUI code generated using PAGE.
- Waits for user input for user email.
- Can either save or remove email from emails list file 'emails.txt' in the scripts/files folder.
Uses Tkinter module for GUI building. Base GUI code generated using PAGE.
- Main menu for the program.
- HOG detection method is required if program is running on raspberry pi.
- Low fps when program detects any face on the video input (face_recog_main.py), might require some adjustments.
Albert E (albertenrico.5@gmail.com)