I am trying to use CoreImage's face detection in iOS 5 but it is not detecting anything. I am trying to detect faces in an image that was just captured by the camera using this code:
- (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];
}
This compiles and runs fine but it the features array is always empty regardless of what's in the image... Any ideas?