Package-level declarations

Types

Link copied to clipboard

Represents the auto-focus algorithm used by the CameraDevice, either while continuously keeping a scene in focus (via auto-3A / AE/AF/AWB), or for a metering action.

Link copied to clipboard
data class BinnedConstraint(val binned: Boolean) : Constraint

A constraint to prefer a binned format, or prefer a non-binned format.

Link copied to clipboard
data class BoundingBox(val x: Double, val y: Double, val width: Double, val height: Double)

The bounding box around a ScannedObject, in camera-space coordinates (0.0 to 1.0). Convert it to view-space with the preview view's convertCameraPointToViewPoint.

Link copied to clipboard
data class CameraCalibrationData(val pixelSize: Double, val intrinsicMatrixReferenceDimensions: Size, val lensDistortionCenter: Point, val cameraIntrinsicMatrix: List<Double>, val cameraExtrinsicsMatrix: List<Double>)

Per-frame calibration data, to counter-apply the transformations of the Camera/ISP: undo distortion correction, or compute the scene in 3D space. iOS only.

Link copied to clipboard

A CameraController controls a CameraDevice connected to a CameraSession: zoom, torch, exposure, focus…

Link copied to clipboard
data class CameraControllerConfiguration(val enableLowLightBoost: Boolean? = null, val enableSmoothAutoFocus: Boolean? = null, val enableDistortionCorrection: Boolean? = null)

Configuration options of a CameraController.

Link copied to clipboard

The CameraDepthFrameOutput streams Depth frames from the Camera, on devices supporting depth (whose CameraDevice.mediaTypes contain MediaType.DEPTH).

Link copied to clipboard

The CameraDevice represents a physical or virtual Camera Device.

Link copied to clipboard

The CameraDeviceFactory allows getting CameraDevices, listening to device changes, and querying extensions or preferred Cameras.

Link copied to clipboard
sealed interface CameraDeviceOrPosition

Either a concrete CameraDevice, or a TargetCameraPosition to automatically select the default CameraDevice at the given position.

Link copied to clipboard
interface CameraExtension

A vendor-specific Camera extension, such as Night mode or Bokeh.

Link copied to clipboard

The type of a vendor-specific CameraExtension.

Link copied to clipboard
interface CameraFactory

The CameraFactory allows creating various other Camera related objects.

Link copied to clipboard

The CameraFrameOutput streams Frames from the Camera synchronously, aka "Frame Processing".

Link copied to clipboard

The CameraObjectOutput scans objects (codes, faces, bodies…) with the platform's built-in detectors. iOS only: on Android, use the barcode module (ML Kit) on a CameraFrameOutput instead.

Link copied to clipboard

Represents the orientation, relative to a base anchor.

Link copied to clipboard

Represents an output of a CameraSession, for example a preview, a photo or a video output.

Link copied to clipboard
data class CameraOutputConfiguration(val output: CameraOutput, val mirrorMode: MirrorMode = MirrorMode.AUTO)

Specifies options for an output in a CameraSessionConnection.

Link copied to clipboard

Synchronizes 2 or more CameraOutputs to align their timestamps, most commonly a CameraFrameOutput and a CameraDepthFrameOutput so their Frames and Depth frames match. iOS only.

Link copied to clipboard

A CameraOutput capturing Photos, in memory (capturePhoto) or directly to a file (capturePhotoToFile).

Link copied to clipboard

Represents the physical position of a CameraDevice on the device.

Link copied to clipboard

An output that streams the Camera feed to a preview view.

Link copied to clipboard
interface CameraSession

Represents a Camera Session.

Link copied to clipboard

A resolved session-level configuration for a CameraSession, the result of negotiating Constraints.

Link copied to clipboard
data class CameraSessionConfiguration(val allowHapticsAndSystemSoundsPlayback: Boolean = false, val allowBackgroundAudioPlayback: Boolean = false)

Session-wide configuration for a CameraSession.

Link copied to clipboard
data class CameraSessionConnection(val input: CameraDeviceOrPosition, val outputs: List<CameraOutputConfiguration>, val constraints: List<Constraint> = emptyList(), val initialZoom: Double? = null, val initialExposureBias: Double? = null, val onSessionConfigSelected: (config: CameraSessionConfig) -> Unit? = null)

Specifies a single Camera input stream connection streaming into zero or more outputs.

