ImageProxyTransformFactory


class ImageProxyTransformFactory


Factory for extracting transform info from ImageProxy.

This class is for extracting a OutputTransform from an ImageProxy object. The OutputTransform represents the transform being applied to the original camera buffer, which can be used by CoordinateTransform to transform coordinates between UseCases.

Summary

Public constructors

Public functions

OutputTransform

Extracts the transform from the given ImageProxy.

Boolean

Whether the factory respects the value of getCropRect.

Boolean

Whether the factory respects the value of getRotationDegrees.

Unit
setUsingCropRect(usingCropRect: Boolean)

Whether to use the crop rect of the ImageProxy.

Unit
setUsingRotationDegrees(usingRotationDegrees: Boolean)

Whether to use the rotation degrees of the ImageProxy.

Public constructors

ImageProxyTransformFactory

Added in 1.1.0
ImageProxyTransformFactory()

Public functions

getOutputTransform

Added in 1.1.0
fun getOutputTransform(imageProxy: ImageProxy): OutputTransform

Extracts the transform from the given ImageProxy.

This method returns a OutputTransform that represents the transform applied to the buffer of a ImageProxy based on factory settings. An ImageProxy can be the output of ImageAnalysis or in-memory ImageCapture.

isUsingCropRect

Added in 1.1.0
fun isUsingCropRect(): Boolean

Whether the factory respects the value of getCropRect.

By default, the value is false.

isUsingRotationDegrees

Added in 1.1.0
fun isUsingRotationDegrees(): Boolean

Whether the factory respects the value of getRotationDegrees.

By default, the value is false.

setUsingCropRect

Added in 1.1.0
fun setUsingCropRect(usingCropRect: Boolean): Unit

Whether to use the crop rect of the ImageProxy.

By default, the value is false and the factory uses the ImageProxy's entire buffer. Only set this value if the coordinates to be transformed respect the crop rect. For example, top-left corner of the crop rect is (0, 0).

setUsingRotationDegrees

Added in 1.1.0
fun setUsingRotationDegrees(usingRotationDegrees: Boolean): Unit

Whether to use the rotation degrees of the ImageProxy.

By default, the value is false and the factory uses a rotation degree of 0. Only set this value to true if the coordinates to be transformed is after the rotation degree is applied. For example, if the getRotationDegrees is 90 degrees, (0, 0) in the original buffer should be mapped to (height, 0) in the rotated image. Set this value to true if the input coordinates are based on the original image, and false if the coordinates are based on the rotated image.