Create AR face filters with the Chrome Face Detection API
summary
Chrome’s experimental Shape Detection API exposes a feature-flagged Face Detection API that creates AR webcam filters by calling new FaceDetector({maxDetectedFaces, fastMode}) and running detector.detect(video) into a canvas. It returns a bounding box plus landmarks with eye and mouth coordinates, so the demo computes eye distance, scale, rotation and draws a transparent PNG of glasses, smoothing positions across frames. It runs fully on-device, trades accuracy for speed with fastMode, and currently misses or jitters landmarks so it’s exploratory rather than production-ready.
AI-written summary · about
chapters (14)
- 0:00Introduction to AR face filters
- 3:35Face Detection API overview
- 7:19Enabling the API in Chrome
- 8:17Basic API usage and face detection
- 10:55Landmarks and face positioning
- 13:14Setting up the HTML structure
- 15:13Detecting faces from webcam
- 21:30Drawing face rectangles
- 23:47Using landmarks for AR elements
- 28:38Adding AR glasses to the face
- 31:35Performance considerations
- 35:51Advanced AR filter examples
- 39:14Demo of the final AR filter
- 40:41Key takeaways and closing