Link copied to clipboard

A CameraOutput recording videos (possibly with audio) to files, through Recorders.

Link copied to clipboard
data class CapturePhotoCallbacks(val onWillBeginCapture: () -> Unit? = null, val onWillCapturePhoto: () -> Unit? = null, val onDidCapturePhoto: () -> Unit? = null, val onPreviewImageAvailable: (previewImage: Image) -> Unit? = null)

Callbacks of a CameraPhotoOutput.capturePhoto call.

Link copied to clipboard
data class CapturePhotoSettings(val flashMode: FlashMode = FlashMode.OFF, val enableShutterSound: Boolean = true, val enableDepthData: Boolean = false, val enableRedEyeReduction: Boolean = true, val enableCameraCalibrationDataDelivery: Boolean = false, val enableDistortionCorrection: Boolean = false, val enableVirtualDeviceFusion: Boolean = true, val location: Location? = null)

Settings of a single CameraPhotoOutput.capturePhoto call.

Link copied to clipboard

Represents the range of YUV color components.

Link copied to clipboard

Represents the color space of a DynamicRange.

Link copied to clipboard
Link copied to clipboard

Commonly used resolutions, in portrait orientation, to be used as target resolutions for outputs.

Link copied to clipboard
sealed interface Constraint

Constraints are session configuration options that are negotiated by the CameraSession to find a closest-matching working Camera configuration.

Link copied to clipboard

A Depth frame, captured by a CameraDepthFrameOutput or embedded in a Photo (Photo.depth).

Link copied to clipboard

The measurement accuracy of a Depth frame.

Link copied to clipboard

The quality classification of a Depth frame.

Link copied to clipboard
data class DepthFrameOutputOptions(val targetResolution: Size = CommonResolutions.VGA_16_9, val enableFiltering: Boolean = true, val enablePhysicalBufferRotation: Boolean = false, val dropFramesWhileBusy: Boolean = true, val allowDeferredStart: Boolean = true)

Configuration options for a CameraDepthFrameOutput.

Link copied to clipboard

Represents the pixel format of a depth image buffer.

Link copied to clipboard
data class DeviceFilter(val physicalDevices: List<DeviceType>? = null)

A filter to find the best matching CameraDevice with getCameraDevice.

Link copied to clipboard

Represents the type of a physical or logical Camera lens on the CameraDevice.

Link copied to clipboard
data class DynamicRange(val bitDepth: DynamicRangeBitDepth, val colorSpace: ColorSpace, val colorRange: ColorRange)

Represents a Dynamic Range, often used for recording HDR videos.

Link copied to clipboard

Represents the bit-depth of a DynamicRange.

Link copied to clipboard

Represents the exposure mode of a CameraDevice.

Link copied to clipboard

The flash mode of a photo capture, see CapturePhotoSettings.flashMode.

Link copied to clipboard

Represents the focus mode of a CameraDevice.

Link copied to clipboard
data class FocusOptions(val responsiveness: FocusResponsiveness = FocusResponsiveness.SNAPPY, val adaptiveness: SceneAdaptiveness = SceneAdaptiveness.CONTINUOUS, val modes: List<MeteringMode>? = null, val autoResetAfter: Duration? = 5.seconds)

Options for a focus metering operation.

Link copied to clipboard

Configures the responsiveness of a AE/AF/AWB focus operation.

Link copied to clipboard
data class FPSConstraint(val fps: Double) : Constraint

A constraint to set a given fps for any Video, Frame or Preview Streams.

Link copied to clipboard

A single Camera Frame, backed by a native buffer (an ImageProxy on Android, a CMSampleBuffer on iOS).

Link copied to clipboard
interface FrameConverter

