I have used the below code to detect face from an image:
-(void)markFaces:(UIImageView *)imagePick {
CIImage* image = [CIImage imageWithCGImage:imagePick.image.CGImage];
CIDetector* detector = [CIDetector detectorOfType:CIDetectorTypeFace
context:nil options:[NSDictionary dictionaryWithObject:CIDetectorAccuracyHigh forKey:CIDetectorAccuracy]];
NSDictionary* imageOptions = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:6] forKey:CIDetectorImageOrientation];
NSLog(@"imageOptions %@",imageOptions);
NSArray* features = [detector featuresInImage:image options:imageOptions];
if([features count] > 0)
{
NSLog(@"Face Found");
}
else
{
NSLog(@"Face not Found");
}
}
and this algorithm is not working if I click a snap from landscape mode. Why? Any help would be appreciated.
Thanks in Advance
I think the problem is in this line:
You are actually telling it to look for portrait orientations only as the number you are passing is 6.
The documentation in the header file says that:
And the options are
It’s annoying that
featuresInImage:options:is not documented (I’ll have to file a bug now that I’ve seen it)