Package-level declarations

Types

Link copied to clipboard

Defines a Processor that is able to take AudioProcessor.Input and run audio processing operations that analyze data to detect patterns and/or mutate the provided AudioProcessor.Input.Frames to apply effects such as filtering, pitch correction etc.

Link copied to clipboard
annotation class Experimental

Indicates that the annotated feature is experimental: it may be removed, its signature or behavior may be changed without warning from one release to the next.

Link copied to clipboard

Defines a Processor that is able to take ImageProcessor.Input, run some image processing operations on it and render the final result to ImageProcessor.Output.

Link copied to clipboard

Defines a Processor that subscribes to LegalProcessor.Input to receive results from a user responding to a LegalProcessor.Input.Prompt for a legal agreement.

Link copied to clipboard

Defines a Processor that subscribes to LocationProcessor.Input to receive information about the current device Location, when available.

Link copied to clipboard

Defines a Processor that subscribes to MediaProcessor.Input to receive Media data.

Link copied to clipboard
interface Processor

Marker interface for all processors that can be attached to a specific Source.

Link copied to clipboard

Defines a Processor that subscribes to SafeRenderAreaProcessor.Input to receive updates on the area that the client considers to be safe for rendering content such as lens UI elements where they can not overlap or interfere with the client's own UI.

Link copied to clipboard
interface Session : Closeable

Entry point to all CameraKit features. To obtain Session implementations must provide methods to get a new instance of Builder which exposes options to customize Session instance once it is built by calling Builder.build. Once done using an instance of Session, Session.close must be called to avoid leaking resources.

Link copied to clipboard
interface Source<P : Processor>

Defines a provider of generic inputs that a Processor of type P can be attached to process over.

Link copied to clipboard
class UnauthorizedApplicationException(val applicationId: String, val apiToken: String, val packageName: String?) : RuntimeException

If application with a specific ID and package name is not authorized to use CameraKit this exception will be thrown, normally ending up in the error handler provided via Session.Builder.handleErrorsWith.

Link copied to clipboard

Defines a Processor that subscribes to UserProcessor.Input to receive information about the current user, when available.

Link copied to clipboard
class Version @JvmOverloads constructor(val major: Int, val minor: Int, val patch: Int, val qualifier: String? = null) : Comparable<Version>

Represents a version of the CameraKit library. Versions are Comparable between each other by following the SemVer 2.0.0 specification.

Functions

Link copied to clipboard

Creates a ImageProcessor.Input.Pausable instance that uses ARCore development kit to provide surface tracking capabilities. Uses a mp4DataSetFile to play back instead of using the live camera feed and IMU sensor data.

Creates a ImageProcessor.Input.Pausable instance that uses ARCore development kit to provide surface tracking capabilities.

Link copied to clipboard
fun <P : ImageProcessor> P.connectInput(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()): Closeable

Connects the provided file and associated optional parameters as a video based ImageProcessor.Input. Invoking Closeable.close on the returned Closeable stops the video playback and releases any resources associated with it.

Link copied to clipboard
fun <P : ImageProcessor> P.connectOutput(textureView: TextureView, outputOptions: Set<ImageProcessor.Output.Option> = Collections.emptySet()): Closeable

Allows to connect TextureView as output to ImageProcessor.

Link copied to clipboard

Creates or uses a recycled AudioProcessor.Input.Frame that gets populated with the provided parameters.

Link copied to clipboard
fun inputFrom(surfaceTexture: SurfaceTexture, width: Int, height: Int, rotationDegrees: Int, facingFront: Boolean, horizontalFieldOfView: Callable<Float>, verticalFieldOfView: Callable<Float>): ImageProcessor.Input
fun inputFrom(surfaceTexture: SurfaceTexture, width: Int, height: Int, rotationDegrees: Int, facingFront: Boolean, horizontalFieldOfView: Float, verticalFieldOfView: Float): ImageProcessor.Input

Creates SurfaceTexture backed ImageProcessor.Input with the provided properties.

