Playing around with AVCapureSessions
and trying to display the output CMSampleBufferRef
's in different ways (using a AVCaptureVideoPreviewLayer
, displaying a CGImage
and transforming it to a UIImage
), I also looked at all the different quality presets you can set for you AVCaptureSession
.
Then I noticed how the quality differences between
AVCaptureSessionPresetLow
,AVCaptureSessionPresetMedium
andAVCaptureSessionPresetHigh
are not only the resolution of the image but also their aspect ratio and most notably the overall image quality. In my specific case, frames gotten with AVCaptureSessionPresetLow/Medium
were much brighter than those with AVCaptureSessionPresetHigh
. Why is this?
To set up the session and to display the images I used this code: http://www.benjaminloulier.com/posts/ios4-and-direct-access-to-the-camera
To set the presets:
[self.captureSession setSessionPreset:AVCaptureSessionPresetHigh];
Here two examples with Medium
and High
quality:
I assure you that these two screenshots are made pointing the camera at the same spot, same time and with the same light conditions.
The difference is caused by the purpose of those presets. While
AVCaptureSessionPresetHigh
is basically for making video,AVCaptureSessionPresetLow/Medium
might be used for creating photos as well because they have the same behavior asAVCaptureSessionPresetPhoto
preset. You can try your default camera app.