Class CameraDeviceFrameSource
- Espacio de nombres
- easyar
- Ensayo
- EasyAR.Sense.dll
A MonoBehaviour that controls easyar.CameraDevice in the scene and provides functional extensions in the Unity environment.
This frame source is not a motion tracking device and does not output motion data in ARSession.
[RequireComponent(typeof(CameraDeviceDisplay))]
public class CameraDeviceFrameSource : FrameSource
- Herencia
-
CameraDeviceFrameSource
- Derived
- Miembros heredados
Campos
CameraOpenIndex
Device index used when opening the camera. Used when CameraOpenMethod == DeviceIndex; changes take effect only before the DeviceOpened event.
[HideInInspector]
[SerializeField]
public int CameraOpenIndex
CameraOpenMethod
Method used when opening the camera. Changes take effect only before the DeviceOpened event.
[HideInInspector]
[SerializeField]
public CameraDeviceFrameSource.CameraDeviceOpenMethod CameraOpenMethod
CameraOpenType
Camera type used when opening the camera. Used when CameraOpenMethod == PreferredType or SpecificType; changes take effect only before the DeviceOpened event.
[HideInInspector]
[SerializeField]
public CameraDeviceType CameraOpenType
Propiedades
AndroidCameraApiType
On Android, this can be used to get the Camera API in use (camera1 or camera2). Available only when Opened is true.
public AndroidCameraApiType AndroidCameraApiType { get; }
AvailableCenterMode
Se proporciona solo al crear un nuevo frame source. It is accessed only during Assemble().
All center modes that can be used.
protected override IReadOnlyList<ARSession.ARCenterMode> AvailableCenterMode { get; }
Camera
Se proporciona solo al crear un nuevo frame source. It is accessed only during Assemble().
On desktop devices or phones, this camera represents the Camera in the virtual world corresponding to the camera device in the real environment. Its projection matrix and position correspond to the real camera and are controlled by EasyAR. On headsets, this camera is used only to display diagnostic text in front of the eyes; it is not used for image rendering, and the camera is not controlled by EasyAR.
protected override Camera Camera { get; }
CameraCandidate
Alternative to Camera. If not set, Camera.main will be used.
public Camera CameraCandidate { get; set; }
CameraCount
Obtiene the number of cameras recognized by the operating system.
public static int CameraCount { get; }
CameraFrameStarted
Se proporciona solo al crear un nuevo frame source. It is accessed throughout the lifecycle of ARSession.
Whether camera frame input has started.
protected override bool CameraFrameStarted { get; }
CameraType
camera type. Available only when Opened is true.
public CameraDeviceType CameraType { get; }
DesiredAndroidCameraApiType
Desired Android Camera Api. Changes take effect only before the DeviceOpened event.
If not set, it will be selected according to DesiredCameraPreference.
public Optional<AndroidCameraApiType> DesiredAndroidCameraApiType { get; set; }
DesiredCameraPreference
Preferences used when creating the camera device. Changes take effect only before session starts.
public Optional<CameraDevicePreference> DesiredCameraPreference { get; set; }
DesiredFocusMode
Desired focus mode. Changes take effect only before the DeviceOpened event.
Note: Due to hardware or system limitations, focus switching may be ineffective on some devices. If not set, it will be selected according to DesiredCameraPreference.
public Optional<CameraDeviceFocusMode> DesiredFocusMode { get; set; }
DesiredSize
Desired camera image size. Changes take effect only before the DeviceOpened event.
The size closest to the value in SupportedSize will be used. If not set, the default value will be used.
public Optional<Vector2Int> DesiredSize { get; set; }
DeviceCameras
Se proporciona solo al crear un nuevo frame source. It is accessed when CameraFrameStarted is true.
Device cameras that provide camera frame data. If camera frame data is provided by multiple cameras, the list must contain all cameras.
Ensure that the value is correct when CameraFrameStarted is true.
protected override List<FrameSourceCamera> DeviceCameras { get; }
Display
Se proporciona solo al crear un nuevo frame source. It is accessed only during Assemble().
Provides display system information. You can use DefaultSystemDisplay or DefaultHMDDisplay to get default display information.
protected override IDisplay Display { get; }
FocusMode
Focus mode. Available only when Opened is true.
public CameraDeviceFocusMode FocusMode { set; }
FrameRateRange
Frame rate range. Available only when Opened is true.
public Vector2 FrameRateRange { get; }
FrameRateRangeIndex
Index of the current frame rate range of the device. Available only when Opened is true.
public int FrameRateRangeIndex { get; set; }
Index
camera index. Available only when Opened is true.
public int Index { get; }
IsAvailable
Se proporciona solo al crear un nuevo frame source. It is accessed only during Assemble().
Whether the current frame source is available.
If the value is null, CheckAvailability() will be called, and the value will be obtained after Coroutine ends.
protected override Optional<bool> IsAvailable { get; }
IsCameraUnderControl
Se proporciona solo al crear un nuevo frame source. It is accessed only during Assemble().
When the value is true, session updates the camera transform and renders the camera image.
When creating a headset extension, it should be false. You should fully control the 3D camera in the scene. You should handle camera rendering, especially in VST mode.
protected override bool IsCameraUnderControl { get; }
IsHMD
Se proporciona solo al crear un nuevo frame source. It is accessed only during Assemble().
Whether the current frame source is a headset. If it is a headset, diagnostic information will be displayed on a 3D board in front of the camera.
Some frame filters behave differently when running on device.
protected override bool IsHMD { get; }
Opened
Whether the camera is opened.
public bool Opened { get; }
Parameters
camera parameters. Available only when Opened is true.
public CameraParameters Parameters { get; set; }
Size
Current image size. Available only when Opened is true.
set will use the size closest to the value in SupportedSize.
If the image size is changed while FrameRecorder is recording, recorded data will stop updating and recording needs to be restarted after closing.
public Vector2Int Size { get; set; }
SupportedFrameRateRange
All frame rate ranges supported by the current device. Available only 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
Inicia/detiene collecting video stream data while ARSession is running. After session starts, collection starts only when MonoBehaviour.enabled is true.
public bool enabled { get; set; }
Métodos
AutoFocus()
Does auto focus once. It is only available when FocusMode is Normal or Macro.
public bool AutoFocus()
Close()
Cierra the device.
public void Close()
OnSessionStart(ARSession)
Se proporciona solo al crear un nuevo frame source. It is accessed only during StartSession().
Gestiona session startup if this frame source has been assembled into Assembly. This method is designed for lazy initialization; you can perform AR-specific initialization work in this method.
protected override void OnSessionStart(ARSession session)
Parámetros
session
OnSessionStop()
Se proporciona solo al crear un nuevo frame source. It is accessed during StopSession(bool) or other session stop/damage processes.
Gestiona session stop if this frame source has been assembled into Assembly. You can use this method to destroy resources created by StartSession() and during session running, and restore internal state. This method is guaranteed to be called before session destruction. If the frame source is destroyed before the session, it will not be called and the session will be damaged.
protected override void OnSessionStop()
Open()
Abre the device. If Open() and Close() are not manually called, ARSession will automatically call Open() after startup.
It can be used only after session starts.
public void Open()
SetFlashTorch(bool)
Establece flash torch mode. Available only when Opened is true.
public bool SetFlashTorch(bool on)
Parámetros
on
Eventos
DeviceClosed
Device closed event.
public event Action DeviceClosed
DeviceOpened
Device opened event. The bool value indicates whether it succeeded.
public event Action<bool, PermissionStatus, string> DeviceOpened
DeviceStateChanged
Device unavailable event such as disconnection or preemption (Windows only).
public event Action<CameraState> DeviceStateChanged