CIDetector and UIImagePickerController

前端 未结 4 1188
借酒劲吻你
借酒劲吻你 2020-12-16 06:15

I\'m trying to implement the built-in iOS 5 face detection API. I\'m using an instance of UIImagePickerController to allow the user to take a photo and then I\'

4条回答
  •  伪装坚强ぢ
    2020-12-16 07:11

    Sure enough, after spending a day looking into this and being stumped, I've found a solution an hour after posting this.

    I eventually noticed that the face detection did work in landscape, but not in portrait.

    Turns out I needed these options:

    NSDictionary *imageOptions = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:6]
                                                             forKey:CIDetectorImageOrientation];
    NSArray *features = [detector featuresInImage:ciimage options:imageOptions];
    

提交回复
热议问题