Converts Frames and Depth frames to Images (port of V5's FrameConverter). Use the HybridFrameConverter instance:

Link copied to clipboard

Represents the reason why a Frame was dropped by the Camera pipeline.

Link copied to clipboard
sealed interface FrameOrDepth

Either a Frame or a Depth frame, as delivered together by a CameraOutputSynchronizer. This is VisionCamera's Frame | Depth union.

Link copied to clipboard
data class FrameOutputOptions(val targetResolution: Size = CommonResolutions.HD_16_9, val pixelFormat: TargetVideoPixelFormat = TargetVideoPixelFormat.NATIVE, val enablePreviewSizedOutputBuffers: Boolean = false, val allowDeferredStart: Boolean = true, val enablePhysicalBufferRotation: Boolean = false, val enableCameraMatrixDelivery: Boolean = false, val dropFramesWhileBusy: Boolean = true)

Configuration options for a CameraFrameOutput.

Link copied to clipboard
interface FramePlane

A single plane of a planar Frame, e.g. the Y or the UV plane of a YUV Frame.

Link copied to clipboard
interface FrameRenderer

Renders Frames into a target. For example, a FrameRendererView connected to a FrameRenderer renders its Frames on screen. It could also feed a custom video recorder.

Link copied to clipboard
class FrameRendererView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : SurfaceView

An Android android.view.View rendering the Frames of a FrameRenderer on screen.

class FrameRendererView : UIView

A UIKit view displaying the Frames rendered by a FrameRenderer (port of V5's HybridFrameRendererView.swift).

Link copied to clipboard

A GestureController controls a property of a CameraController with a user gesture, e.g. the zoom with a pinch (ZoomGestureController).

Link copied to clipboard

The platform's FrameConverter (V5's HybridFrameConverter).

Link copied to clipboard
interface Image

A decoded, ready to display image, the equivalent of the Image of react-native-nitro-image that VisionCamera returns from Photo.toImage, CapturePhotoCallbacks.onPreviewImageAvailable, the preview view's takeSnapshot() and the FrameConverter.

Link copied to clipboard

The reason a CameraSession was interrupted.

Link copied to clipboard
fun interface ListenerSubscription

Represents a subscription to any kind of listener.

Link copied to clipboard
data class Location(val latitude: Double, val longitude: Double, val altitude: Double = 0.0, val horizontalAccuracy: Double = 0.0, val verticalAccuracy: Double = 0.0, val timestamp: Double = 0.0, val isMock: Boolean = false)

A geographic location, embedded in the metadata of a Photo (CapturePhotoSettings.location) or a video (RecorderSettings.location).

Link copied to clipboard
data class MediaSampleMetadata(val timestamp: CValue<CMTime>, val orientation: CameraOrientation, val isMirrored: Boolean)

The timestamp, orientation and mirroring of a captured media sample.

Link copied to clipboard

Represents the type of a media sample.

Link copied to clipboard

Specifies the metering mode, also known as the 3A operation.

Link copied to clipboard
interface MeteringPoint

A point used to focus AE/AF/AWB on the Camera via CameraController.focusTo.

Link copied to clipboard

Represents the target mirroring setting for a Camera Output.

Link copied to clipboard
interface NativeBuffer

An unmanaged memory pointer to a native platform buffer.

Link copied to clipboard

A CameraDevice backed by a CameraX CameraInfo.

Link copied to clipboard

A CameraOutput backed by a CameraX UseCase (port of V5's public/NativeCameraOutput.kt).

A CameraOutput backed by an AVCaptureOutput (photo, video, frames...), that is added to the AVCaptureSession and manually connected to its input in CameraSession.configure.

Link copied to clipboard
interface NativeDepth

Gives access to the native AVDepthData of a Depth (port of V5's Public/NativeDepth.swift).

Link copied to clipboard
interface NativeFrame

A Frame or Depth created by VisionCamera on Android, backed by a CameraX ImageProxy (port of V5's public/NativeFrame.kt).

interface NativeFrame

Gives access to the native CMSampleBuffer of a Frame (port of V5's Public/NativeFrame.swift).

Link copied to clipboard

A FrameRenderer created by VisionCamera on Android, rendering into a Surface.

Link copied to clipboard
interface NativeThread

A native thread: an Executor on Android, a DispatchQueue on iOS.

Link copied to clipboard

Creates NativeThreads, for advanced asynchronous processing. Camera outputs already create their own threads, so this is rarely needed.

Link copied to clipboard
data class ObjectOutputOptions(val enabledObjectTypes: List<ScannedObjectType>)

Configuration options for a CameraObjectOutput.

Link copied to clipboard

Listens to CameraOrientation changes of the device or the interface.

Link copied to clipboard

Represents the source of a CameraOrientation.

Link copied to clipboard
data class OutputConfiguration(val mirrorMode: MirrorMode)

The configuration applied to an output when the CameraSession is configured.

Link copied to clipboard

Represents the type of an output stream, used to query available resolutions via CameraDevice.getSupportedResolutions.

Link copied to clipboard

Represents the status of a Permission - e.g. Camera or Microphone.

Link copied to clipboard
interface Photo : AutoCloseable

A photo captured in memory by CameraPhotoOutput.capturePhoto.

Link copied to clipboard

Represents the container format of a captured Photo.

Link copied to clipboard
data class PhotoFile(val filePath: String, val width: Int, val height: Int, val orientation: CameraOrientation, val isMirrored: Boolean, val timestamp: Double, val isRawPhoto: Boolean, val containerFormat: PhotoContainerFormat)

A photo captured by CameraPhotoOutput.capturePhotoToFile and written to a file.

Link copied to clipboard
data class PhotoHDRConstraint(val photoHDR: Boolean) : Constraint

A constraint to set Photo HDR for Photo Outputs.

Link copied to clipboard
data class PhotoOutputOptions(val targetResolution: Size = CommonResolutions.UHD_4_3, val containerFormat: TargetPhotoContainerFormat = TargetPhotoContainerFormat.NATIVE, val quality: Double = 0.9, val qualityPrioritization: QualityPrioritization = QualityPrioritization.BALANCED, val previewImageTargetSize: Size? = null)

Configuration options of a CameraPhotoOutput, see CameraFactory.createPhotoOutput.

Link copied to clipboard
sealed interface PixelFormat

Represents any kind of pixel format for a media sample:

Link copied to clipboard
data class PixelFormatConstraint(val pixelFormat: PixelFormat) : Constraint

A constraint to prefer a streaming Format with the given target PixelFormat.

Link copied to clipboard
data class Point(val x: Double, val y: Double)

Represents a Point in the current context's coordinate system.

Link copied to clipboard

The implementation used by the preview view on Android. Ignored on iOS.

Link copied to clipboard

How the preview view scales the Camera feed into its bounds.

Link copied to clipboard
data class PreviewStabilizationModeConstraint(val previewStabilizationMode: TargetStabilizationMode) : Constraint

A constraint to set a TargetStabilizationMode for Preview Streams.

Link copied to clipboard
class PreviewView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : FrameLayout

An Android android.view.View displaying the Camera feed of a CameraPreviewOutput.

class PreviewView : UIView

A UIKit view displaying the Camera feed of a CameraPreviewOutput (port of V5's HybridPreviewView.swift).

Link copied to clipboard

Specifies the prioritization between speed and quality for photo capture.

Link copied to clipboard
data class Range(val min: Double, val max: Double)

Represents a numeric range with a minimum and maximum value, inclusive on both ends.

Link copied to clipboard
interface Recorder

Records a single video to a file, see CameraVideoOutput.createRecorder. To record several videos, create several Recorders.

Link copied to clipboard

The container file type of a CameraVideoOutput's recordings.

Link copied to clipboard
data class RecorderSettings(val location: Location? = null, val filePath: String? = null, val maxDuration: Duration? = null, val maxFileSize: Long? = null)
Link copied to clipboard

Why a Recorder's recording finished. In every case, the video file is fully written and usable.

Link copied to clipboard
data class ResolutionBiasConstraint(val resolutionBias: CameraOutput) : Constraint

A constraint to bias the resolution of the given CameraOutput over other constraints.

Link copied to clipboard

Represents a Camera Output that participates in resolution negotiations.

Link copied to clipboard
sealed interface ResolutionRule

The resolution an output would like to stream at.

Link copied to clipboard

A machine-readable code, such as a QR code. iOS only.

Link copied to clipboard

A face. iOS only.

Link copied to clipboard
interface ScannedObject

Any kind of object scanned by a CameraObjectOutput: a ScannedCode, a ScannedFace, or another object like a body. iOS only.

Link copied to clipboard
Link copied to clipboard

Configures the adaptiveness of the AE/AF/AWB pipeline after a metering operation has settled.

Link copied to clipboard
data class Size(val width: Int, val height: Int)

Represents a 2D size in pixels.

Link copied to clipboard

Specifies the stabilization algorithm/mode to use.

Link copied to clipboard

The kind of stream a ResolutionNegotiationParticipant negotiates a resolution for.

Link copied to clipboard
Link copied to clipboard

Represents the target physical position of a CameraDevice on the device.

Link copied to clipboard
data class TargetDynamicRange(val bitDepth: DynamicRangeBitDepth, val colorSpace: ColorSpace, val colorRange: ColorRange)

Represents a target DynamicRange, for example to be used with the Constraints API. None of its components can be UNKNOWN.

Link copied to clipboard

Represents a PhotoContainerFormat that can be used to capture Photos in.

Link copied to clipboard
sealed interface TargetStabilizationMode

Specifies a target stabilization mode: either a specific StabilizationMode (which has to be supported by the CameraDevice), TargetStabilizationMode.Auto or TargetStabilizationMode.Off.

Link copied to clipboard

Represents a desired pixel format for a video pipeline, e.g. the format a frame output streams frames in.

Link copied to clipboard

Represents the setting for the device's torch.

Link copied to clipboard

Represents a video codec for encoded video data.

Link copied to clipboard
data class VideoDynamicRangeConstraint(val videoDynamicRange: TargetDynamicRange) : Constraint

A constraint to set a TargetDynamicRange for Video Streams.

Link copied to clipboard
data class VideoOutputOptions(val targetResolution: Size = CommonResolutions.FHD_16_9, val enableAudio: Boolean = false, val enablePersistentRecorder: Boolean = false, val enableHigherResolutionCodecs: Boolean = false, val targetBitRate: Double? = null, val fileType: RecorderFileType = RecorderFileType.MOV)

Configuration options of a CameraVideoOutput, see CameraFactory.createVideoOutput.

Link copied to clipboard
data class VideoOutputSettings(val codec: VideoCodec? = null)
Link copied to clipboard

Represents the pixel format of a video image buffer. Video formats are either YUV or RGB. The most commonly used format is YUV_420_8_BIT_VIDEO.

Link copied to clipboard
data class VideoStabilizationModeConstraint(val videoStabilizationMode: TargetStabilizationMode) : Constraint

A constraint to set a TargetStabilizationMode for Video Streams.

Link copied to clipboard

The entry point of KMP Vision Camera: the platform's CameraFactory.

Link copied to clipboard
open class VisionCameraException(message: String, cause: Throwable? = null) : Exception

An error thrown by KMP Vision Camera, for example when a CameraSession fails to configure.

Link copied to clipboard
data class WhiteBalanceGains(val redGain: Double, val blueGain: Double, val greenGain: Double)

Represents the per-channel gains applied for white balance correction.

Link copied to clipboard

Represents the white balance mode of a CameraDevice.

Link copied to clipboard
data class WhiteBalanceTemperatureAndTint(val temperature: Double, val tint: Double)

Represents a white balance setting expressed as a color temperature and tint offset.

Link copied to clipboard

A GestureController that changes CameraController.zoom with a pinch gesture.

Properties

Link copied to clipboard
val AVCaptureConnection.inputStreamResolution: Size?

The resolution of the stream currently flowing through this connection's first input port, in sensor-native (un-rotated) pixels, or null until the session is configured.

Link copied to clipboard

The Surface.ROTATION_* value of this CameraOrientation, used as a CameraX target rotation.

Functions

Link copied to clipboard
fun NativeThread.asCoroutineDispatcher(): CoroutineDispatcher

A CoroutineDispatcher running coroutines on this NativeThread, e.g. to process frames asynchronously on the output's thread with withContext(frameOutput.thread.asCoroutineDispatcher()).

Link copied to clipboard
fun getCameraDevice(deviceFactory: CameraDeviceFactory, position: TargetCameraPosition, filter: DeviceFilter? = null): CameraDevice?

Get the CameraDevice that best satisfies the given filter at the given position, or the platform's default CameraDevice at that position if no filter is given.

Link copied to clipboard

Gets the Android Bitmap of this Image.

Converts this Photo to an Android Bitmap, with its Photo.orientation and mirroring applied.

Link copied to clipboard
Link copied to clipboard

Wraps this Bitmap in an Image, without copying it.

fun UIImage.toImage(): Image

Wraps this UIImage in an Image, without copying it.

Link copied to clipboard

Converts an Android android.util.Size to a Size.

Link copied to clipboard
fun Image.toUIImage(): UIImage

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

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().

Link copied to clipboard
fun CameraOrientation.toUIImageOrientation(isMirrored: Boolean = false): UIImageOrientation

Converts this CameraOrientation to a UIImageOrientation, mirrored if isMirrored.