Link copied to clipboard
@RequiresPermission(value = "android.permission.RECORD_AUDIO", conditional = true)
fun microphoneSourceFor(executorService: ExecutorService): Source<AudioProcessor>

Creates a new Source that attempts to use device microphone to read audio data and provide it to an attached AudioProcessor.

Link copied to clipboard
fun newBuilder(context: Context, lifecycleOwner: LifecycleOwner? = context as? LifecycleOwner): Session.Builder

Creates a new Session.Builder with the provided context. An optional LifecycleOwner can be provided as an aid to tie behaviours such as audio playback to application lifecycle. If no LifecycleOwner is provided then the context will be checked for LifecycleOwner implementation to be used as a fallback.

Link copied to clipboard
fun outputFrom(surfaceTexture: SurfaceTexture, purpose: ImageProcessor.Output.Purpose = ImageProcessor.Output.Purpose.PREVIEW, rotationDegrees: Int = Int.MIN_VALUE): ImageProcessor.Output

Creates SurfaceTexture backed ImageProcessor.Output with the provided purpose and rotationDegrees.

fun outputFrom(surface: Surface, purpose: ImageProcessor.Output.Purpose = ImageProcessor.Output.Purpose.PREVIEW, rotationDegrees: Int = Int.MIN_VALUE): ImageProcessor.Output

Creates Surface backed ImageProcessor.Output with the provided purpose and rotationDegrees.

Link copied to clipboard
fun <P : ImageProcessor> P.processBitmap(connectedInput: ImageProcessor.Input, bitmap: Bitmap, outputRotationDegrees: Int = 0, timeout: Long = 10, timeoutUnit: TimeUnit = TimeUnit.SECONDS, mirrorHorizontally: Boolean = false, mirrorVertically: Boolean = false, allowDownscaling: Boolean = true): Bitmap?

If connectedInput is currently connected to this processor, process the bitmap and output the result as Bitmap. Source bitmap will be cropped to match connectedInput aspect ratio if they are different. Source bitmap will be rotated on ImageProcessor.Input.rotationDegrees of the connectedInput during processing. outputRotationDegrees can be used to apply an additional rotation to the resulting Bitmap. This method is a blocking operation therefore it is expected to run on a worker thread.

Link copied to clipboard
fun <P : ImageProcessor> P.processImage(connectedInput: ImageProcessor.Input, image: Image, outputRotationDegrees: Int = 0, timeout: Long = 10, timeoutUnit: TimeUnit = TimeUnit.SECONDS, mirrorHorizontally: Boolean = false, mirrorVertically: Boolean = false, allowDownscaling: Boolean = true): Bitmap?

If connectedInput is currently connected to this processor, process the image and output the result as Bitmap. Source image will be cropped to match connectedInput aspect ratio if they are different. Source image will be rotated on ImageProcessor.Input.rotationDegrees of the connectedInput during processing. outputRotationDegrees can be used to apply an additional rotation to the resulting Bitmap. Only images of android.graphics.ImageFormat.JPEG format are currently supported. This method is a blocking operation therefore it is expected to run on a worker thread.

Link copied to clipboard
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.

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.

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.

Link copied to clipboard
fun supported(context: Context): Boolean

Allows to check if the current environment is supported to run CameraKit Session. Attempts to build and run Session in unsupported environment will lead to undefined behavior and exceptions routed to an error handler, if one is supplied using Session.Builder.handleErrorsWith.

Link copied to clipboard
fun <P : ImageProcessor> P.toBitmap(width: Int, height: Int, rotationDegrees: Int = Int.MIN_VALUE, purpose: ImageProcessor.Output.Purpose = ImageProcessor.Output.Purpose.SNAPSHOT): Bitmap?

If ImageProcessor.Input is currently connected to this processor, process the input and outputs the result as Bitmap for the specified width and height dimensions and an optional rotationDegrees as well as purpose. This method is a blocking operation therefore it is expected to run on a worker thread.

Link copied to clipboard
fun versionFrom(context: Context): Version

Obtains the current Version of CameraKit library using the information from the provided context.

Properties

Link copied to clipboard

LensCore version code (ie 243).