Last active
November 5, 2018 19:27
-
-
Save owahltinez/448c7ae59d21b1ebca421ec9bb88281f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val cameraSession: CameraCaptureSession = ... | |
// Use still capture template to build our capture request | |
val captureRequest = cameraSession.device.createCaptureRequest( | |
CameraDevice.TEMPLATE_STILL_CAPTURE) | |
// Determine if this device supports distortion correction | |
val characteristics: CameraCharacteristics = ... | |
val supportsDistortionCorrection = characteristics.get( | |
CameraCharacteristics.DISTORTION_CORRECTION_AVAILABLE_MODES)?.contains( | |
CameraMetadata.DISTORTION_CORRECTION_MODE_HIGH_QUALITY) ?: false | |
if (supportsDistortionCorrection) { | |
captureRequest.set( | |
CaptureRequest.DISTORTION_CORRECTION_MODE, | |
CameraMetadata.DISTORTION_CORRECTION_MODE_HIGH_QUALITY) | |
} | |
// Add output target, set other capture request parameters... | |
// Dispatch the capture request | |
cameraSession.capture(captureRequest.build(), ...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment