本文整理匯總了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;
}