createFromCameraXImageProxy

fun createFromCameraXImageProxy(image: ImageProxy, rotation: ImageRotation = ImageRotation.fromDegreesInt(image.imageInfo.rotationDegrees), cropRect: Rect = image.cropRect): InputImage

Creates an SDK InputImage instance from a CameraX ImageProxy.

This function converts a CameraX ImageProxy into an InputImage that can be used for image processing tasks. It extracts the necessary data from the ImageProxy, including the image data, rotation, and crop rectangle.

Return

an InputImage object created from the provided ImageProxy.

Parameters

image

the CameraX ImageProxy to create the InputImage from.

rotation

rotation needed to transform the image to the correct orientation.

cropRect

the crop rectangle to apply to the image. Defaults to the image's ImageProxy.cropRect.

Throws

If the image's format is not supported.