This application switches between two modes, face detection and face recognition.
What's the difference?
Face detection identifies when any face is present whereas face recognition can identify a specific face. Performing face detection is faster than performing face recognition. In face recognition, algorithms not only detect the face but also attempt to identify similarities between faces.
Face Detection
After uploading the code and pressing RESET, the MEMENTO's screen displays what the camera module sees.
Move your face in front of the camera. If a face is detected by the MEMENTO, the screen displays the text, "DETECTED FACE!". A bounding box is drawn around the face and contains facial landmarks within it.
Face Detection Explanation
To understand what's happening in this demo, let's define a few terms first:
What is the green box around my face?
In computer vision, the green box around an object is called a bounding box. This box contains the x and y coordinates (the boundaries) of the detected object.
What are the points placed over my face?
These points are called landmarks. The landmarks identified by this demo are facial landmarks, such as your left eye, mouth (left corner), nose, right eye, and mouth (right corner). Landmarks are primarily used for facial recognition but also can be used for emotional/mood analysis or pose detection.
Face Recognition
Unlike the face detection demo which runs automatically, face recognition has a few steps. Before we can detect a face, the face needs to be enrolled first.
To enroll a new face, press the shutter button on the MEMENTO.
After pressing the shutter, the NeoPixel ring emits a white light to illuminate a face. The light indicates the MEMENTO is in "face enroll mode" and is attempting to detect a face.
Move your face in front of the camera. If a face is detected, the screen will briefly display Enrolled a new face with ID #0 and the NeoPixel ring will turn off.
The next time the same face is moved in front of the camera, it will recognize it and the NeoPixel ring will turn green.
When you point the camera at a different, unrelated, face, the NeoPixel ring will glow red to indicate that the camera has detected a face but it is not one of the enrolled faces.
Going Further - "Tricking" the Facial Recognition
Since the facial recognition demo runs on an embedded system, Ladyada asked me to try out both the recognition performed by the MEMENTO's ESP32x and my iPhone's FaceID.
To attempt to test the face recognition code further, I went with something basic. I took a photo of my face and printed it out on printer paper.
After enrolling my face, I placed the photo of my face in front of the camera. It was recognized by the MEMENTO and lit up the NeoPixels with a green light.
However, my iPhone did not recognize the photo of my face. Even holding the photo in different lighting did not help.
Why?
The iPhone uses a more advanced version of facial recognition called Face ID. This system doesn't identify a face using a camera module like the MEMENTO code does, it performs recognition on the depth of the image.
Face ID begins by projecting over 30,000 infrared (invisible) "dots" onto your face. A module then projects infrared light on your face and an infrared camera takes a picture of the dots.
The pattern is then securely stored as a "map" (shown by the image above) in the iPhone's storage. The next time you put your iPhone up to your face, the camera will generate a new map and try to match it to the saved map.
Earlier on this page, we discussed landmarks as the method of identifying features for facial recognition. This is similar, except Face ID identifies over 30,000 landmark points compared to the MEMENTO which identifies 6 landmarks.
Text editor powered by tinymce.