Detecting the face is only possible with the help of a camera. You have to use some gadgets for detecting the face and the eyes. Likewise, I have made this project which you need your PC to run it or you can use a raspberry pi.
This kind of project is mostly used in robot or for home appliances. People mostly use the raspberry pi for their personal use rather than for others. In this project, I have created a face and eye detection program using python as a language. To use this project you need certain things like:
Things you need for face detection:
- You must install python 2.7 or python 3 to run this project.
- After installing python, you must install libraries that are Tkinter for a graphical interface, threading for creating a thread, CV2 for video capture, time for giving seconds of sleep and PIL for Image and ImageTK.
- You can install the library using: sudo pip install and the library name.
- And the main thing you have to install HaarCascade (haarcascade_frontalface_default.xml) for face detection and (haarcascade_eye.xml) for eyes detection.
- You can install any HaarCascade if you want like smile detection, palm detection and can edit it.
As you can see that I have used only two buttons that start the camera and stop the camera. Start button is used to start the camera while stop button is used to stop it. The above-given color indicates the camera display. The red one is for the colorful display whereas yellow is for black and white display. You may be wondering why I used black and white, why not only colorful? Yes, you can only use the colorful one but I am making you clear by providing both displays. The face detection and eyes detection actually work on black and white while the borderline for detection is shown in colorful one. It makes you easy to understand what is going on this project.
Things I have used in this project:
- I have used HaarCascade for face detection and eyes detection.
- I have used try except condition for finding the bug.
- In the Main Camera, I have used threading for creating a thread by starting the camera.
And finally, click on below button to download this project.