CameraDevice
class NatML.Devices.CameraDevice : IMediaDevice<CameraImage>
The CameraDevice
provides an abstraction for hardware cameras.
Identifying the Device
Camera devices can be identified either by their unique identifier or by their position relative to the screen.
Unique Identifier
Refer to the Identifying the Device section of the IMediaDevice
interface for more information.
Device Name
Refer to the Identifying the Device section of the IMediaDevice
interface for more information.
Device Location
Refer to the Identifying the Device section of the IMediaDevice
interface for more information.
Default Device
Refer to the Identifying the Device section of the IMediaDevice
interface for more information.
Camera Position
The camera device provides information about its position relative to the screen.
Field of View
The camera device is able to report its field of view angles, in degrees.
Checking the Device State
Refer to the Checking the Device State section of the IMediaDevice
interface for more information.
Streaming the Preview
The camera device streams camera images to the provided handler
. Each camera image contains a pixelBuffer
along with a selection of EXIF metadata.
The camera startup is typically a complex process, so the can be a small delay before frames start getting reported to the handler
.
Preview Resolution
All camera devices allow getting and setting the camera preview resolution. This setting determines the size of camera images reported by the camera.
Resolutions are always specified in landscape format, meaning that the width
is always larger than the height
.
Camera devices do not support arbitrary preview resolutions. Instead, the device will find the closest supported resolution to what you request. You can check what this is by getting the value of previewResolution
immediately after setting it.
Do not set the previewResolution
while the device is running. Instead, set it before starting the device.
Preview Frame Rate
Camera devices support setting the preview frame rate.
NatDevice supports high frame-rate camera streaming, including 120FPS and 240FPS on camera devices that support it.
Do not set the frameRate
while the device is running. Instead, set it before starting the device.
Capturing Photos
Camera devices can capture high resolution photos, exactly like standard camera apps can.
Photo Resolution
The photo resolution can be queried and updated:
Resolutions are always specified in landscape format, meaning that the width
is always larger than the height
.
Camera devices do not support arbitrary photo resolutions. Instead, the device will find the closest supported resolution to what you request. You can check what this is by getting the value of photoResolution
immediately after setting it.
Do not set the photoResolution
while the device is running. Instead, set it before starting the device.
Flash Mode
The flash mode can be set, giving some control over lighting when the photo is captured. The flash mode can be set to one of the following values:
Before setting a flash mode, you must check whether flash settings are in fact supported by the camera device:
The default flash mode is FlashMode.Off
. This is also the flash mode reported when the device does not support flash.
Stopping the Stream
Refer to the Stopping the Stream section of the IMediaDevice
interface for more information.
Focus Controls
Camera devices provide focus controls, including setting the focus mode and focus point of interest.
Focus Mode
Camera devices can be set to use one of the following focus modes:
Finally, the camera device can be queried for whether it supports a given focus mode:
Focus Point
Camera devices can be set to focus at a specific point in the camera view.
Focus point coordinates are always normalized in range [0.0, 1.0]
.
Exposure Controls
Camera devices provide exposure controls, including setting the exposure mode, exposure bias, exposure point of interest, and manual exposure controls.
Exposure Mode
Camera devices operate in one of a set of exposure modes:
Finally, the camera device can be queried for whether it supports a given exposure mode:
Exposure Bias
The exposure bias roughly determines how bright or dark the camera preview is. Its nominal value is , but can be set to any value within the supported range:
If the minimum exposure bias is equal to the maximum bias, which is equal to 0, then the camera does not support setting an exposure bias.
Exposure Point
Similar to focus, camera devices can be set to exposure for a specific point in the camera view.
Exposure point coordinates are always normalized in range [0.0, 1.0]
.
Manual Exposure
Camera devices can be configured to use manual exposure, allowing for fine-grained controls for photography and computer vision applications. The duration
can be set to any value within the supported range:
Similarly, the ISO
can be set to any value within the supported range:
White Balance Controls
Camera devices provide control over the white balance mode:
White Balance Mode
Camera devices operate in one of a set of exposure modes:
The camera can be queried for whether it supports a given white balance mode:
Video Stabilization
Some camera devices support video stabilization. As such, this behaviour can be enabled by setting an appropriate stabilization mode:
Camera devices can be queried for whether they support a given video stabilization mode:
Zoom Ratio
Some camera devices support setting the zoom ratio. The zoom ratio applies to the camera preview and captured photos alike. The zoom ratio can be set to any value within the camera's zoom range:
Torch Unit
Some camera devices have accompanying torch units. This property can be used to activate or deactivate the torch unit. Supported modes include:
The camera can be queried for whether it has an available torch unit:
The torch unit can be enabled even when the device is not running.
Last updated