🧩 AndroidFaceDetector
Lightweight face-detection extension using Android’s built-in FaceDetector API.
Detects faces from local image files or URLs, returning:
midpoints, eye distances, confidence, and Euler pose (X, Y, Z).
Developed by A E M O, built with FAST.
Specifications
| Property | Value |
|---|---|
me.aemo.androidfacedetector |
|
| 7.87 KB | |
| 1.5 | |
| 14 | |
| 2025-10-31 | |
| FAST v5.2.2-premium |
Events
1. OnFacesDetected
Triggered when one or more faces are detected.
| Parameter | Type | Description |
|---|---|---|
totalFaces |
number | Total number of faces detected. |
width |
number | Image width in pixels. |
height |
number | Image height in pixels. |
midXs |
list | List of midpoint X coordinates for faces. |
midYs |
list | List of midpoint Y coordinates for faces. |
eyesDistances |
list | Distance between the eyes for each face. |
confidences |
list | Detection confidence values (0–100). |
poseXs |
list | Euler X rotation (tilt). |
poseYs |
list | Euler Y rotation (yaw). |
poseZs |
list | Euler Z rotation (roll). |
2. OnError
Triggered when an error occurs (invalid path, unreadable image, or no faces detected).
| Parameter | Type | Description |
|---|---|---|
message |
text | Description of the error. |
Method
FindFaces
Detects faces in an image and triggers OnFacesDetected or OnError.
| Parameter | Type | Description |
|---|---|---|
imagePath |
text | File path or URL of the image (must be readable). |
maxFaces |
number | Maximum number of faces to detect (recommended: 1–10). |
Download
AndroidFaceDetector Extension (.aix)
me.aemo.androidfacedetector.aix (7.9 KB)
Library Used
This extension uses Android’s classic on-device face detector:
android.media.FaceDetector
Official Documentation:
Notes & Limitations
Android’s built-in FaceDetector API is lightweight but has major limitations:
Faces Must Be Upright
Only detects upright, forward-facing faces. Fails on:
- side profiles
- upside-down faces
- extreme angles
- heavily rotated faces
Only Detects Basic Data
Provides only:
- midpoint
- eye distance
- Euler rotation
- confidence
No bounding box
No landmarks (nose, mouth, etc.)
Max Resolution Issues
Very large images may cause:
- memory errors
- slow processing
- “no faces detected” due to scaling
Bitmap Format Restriction
Only works with RGB_565 (16-bit) images.
Conversion failures trigger errors.
maxFaces Limitation
Faces beyond the maxFaces value are ignored.
Poor Detection in Low Light
Performance is limited in:
- dark environments
- overexposed images
- blurry images
Best Practices for Better Detection
- Use medium-resolution images (300×200 → 1024×1024).
- Make sure the face is upright and clearly visible.
- Avoid low-light and blurry images.
- Use direct image URLs (.jpg / .png).
- Set a realistic
maxFacesvalue (1–5 recommended). - Avoid images with extreme rotation.
Troubleshooting
| Error Message | Cause | Solution |
|---|---|---|
| File not found | Incorrect path | Verify full file path. |
| Unable to load image | Corrupted / unsupported image | Convert to JPG or PNG. |
| Bitmap config not supported | Not RGB_565 | Pre-convert or compress image. |
| No faces detected | Angle, lighting, bad quality | Improve lighting or crop closer. |
| URL failed to load | Redirect / HTML page | Use a direct image URL. |
| OutOfMemoryError | Image too large | Use lower resolution. |
Coming Soon 
ML Kit FaceDetector Integration
A new version of this extension using Google ML Kit’s Face Detection API is in development.
It will support:
high-accuracy detection
side-profile faces
full landmarks (eyes, nose, mouth, etc.)
expression detection
multi-face tracking
improved performance
Planned name: me.aemo.mlkitfacedetector
Release: Coming soon! ![]()
FaceDetector vs ML Kit
| Feature | Android FaceDetector | Google ML Kit |
|---|---|---|
| Accuracy | Low | High |
| Works offline | ||
| Side-profile faces | ||
| Landmarks | ||
| Expressions detection | ||
| Multi-face tracking | ||
| Stability | Medium | High |
| Modern support | Limited | Excellent |