This class provides access to camera methods and properties More...
Classes | |
struct | CameraField |
Camera fields are advanced properties of the camera More... | |
struct | Int64Range |
A struct describing a range of 64 bit integers with a lower and upper bound More... | |
struct | VideoModeData |
This struct stores video mode data. This includes the width and height of the frame and the framerate of the camera. More... | |
Public Types | |
enum | CameraDeviceMode { MODE_DEFAULT = -1, MODE_OPTIMIZE_SPEED = -2, MODE_OPTIMIZE_QUALITY = -3 } |
The mode used for camera capturing and video rendering. The camera device mode is set through the Unity inspector. More... | |
enum | FocusMode { FOCUS_MODE_NORMAL, FOCUS_MODE_TRIGGERAUTO, FOCUS_MODE_CONTINUOUSAUTO, FOCUS_MODE_INFINITY, FOCUS_MODE_MACRO } |
The different focus modes for the active camera More... | |
Public Member Functions | |
bool | Deinit () |
Deinitializes the camera. More... | |
Vector2 | GetCameraFieldOfViewRads () |
Get the field of view for the active camera. This is a Vector2 containing the x- and y- components of the FOV in radians. If the value cannot be obtained for some reason, then Vector2.zero will be returned More... | |
IEnumerable< CameraField > | GetCameraFields () |
Get available 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 More... | |
Image | GetCameraImage (PIXEL_FORMAT format) |
Returns a camera images for the requested format. Returns null if this image is not available. You must call SetFrameFormat before accessing the corresponding camera image. More... | |
bool | GetField (string key, out string value) |
Read accessors for camera fields More... | |
bool | GetField (string key, out long value) |
Read accessors for camera fields More... | |
bool | GetField (string key, out float value) |
Read accessors for camera fields More... | |
bool | GetField (string key, out bool value) |
Read accessors for camera fields More... | |
bool | GetField (string key, out Int64Range value) |
Read accessors for camera fields More... | |
bool | GetSelectedVideoMode (out CameraDeviceMode mode) |
Can be used to query a previously set camera device mode. Will return false if the mode has not been set yet. More... | |
VideoModeData | GetVideoMode () |
Get the video mode data that matches the selected CameraDeviceMode. More... | |
VideoModeData | GetVideoMode (CameraDeviceMode mode) |
Get the video mode data that matches the given CameraDeviceMode. More... | |
bool | Init () |
Initializes the camera. More... | |
bool | IsActive () |
If the Camera has been started More... | |
bool | SelectVideoMode (CameraDeviceMode mode) |
Chooses a video mode out of the list of modes. This function can be only called after the camera device has been initialized but not started yet. Once you have started the camera and you need the select another video mode, you need to Stop(), Deinit(), then Init() the camera before calling SelectVideoMode() again. More... | |
bool | SetField (string key, string value) |
Write accessors for camera fields More... | |
bool | SetField (string key, long value) |
Write accessors for camera fields More... | |
bool | SetField (string key, float value) |
Write accessors for camera fields More... | |
bool | SetField (string key, bool value) |
Write accessors for camera fields More... | |
bool | SetField (string key, Int64Range value) |
Write accessors for camera fields More... | |
bool | SetFlashTorchMode (bool on) |
Activate or deactivate the camera device flash. Returns false if flash is not available or can't be activated. More... | |
bool | SetFocusMode (FocusMode mode) |
Set the active focus mode. Returns false if this mode is not available or can't be activated. More... | |
bool | SetFrameFormat (PIXEL_FORMAT format, bool enabled) |
Enables or disables the request of the camera image in the desired pixel format. Returns true on success, false otherwise. Note that this may result in processing overhead. Image are accessed using GetCameraImage. Note that there may be a delay of several frames until the camera image becomes availables. More... | |
bool | Start () |
Starts the camera. Frames are being delivered. More... | |
bool | Stop () |
Stops the camera if video feed is not required (e.g. in non-AR mode of an application). More... | |
Properties | |
static CameraDevice | Instance [get] |
Returns an instance of a CameraDevice (thread safe) More... | |
This class provides access to camera methods and properties
|
strong |
The mode used for camera capturing and video rendering. The camera device mode is set through the Unity inspector.
|
strong |
bool Deinit | ( | ) |
Deinitializes the camera.
Vector2 GetCameraFieldOfViewRads | ( | ) |
Get the field of view for the active camera. This is a Vector2 containing the x- and y- components of the FOV in radians. If the value cannot be obtained for some reason, then Vector2.zero will be returned
IEnumerable<CameraField> GetCameraFields | ( | ) |
Get available 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
Image GetCameraImage | ( | PIXEL_FORMAT | format | ) |
Returns a camera images for the requested format. Returns null if this image is not available. You must call SetFrameFormat before accessing the corresponding camera image.
bool GetField | ( | string | key, |
out string | value | ||
) |
Read accessors for camera fields
bool GetField | ( | string | key, |
out long | value | ||
) |
Read accessors for camera fields
bool GetField | ( | string | key, |
out float | value | ||
) |
Read accessors for camera fields
bool GetField | ( | string | key, |
out bool | value | ||
) |
Read accessors for camera fields
bool GetField | ( | string | key, |
out Int64Range | value | ||
) |
Read accessors for camera fields
bool GetSelectedVideoMode | ( | out CameraDeviceMode | mode | ) |
Can be used to query a previously set camera device mode. Will return false if the mode has not been set yet.
VideoModeData GetVideoMode | ( | ) |
Get the video mode data that matches the selected CameraDeviceMode.
VideoModeData GetVideoMode | ( | CameraDeviceMode | mode | ) |
Get the video mode data that matches the given CameraDeviceMode.
bool Init | ( | ) |
Initializes the camera.
bool IsActive | ( | ) |
If the Camera has been started
bool SelectVideoMode | ( | CameraDeviceMode | mode | ) |
Chooses a video mode out of the list of modes. This function can be only called after the camera device has been initialized but not started yet. Once you have started the camera and you need the select another video mode, you need to Stop(), Deinit(), then Init() the camera before calling SelectVideoMode() again.
bool SetField | ( | string | key, |
string | value | ||
) |
Write accessors for camera fields
bool SetField | ( | string | key, |
long | value | ||
) |
Write accessors for camera fields
bool SetField | ( | string | key, |
float | value | ||
) |
Write accessors for camera fields
bool SetField | ( | string | key, |
bool | value | ||
) |
Write accessors for camera fields
bool SetField | ( | string | key, |
Int64Range | value | ||
) |
Write accessors for camera fields
bool SetFlashTorchMode | ( | bool | on | ) |
Activate or deactivate the camera device flash. Returns false if flash is not available or can't be activated.
bool SetFocusMode | ( | FocusMode | mode | ) |
Set the active focus mode. Returns false if this mode is not available or can't be activated.
bool SetFrameFormat | ( | PIXEL_FORMAT | format, |
bool | enabled | ||
) |
Enables or disables the request of the camera image in the desired pixel format. Returns true on success, false otherwise. Note that this may result in processing overhead. Image are accessed using GetCameraImage. Note that there may be a delay of several frames until the camera image becomes availables.
bool Start | ( | ) |
Starts the camera. Frames are being delivered.
bool Stop | ( | ) |
Stops the camera if video feed is not required (e.g. in non-AR mode of an application).
|
staticget |
Returns an instance of a CameraDevice (thread safe)