Face recognition in the dark works because many phones do not rely on visible light alone. A depth-sensing system can shine invisible infrared light onto your face, read the reflected pattern, and build a 3D shape map even in a dark room. This matters because a face unlock system must tell a real face from a photo, a video, or a simple mask.
It combines physics, computer vision, and machine learning in a tiny sensor system above the screen.
A typical system uses an infrared flood light, a dot projector, an infrared camera, and a processor running neural network models. The camera sees how the dot grid bends across your nose, eyes, cheeks, and mouth, then software converts that pattern into a depth map. A convolutional neural network turns the face data into a compact face embedding, which is compared with the encrypted template stored during setup.
Anti-spoofing checks look for 3D structure, eye region details, surface reflectance, and sensor consistency, which is why mask attacks work on some phones but fail on others.
Key Facts
- Infrared light has wavelengths longer than visible red light, so it can illuminate a face without appearing bright to human eyes.
- A dot projector creates a known pattern, and depth is estimated from how the pattern shifts across the face.
- Similarity can be measured with cosine similarity: cos(theta) = (A dot B) / (|A||B|).
- A face embedding is a vector of numbers that represents important identity features while ignoring small changes like expression or lighting.
- A match happens only if similarity is above a security threshold: score >= threshold.
- 3D depth sensing helps reject flat photos because a real face has nose, eye socket, cheek, and mouth depth changes.
Vocabulary
- Infrared light
- Infrared light is electromagnetic radiation with wavelengths longer than visible red light, often used by cameras and sensors in the dark.
- Dot projector
- A dot projector is a tiny light source that casts a known grid of infrared dots onto an object so its 3D shape can be estimated.
- Depth map
- A depth map is an image-like grid where each pixel stores distance from the camera instead of color.
- Face embedding
- A face embedding is a numerical vector produced by an AI model to summarize the identity-related features of a face.
- Anti-spoofing
- Anti-spoofing is the set of tests a recognition system uses to reject fake inputs such as photos, videos, masks, or models.
Common Mistakes to Avoid
- Thinking Face ID needs visible light is wrong because many systems use infrared illumination that the sensor can see even when the room looks dark to you.
- Assuming the phone stores a normal photo of your face is wrong because secure systems usually store a mathematical template or embedding, not a simple image in the photo gallery.
- Treating any high similarity score as safe is wrong because recognition systems must set a threshold that balances false accepts and false rejects.
- Believing every mask attack works the same on every phone is wrong because sensors, training data, depth resolution, anti-spoofing models, and security thresholds vary by device.
Practice Questions
- 1 A depth sensor projects 30,000 infrared dots, but 8 percent are blocked by hair and glasses. How many dots are still visible to the infrared camera?
- 2 A face embedding model outputs two 4D vectors: A = [1, 2, 2, 1] and B = [2, 1, 2, 1]. Compute A dot B and decide whether the match passes if the required dot product score is at least 9.
- 3 Explain why a printed photo of a face can fool a simple 2D camera system more easily than a system that checks both an infrared dot pattern and a 3D depth map.