Class TofArTofManager
Manage the connection with ToF camera
Has the following functions
- Manage connection with ToF camera
- Get Depth data
- Get Confidence data
- Get PointCloud data
- Texture2D conversion of Depth data
- Texture2D conversion of Confidence data
- Notice on (data) stream starting event
- Notice on (data) stream ending event
- Notice on arrival of frame
- Notice on unexpected stop of stream
- Check if ToF camera is equipped
- Management of camera calibration info
- Playback of recording file
Inheritance
Inherited Members
Namespace: TofAr.V0.Tof
Assembly: TofArTofAssembly.dll
Syntax
public class TofArTofManager : Singleton<TofArTofManager>, IStreamStoppable, IDisposable, IStreamHolder, IDependedManager
Fields
autoloadCalibration
true: Automatically load the camera internal parameters calibrated by the AutoCalib app on start
false: Do not load camera internal parameters on start
Default: true
Declaration
public bool autoloadCalibration
Field Value
Type |
---|
System.Boolean |
autoStart
If true, ToF data stream will automatically start when the application is started
Declaration
public bool autoStart
Field Value
Type |
---|
System.Boolean |
autoSwitchColorCameraId
true: Automatically switch color camera when Tof and Color are streamed simultaneously
false: Do not automatically switch color camera
Default: true
Declaration
[HideInInspector]
public bool autoSwitchColorCameraId
Field Value
Type |
---|
System.Boolean |
CalibrationSettingsFailed
Notice on camera calibration load failed
Declaration
public TofArTofManager.CalibrationSettingsFailedEventHandler CalibrationSettingsFailed
Field Value
Type |
---|
TofArTofManager.CalibrationSettingsFailedEventHandler |
CalibrationSettingsLoaded
Notice on camera calibration settings loaded
Declaration
public TofArTofManager.CalibrationSettingsLoadedEventHandler CalibrationSettingsLoaded
Field Value
Type |
---|
TofArTofManager.CalibrationSettingsLoadedEventHandler |
cameraSynchronization
Set ToF camera and Color camera sync options
Default: Master
Declaration
public CameraSynchronization cameraSynchronization
Field Value
Type |
---|
CameraSynchronization |
defaultColorHeight
Default Color camera resolution height used when loading the camera calibration information Default: 720
Declaration
public int defaultColorHeight
Field Value
Type |
---|
System.Int32 |
defaultColorId
Default Color camera ID used when loading the camera calibration information Default: “0”
Declaration
public string defaultColorId
Field Value
Type |
---|
System.String |
defaultColorWidth
Default color camera resolution width to use when loading camera calibration information. Default: 1280
Declaration
public int defaultColorWidth
Field Value
Type |
---|
System.Int32 |
SetDefaultStreamDelay
Event for when frames to delay has been reset to default
Declaration
public TofArTofManager.SetDefaultStreamDelayEventHandler SetDefaultStreamDelay
Field Value
Type |
---|
TofArTofManager.SetDefaultStreamDelayEventHandler |
timeToDetectStreamUnexpectedStop
Time before unexpected stop is determined (seconds)
Default: 1.5
Declaration
public float timeToDetectStreamUnexpectedStop
Field Value
Type |
---|
System.Single |
Properties
CalibrationSettings
Camera calibration info
Declaration
public CalibrationSettingsProperty CalibrationSettings { get; set; }
Property Value
Type |
---|
CalibrationSettingsProperty |
CalibrationSettingsStatus
Status of camera calibration settings
Declaration
public TofArTofManager.CalibrationSettingsStatusType CalibrationSettingsStatus { get; }
Property Value
Type |
---|
TofArTofManager.CalibrationSettingsStatusType |
ConfidenceData
Latest Confidence data
Declaration
public ConfidenceData ConfidenceData { get; }
Property Value
Type |
---|
ConfidenceData |
ConfidenceTexture
Texture2D after conversion from Confidence data
Declaration
public Texture2D ConfidenceTexture { get; }
Property Value
Type |
---|
UnityEngine.Texture2D |
DepthData
Latest Depth data
Declaration
public DepthData DepthData { get; }
Property Value
Type |
---|
DepthData |
DepthTexture
Texture2D after conversion from Depth data
Declaration
public Texture2D DepthTexture { get; }
Property Value
Type |
---|
UnityEngine.Texture2D |
DesiredFrameRate
Desired FPS. Changes are reflected on next stream start.
Declaration
public float DesiredFrameRate { get; }
Property Value
Type |
---|
System.Single |
FrameRate
Actual FPS
Declaration
public float FrameRate { get; }
Property Value
Type |
---|
System.Single |
IsPlaying
True if recording file is being played
Declaration
public bool IsPlaying { get; }
Property Value
Type |
---|
System.Boolean |
IsProcessTexture
If true, execute Texture2D conversion of data
Declaration
[Obsolete("IsProcessTexture is deprecated, please use ProcessTexture instead")]
public bool IsProcessTexture { get; }
Property Value
Type |
---|
System.Boolean |
IsStreamActive
If true, it is streaming
Declaration
public bool IsStreamActive { get; }
Property Value
Type |
---|
System.Boolean |
PointCloudData
Latest Confidence data
Declaration
public PointCloudData PointCloudData { get; }
Property Value
Type |
---|
PointCloudData |
ProcessTargets
Get channel of processing object
Declaration
public ProcessTargetsProperty ProcessTargets { get; }
Property Value
Type |
---|
ProcessTargetsProperty |
ProcessTexture
If true, execute Texture2D conversion of data
Declaration
public bool ProcessTexture { get; }
Property Value
Type |
---|
System.Boolean |
Stream
Stream
Declaration
public Stream Stream { get; }
Property Value
Type |
---|
SensCord.Stream |
StreamDelay
Delay the sending of frames by the specified number of frames
Declaration
public int StreamDelay { get; set; }
Property Value
Type |
---|
System.Int32 |
StreamPlay
Playback stream
Declaration
public Stream StreamPlay { get; }
Property Value
Type |
---|
SensCord.Stream |
Version
Component version No.
Declaration
public string Version { get; }
Property Value
Type |
---|
System.String |
Methods
AddManagerDependency(IDependManager)
Add dependent manager
Declaration
public void AddManagerDependency(IDependManager dependManager)
Parameters
Type | Name | Description |
---|---|---|
IDependManager | dependManager | Dependent manager |
CheckDevice()
Check if device is equipped with a ToF camera
Declaration
public bool CheckDevice()
Returns
Type | Description |
---|---|
System.Boolean | If true |
ClearLoadedSettings()
Clear calibration config list
Declaration
public void ClearLoadedSettings()
Dispose()
Disposal method
Declaration
public void Dispose()
GetProperty<T>()
Get component property
Declaration
public T GetProperty<T>()
where T : class, IBaseProperty, new()
Returns
Type | Description |
---|---|
T | Property class |
Type Parameters
Name | Description |
---|---|
T | IBaseProperty inherited class |
GetProperty<T>(T)
Get property of Component. Input parameter value may be designated.
Declaration
public T GetProperty<T>(T value)
where T : class, IBaseProperty
Parameters
Type | Name | Description |
---|---|---|
T | value | Input parameter |
Returns
Type | Description |
---|---|
T | Property class |
Type Parameters
Name | Description |
---|---|
T | IBaseProperty inherited class |
GetProperty<T>(T, Int32)
Set the size of the serialization buffer and get component properties. Input parameter value may be designated.
Declaration
public T GetProperty<T>(T value, int bufferSize)
where T : class, IBaseProperty, new()
Parameters
Type | Name | Description |
---|---|---|
T | value | Input parameter |
System.Int32 | bufferSize | Serialization buffer size |
Returns
Type | Description |
---|---|
T | Property class |
Type Parameters
Name | Description |
---|---|
T | IBaseProperty inherited class |
GetPropertyList()
Get property list
Declaration
public string[] GetPropertyList()
Returns
Type | Description |
---|---|
System.String[] | Property list |
LoadSettings()
Load calibration settings
Declaration
public CalibrationSettingsProperty LoadSettings()
Returns
Type | Description |
---|---|
CalibrationSettingsProperty | Calibration config data |
LoadSettings(String, Int32, Int32, Boolean)
Load calibration settings
Declaration
public CalibrationSettingsProperty LoadSettings(string depth_id, int depth_h, int depth_w, bool reportFailure)
Parameters
Type | Name | Description |
---|---|---|
System.String | depth_id | Camera ID |
System.Int32 | depth_h | Vertical resolution |
System.Int32 | depth_w | Horizontal resolution |
System.Boolean | reportFailure | Whether to emit event when failing to load calibration |
Returns
Type | Description |
---|---|
CalibrationSettingsProperty | Calibration config data |
LoadSettings(String, Int32, Int32, String, Int32, Int32, Boolean)
Load calibration settings
Declaration
public CalibrationSettingsProperty LoadSettings(string color_cameraId, int color_h, int color_w, string depth_cameraId, int depth_h, int depth_w, bool reportFailure)
Parameters
Type | Name | Description |
---|---|---|
System.String | color_cameraId | Color camera ID |
System.Int32 | color_h | Color vertical resolution |
System.Int32 | color_w | Color horizontal resolution |
System.String | depth_cameraId | Depth camera ID |
System.Int32 | depth_h | Depth vertical resolution |
System.Int32 | depth_w | Depth horizontal resolution |
System.Boolean | reportFailure | Whether to emit event when failing to load calibration |
Returns
Type | Description |
---|---|
CalibrationSettingsProperty | Calibration config data |
RegisterTofPreProcessing(IPreProcessTofData)
Register Tof data preprocessing
Declaration
public void RegisterTofPreProcessing(IPreProcessTofData preProcessTof)
Parameters
Type | Name | Description |
---|---|---|
IPreProcessTofData | preProcessTof | Tof data processing class |
RemoveManagerDependency(IDependManager)
Remove dependent manager
Declaration
public void RemoveManagerDependency(IDependManager dependManager)
Parameters
Type | Name | Description |
---|---|---|
IDependManager | dependManager | Dependent manager |
SetProcessTargets(Boolean, Boolean, Boolean)
Set channel of processing object
Declaration
public void SetProcessTargets(bool depth, bool confidence, bool pointCloud)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | depth | if True, treat Depth channel as valid |
System.Boolean | confidence | if True, treat Confidence channel as valid |
System.Boolean | pointCloud | if True, treat PointCloud channel as valid |
SetProperty<T>(T)
Set component property
Declaration
public void SetProperty<T>(T value)
where T : class, IBaseProperty
Parameters
Type | Name | Description |
---|---|---|
T | value | Input parameter |
Type Parameters
Name | Description |
---|---|
T | IBaseProperty inherited class |
StartPlayback(String)
Start playback of the recording file from the specified path
Declaration
public void StartPlayback(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Directory path of recording file to playback |
StartStream(Boolean)
Start streaming
Declaration
public void StartStream(bool isProcessTexture = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isProcessTexture | isProcessTexture is process of Texture2D conversion executed for camera data |
StartStream(CameraConfigurationProperty, Boolean)
Start streaming
Declaration
public void StartStream(CameraConfigurationProperty configuration, bool isProcessTexture = false)
Parameters
Type | Name | Description |
---|---|---|
CameraConfigurationProperty | configuration | camera setting used for streaming |
System.Boolean | isProcessTexture | isProcessTexture is process of Texture2D conversion executed for camera data |
StartStream(CameraConfigurationProperty, List<ITofMetadataProperty>, Boolean)
Start streaming
Declaration
public void StartStream(CameraConfigurationProperty configuration, List<ITofMetadataProperty> metadataProperties, bool isProcessTexture = false)
Parameters
Type | Name | Description |
---|---|---|
CameraConfigurationProperty | configuration | Configuration used for streaming |
System.Collections.Generic.List<TofAr.V0.Tof.ITofMetadataProperty> | metadataProperties | Meta data used for streaming |
System.Boolean | isProcessTexture | isProcessTexture is process of Texture2D conversion executed for camera data |
StartStreamWithColor(CameraConfigurationProperty, Boolean)
Start streaming simultaneously with Color. Start color stream with default resolution. Enable Texture2D conversion processing of camera data.
Declaration
public void StartStreamWithColor(CameraConfigurationProperty tofConf, bool processTextureTof = true)
Parameters
Type | Name | Description |
---|---|---|
CameraConfigurationProperty | tofConf | ToF camera settings used for streaming |
System.Boolean | processTextureTof | Whether to perform Texture2D conversion processing of ToF camera data |
StartStreamWithColor(CameraConfigurationProperty, Boolean, Boolean)
Start streaming simultaneously with Color. Start color stream with default resolution.
Declaration
public void StartStreamWithColor(CameraConfigurationProperty tofConf, bool processTextureTof, bool processTextureColor)
Parameters
Type | Name | Description |
---|---|---|
CameraConfigurationProperty | tofConf | ToF camera settings used for streaming |
System.Boolean | processTextureTof | Whether to perform Texture2D conversion processing of ToF camera data |
System.Boolean | processTextureColor | Whether to perform Texture2D conversion processing of Color camera data |
StartStreamWithColor(CameraConfigurationProperty, ResolutionProperty, Boolean, Boolean, List<ITofMetadataProperty>, List<IColorMetadataProperty>)
Start Tof and Color simultaneous streaming
Declaration
public void StartStreamWithColor(CameraConfigurationProperty tofConf, ResolutionProperty colorConf, bool processTextureTof, bool processTextureColor, List<ITofMetadataProperty> metadataPropertiesTof = null, List<IColorMetadataProperty> metadataPropertiesColor = null)
Parameters
Type | Name | Description |
---|---|---|
CameraConfigurationProperty | tofConf | Configuration used for Tof streaming |
ResolutionProperty | colorConf | Configuration used for Color streaming |
System.Boolean | processTextureTof | Whether to perform Texture2D conversion processing of Tof data |
System.Boolean | processTextureColor | Whether to perform Texture2D conversion processing of Color data |
System.Collections.Generic.List<TofAr.V0.Tof.ITofMetadataProperty> | metadataPropertiesTof | Meta data used for Tof streaming |
System.Collections.Generic.List<TofAr.V0.Color.IColorMetadataProperty> | metadataPropertiesColor | Meta data used for Color streaming |
StopPlayback()
Stop playback of recording file
Declaration
public void StopPlayback()
StopStream()
Stop streaming
Declaration
public void StopStream()
StopStream(Boolean)
Stop streaming
Declaration
public void StopStream(bool isRestart = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isRestart | If true, stops stream and instantly restarts it, if false, stops without restarting |
StopStreamWithColor()
Stop streaming simultaneously with Color.
Declaration
public void StopStreamWithColor()
UnregisterTofPreProcessing(IPreProcessTofData)
Unregister Tof data preprocessing
Declaration
public void UnregisterTofPreProcessing(IPreProcessTofData preProcessTof)
Parameters
Type | Name | Description |
---|---|---|
IPreProcessTofData | preProcessTof | Tof data processing class |
Events
OnApplicationPausing
Application pausing
Declaration
public static event TofArTofManager.ApplicationPausingEventHandler OnApplicationPausing
Event Type
Type | Description |
---|---|
TofArTofManager.ApplicationPausingEventHandler |
OnApplicationResuming
Application resuming
Declaration
public static event TofArTofManager.ApplicationResumingEventHandler OnApplicationResuming
Event Type
Type | Description |
---|---|
TofArTofManager.ApplicationResumingEventHandler |
OnAvailableConfigurationsChanged
Event for when config list has been changed
Declaration
public static event TofArTofManager.AvailableConfigurationsChanged OnAvailableConfigurationsChanged
Event Type
Type | Description |
---|---|
TofArTofManager.AvailableConfigurationsChanged |
OnDetectStreamUnexpectedStop
Notice on unexpected stop of stream
Declaration
public static event TofArTofManager.DetectStreamUnexpectedStopEventHandler OnDetectStreamUnexpectedStop
Event Type
Type | Description |
---|---|
TofArTofManager.DetectStreamUnexpectedStopEventHandler |
OnFrameArrived
Notice on arrival of new frame
Declaration
public static event TofArTofManager.FrameArrivedEventHandler OnFrameArrived
Event Type
Type | Description |
---|---|
TofArTofManager.FrameArrivedEventHandler |
OnStreamStarted
Notice on starting of streaming
Declaration
public static event TofArTofManager.StreamStartedEventHandler OnStreamStarted
Event Type
Type | Description |
---|---|
TofArTofManager.StreamStartedEventHandler |
OnStreamStopped
Notice on ending of streaming
Declaration
public static event TofArTofManager.StreamStoppedEventHandler OnStreamStopped
Event Type
Type | Description |
---|---|
TofArTofManager.StreamStoppedEventHandler |