# Quick Task 260330-mb3: 完整人脸识别示例 **Date:** 2026-03-30 **Commit:** 3c7e992 ## Summary 重写 example 示例代码,实现真正的 1:1 人脸识别功能。 ## Changes ### example/lib/main.dart - 完全重写 `FaceRecognitionScreen` 类 - 实现 `_registerFace()` 方法:使用 `extractFaceFeature(extractType: 0)` 注册模式 - 实现 `_verifyFace()` 方法:使用 `extractFaceFeature(extractType: 1)` + `compareFaceFeature()` - 使用 `SharedPreferences` 存储人脸特征数据 (Base64 编码) - 添加注册/验证模式切换功能 - 显示相似度百分比和验证结果 ### example/pubspec.yaml - 添加 `shared_preferences: ^2.2.2` 依赖 ## Key API Usage | 流程 | API | 参数 | |------|-----|------| | 人脸检测 | `detectFaces()` | format=2050 (NV21) | | 注册特征提取 | `extractFaceFeature()` | extractType=0 (REGISTER) | | 识别特征提取 | `extractFaceFeature()` | extractType=1 (RECOGNIZE) | | 特征比对 | `compareFaceFeature()` | compareModel=0 (LIFE_PHOTO) | ## Verification Threshold - 推荐阈值: 0.8 (生活照) - 相似度 >= 0.8 判定为同一人 ## Files Modified - `example/lib/main.dart` (+419/-208 lines) - `example/pubspec.yaml` (+3 lines)