toUIImage

fun Image.toUIImage(): UIImage

Gets the UIImage of this Image. Its orientation and mirroring are applied through UIImage.imageOrientation.

val uiImage = HybridFrameConverter.convertFrameToImage(frame).toUIImage()

Throws

If this Image was not created by VisionCamera.


fun Photo.toUIImage(): UIImage

Converts this Photo to a UIImage, applying its Photo.orientation and Photo.isMirrored through the image's imageOrientation. Same as Photo.toImage followed by Image.toUIImage().

val image = photoOutput.capturePhoto().use { it.toUIImage() }

Throws

If this photo was not captured by VisionCamera, was disposed, or cannot be converted (e.g. it is a RAW photo).