0

Is there a way to turn off face recognition when presenting a UIImagePickerController (i.e. the yellow box that appears over your face?

_imagePicker = [[UIImagePickerController alloc] init];
_imagePicker.allowsEditing = YES;
_imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
_imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
[self presentViewController:_imagePicker animated:NO completion:NULL];

Based on these docs there is a key that will disable facial recognition. How do I set this key to disable it?

CIDetectorTracking
A key used to enable or disable face tracking for the detector. Use this option when you want to track faces across frames in a video

Edit

How would I go about writing a bare-bones camera using AVFoundation?

Apollo
  • 8,874
  • 32
  • 104
  • 192
  • Did you check this out? http://stackoverflow.com/questions/12315260/uiimagepickercontroller-disable-iphone-4s-face-detection-ios-5-1 – The dude Jun 01 '14 at 19:30
  • 1
    The docs you refer to are OS X docs. I'll try and research on this issue, sounds pretty interesting :) – Lior Pollak Jun 04 '14 at 14:44

2 Answers2

1

According to UIImagePickerController's documentation. There is no API to enable/disable the face recognition.

If you really want to disable it when user take image, I suggest you to use Media Capture and Access to Camera in AV Foundation Programming Guide.

sunkehappy
  • 8,970
  • 5
  • 44
  • 65
  • please see my edited question. I checked out Apple's sample AVCam project, but it seems like overkill for what I want to do. I don't need to capture video. – Apollo Jun 04 '14 at 14:40
0

Update: Warning: I do not recommend using this at all, it's just to show a way I managed to hide those boxes, it will break sooner or later.

After hacking around a little bit, i managed to track down the subview that holds those little squares and set it's hidden property to YES

simply, at the end of your init code, you makeKeyAndVisible, put in this:

[[[[[[[[[[[[[[_imagePicker childViewControllers] objectAtIndex:0] view] subviews] objectAtIndex:0] subviews] objectAtIndex:0] subviews] objectAtIndex:0] subviews] objectAtIndex:0] subviews] objectAtIndex:0] setHidden:YES];

Sorry for the bad formatting, I'm doing this in a hurry, but you get the idea, Also while messing around I found that you can control the Camera Iris view and some other features. but this should do your trick Also, this won't disable the face detection, meaning when the user finishes selecting, you can find out how many face features where detected !

I also think this will ONLY work on iPhone 4s and up ! You need to test a lot, this is really bad hackery that I don't recommend using on production apps !

  • Besides rejection it is very likely to crash on the slightest SDK change. At very list you should keep validating your objects at every step. – Rivera Jun 10 '14 at 06:33
  • @Rivera : Yes, you are right. That's why I said its just kind of a hack and this should not be used at all. :) – try catch finally Jun 10 '14 at 07:00