我想在iOS 5中使用CoreImage的人臉檢測,但它沒有檢測到任何東西。我想檢測剛相機使用此代碼拍攝的圖像中的人臉:iOS人臉檢測問題
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSDictionary *detectorOptions = [[NSDictionary alloc] initWithObjectsAndKeys:CIDetectorAccuracyHigh, CIDetectorAccuracy, nil];
CIDetector *faceDetector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:detectorOptions];
NSArray *features = [faceDetector featuresInImage:image.CIImage];
NSLog(@"Features = %@", features);
[self dismissModalViewControllerAnimated:YES];
}
這編譯並運行良好,但不管什麼圖像中它的特徵陣列始終是空的...任何想法?
今天仍然有用!絕對的輝煌 – 2017-06-24 19:25:49