CameraPhotoOutput

A CameraOutput capturing Photos, in memory (capturePhoto) or directly to a file (capturePhotoToFile).

val photoOutput = VisionCamera.createPhotoOutput(PhotoOutputOptions(targetResolution = CommonResolutions.UHD_4_3))
// ... connect it to a CameraSession, then:
photoOutput.capturePhoto().use { photo ->
photo.saveToFile(path)
}

Properties

Link copied to clipboard
abstract val currentResolution: Size?

The resolution this output is currently streaming at, or null if it is not connected yet.

Link copied to clipboard
abstract val mediaType: MediaType

The MediaType of this output.

Link copied to clipboard

The orientation of the content produced by this output.

Link copied to clipboard

Whether this output can deliver camera calibration data with photos (CapturePhotoSettings.enableCameraCalibrationDataDelivery).

Link copied to clipboard

Whether this output can deliver depth data with photos (CapturePhotoSettings.enableDepthData).

Functions

Link copied to clipboard
abstract suspend fun capturePhoto(settings: CapturePhotoSettings = CapturePhotoSettings(), callbacks: CapturePhotoCallbacks = CapturePhotoCallbacks()): Photo

Captures a Photo in memory with the given settings.

Link copied to clipboard
abstract suspend fun capturePhotoToFile(settings: CapturePhotoSettings = CapturePhotoSettings(), callbacks: CapturePhotoCallbacks = CapturePhotoCallbacks()): PhotoFile

Captures a photo with the given settings and writes it to a temporary file.

Link copied to clipboard
open override fun close()

Same as dispose, to use a CameraOutput with use { }.

Link copied to clipboard
abstract fun dispose()

Eagerly disposes the native resources this output holds (its threads, analyzers, delegates, sounds...), like VisionCamera's HybridObject.dispose().

Link copied to clipboard
abstract suspend fun prepareSettings(settings: List<CapturePhotoSettings>)

Prepares the pipeline for the given settings, so that later capturePhoto calls with any of them start faster. Optional; a no-op on Android.