sourceFrom

fun sourceFrom(context: Context, file: File, rotationDegrees: Int = Int.MIN_VALUE, facingFront: Boolean = true, horizontalFieldOfView: Float = DEFAULT_FIELD_OF_VIEW.width, verticalFieldOfView: Float = DEFAULT_FIELD_OF_VIEW.height, options: Set<ImageProcessor.Input.Option> = emptySet()): Source<ImageProcessor>

Creates a video file based Source for ImageProcessor. The returned Source attempts to read and play video as soon as ImageProcessor is attached to it. When ImageProcessor is de-attached, the Source stops the video and releases all resources associated with it.

The rotationDegrees, facingFront, horizontalFieldOfView, verticalFieldOfView and options parameters are optional and can be used to override the defaults when the defaults do not match the provided video file content.

Note: this is intended to be used only for testing purposes, full set of image processing features is supported only when using live camera input Source.


fun sourceFrom(@ColorInt color: Int, width: Int = 1280, height: Int = 1920, choreographer: Choreographer = Choreographer.getInstance(), rotationDegrees: Int = 0, facingFront: Boolean = true, horizontalFieldOfView: Float = DEFAULT_FIELD_OF_VIEW.width, verticalFieldOfView: Float = DEFAULT_FIELD_OF_VIEW.height, options: Set<ImageProcessor.Input.Option> = emptySet()): Source<ImageProcessor>

Creates a color based Source for ImageProcessor. The returned Source simply renders the provided color as ImageProcessor.Input using callbacks queued via Choreographer for synchronization.

The rotationDegrees, facingFront, horizontalFieldOfView, verticalFieldOfView and options parameters are optional and can be used to override the defaults when the defaults do not match the expected results.

Note: The intent of this Source is for testing purposes as well as simple use cases such as basic 3D model rendering, games etc. where real camera input is not necessary but a uniform color background is sufficient.

Since

1.21.0


fun sourceFrom(bitmap: Bitmap, choreographer: Choreographer = Choreographer.getInstance(), rotationDegrees: Int = 0, facingFront: Boolean = true, horizontalFieldOfView: Float = DEFAULT_FIELD_OF_VIEW.width, verticalFieldOfView: Float = DEFAULT_FIELD_OF_VIEW.height, options: Set<ImageProcessor.Input.Option> = emptySet()): Source<ImageProcessor>

Creates a bitmap based Source for ImageProcessor. The returned Source simply renders the provided bitmap as ImageProcessor.Input using callbacks queued via Choreographer for synchronization.

The rotationDegrees, facingFront, horizontalFieldOfView, verticalFieldOfView and options parameters are optional and can be used to override the defaults when the defaults do not match the expected results.

Note: The intent of this Source is for testing purposes as well as simple use cases such as basic 3D model rendering, games etc. where real camera input is not necessary but a static image background is sufficient.

Since

1.21.0