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 thi
OK, it's always helpful to read the documentation CAREFULLY. In the UIImage docs, under the CIImage property it says: "If the UIImage object was initialized using a CGImageRef, the value of the property is nil." Apparently, the UIImagePickerController does initialize the image from a CGImageRef because this property is indeed nil. To make the above code work, you need to add:
CIImage *ciImage = [CIImage imageWithCGImage:image.CGImage];
and change this line:
NSArray *features = [faceDetector featuresInImage:ciImage];
Another BIG thing I noticed is that face detection from a still image does not really work on the low-res image from the front camera! It works every time when I use the back, high-res camera. Perhaps the algorithm is tuned for high-res...