Class CameraDeviceFrameSource
- Namespace
- easyar
- Assembly
- EasyAR.Sense.dll
Controls the easyar.CameraDevice in the scene, extending functionality in the Unity environment.
This frame source is not a motion-tracking device and will not output motion data in ARSession.
[RequireComponent(typeof(CameraDeviceDisplay))]
public class CameraDeviceFrameSource : FrameSource
- Inheritance
-
CameraDeviceFrameSource
- Derived
- Inherited Members
Fields
CameraOpenIndex
The device index used when opening the camera, used when CameraOpenMethod == DeviceIndex, effective only if modified before the DeviceOpened event.
[HideInInspector]
[SerializeField]
public int CameraOpenIndex
CameraOpenMethod
The method used when opening the camera, effective only if modified before the DeviceOpened event.
[HideInInspector]
[SerializeField]
public CameraDeviceFrameSource.CameraDeviceOpenMethod CameraOpenMethod
CameraOpenType
The camera type used when opening the camera, used when CameraOpenMethod == PreferredType or SpecificType, effective only if modified before the DeviceOpened event.
[HideInInspector]
[SerializeField]
public CameraDeviceType CameraOpenType
Properties
AndroidCameraApiType
On Android, can be used to get the camera API used (camera1 or camera2). Available only when Opened is true.
public AndroidCameraApiType AndroidCameraApiType { get; }
AvailableCenterMode
Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof
Allcentermodesthatcanbeused.
protected override IReadOnlyList<ARSession.ARCenterMode> AvailableCenterMode { get; }
Camera
Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof
Ondesktopdevicesorphones,thiscameracorrespondstothe
protected override Camera Camera { get; }
CameraCandidate
Alternative to Camera; if not set, Camera.main will be used.
public Camera CameraCandidate { get; set; }
CameraCount
Gets the number of cameras recognized by the operating system.
public static int CameraCount { get; }
CameraFrameStarted
Providedonlywhencreatinganewframesource.Itisaccessedthroughouttheentirelifecycleof
Whetherthecameraframehasstartedinput.
protected override bool CameraFrameStarted { get; }
CameraType
The camera type. Available only when Opened is true.
public CameraDeviceType CameraType { get; }
DesiredAndroidCameraApiType
Desired Android Camera Api, effective only if modified before the DeviceOpened event.
If not set, it will be chosen based on DesiredCameraPreference.
public Optional<AndroidCameraApiType> DesiredAndroidCameraApiType { get; set; }
DesiredCameraPreference
Preference settings used when creating the camera device, effective only if modified before the session starts.
public Optional<CameraDevicePreference> DesiredCameraPreference { get; set; }
DesiredFocusMode
Desired focus mode, effective only if modified before the DeviceOpened event.
Note: Subject to hardware or system limitations, focus switching may not work on some devices. If not set, it will be chosen based on DesiredCameraPreference.
public Optional<CameraDeviceFocusMode> DesiredFocusMode { get; set; }
DesiredSize
Desired camera image size, effective only if modified before the DeviceOpened event.
Will use the closest size in SupportedSize. If not set, the default value will be used.
public Optional<Vector2Int> DesiredSize { get; set; }
DeviceCameras
Providedonlywhencreatinganewframesource.Itisaccessedwhen
Thedevicecamerathatprovidesthecameraframedata.Ifthecameraframedataisprovidedbymultiplecameras,thelistshouldincludeallofthem.
Ensurethatthevalueiscorrectwhen
protected override List<FrameSourceCamera> DeviceCameras { get; }
Display
Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof
Providesdisplaysysteminformation.Youcanuse
protected override IDisplay Display { get; }
FocusMode
Focus mode. Only available when Opened is true.
public CameraDeviceFocusMode FocusMode { set; }
FrameRateRange
Frame rate range. Only available when Opened is true.
public Vector2 FrameRateRange { get; }
FrameRateRangeIndex
Index of the current frame rate range of the device. Only available when Opened is true.
public int FrameRateRangeIndex { get; set; }
Index
The camera index. Available only when Opened is true.
public int Index { get; }
IsAvailable
Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof
Whetherthecurrentframesourceisavailable.
Ifthevalueisnull,
protected override Optional<bool> IsAvailable { get; }
IsCameraUnderControl
Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof
Whenthevalueistrue,thesessionwillupdatethecamera'stransformandrenderthecameraimage.
Whencreatingaheadsetextension,itshouldbefalse.Youshouldhavefullcontroloverthe3Dcamerainthescene.Youshouldhandlecamerarendering,especiallyinVSTmode.
protected override bool IsCameraUnderControl { get; }
IsHMD
Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheAssembleprocessof
Whetherthecurrentframesourceisaheadset.Ifitisaheadset,diagnosticinformationwillbedisplayedona3Dboardinfrontofthecamera.
Someframefiltersmayoperatedifferentlyonthedevice.
protected override bool IsHMD { get; }
Opened
Whetherthecameraisopen.
public bool Opened { get; }
Parameters
Camera parameters. Only available when Opened is true.
public CameraParameters Parameters { get; set; }
Size
Current image size. Only available when Opened is true.
set will use the closest size in SupportedSize.
If the image size is modified during FrameRecorder recording, recording data will stop updating; recording must be stopped and restarted.
public Vector2Int Size { get; set; }
SupportedFrameRateRange
All supported frame rate ranges of the current device. Only available when Opened is true.
public List<Vector2> SupportedFrameRateRange { get; }
SupportedSize
All image sizes supported by the current device. Available only when Opened is true.
public List<Vector2Int> SupportedSize { get; }
enabled
Starts/stopscollectingvideostreamdataduring
public bool enabled { get; set; }
Methods
AutoFocus()
Does auto focus once. It is only available when FocusMode is Normal or Macro.
public bool AutoFocus()
Close()
Closethedevice.
public void Close()
OnSessionStart(ARSession)
Providedonlywhencreatinganewframesource.ItisaccessedonlyduringtheStartSessionprocessof
Handlessessionstartupifthisframesourcehasbeenassembledinto
protected override void OnSessionStart(ARSession session)
Parameters
session
OnSessionStop()
Providedonlywhencreatinganewframesource.Itisaccessedduring
Handlessessionstopifthisframesourcehasbeenassembledinto
protected override void OnSessionStop()
Open()
Open the device. If Open() and Close() are not manually called, the ARSession will automatically Open() after starting.
Only available after the session has started.
public void Open()
SetFlashTorch(bool)
Set flash torch mode. Only available when Opened is true.
public bool SetFlashTorch(bool on)
Parameters
on
Events
DeviceClosed
Theeventfordeviceclosing.
public event Action DeviceClosed
DeviceOpened
Theeventfordeviceopening,whereabooleanvalueindicateswhetheritwassuccessful.
public event Action<bool, PermissionStatus, string> DeviceOpened
DeviceStateChanged
The event of device disconnection or preemption making it unusable (only Windows).
public event Action<CameraState> DeviceStateChanged