Skip to content

Instantly share code, notes, and snippets.

@owahltinez
Last active November 5, 2018 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owahltinez/448c7ae59d21b1ebca421ec9bb88281f to your computer and use it in GitHub Desktop.
Save owahltinez/448c7ae59d21b1ebca421ec9bb88281f to your computer and use it in GitHub Desktop.
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