本文整理汇总了Java中android.hardware.camera2.CameraMetadata.LENS_FACING_FRONT属性的典型用法代码示例。如果您正苦于以下问题:Java CameraMetadata.LENS_FACING_FRONT属性的具体用法?Java CameraMetadata.LENS_FACING_FRONT怎么用?Java CameraMetadata.LENS_FACING_FRONT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.hardware.camera2.CameraMetadata
的用法示例。
在下文中一共展示了CameraMetadata.LENS_FACING_FRONT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
private void start() {
checkIsOnCameraThread();
Logging.d(TAG, "start");
try {
cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraId);
} catch (final CameraAccessException e) {
reportError("getCameraCharacteristics(): " + e.getMessage());
return;
}
cameraOrientation = cameraCharacteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
isCameraFrontFacing = cameraCharacteristics.get(CameraCharacteristics.LENS_FACING)
== CameraMetadata.LENS_FACING_FRONT;
findCaptureFormat();
openCamera();
}
示例2: isFrontFacing
@Override
public boolean isFrontFacing(String deviceName) {
CameraCharacteristics characteristics = getCameraCharacteristics(deviceName);
return characteristics != null
&& characteristics.get(CameraCharacteristics.LENS_FACING)
== CameraMetadata.LENS_FACING_FRONT;
}
示例3: getJpegRotation
/**
* Given the device orientation and Camera2 characteristics, this returns
* the required JPEG rotation for this camera.
*
* @param deviceOrientationDegrees the device orientation in degrees.
* @return The JPEG orientation in degrees.
*/
public static int getJpegRotation(int deviceOrientationDegrees,
CameraCharacteristics characteristics) {
if (deviceOrientationDegrees == OrientationEventListener.ORIENTATION_UNKNOWN) {
return 0;
}
int facing = characteristics.get(CameraCharacteristics.LENS_FACING);
int sensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
if (facing == CameraMetadata.LENS_FACING_FRONT) {
return (sensorOrientation + deviceOrientationDegrees) % 360;
} else {
return (sensorOrientation - deviceOrientationDegrees + 360) % 360;
}
}
示例4: isFrontFacing
@Override
public boolean isFrontFacing() {
return mCharacteristics.get(CameraCharacteristics.LENS_FACING)
== CameraMetadata.LENS_FACING_FRONT;
}