Class TofArColorManager
Colorカメラとの接続を管理する
下記機能を有する
- Colorカメラとの接続管理
- Colorデータの取得
- ColorデータのTexture2D変換
- ストリーム開始イベント通知
- ストリーム終了イベント通知
- フレーム到着通知
- 録画ファイルの再生
Inheritance
Inherited Members
Namespace: TofAr.V0.Color
Assembly: TofArColorAssembly.dll
Syntax
public class TofArColorManager : Singleton<TofArColorManager>, IStreamStoppable, IDisposable, IStreamHolder, IDependedManager
Remarks
FieldsにないUnityのInspector項目
| Field | Type | Description |
|---|---|---|
| Process Texture | bool | trueの場合データのTexture2D変換処理を行う |
| Color Format | ColorFormat | Colorデータフォーマット |
| Auto Focus | bool | オートフォーカスの有効性 true: オートフォーカス有効 false: オートフォーカス無効 |
| Focus Distance | float | 固定フォーカスとする場合の焦点距離(ミリメートル単位) |
| Auto Exposure | bool | 自動露出機能の有効性 true: 自動露出有効 false: 自動露出無効 |
| Exposure Time | long | 露出機能の露光時間 |
| Frame Duration | long | 露出機能のフレーム間隔 |
| Sensitivity | int | 露出機能の分光感度 |
| Flash Mode | FlashMode | Off: フラッシュオフ Single: 1フレームのみフラッシュを使用する Torch: フラッシュを連続点灯する |
| Auto White Balance | bool | 自動ホワイトバランス機能の有効性 true: 自動ホワイトバランス有効 false: 自動ホワイトバランス無効 |
| White Balance Mode | WhiteBalanceMode | ホワイトバランスモード |
| Lens Stabilization | bool | true: 手ブレ補正を有効とする false: 手ブレ補正を無効とする |
| Desired Frame Rate | float | 設定希望FPS |
| Use Front Camera As Default | bool | true: フロントカメラをデフォルトとして設定 false: カメラのデフォルトは変更しない |
| Use Default Stream Delay | bool | true: ストリームの遅延設定を設定ファイルから行う false: ストリームの遅延設定をInspectorで設定する |
Fields
autoStart
trueの場合、アプリケーション開始時に自動的にColorデータのストリームを開始する
Declaration
public bool autoStart
Field Value
| Type |
|---|
| System.Boolean |
SetDefaultStreamDelay
ストリーミングデフォルト遅延設定通知
Declaration
public TofArColorManager.SetDefaultStreamDelayEventHandler SetDefaultStreamDelay
Field Value
| Type |
|---|
| TofArColorManager.SetDefaultStreamDelayEventHandler |
Properties
ColorData
Colorデータ
Declaration
public ColorData ColorData { get; }
Property Value
| Type |
|---|
| ColorData |
ColorTexture
Colorデータを変換したTexture2D
Colorデータが下記フォーマットの場合、Unityがサポートしていないため表示可能なデータは格納されない。
- YUV420
- BGR
Declaration
public Texture2D ColorTexture { get; }
Property Value
| Type |
|---|
| UnityEngine.Texture2D |
CurrentYUVFrameInfo
現在のYUVフレーム情報
Declaration
public TofArColorManager.YUVFrameInfo CurrentYUVFrameInfo { get; }
Property Value
| Type |
|---|
| TofArColorManager.YUVFrameInfo |
DesiredFrameRate
設定希望FPS。設定は次回ストリーミング開始時に有効となる。
Declaration
public float DesiredFrameRate { get; set; }
Property Value
| Type |
|---|
| System.Single |
DirectFrameCaptureEnabled
trueの場合、Native層から直接フレームをキャプチャする(Windows Standalone プラットフォームのみで有効)
Declaration
public bool DirectFrameCaptureEnabled { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
FrameRate
実測FPS
Declaration
public float FrameRate { get; }
Property Value
| Type |
|---|
| System.Single |
IsColorStarting
ストリーミング起動中のステータス
Declaration
public bool IsColorStarting { get; }
Property Value
| Type |
|---|
| System.Boolean |
IsPlaying
trueの場合、録画ファイルを再生している
Declaration
public bool IsPlaying { get; }
Property Value
| Type |
|---|
| System.Boolean |
IsStreamActive
trueの場合ストリーミングを行っている
Declaration
public bool IsStreamActive { get; }
Property Value
| Type |
|---|
| System.Boolean |
PhotoColorData
静止画Colorデータ
Declaration
public PhotoColorData PhotoColorData { get; }
Property Value
| Type |
|---|
| PhotoColorData |
PhotoDepthData
静止画Depthデータ
Declaration
public PhotoDepthData PhotoDepthData { get; }
Property Value
| Type |
|---|
| PhotoDepthData |
ProcessTexture
trueの場合データのTexture2D変換処理を行っている
Declaration
public bool ProcessTexture { get; }
Property Value
| Type |
|---|
| System.Boolean |
Stream
ストリーム
Declaration
public Stream Stream { get; }
Property Value
| Type |
|---|
| SensCord.Stream |
StreamDelay
フレーム送出遅延数
Declaration
public int StreamDelay { get; set; }
Property Value
| Type |
|---|
| System.Int32 |
StreamPlay
再生ストリーム
Declaration
public Stream StreamPlay { get; }
Property Value
| Type |
|---|
| SensCord.Stream |
Version
コンポーネントのバージョン番号
Declaration
public string Version { get; }
Property Value
| Type |
|---|
| System.String |
Methods
AddManagerDependency(IDependManager)
依存Managerを追加する
Declaration
public void AddManagerDependency(IDependManager dependManager)
Parameters
| Type | Name | Description |
|---|---|---|
| IDependManager | dependManager | 依存Manager |
DecodeYUVData(TofArColorManager.YUVFrameInfo, Int32, Int32, ColorFormat)
YUVフレームデータを他のフォーマットへ変換する
Declaration
public byte[] DecodeYUVData(TofArColorManager.YUVFrameInfo yuvFrameInfo, int frameWidth, int frameHeight, ColorFormat outputFormat)
Parameters
| Type | Name | Description |
|---|---|---|
| TofArColorManager.YUVFrameInfo | yuvFrameInfo | YUVフレーム情報 |
| System.Int32 | frameWidth | |
| System.Int32 | frameHeight | フレーム高さ |
| ColorFormat | outputFormat | 出力フォーマット |
Returns
| Type | Description |
|---|---|
| System.Byte[] | 変換後のバッファ |
Dispose()
オブジェクト破棄
Declaration
public void Dispose()
Dispose(Boolean)
破棄処理
Declaration
public void Dispose(bool ignoreEventRelease)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | ignoreEventRelease | trueの場合、イベントハンドラのクリアをスキップする |
GetProperty<T>()
コンポーネントプロパティを取得する
Declaration
public T GetProperty<T>()
where T : class, IBaseProperty, new()
Returns
| Type | Description |
|---|---|
| T | プロパティクラス |
Type Parameters
| Name | Description |
|---|---|
| T | IBaseProperty継承クラス |
GetProperty<T>(T)
コンポーネントプロパティを取得する。入力パラメータvalueを指定可能。
Declaration
public T GetProperty<T>(T value)
where T : class, IBaseProperty
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | 入力パラメータ |
Returns
| Type | Description |
|---|---|
| T | プロパティクラス |
Type Parameters
| Name | Description |
|---|---|
| T | IBaseProperty継承クラス |
GetProperty<T>(T, Int32)
シリアライズ用バッファサイズを指定してコンポーネントプロパティを取得する。入力パラメータvalueを指定可能。
Declaration
public T GetProperty<T>(T value, int bufferSize)
where T : class, IBaseProperty
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | 入力パラメータ |
| System.Int32 | bufferSize | シリアライズ用バッファサイズ |
Returns
| Type | Description |
|---|---|
| T | プロパティクラス |
Type Parameters
| Name | Description |
|---|---|
| T | IBaseProperty継承クラス |
GetPropertyList()
Propertyのリストを取得する
Declaration
public string[] GetPropertyList()
Returns
| Type | Description |
|---|---|
| System.String[] | Propertyのリスト |
RegisterColorPreProcessing(IPreProcessColorData)
Colorデータ送出前の処理を登録する
Declaration
public void RegisterColorPreProcessing(IPreProcessColorData preProcessColor)
Parameters
| Type | Name | Description |
|---|---|---|
| IPreProcessColorData | preProcessColor | データ処理クラス |
RemoveManagerDependency(IDependManager)
依存Managerを削除する
Declaration
public void RemoveManagerDependency(IDependManager dependManager)
Parameters
| Type | Name | Description |
|---|---|---|
| IDependManager | dependManager | 依存Manager |
SetProperty(FormatConvertProperty)
コンポーネントプロパティを設定する
Declaration
public void SetProperty(FormatConvertProperty value)
Parameters
| Type | Name | Description |
|---|---|---|
| FormatConvertProperty | value | 入力パラメータ |
SetProperty<T>(T)
コンポーネントプロパティを設定する
Declaration
public void SetProperty<T>(T value)
where T : class, IBaseProperty
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | 入力パラメータ |
Type Parameters
| Name | Description |
|---|---|
| T | BaseProperty継承クラス |
SetStreamDelayToDefault(IExternalColorStream)
ストリームの遅延設定を設定ファイルから行う
Declaration
public void SetStreamDelayToDefault(IExternalColorStream externalSource = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IExternalColorStream | externalSource |
StartPlayback(String)
指定されたパス内の録画ファイルの再生を開始する
Declaration
public void StartPlayback(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | path | 再生する録画ファイルを含むディレクトリのパス |
StartStream(Boolean)
ストリーミングを開始する
Declaration
public void StartStream(bool isProcessTexture = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | isProcessTexture | カメラデータのTexture2D変換処理を実施するかどうか |
StartStream(ResolutionProperty, Boolean)
ストリーミングを開始する
Declaration
public void StartStream(ResolutionProperty configuration, bool isProcessTexture = true)
Parameters
| Type | Name | Description |
|---|---|---|
| ResolutionProperty | configuration | ストリーミングで使用する解像度 |
| System.Boolean | isProcessTexture | trueの場合、カメラデータのTexture2D変換処理を実施する |
StartStream(ResolutionProperty, List<IColorMetadataProperty>, Boolean)
ストリーミングを開始する
Declaration
public void StartStream(ResolutionProperty configuration, List<IColorMetadataProperty> metadataProperties, bool isProcessTexture = true)
Parameters
| Type | Name | Description |
|---|---|---|
| ResolutionProperty | configuration | ストリーミングで使用する解像度 |
| System.Collections.Generic.List<TofAr.V0.Color.IColorMetadataProperty> | metadataProperties | ストリーミングで使用するメタデータ |
| System.Boolean | isProcessTexture | trueの場合、カメラデータのTexture2D変換処理を実施する |
StopPlayback()
録画ファイルの再生を停止する
Declaration
public void StopPlayback()
StopStream()
ストリーミングを停止する
Declaration
public void StopStream()
StopStream(Boolean)
ストリーミングを停止する
Declaration
public void StopStream(bool isRestart = true)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | isRestart | trueの場合はストリームを中止してすぐ再起動する、falseの場合は再起動せずに終了する |
UnregisterColorPreProcessing(IPreProcessColorData)
登録されたColorデータ送出前の処理を登録解除する
Declaration
public void UnregisterColorPreProcessing(IPreProcessColorData preProcessColor)
Parameters
| Type | Name | Description |
|---|---|---|
| IPreProcessColorData | preProcessColor | データ処理クラス |
Events
OnApplicationPausing
アプリケーション一時停止開始時
Declaration
public static event TofArColorManager.ApplicationPausingEventHandler OnApplicationPausing
Event Type
| Type | Description |
|---|---|
| TofArColorManager.ApplicationPausingEventHandler |
OnApplicationResuming
アプリケーション復帰開始時
Declaration
public static event TofArColorManager.ApplicationResumingEventHandler OnApplicationResuming
Event Type
| Type | Description |
|---|---|
| TofArColorManager.ApplicationResumingEventHandler |
OnAvailableResolutionsChanged
解像度の変更通知
Declaration
public static event TofArColorManager.AvailableResolutionsChanged OnAvailableResolutionsChanged
Event Type
| Type | Description |
|---|---|
| TofArColorManager.AvailableResolutionsChanged |
OnFrameArrived
新しいフレームの到着通知
Declaration
public static event TofArColorManager.FrameArrivedEventHandler OnFrameArrived
Event Type
| Type | Description |
|---|---|
| TofArColorManager.FrameArrivedEventHandler |
OnPhotoFrameArrived
撮影静止画フレームの到着通知
Declaration
public static event TofArColorManager.PhotoFrameArrivedEventHandler OnPhotoFrameArrived
Event Type
| Type | Description |
|---|---|
| TofArColorManager.PhotoFrameArrivedEventHandler |
OnStreamStarted
ストリーミング開始通知
Declaration
public static event TofArColorManager.StreamStartedEventHandler OnStreamStarted
Event Type
| Type | Description |
|---|---|
| TofArColorManager.StreamStartedEventHandler |
OnStreamStartError
ストリーミング開始エラー通知
Declaration
public static event TofArColorManager.StreamStartErrorEventHandler OnStreamStartError
Event Type
| Type | Description |
|---|---|
| TofArColorManager.StreamStartErrorEventHandler |
OnStreamStopped
ストリーミング終了通知
Declaration
public static event TofArColorManager.StreamStoppedEventHandler OnStreamStopped
Event Type
| Type | Description |
|---|---|
| TofArColorManager.StreamStoppedEventHandler |