Getting Started with EasyAR
Inherits:Base

Description

CameraDevice is the class represent a device camera.

A CameraDevice works on its own thread. You can Open/Close a camera. You can also close and reopen a different camera with different input parameters at any point. Start/Stop is used to stat or stop the camera preview but keep pre-set camera parameters and algorithm connections. The control methods are similar to those provided in the system API.

CameraDevice is the input source of trackers and other algorithms. You should call Open before any other methods, otherwise they will have no effect. All algorithms can only work after a CameraDevice is attached. If a CameraDevice is closed, all algorithms will lost attach to the CameraDevice and a reopen will not restore the connections.

Public Types

enumFocusMode{Normal, Triggerauto, Continousauto, Infinity, Macro}
enumDevice{Default, Back, Front}

Public Properties

CameraCalibrationCalibration
floatFPS
boolIsOpened
Vector2ISize
float[]SupportedFPS
Vector2I[]SupportedSize
boolHorizontalFlip (since 1.3.0)

Public Functions

CameraDevice()
boolOpen(Device camera = Device.Default)
boolOpen(int camera) (since 1.3.0)
boolClose()
boolStart()
boolStop()
boolSetFlashTorchMode(bool on)
boolSetFocusMode(FocusMode focusMode)

enum FocusMode

ConstantValueDescription
Normal0Normal auto focus mode. You should call SetFocusMode(FocusMode.Triggerauto) to start the focus in this mode.
Triggerauto1Triggers auto focus. Focus mode will be set to FocusMode.Normal.
Continousauto2Continuous auto focus mode.
Infinity3Infinity focus mode.
Macro4Macro (close-up) focus mode. You should call SetFocusMode(FocusMode.Triggerauto) to start the focus in this mode.

enum Device

ConstantValueDescription
Default0The default camera device.
Back1The back faced camera device.
Front2The front faced camera device.

bool IsOpened

True if the CameraDevice is opened, false otherwise. It is useful for the functions getting parameters because only an opened camera will return valid values.

float FPS

Current frame rate. The proximal value available will be selected for set. Use after a successful Open.

float[] SupportedFPS

The supported frame rate. Use after a successful Open.

Vector2I Size

Current preview size. The proximal value available will be selected for set. Use after a successful Open.

Vector2I[] SupportedSize

The supported preview size. Use after a successful Open.

bool HorizontalFlip (since 1.3.0)

The horizontal flip flag. When set, the camera image will be horizontal flipped from default. Use after a successful Open.

CameraCalibration Calibration

Calibration data. Use after a successful Open.

bool Open(Device camera = Device.Default)

Opens a camera with camera device type. On desktop OSes, Device.Default represents the default camera and the value > 0 represents the device number (start from 1).

bool Open(int camera) (since 1.3.0)

Opens a camera with camera index. On desktop OSes, 0 represents the default camera and the value > 0 represents the device number (start from 1).

bool Close()

Closes a camera. If a CameraDevice is closed, all algorithms will lost attach to the CameraDevice and a reopen will not restore the connections.

bool Start()

Starts the capture.

bool Stop()

Stops the capture. Only stops the capture process, all parameters and connections with algorithms are kept unchanged.

bool SetFlashTorchMode(bool on)

Sets flash torch mode to on. Use after a successful Open.

bool SetFocusMode(FocusMode focusMode)

Sets focus mode to focusMode. Use after Start.