Advanced Camera API

The Advanced Camera API provides low level access to a device's system camera APIs, enabling more precise control of camera parameters. This API can be used to support custom computer vision modules that utilize the Vuforia Image API and to improve performance on specific devices and/or in specific environments.

The Advanced Camera API is not a general purpose API. Any use of this API should be thoroughly tested to understand its impact on the performance of the Vuforia SDK.

The CameraFields class provides getters and setters on CameraDevice. These allow modification of the camera's ISO, and exposure compensation using the parameters of the Android Camera 1 API.

    Header file for CameraDevice class.
namespace Vuforia
/// Implements access to the phone's built-in camera
class VUFORIA_API CameraDevice : private NonCopyable

    /// Write accessors for camera fields
    // Setting to NULL removes the field
    virtual bool setField(const char* key, const char* value) = 0;
    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;
    /// Get the number of camera fields
     *  Note this may not be the complete set of camera fields available on this
     *  device and some keys may not be supported on every device
    virtual int getNumFields() const = 0;
    /// Get the CameraField and associated key for the given index
    virtual bool getCameraField(int index, CameraField& field) const = 0; 
    /// Read accessors for camera fields
    virtual bool getFieldString(const char* key, char* value, size_t maxlength) const = 0; 
    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;
} // namespace Vuforia
    Header file for CameraField class.
namespace Vuforia
/// Camera fields are advanced properties of the camera
 *  Camera fields represent advanced camera properties and capture parameters such as
 *  exposure compensation, ISO and others. A field may be read only (e.g. maximum
 *  exposure compensation value) or read-write (e.g. exposure compensation value).
 *  Camera fields are accessed as key-value pairs, where the value may be one of
 *  multiple basic types.
 *  Camera fields are highly platform dependent and the keys to identify a given
 *  property and available values to set will vary across operating system,
 *  operating system version, camera API version and the device model itself.
 *  Furthermore the behavior of the camera driver wrt. these fields is highly
 *  fragmented. Thus CameraFields should only be used for specific use case and devices.
 *  All of the Camera field APIs shall be called only after initializing the
 *  CameraDevice.
 *  Camera Fields are currently only implemented for Android.
 *  Finally, setting advanced camera parameters may adversely affect Vuforia
 *  tracking performance as well as cause functional issues.
class CameraField
    /// A camera field may be of the following types. On some platforms all
    /// fields are strings.
    enum DataType
        TypeString,     ///< Null terminated array of characters (ASCII)
        TypeInt64,      ///< 64-bit signed integer
        TypeFloat,      ///< Single precision floating point
        TypeBool,       ///< Boolean
        TypeInt64Range, ///< Array of two 64-bit signed integer
        /// On some platforms the type may not be known at run-time. Setting
        /// or getting a parameter of unknown type will fail.
    /// Default constructor
    CameraField() : mType(TypeUnknown), mKey("") {};
    /// The data type of this field
    DataType mType;
    /// The key to identify this field.
    /// Note the string is only valid until the next call to getCameraField,
    /// take a copy of the string if you want to hold on to it.
    const char* mKey;
} // namespace Vuforia