# Face detection

## Purpose

Demonstrate enabling face mode on the online recognition pipeline, consuming quality-ranked `FaceModel`s, and extracting optimised crops for downstream usage.

## Entry points

Glass home:

- `HomeActivity` → `GlassFaceTrackActivity`

Sample Activity:

- `com.rokid.glass.GlassFaceTrackActivity`

## Platform

- Glass

## Main file

- [GlassFaceTrackActivity.kt](https://gitee.com/as_pixar/glass3sdkdemo/blob/main/glassdemo/app/src/main/java/com/rokid/glass/GlassFaceTrackActivity.kt)

## Flow

1. Grab `GlassSdk.getGlassOnlineRecService()`.  
2. Attach `IGlassDetectionListener`.  
3. `startDetection(MODE_FACE)`.  
4. Consume `onProcessedFaceModels()` to pick the best samples.  
5. Filter noisy tracks via quality + `trackId`.  
6. Snapshot crops through `getFaceSamllBitmap(trackId)` and render.

## FAQ

### What “best face” means here

Heuristic blend of bounding-box area, `iqaScore`, `faceScore`, deduped per `trackId`; samples under `iqaScore < 40` drop out.

### Detection vs recognition

This path emphasises **detection + crop quality scoring**—no ID compare is performed in UI.

## Caveats

- Always call stop + detach on exit.  
- Persistence hooks exist but stay commented—focus is pipeline validation, not archival UX.
