This program leverages OpenCV to perform real-time face detection via the webcam. Upon detecting a face, it outlines the face with a rectangle and counts the number of faces within the frame. Additionally, it draws a line at the top of the frame and issues a warning message when a face crosses this line. The system saves a cropped image of the detected face, timestamped, in a designated "saved" folder. Furthermore, it provides the capability to display these saved images in a separate window.
- OpenCV
- NumPy
- datetime
- os
- threading
- intruder_det.py: The main Python script that runs the face recognition with intruder detection.
- whatsapp_message.py: A Python script that sends a WhatsApp message to a specified number.
- haarcascade_frontalface_default.xml: A pre-trained Haar Cascade classifier for face detection.
- The program uses the Haar Cascade Classifier to detect faces. The classifier XML file is stored in the "XML_Files" folder.
- The program displays a warning message when a face crosses the line. The line is drawn at 200 pixels from the top of the frame and can be changed by modifying the line_yvariable.
- The program saves the detected faces to a folder named "saved". The folder can be changed by modifying the saveImage()function.
- The problem of the video feed lagging behind the face detection is solved by using a separate thread to send the WhatsApp message. The thread is created in the ThreadSendMessage()function.
- 
Fork the repository 
- 
Clone the repository to your local machine git clone <url> 
- 
Create a python virtual environment python -m venv .venv 
- 
Activate the virtual environment .venv\Scripts\activate 
- 
Install the requirements pip install -r requirements.txt To see the program execution: cd Main python intruder_det.py
- 
Create a new branch git checkout -b <branch-name> 
- 
Make your changes 
- 
Commit and push your changes git add . git commit -m "<message>" git push origin <branch-name> 
- 
Create a pull request 
