Camera 2 API
suggest changeVersions
[{“Name”:“5.0”,“GroupName”:null},{“Name”:“5.1”,“GroupName”:null},{“Name”:“6.0”,“GroupName”:null},{“Name”:“7.0”,“GroupName”:null},{“Name”:“7.1”,“GroupName”:null}]
Parameters
Parameter | Details |
——— | —–– |
CameraCaptureSession
| A configured capture session for a CameraDevice
, used for capturing images from the camera or reprocessing images captured from the camera in the same session previously |CameraDevice
| A representation of a single camera connected to an Android device |CameraCharacteristics
| The properties describing a CameraDevice. These properties are fixed for a given CameraDevice, and can be queried through the CameraManager interface with getCameraCharacteristics(String)
|CameraManager
| A system service manager for detecting, characterizing, and connecting to CameraDevices
. You can get an instance of this class by calling Context.getSystemService()
|CaptureRequest
| An immutable package of settings and outputs needed to capture a single image from the camera device. Contains the configuration for the capture hardware (sensor, lens, flash), the processing pipeline, the control algorithms, and the output buffers. Also contains the list of target Surfaces to send image data to for this capture. Can be created by using a CaptureRequest.Builder
instance, obtained by calling createCaptureRequest(int)
CaptureResult
| The subset of the results of a single image capture from the image sensor. Contains a subset of the final configuration for the capture hardware (sensor, lens, flash), the processing pipeline, the control algorithms, and the output buffers. It is produced by a CameraDevice
after processing a CaptureRequest
Remarks
- Camera2 APIs are available in API 21+ (Lollipop and beyond)
- Even if an Android device has a 21+ ROM officially, there is no guarantee that it implements Camera2 APIs, it’s totally up to the manufacturer to implement it or not (Example: LG G2 has official Lollipop support, but no Camera2 APIs)
- With Camera2, Camera (“Camera1”) is deprecated
- With great power comes great responsability: It’s easier to mess it up when using this APIs.
- Remember, if you only want to take a photo in your app, and simply get it, you don’t need to implement Camera2, you can open the device’s camera app via an Intent, and receive it back