Camera2CameraInfo
public
final
class
Camera2CameraInfo
extends Object
java.lang.Object | |
↳ | androidx.camera.camera2.interop.Camera2CameraInfo |
An interface for retrieving Camera2-related camera information.
Summary
Public methods | |
---|---|
static
Camera2CameraInfo
|
from(CameraInfo cameraInfo)
Gets the |
<T>
T
|
getCameraCharacteristic(Key<T> key)
Gets a camera characteristic value. |
String
|
getCameraId()
Gets the string camera ID. |
Inherited methods | |
---|---|
Public methods
from
public static Camera2CameraInfo from (CameraInfo cameraInfo)
Gets the Camera2CameraInfo
from a CameraInfo
.
Parameters | |
---|---|
cameraInfo |
CameraInfo : The CameraInfo to get from. |
Returns | |
---|---|
Camera2CameraInfo |
The camera information with Camera2 implementation. |
Throws | |
---|---|
IllegalArgumentException |
if the camera info does not contain the camera2 information
(e.g., if CameraX was not initialized with a
Camera2Config ).
|
getCameraCharacteristic
public T getCameraCharacteristic (Key<T> key)
Gets a camera characteristic value.
The characteristic value is the same as the value in the CameraCharacteristics
that would be obtained from
CameraManager.getCameraCharacteristics(String)
.
Parameters | |
---|---|
key |
Key : The CameraCharacteristics.Key of the characteristic. |
Returns | |
---|---|
T |
the value of the characteristic. |
getCameraId
public String getCameraId ()
Gets the string camera ID.
The camera ID is the same as the camera ID that would be obtained from
CameraManager.getCameraIdList()
. The ID that is retrieved
is not static and can change depending on the current internal configuration of the
Camera
from which the CameraInfo was retrieved.
The Camera is a logical camera which can be backed by multiple
CameraDevice
. However, only one CameraDevice is active at
one time. When the CameraDevice changes then the camera id will change.
Returns | |
---|---|
String |
the camera ID. |
Throws | |
---|---|
IllegalStateException |
if the camera info does not contain the camera 2 camera ID
(e.g., if CameraX was not initialized with a
Camera2Config ).
|