![]() On most iPhones and iPads, we can choose between the back camera and the front camera - aka the selfie camera. First we need an AVCaptureSession object: Additionally, it owns a session (the outputs are owned by a session). It also has some utility methods for converting points from layer coordinates to those of the device. The AVCaptureVideoPreviewLayer is a subclass of CALayer, and can be used to automatically display the live feed generated from the camera. There are three concrete subclasses of interest to still image capture:ĪVCaptureStillImageOutput is used to capture a still image.ĪVCaptureMetadataOutput enables detection of faces and QR codes.ĪVCaptureVideoOutput provides the raw frames for a live preview.ĪVCaptureSession manages the data flow between the inputs and the outputs, and generates runtime errors in case something goes wrong. It is used to control the hardware features such as the position of the lens, the exposure, and the flash.ĪVCaptureDeviceInput provides the data coming from the device.ĪVCaptureOutput is an abstract class describing the result of a capture session. These classes give access to the raw data coming from the camera device and can control its components.ĪVCaptureDevice is the interface to the hardware camera. However, when direct access to the camera is necessary, the AVFoundation framework allows full control, for example, for changing the hardware parameters programmatically, or manipulating the live preview.Īn image capture implemented with the AVFoundation framework is based on a few classes. It supports all the basic features, such as switching to the front-facing camera, toggling the flash, tapping on an area to lock focus and exposure, and, on iOS 8, adjusting the exposure just as in the system camera app. UIImagePickerController provides a very simple way to take a picture. In this article, we'll see how image capture with AVFoundation works, how to control the camera, and the new features recently introduced in iOS 8. In the first SDKs, the only way to integrate the camera within an app was by using UIImagePickerController, but iOS 4 introduced the AVFoundation framework, which allowed more flexibility. The iPhone has shipped with a camera since its first model.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |