Provides access to the device's built-in camera.
The CameraDevice is a singleton, accessible via CameraDevice::getInstance() after Vuforia::init() has succeeded.
It provides control over the camera lifecycle (init(), deinit(), start(), and stop()), frame size and FPS (selectVideoMode()), torch (if available) (setFlashTorchMode()), and autofocus (setFocusMode()).
It also provides access to advanced camera properties such as ISO and exposure compensation (setField()). See CameraField for more details.
Public Types | |
enum | MODE { MODE_DEFAULT = -1, MODE_OPTIMIZE_SPEED = -2, MODE_OPTIMIZE_QUALITY = -3 } |
enum | FOCUS_MODE { FOCUS_MODE_NORMAL, FOCUS_MODE_TRIGGERAUTO, FOCUS_MODE_CONTINUOUSAUTO, FOCUS_MODE_INFINITY, FOCUS_MODE_MACRO } |
Public Member Functions | |
virtual bool | init ()=0 |
Initialize the camera. More... | |
virtual bool | deinit ()=0 |
Deinitialize the camera. More... | |
virtual bool | start ()=0 |
Start the camera. More... | |
virtual bool | stop ()=0 |
Stop the camera. More... | |
virtual int | getNumVideoModes () const =0 |
Get the number of available VideoModes. More... | |
virtual VideoMode | getVideoMode (int nIndex) const =0 |
Get a specific VideoMode. More... | |
virtual VideoMode | getCurrentVideoMode () const =0 |
Get a currently selected VideoMode. More... | |
virtual bool | selectVideoMode (int index)=0 |
Tell the CameraDevice to use a particular VideoMode. More... | |
virtual bool | setFlashTorchMode (bool on)=0 |
Enable/disable torch mode if the device supports it. More... | |
virtual bool | setFocusMode (int focusMode)=0 |
Set a particular focus mode, or trigger a single autofocus event. More... | |
virtual int | getNumFields () const =0 |
Get the number of CameraFields. More... | |
virtual bool | getCameraField (int index, CameraField &field) const =0 |
Get a particular CameraField. More... | |
virtual bool | getFieldString (const char *key, char *value, size_t maxlength) const =0 |
Read a camera field value. More... | |
virtual bool | getFieldInt64 (const char *key, Vuforia::Int64 &value) const =0 |
virtual bool | getFieldFloat (const char *key, float &value) const =0 |
virtual bool | getFieldBool (const char *key, bool &value) const =0 |
virtual bool | getFieldInt64Range (const char *key, Vuforia::Int64 *intRange) const =0 |
virtual bool | setField (const char *key, const char *value)=0 |
Write a camera field value. More... | |
virtual bool | setField (const char *key, Vuforia::Int64 value)=0 |
virtual bool | setField (const char *key, float value)=0 |
virtual bool | setField (const char *key, bool value)=0 |
virtual bool | setField (const char *key, Vuforia::Int64 intRange[2])=0 |
Static Public Member Functions | |
static CameraDevice & | getInstance () |
Get the CameraDevice singleton instance. More... | |
enum MODE |
enum FOCUS_MODE |
|
static |
Get the CameraDevice singleton instance.
The singleton instance is available immediately after Vuforia::init() has succeeded.
It is no longer available after calling Vuforia::deinit().
|
pure virtual |
Initialize the camera.
|
pure virtual |
Deinitialize the camera.
Release any resources created or used by the camera.
|
pure virtual |
Start the camera.
This method starts the process of delivering frames from the camera to Vuforia. The CameraDevice must have been initialized first via a call to init().
Depending on the type of the camera it may be necessary to perform certain configuration tasks after calling init() before it can be started (such as selectVideoMode() and/or specific calls to setField()).
|
pure virtual |
Stop the camera.
Stop the delivery of frames from the camera to Vuforia.
Since the camera can consume a lot of power, you may want to use this method to suspend Vuforia when it is not actively required, such as when the user is doing non-AR/VR tasks in your app.
|
pure virtual |
Get the number of available VideoModes.
This is device specific and can differ between mobile devices or operating system versions.
|
pure virtual |
Get a specific VideoMode.
nIndex | The VideoMode to get, in the range 0..getNumVideoModes()-1 |
|
pure virtual |
|
pure virtual |
Tell the CameraDevice to use a particular VideoMode.
If this method is not called, Vuforia will select a default video mode.
To switch video modes after the camera has been started, call stop(), then deinit(), then init(), then selectVideoMode() with the new mode, then start().
index | The VideoMode to set, in the range 0..getNumVideoModes()-1. |
|
pure virtual |
Enable/disable torch mode if the device supports it.
|
pure virtual |
Set a particular focus mode, or trigger a single autofocus event.
You can trigger a single autofocus event using FOCUS_MODE_TRIGGERAUTO. Note that doing so may interrupt FOCUS_MODE_CONTINUOUSAUTO if that mode is currently set.
focusMode | The focus mode to set. See FOCUS_MODE for a list of possible values. |
|
pure virtual |
Get the number of CameraFields.
|
pure virtual |
Get a particular CameraField.
index | The index of the field to get, in the range 0..getNumFields()-1. |
field | On return, will be populated with the requested field data. |
|
pure virtual |
Read a camera field value.
key | Key for the value to read. Must match one of CameraField::mKey as returned from getCameraField(). |
value | On return, will be populated with the value of the requested key. |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Write a camera field value.
key | Key for the value to write. Must match one of CameraField::mKey as returned from getCameraField(). |
value | The value to write. |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |