0

Rightnow i am developing an app to detect distance between the user's face and device by using front camera with AVFoundation and Core - image framework.

For face detection i got a sample code (squarecam) from apple website https://developer.apple.com/LIBRARY/IOS/samplecode/SquareCam/Introduction/Intro.html

In this example they are using AvFoundation to control the camera and core - image to detect face with Camera UI. But i need these process without camera UI. Is it possible to hide camera UI using AVFoundation framework.

SURESH KUMAR
  • 403
  • 5
  • 15

2 Answers2

0

You can use UIImagePickerViewController and set showsCameraControls property to NO and provide your own user interface using cameraOverlayView. here is the example https://developer.apple.com/LIBRARY/IOS/samplecode/PhotoPicker/Introduction/Intro.html

or can use AVFoundation classes, refer AVCamCaptureManager and AVCamRecorder classes. here is the demo by apple https://developer.apple.com/library/ios/samplecode/AVCam/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010112

Suhit Patil
  • 11,748
  • 3
  • 50
  • 60
  • Suhit thanks for your response.I have checked the links which you mentioned, in that they are changing the camera controls but not hiding the whole UI. In my case i want to open camera but UI should not be shown. – SURESH KUMAR Nov 25 '13 at 08:57
  • in the photopicker they have created the custom interface, you can hide controls if you want or customise it. – Suhit Patil Nov 25 '13 at 09:34
0

If I understand correctly, you want to hide the camera preview while still getting a video feed from the camera?

In that case, I believe you can keep using the code in squarecam and simply hide the PreviewLayer.

You will still get the

- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection

so you can get the image.

However, I would recommend you find the sample code for Stachecam and look at the AVMetaDataOutput implementation for real-time face detection

Jack
  • 16,677
  • 8
  • 47
  • 51