我在使用适用于 iOS 的 GoogleMobileVision 时遇到了一些问题。
像这样设置 UIImagePickerController
UIImagePickerController* picker = [[UIImagePickerController alloc]init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
[self presentViewController:picker animated:YES completion:^
{
self.faceImageView.layer.sublayers = nil; // drawing and re-drawing some lines...
}];
和探测器:
[super viewDidLoad];
NSDictionary* options = @{
GMVDetectorFaceLandmarkType : @(GMVDetectorFaceLandmarkAll),
GMVDetectorFaceClassificationType : @(GMVDetectorFaceClassificationAll),
GMVDetectorFaceTrackingEnabled : @(NO),
//GMVDetectorFaceMode : @(GMVDetectorFaceAccurateMode) // Accurate mode detects face, but with wrong orientation; Fast mode can't detect faces!
};
self.faceDetector = [GMVDetector detectorOfType:GMVDetectorTypeFace options:options];
但是,如果使用:picker.allowsEditing = YES;
一切正常!
问题:是图像大小的原因吗?picker.allowsEditing = YES;
在 iPhone 6s 和 1932x2576 上返回大小为 750x750 的图像,默认值为picker.allowsEditing
XCode v. 8.1 iPhone 6S iOS 10.1.1 GoogleMobileVision v 1.0.4