Léo*_*aes 5 ios dart flutter firebase-mlkit
我正在开发一个可以进行面部识别的应用程序。步骤之一包括检测用户微笑。为此,我目前正在使用谷歌的 Ml Kit。该应用程序在 Android 平台上运行良好,但当我在 Ios(Iphone Xr 和其他)上运行时,它无法识别任何图像上的任何面孔。我已经遵循了如何集成 Ios 和 Firebase 的每个步骤,并且运行良好。
这是我的代码。它总是落在 length == 0 上,因为图像不包含任何人脸。作为参数传递的图像来自 image_picker 插件。
Future<Face> verifyFace(File thisImage) async {
var beforeTime = new DateTime.now();
final image = FirebaseVisionImage.fromFile(thisImage);
final faceDetector = FirebaseVision.instance.faceDetector(
FaceDetectorOptions(
mode: FaceDetectorMode.accurate,
enableClassification: true,
),
);
var processedImages = await faceDetector.processImage(image);
print('Processing time: ' +
DateTime.now().difference(beforeTime).inMilliseconds.toString());
if (processedImages.length == 0) {
throw new NoFacesDetectedException();
} else if (processedImages.length == 1) {
Face face = processedImages.first;
if(face.smilingProbability == null){
throw new LipsNotFoundException();
}
else {
return face;
}
} else if (processedImages.length > 1) {
throw new TooManyFacesDetectedException();
}
}
Run Code Online (Sandbox Code Playgroud)
如果有人有任何提示或可以告诉我做错了什么,我将不胜感激。
| 归档时间: |
|
| 查看次数: |
1246 次 |
| 最近记录: |