DeepMedia logodeepmedia

Camera SDK

Version 0.8.5

Search

Choose platform

Other versions of this page

Controls

Camera sensors can be configured using the CameraCapabilities and CameraConfiguration classes.

  • The capabilities object lets you understand which settings are supported (read only)
  • The configuration object lets you apply them

For example, for white balance:

kotlin logokotlin
val capabilities: CameraCapabilities = device.capabilities val options: Set<WhiteBalance> = capabilities.whiteBalance // Let user choose among the set above, then apply: device.configure(whiteBalance = options[selectedIndex]) // Or with the lambda syntax: device.configure { whiteBalance = options[selectedIndex] }
swift
let capabilities: CameraCapabilities = device.capabilities let options: Set<WhiteBalance> = capabilities.whiteBalance // Let user choose among the set above, then apply: try await device.configure(whiteBalance: options[selectedIndex]) // Or with the lambda syntax: device.configure { $0.whiteBalance = options[selectedIndex] }

Settings

The list below documents all the settings that can be configured through the capabilities/configuration mechanism.

Flash

Controls the device flash.

  • Type: Flash enumeration
  • Set of supported values: CameraCapabilities.flash
  • Configuration field: CameraConfiguration.flash
ValueDescription
WhiteBalance.OffWhiteBalance.offFlash is disabled.
WhiteBalance.AutoWhiteBalance.autoThe sensor automatically determines whether flash is needed or not during takePicture.
WhiteBalance.OnWhiteBalance.onFlash is always triggered during takePicture.
WhiteBalance.TorchWhiteBalance.torchFlash stays on in torch mode.

Zoom

Controls zoom. The available range is that of the camera sensor. For logical cameras, changing zoom may also cause it to use a different lens under the hood (e.g. switch to wide angle for low zoom).

  • Type: Float
  • Range of supported values: CameraCapabilities.zoom
  • Configuration field: CameraConfiguration.zoom

Stabilization

Controls the device flash.

  • Type: Stabilization enumeration
  • Set of supported values: CameraCapabilities.stabilization
  • Configuration field: CameraConfiguration.stabilization
ValueDescription
Stabilization.OffStabilization is off.
Stabilization.OpticalOptical stabilization (OIS) is active.
Stabilization.DigitalDigital stabilization is active.
ValueDescription
Stabilization.offStabilization is off.
Stabilization.autoStabilization, either optical or digital, is active.

White Balance

Adjusts the white balance to a different, fixed value. Note that any value different than Autoauto will disable continuous AWB metering.

  • Type: WhiteBalance enumeration
  • Set of supported values: CameraCapabilities.whiteBalance
  • Configuration field: CameraConfiguration.whiteBalance
ValueDescription
WhiteBalance.AutoWhiteBalance.autoWhite balance is automatically, continuously adapted to the scene.
WhiteBalance.FluorescentWhiteBalance.fluorescentAppropriate for fluorescent illumination (CIE standard illuminant F2).
WhiteBalance.IncandescentWhiteBalance.incandescentAppropriate for incandescent illumination (CIE standard illuminant A).
WhiteBalance.DaylightWhiteBalance.daylightAppropriate for incandescent illumination (CIE standard illuminant D65).
WhiteBalance.CloudyWhiteBalance.cloudyAppropriate for cloud light.
WhiteBalance.TwilightWhiteBalance.twilightAppropriate for twilight light.

Exposure Compensation

Manually corrects the sensor's exposure value (EV), in camera stops. A positive EV will make the resulting picture or video brighter, a negative EV will make it darker. You can use 0 to undo any previous modification.

  • Type: Float
  • Range of supported values: CameraCapabilities.exposureCompensation
  • Configuration field: CameraConfiguration.exposureCompensation

Metering Modes

Metering modes determine how to interpret the center parameter in a scan() operation, which is described in the metering documentation.

  • Type: MeteringMode enumeration
  • Sets of supported values: CameraCapabilities.exposureMetering, CameraCapabilities.focusMetering, CameraCapabilities.whiteBalanceMetering
  • Configuration fields: CameraConfiguration.exposureMetering, CameraCapabilities.focusMetering, CameraCapabilities.whiteBalanceMetering

Find a list of possible values and their meaning here.

Observing changes

Configuration is applied with the configure() API, and can be observed with the configuration property. This can be useful to implement reactive UI components that depend on the configuration state.

kotlin logokotlin
val current: CameraConfiguration = device.configuration.value val flow: StateFlow<CameraConfiguration> = device.CameraConfiguration
swift
let current: CameraConfiguration = device.configuration let publisher: AnyPublisher<CameraConfiguration, Never> = device.configurationPublisher

Subscribe to the DeepMedia Newsletter

The latest news about DeepMedia products, open source projects and software development at our company.

By clicking “Subscribe”, you agree that DeepMedia may use your email address to send you newsletters, including commercial communications, and to process your personal data for this purpose. You agree that DeepMedia may process said data using third-party services for this purpose in accordance with the DeepMedia Privacy Policy. You can revoke this consent at any time using the unsubscribe link included in each email or by writing at contact@deepmedia.io.