I'd like to capture high resolution still images using AVCaptureSession
. Therefore AVCaptureSession
preset is set to Photo
.
This is working well so far. On an iPhone 4 the final still image resolution is at its maximum of 2448x3264 pixels and the preview (video) resolution is 852x640 pixels.
Now, because the preview frames are analyzed to detect objects in the scene, I'd like to lower their resolution. How can this be done?
I've tried to set AVVideoSettings
with a lower width/height to AVCaptureVideoDataOutput
, but this leads to the following error message:
AVCaptureVideoDataOutput setVideoSettings:] - videoSettings dictionary contains one or more unsupported (ignored) keys: (AVVideoHeightKey, AVVideoWidthKey
So it seems this is not the right approach to configure the size of the preview frames received by AVCaptureVideoDataOutput
/ AVCaptureVideoDataOutputSampleBufferDelegate
. Do you have any ideas how the resolution of the preview frames can be configured?
Any advise is welcome, Thank you.
Just for the records: I ended up configuring AVCaptureSession
in preset Low
while aiming the camera. As soon as the shutter is triggered, the app switches to preset Photo
, performs a focus run and takes the picture. This way it takes between 1 and 2.5 seconds to take a picture, which isn't that great, but it's at least a workaround.