0

I use AVFoundation to capture a still image, it will takes about 0.8 seconds. I think it's really slowly. But when I use the system's penter code hererimary camera, it's much more faster.

This is the function I used : it's really slowly, maybe there is something I don't know, can anyone help me?

- (void)captureStillImageAsynchronouslyFromConnection:(AVCaptureConnection *)connection completionHandler:(void (^)(CMSampleBufferRef imageDataSampleBuffer, NSError *error))handler;
Community
  • 1
  • 1

1 Answers1

2

This seems like an issue with the resolution of your AVCaptureSession. If you set your sessionPreset to AVCaptureSessionPresetPhoto, then that is the highest resolution photo from the camera which can be slow to parse.

Try setting your sessionPreset to AVCaptureSessionPresetHigh. On some devices, the resolution difference (amount of pixels in the photo) is nearly 50%! For a detailed table of device photo resolutions, see: https://stackoverflow.com/a/31964333/4769084

Community
  • 1
  • 1
David T
  • 2,724
  • 1
  • 17
  • 27