集成UVC摄像头功能
This commit is contained in:
parent
cd5bc028c4
commit
2233e6e83d
|
@ -255,6 +255,8 @@ RectTransform:
|
|||
- {fileID: 8475079236000353301}
|
||||
- {fileID: 6229047881894855180}
|
||||
- {fileID: 4277339089744270226}
|
||||
- {fileID: 4318354961022875112}
|
||||
- {fileID: 3096906925272982799}
|
||||
m_Father: {fileID: 475269767089658797}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
|
@ -1395,6 +1397,78 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ShowMaskGraphic: 1
|
||||
--- !u!1 &5049731194724459156
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4318354961022875112}
|
||||
- component: {fileID: 9105578097159592020}
|
||||
- component: {fileID: 7455986887067286179}
|
||||
m_Layer: 5
|
||||
m_Name: Displayer
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4318354961022875112
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5049731194724459156}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 38199016232350786}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -270, y: 0}
|
||||
m_SizeDelta: {x: -640, y: -100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &9105578097159592020
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5049731194724459156}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7455986887067286179
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5049731194724459156}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Texture: {fileID: 0}
|
||||
m_UVRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
--- !u!1 &5105019391767359508
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1908,6 +1982,114 @@ MonoBehaviour:
|
|||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &7940173089482779789
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3096906925272982799}
|
||||
- component: {fileID: 7626762285874418130}
|
||||
- component: {fileID: 6854932209812094026}
|
||||
m_Layer: 5
|
||||
m_Name: CaptureManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3096906925272982799
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7940173089482779789}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 38199016232350786}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &7626762285874418130
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7940173089482779789}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c96807d839ba7554d92494fd6d25bb28, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_webCamTextureToMatHelper: {fileID: 0}
|
||||
SamplingRate: 0.3
|
||||
TargetDisplayer: {fileID: 7455986887067286179}
|
||||
--- !u!114 &6854932209812094026
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7940173089482779789}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: df35b0c19ca97734e87299a664cea35f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_requestedDeviceName:
|
||||
_requestedWidth: 960
|
||||
_requestedHeight: 720
|
||||
_requestedIsFrontFacing: 0
|
||||
_requestedFPS: 30
|
||||
_rotate90Degree: 0
|
||||
_flipVertical: 0
|
||||
_flipHorizontal: 0
|
||||
_outputColorFormat: 4
|
||||
_timeoutFrameCount: 1500
|
||||
onInitialized:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 7626762285874418130}
|
||||
m_TargetAssemblyTypeName: Yoga.MotionCaptureManager, Assembly-CSharp
|
||||
m_MethodName: OnWebCamTextureToMatHelperInitialized
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onDisposed:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 7626762285874418130}
|
||||
m_TargetAssemblyTypeName: Yoga.MotionCaptureManager, Assembly-CSharp
|
||||
m_MethodName: OnWebCamTextureToMatHelperDisposed
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onErrorOccurred:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
avoidAndroidFrontCameraLowLightIssue: 0
|
||||
--- !u!1 &8393834018379886065
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -290,6 +290,50 @@ RectTransform:
|
|||
m_CorrespondingSourceObject: {fileID: 8805156796672989800, guid: 85c5c8dc06b4f49419cf4b1751725a67, type: 3}
|
||||
m_PrefabInstance: {fileID: 168110290}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &280144576
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 280144578}
|
||||
- component: {fileID: 280144577}
|
||||
m_Layer: 0
|
||||
m_Name: YogaMainManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &280144577
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 280144576}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b55f4807e5753354ca51edb2a942ff20, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!4 &280144578
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 280144576}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 1042.905, y: 591.9674, z: 1279.6279}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &519578969
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -817,195 +861,6 @@ RectTransform:
|
|||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!1 &1603288915
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1603288919}
|
||||
- component: {fileID: 1603288918}
|
||||
- component: {fileID: 1603288916}
|
||||
- component: {fileID: 1603288917}
|
||||
- component: {fileID: 1603288921}
|
||||
- component: {fileID: 1603288922}
|
||||
m_Layer: 0
|
||||
m_Name: Capture
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!64 &1603288916
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1603288915}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 5
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &1603288917
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1603288915}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 7b4f42e90cf460d47a091713acf8db47, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &1603288918
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1603288915}
|
||||
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &1603288919
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1603288915}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -30, y: 0, z: 80}
|
||||
m_LocalScale: {x: 128, y: 96, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1603288921
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1603288915}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: df35b0c19ca97734e87299a664cea35f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_requestedDeviceName: 1
|
||||
_requestedWidth: 1280
|
||||
_requestedHeight: 960
|
||||
_requestedIsFrontFacing: 0
|
||||
_requestedFPS: 30
|
||||
_rotate90Degree: 0
|
||||
_flipVertical: 0
|
||||
_flipHorizontal: 0
|
||||
_outputColorFormat: 2
|
||||
_timeoutFrameCount: 300
|
||||
onInitialized:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1603288922}
|
||||
m_TargetAssemblyTypeName: Yoga.MotionCaptureManager, Assembly-CSharp
|
||||
m_MethodName: OnWebCamTextureToMatHelperInitialized
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onDisposed:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1603288922}
|
||||
m_TargetAssemblyTypeName: Yoga.MotionCaptureManager, Assembly-CSharp
|
||||
m_MethodName: OnWebCamTextureToMatHelperDisposed
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onErrorOccurred:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1603288922}
|
||||
m_TargetAssemblyTypeName: Yoga.MotionCaptureManager, Assembly-CSharp
|
||||
m_MethodName: OnWebCamTextureToMatHelperErrorOccurred
|
||||
m_Mode: 0
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
avoidAndroidFrontCameraLowLightIssue: 1
|
||||
--- !u!114 &1603288922
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1603288915}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c96807d839ba7554d92494fd6d25bb28, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
SamplingRate: 0.1
|
||||
--- !u!1 &1680658391
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -7387,7 +7242,7 @@ SceneRoots:
|
|||
- {fileID: 963194228}
|
||||
- {fileID: 1190353384}
|
||||
- {fileID: 1521186386}
|
||||
- {fileID: 1603288919}
|
||||
- {fileID: 1763781738}
|
||||
- {fileID: 51299363}
|
||||
- {fileID: 2046868293}
|
||||
- {fileID: 280144578}
|
||||
|
|
|
@ -90,11 +90,11 @@ public class CVEstimator : Singleton<CVEstimator>
|
|||
Mat bgrMat = new Mat();
|
||||
while (IsRunning)
|
||||
{
|
||||
Mat rgbaMat = MotionCaptureManager.Instance.RgbaMat;
|
||||
Mat rgbaMat = YogaManager.Instance.RgbaMat;
|
||||
if (rgbaMat == null)
|
||||
{
|
||||
Debug.Log("WebCamTexture is null. ");
|
||||
Debug.Log("Re-Estimation.");
|
||||
//Debug.Log("WebCamTexture is null. ");
|
||||
//Debug.Log("Re-Estimation.");
|
||||
continue; //重新检测
|
||||
}
|
||||
Imgproc.cvtColor(rgbaMat, bgrMat, Imgproc.COLOR_RGBA2BGR);
|
||||
|
@ -106,7 +106,7 @@ public class CVEstimator : Singleton<CVEstimator>
|
|||
}
|
||||
|
||||
//更新关键点位检测结果
|
||||
MotionCaptureManager.Instance.CurrPersonPoints = points;
|
||||
YogaManager.Instance.CurrPersonPoints = points;
|
||||
|
||||
//等待到下一个更新周期
|
||||
if (DateTime.Now - startTime > _refreshRate)
|
||||
|
|
|
@ -108,7 +108,7 @@ public class OpenPoseEsimater : Estimator
|
|||
}
|
||||
|
||||
//更新人物框检测结果
|
||||
MotionCaptureManager.Instance.VoloResult = voloResultBox;
|
||||
YogaManager.Instance.VoloResult = voloResultBox;
|
||||
|
||||
points = null;
|
||||
|
||||
|
@ -164,12 +164,12 @@ public class OpenPoseEsimater : Estimator
|
|||
|
||||
public override void DebugPrint(Mat image, bool isRGB = false)
|
||||
{
|
||||
if (MotionCaptureManager.Instance.VoloResult.Count > 2)
|
||||
if (YogaManager.Instance.VoloResult.Count > 2)
|
||||
return;
|
||||
|
||||
var box = MotionCaptureManager.Instance.VoloResult[0];
|
||||
var conf = MotionCaptureManager.Instance.VoloResult[1];
|
||||
var cls = MotionCaptureManager.Instance.VoloResult[2];
|
||||
var box = YogaManager.Instance.VoloResult[0];
|
||||
var conf = YogaManager.Instance.VoloResult[1];
|
||||
var cls = YogaManager.Instance.VoloResult[2];
|
||||
|
||||
float left = box[0];
|
||||
float top = box[1];
|
||||
|
|
|
@ -1,30 +1,24 @@
|
|||
using OpenCVForUnity.CoreModule;
|
||||
using OpenCVForUnity.DnnModule;
|
||||
using OpenCVForUnity.ImgprocModule;
|
||||
using OpenCVForUnity.UnityUtils;
|
||||
using OpenCVForUnity.UnityUtils.Helper;
|
||||
using OpenCVForUnityExample;
|
||||
//using Serenegiant.UVC;
|
||||
using Serenegiant.UVC;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Video;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Yoga
|
||||
{
|
||||
public class MotionCaptureManager : MonoSingleton<MotionCaptureManager>
|
||||
public class MotionCaptureManager : CameraCaptureManagerBase, IUVCDrawer
|
||||
{
|
||||
private WebCamTextureToMatHelper _webCamTextureToMatHelper;
|
||||
//private UVCManager _uvcManager;
|
||||
public WebCamTextureToMatHelper _webCamTextureToMatHelper;
|
||||
private Texture2D texture;
|
||||
|
||||
public float SamplingRate = 0.3f;
|
||||
|
||||
private List<float[]> _voloResult = new List<float[]>();
|
||||
private List<Point> _currPersonPoints = new List<Point>();
|
||||
public RawImage TargetDisplayer;
|
||||
|
||||
private Mat _bgrMat;
|
||||
|
||||
|
@ -32,21 +26,7 @@ namespace Yoga
|
|||
public bool IsOnCamCapture { get => _isOnCamCapture; internal set => _isOnCamCapture = value; }
|
||||
public WebCamTextureToMatHelper WebCamTextureToMatHelper => _webCamTextureToMatHelper;
|
||||
|
||||
public List<Point> CurrPersonPoints { get => _currPersonPoints; set => _currPersonPoints = value; }
|
||||
public List<float[]> VoloResult { get => _voloResult; set => _voloResult = value; }
|
||||
private bool _isCorrectAction = false;
|
||||
private Mat _rgbaMat;
|
||||
public Mat RgbaMat
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_rgbaMat == null && _webCamTextureToMatHelper != null)
|
||||
_rgbaMat = _webCamTextureToMatHelper.GetMat();
|
||||
return _rgbaMat;
|
||||
}
|
||||
|
||||
set => _rgbaMat = value;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
|
@ -58,6 +38,7 @@ namespace Yoga
|
|||
EventManager.Instance.AddEventListener(YogaEventType.ChangeCaptureCameraDevice, ChangeCaptureCameraDevice);
|
||||
}
|
||||
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
EventManager.Instance.RemoveEventListener(YogaEventType.StartMotionCapture, OnStartMotionCapture);
|
||||
|
@ -68,12 +49,10 @@ namespace Yoga
|
|||
EventManager.Instance.RemoveEventListener(YogaEventType.ChangeCaptureCameraDevice, ChangeCaptureCameraDevice);
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
public void Awake()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_webCamTextureToMatHelper = gameObject.GetComponentInChildren<WebCamTextureToMatHelper>();
|
||||
//_uvcManager = gameObject.GetComponentInChildren<UVCManager>();
|
||||
if (_webCamTextureToMatHelper == null)
|
||||
_webCamTextureToMatHelper = transform.GetComponent<WebCamTextureToMatHelper>();
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
// Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2).
|
||||
|
@ -82,18 +61,116 @@ namespace Yoga
|
|||
|
||||
_webCamTextureToMatHelper.Initialize();
|
||||
|
||||
UIManager.Instance.LoadReset();
|
||||
|
||||
if (YogaManager.Instance.Action == null)
|
||||
YogaManager.Instance.InitData();
|
||||
|
||||
UIManager.Instance.ShowPanel<ActionGuideVideoPanel>(false, YogaManager.Instance.Action);
|
||||
|
||||
Utils.setDebugMode(true); //打印日志
|
||||
|
||||
GlobalData.Instance.CameraDeviceType = CameraDeviceType.USB; //test
|
||||
|
||||
var devices = UVCManager.Instance.GetAttachedDevices();
|
||||
CVEstimator.Instance.Init();//初始化姿态检测
|
||||
}
|
||||
|
||||
#region UVC
|
||||
public UVCFilter[] UVCFilters;
|
||||
private Texture SavedTexture;
|
||||
public bool OnUVCAttachEvent(UVCManager manager, UVCDevice device)
|
||||
{
|
||||
var result = !device.IsRicoh || device.IsTHETA;
|
||||
|
||||
result &= UVCFilter.Match(device, UVCFilters);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void OnUVCDetachEvent(UVCManager manager, UVCDevice device)
|
||||
{
|
||||
Debug.Log("OnUVCDetachEvent " + device);
|
||||
}
|
||||
|
||||
public bool CanDraw(UVCManager manager, UVCDevice device)
|
||||
{
|
||||
return UVCFilter.Match(device, UVCFilters);
|
||||
}
|
||||
|
||||
public void OnUVCStartEvent(UVCManager manager, UVCDevice device, Texture tex)
|
||||
{
|
||||
HandleOnStartPreview(tex);
|
||||
}
|
||||
|
||||
public void OnUVCStopEvent(UVCManager manager, UVCDevice device)
|
||||
{
|
||||
HandleOnStopPreview();
|
||||
}
|
||||
|
||||
private void HandleOnStartPreview(Texture tex)
|
||||
{
|
||||
SavedTexture = TargetDisplayer.texture;
|
||||
TargetDisplayer.texture = texture;
|
||||
}
|
||||
private void HandleOnStopPreview()
|
||||
{
|
||||
RestoreTexture();
|
||||
}
|
||||
|
||||
private void RestoreTexture()
|
||||
{
|
||||
try
|
||||
{
|
||||
transform.GetComponent<Renderer>().material.mainTexture = SavedTexture;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogException(e);
|
||||
}
|
||||
SavedTexture = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public static Texture2D HorizontalFlipTexture(Texture2D texture)
|
||||
{
|
||||
//得到图片的宽高
|
||||
int width = texture.width;
|
||||
int height = texture.height;
|
||||
|
||||
Texture2D flipTexture = new Texture2D(width, height);
|
||||
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
flipTexture.SetPixels(i, 0, 1, height, texture.GetPixels(width - i - 1, 0, 1, height));
|
||||
}
|
||||
flipTexture.Apply();
|
||||
|
||||
return flipTexture;
|
||||
}
|
||||
|
||||
private Mat GetMat()
|
||||
{
|
||||
Mat img = null;
|
||||
if (GlobalData.Instance.CameraDeviceType == CameraDeviceType.USB &&
|
||||
UVCManager.Instance != null &&
|
||||
UVCManager.Instance.GetAttachedDevices() != null && UVCManager.Instance.GetAttachedDevices().Count > 0)
|
||||
{
|
||||
var devices = UVCManager.Instance.GetAttachedDevices();
|
||||
var formatRefMat = _webCamTextureToMatHelper.GetMat();
|
||||
var picCaptured = devices.FirstOrDefault().previewTexture;
|
||||
Texture2D tmpTex = new Texture2D(picCaptured.width, picCaptured.height);
|
||||
Utils.textureToTexture2D(picCaptured, tmpTex);
|
||||
tmpTex = HorizontalFlipTexture(tmpTex);//picCaptured texture水平反转
|
||||
img = new Mat(formatRefMat.rows(), formatRefMat.cols(), formatRefMat.type());
|
||||
Utils.texture2DToMat(tmpTex, img);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_webCamTextureToMatHelper.IsPlaying() && _webCamTextureToMatHelper.DidUpdateThisFrame())
|
||||
{
|
||||
img = _webCamTextureToMatHelper.GetMat();
|
||||
Imgproc.cvtColor(img, img, Imgproc.COLOR_BGR2RGB);
|
||||
}
|
||||
}
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!_isOnCamCapture)
|
||||
|
@ -101,66 +178,46 @@ namespace Yoga
|
|||
return;
|
||||
}
|
||||
|
||||
if (GlobalData.Instance.CameraDeviceType == CameraDeviceType.USB)
|
||||
{
|
||||
//if (_uvcManager != null)
|
||||
//{
|
||||
// var devices = _uvcManager.GetAttachedDevices();
|
||||
// if (devices != null && devices.Count > 0)
|
||||
// {
|
||||
// Utils.textureToTexture2D(devices.FirstOrDefault().previewTexture, texture);
|
||||
// //Mat img = RgbaMat.clone();
|
||||
// //Utils.texture2DToMat(texture, img);
|
||||
// //YogaManager.Instance.CurrentEstimator.Check(ref img);
|
||||
// //Utils.matToTexture2D(img, texture);
|
||||
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
if (!transform.gameObject.activeSelf)
|
||||
transform.gameObject.SetActive(true);
|
||||
|
||||
if (_webCamTextureToMatHelper.IsPlaying() && _webCamTextureToMatHelper.DidUpdateThisFrame())
|
||||
Mat img = GetMat();
|
||||
|
||||
if (img == null)
|
||||
return;
|
||||
|
||||
|
||||
YogaManager.Instance.RgbaMat = img.clone();
|
||||
YogaManager.Instance.CurrentEstimator.Check(ref img);//检测模型,将错误信息打印在图片上
|
||||
|
||||
if (YogaManager.Instance.VoloResult.Count >= 2)
|
||||
YogaManager.Instance.CurrentEstimator.DebugPrint(img);
|
||||
|
||||
if (YogaManager.Instance.CurrPersonPoints != null && YogaManager.Instance.CurrPersonPoints.Count > 0)
|
||||
{
|
||||
Mat img = _webCamTextureToMatHelper.GetMat();
|
||||
Imgproc.cvtColor(img, img, Imgproc.COLOR_BGR2RGB);
|
||||
_rgbaMat = img.clone();
|
||||
List<Point> points = YogaManager.Instance.CurrPersonPoints;
|
||||
|
||||
YogaManager.Instance.CurrentEstimator.Check(ref img);//检测模型,将错误信息打印在图片上
|
||||
|
||||
|
||||
if (_voloResult.Count >= 2)
|
||||
YogaManager.Instance.CurrentEstimator.DebugPrint(img);//DebugPrintObjectLayout(img, _voloResult[0], _voloResult[1], _voloResult[2]);
|
||||
|
||||
if (_currPersonPoints != null && _currPersonPoints.Count > 0)
|
||||
for (int i = 0; i < YogaConfig.POSE_PAIRS.GetLength(0); i++)
|
||||
{
|
||||
List<Point> points = _currPersonPoints;
|
||||
string partFrom = YogaConfig.POSE_PAIRS[i, 0];
|
||||
string partTo = YogaConfig.POSE_PAIRS[i, 1];
|
||||
|
||||
for (int i = 0; i < YogaConfig.POSE_PAIRS.GetLength(0); i++)
|
||||
int idFrom = YogaConfig.BODY_PARTS[partFrom];
|
||||
int idTo = YogaConfig.BODY_PARTS[partTo];
|
||||
|
||||
if (points[idFrom] == new Point(-1, -1) || points[idTo] == new Point(-1, -1))
|
||||
continue;
|
||||
|
||||
if (points[idFrom] != null && points[idTo] != null)
|
||||
{
|
||||
string partFrom = YogaConfig.POSE_PAIRS[i, 0];
|
||||
string partTo = YogaConfig.POSE_PAIRS[i, 1];
|
||||
|
||||
int idFrom = YogaConfig.BODY_PARTS[partFrom];
|
||||
int idTo = YogaConfig.BODY_PARTS[partTo];
|
||||
|
||||
if (points[idFrom] == new Point(-1, -1) || points[idTo] == new Point(-1, -1))
|
||||
continue;
|
||||
|
||||
if (points[idFrom] != null && points[idTo] != null)
|
||||
{
|
||||
Imgproc.line(img, points[idFrom], points[idTo], new Scalar(0, 255, 0), 3);
|
||||
Imgproc.ellipse(img, points[idFrom], new Size(3, 3), 0, 0, 360, new Scalar(0, 0, 255), Core.FILLED);
|
||||
Imgproc.ellipse(img, points[idTo], new Size(3, 3), 0, 0, 360, new Scalar(0, 0, 255), Core.FILLED);
|
||||
}
|
||||
Imgproc.line(img, points[idFrom], points[idTo], new Scalar(0, 255, 0), 3);
|
||||
Imgproc.ellipse(img, points[idFrom], new Size(3, 3), 0, 0, 360, new Scalar(0, 0, 255), Core.FILLED);
|
||||
Imgproc.ellipse(img, points[idTo], new Size(3, 3), 0, 0, 360, new Scalar(0, 0, 255), Core.FILLED);
|
||||
}
|
||||
}
|
||||
|
||||
//#endif
|
||||
Utils.matToTexture2D(img, texture);
|
||||
}
|
||||
|
||||
Utils.matToTexture2D(img, texture);
|
||||
}
|
||||
|
||||
#region Event Func
|
||||
|
@ -182,9 +239,9 @@ namespace Yoga
|
|||
var startTime = DateTime.Now;
|
||||
while (true)
|
||||
{
|
||||
if (_currPersonPoints != null && _currPersonPoints.Count != 0)
|
||||
if (YogaManager.Instance.CurrPersonPoints != null && YogaManager.Instance.CurrPersonPoints.Count != 0)
|
||||
{
|
||||
YogaManager.Instance.Points = _currPersonPoints;
|
||||
YogaManager.Instance.Points = YogaManager.Instance.CurrPersonPoints;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -212,9 +269,9 @@ namespace Yoga
|
|||
|
||||
while (true)
|
||||
{
|
||||
if (YogaManager.Instance.ActionCheckPoints(_currPersonPoints))
|
||||
if (YogaManager.Instance.ActionCheckPoints(YogaManager.Instance.CurrPersonPoints))
|
||||
{
|
||||
_isCorrectAction = (_isCorrectAction || YogaManager.Instance.IsCorrectAction(_currPersonPoints, actionType));
|
||||
_isCorrectAction = (_isCorrectAction || YogaManager.Instance.IsCorrectAction(YogaManager.Instance.CurrPersonPoints, actionType));
|
||||
break;
|
||||
}
|
||||
if (startTime.AddMilliseconds(100) < DateTime.Now)
|
||||
|
@ -226,7 +283,6 @@ namespace Yoga
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void ChangeCaptureCameraDevice()
|
||||
{
|
||||
var deviceName = WebCamTexture.devices[GlobalData.Instance.CameraIndex].name;
|
||||
|
@ -273,7 +329,8 @@ namespace Yoga
|
|||
texture = new Texture2D(webCamTextureMat.cols(), webCamTextureMat.rows(), TextureFormat.RGB24, false);
|
||||
Utils.matToTexture2D(webCamTextureMat, texture);
|
||||
|
||||
this.gameObject.GetComponent<Renderer>().material.mainTexture = texture;
|
||||
//gameObject.GetComponent<Renderer>().material.mainTexture = texture;
|
||||
TargetDisplayer.texture = texture;
|
||||
|
||||
gameObject.transform.localScale = new Vector3(webCamTextureMat.cols() / 10, webCamTextureMat.rows() / 10, 1);
|
||||
Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
|
||||
|
@ -330,4 +387,8 @@ namespace Yoga
|
|||
_isCorrectAction = false;//重置
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class CameraCaptureManagerBase : MonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class YogaMainManager : MonoBehaviour
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
UIManager.Instance.LoadReset();
|
||||
|
||||
if (YogaManager.Instance.Action == null)
|
||||
YogaManager.Instance.InitData();
|
||||
|
||||
UIManager.Instance.ShowPanel<ActionGuideVideoPanel>(false, YogaManager.Instance.Action);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b55f4807e5753354ca51edb2a942ff20
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -16,6 +16,21 @@ using Yoga;
|
|||
public class YogaManager : MonoSingleton<YogaManager>
|
||||
{
|
||||
private List<Point> _points = new List<Point>();
|
||||
private Mat _rgbaMat;
|
||||
public Mat RgbaMat
|
||||
{
|
||||
get
|
||||
{
|
||||
return _rgbaMat;
|
||||
}
|
||||
|
||||
set => _rgbaMat = value;
|
||||
}
|
||||
|
||||
private List<Point> _currPersonPoints = new List<Point>();
|
||||
public List<Point> CurrPersonPoints { get => _currPersonPoints; set => _currPersonPoints = value; }
|
||||
private List<float[]> _voloResult = new List<float[]>();
|
||||
public List<float[]> VoloResult { get => _voloResult; set => _voloResult = value; }
|
||||
|
||||
public List<Point> Points { get => _points; set => _points = value; }
|
||||
|
||||
|
@ -116,7 +131,7 @@ public class YogaManager : MonoSingleton<YogaManager>
|
|||
{
|
||||
if (points == null || points.Count == 0)
|
||||
{
|
||||
Debug.Log("ActionCheckPoints points is null");
|
||||
//Debug.Log("ActionCheckPoints points is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class CubeHandler : MonoBehaviour,
|
|||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine("OnClick:");
|
||||
Debug.Log("OnClick:");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace Serenegiant {
|
|||
{ // タッチしたとき
|
||||
touchEvent.state = TouchState.Began;
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine("タッチした:");
|
||||
Debug.Log("タッチした:");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ namespace Serenegiant {
|
|||
{ // 離したとき
|
||||
touchEvent.state = TouchState.Ended;
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine("タッチした:");
|
||||
Debug.Log("タッチした:");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ namespace Serenegiant {
|
|||
{ // 押し続けているとき
|
||||
touchEvent.state = TouchState.Moved;
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine("押し続けている");
|
||||
Debug.Log("押し続けている");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace Serenegiant
|
|||
void Awake()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}Awake:");
|
||||
Debug.Log($"{TAG}Awake:");
|
||||
#endif
|
||||
#if UNITY_ANDROID
|
||||
Input.backButtonLeavesApp = true; // 端末のバックキーでアプリを終了できるようにする
|
||||
|
@ -78,7 +78,7 @@ namespace Serenegiant
|
|||
public void OnStartEvent()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnStartEvent:");
|
||||
Debug.Log($"{TAG}OnStartEvent:");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace Serenegiant
|
|||
public void OnResumeEvent()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnResumeEvent:");
|
||||
Debug.Log($"{TAG}OnResumeEvent:");
|
||||
#endif
|
||||
LifecycleEvent?.Invoke(true);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ namespace Serenegiant
|
|||
public void OnPauseEvent()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnPauseEvent:");
|
||||
Debug.Log($"{TAG}OnPauseEvent:");
|
||||
#endif
|
||||
LifecycleEvent?.Invoke(false);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ namespace Serenegiant
|
|||
public void OnStopEvent()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnStopEvent:");
|
||||
Debug.Log($"{TAG}OnStopEvent:");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ namespace Serenegiant
|
|||
public void OnPermissionGrant()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnPermissionGrant:");
|
||||
Debug.Log($"{TAG}OnPermissionGrant:");
|
||||
#endif
|
||||
grantResult = PermissionGrantResult.PERMISSION_GRANT;
|
||||
isPermissionRequesting = false;
|
||||
|
@ -132,7 +132,7 @@ namespace Serenegiant
|
|||
public void OnPermissionDeny()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnPermissionDeny:");
|
||||
Debug.Log($"{TAG}OnPermissionDeny:");
|
||||
#endif
|
||||
grantResult = PermissionGrantResult.PERMISSION_DENY;
|
||||
isPermissionRequesting = false;
|
||||
|
@ -144,7 +144,7 @@ namespace Serenegiant
|
|||
public void OnPermissionDenyAndNeverAskAgain()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnPermissionDenyAndNeverAskAgain:");
|
||||
Debug.Log($"{TAG}OnPermissionDenyAndNeverAskAgain:");
|
||||
#endif
|
||||
grantResult = PermissionGrantResult.PERMISSION_DENY_AND_NEVER_ASK_AGAIN;
|
||||
isPermissionRequesting = false;
|
||||
|
@ -158,7 +158,7 @@ namespace Serenegiant
|
|||
private void Initialize()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}Initialize:{gameObject.name}");
|
||||
Debug.Log($"{TAG}Initialize:{gameObject.name}");
|
||||
#endif
|
||||
using (AndroidJavaClass clazz = new AndroidJavaClass(FQCN_PLUGIN))
|
||||
{
|
||||
|
@ -204,7 +204,7 @@ namespace Serenegiant
|
|||
public static IEnumerator RequestPermission(string permission, OnPermission callback)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}GrantPermission:{permission}");
|
||||
Debug.Log($"{TAG}GrantPermission:{permission}");
|
||||
#endif
|
||||
if (!HasPermission(permission))
|
||||
{
|
||||
|
@ -245,7 +245,7 @@ namespace Serenegiant
|
|||
public static IEnumerator GrantPermission(string permission, OnPermission callback)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}GrantPermission:{permission}");
|
||||
Debug.Log($"{TAG}GrantPermission:{permission}");
|
||||
#endif
|
||||
if (!HasPermission(permission))
|
||||
{
|
||||
|
@ -284,7 +284,7 @@ namespace Serenegiant
|
|||
public static IEnumerator GrantCameraPermission(OnPermission callback)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}GrantCameraPermission:");
|
||||
Debug.Log($"{TAG}GrantCameraPermission:");
|
||||
#endif
|
||||
if (CheckAndroidVersion(23))
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace Serenegiant.UVC
|
|||
void Start()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}Start:");
|
||||
Debug.Log($"{TAG}Start:");
|
||||
#endif
|
||||
UpdateTarget();
|
||||
|
||||
|
@ -91,7 +91,7 @@ namespace Serenegiant.UVC
|
|||
public bool OnUVCAttachEvent(UVCManager manager, UVCDevice device)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnUVCAttachEvent:{device}");
|
||||
Debug.Log($"{TAG}OnUVCAttachEvent:{device}");
|
||||
#endif
|
||||
// XXX 今の実装では基本的に全てのUVC機器を受け入れる
|
||||
// ただしTHETA SとTHETA VとTHETA Z1は映像を取得できないインターフェースがあるのでオミットする
|
||||
|
@ -112,7 +112,7 @@ namespace Serenegiant.UVC
|
|||
public void OnUVCDetachEvent(UVCManager manager, UVCDevice device)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnUVCDetachEvent:{device}");
|
||||
Debug.Log($"{TAG}OnUVCDetachEvent:{device}");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -126,26 +126,26 @@ namespace Serenegiant.UVC
|
|||
// public SupportedFormats.Size OnUVCSelectSize(UVCManager manager, UVCDevice device, SupportedFormats formats)
|
||||
// {
|
||||
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
// Console.WriteLine($"{TAG}OnUVCSelectSize:{device}");
|
||||
// Debug.Log($"{TAG}OnUVCSelectSize:{device}");
|
||||
//#endif
|
||||
// if (device.IsTHETA_V || device.IsTHETA_Z1)
|
||||
// {
|
||||
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
// Console.WriteLine($"{TAG}OnUVCSelectSize:THETA V/Z1");
|
||||
// Debug.Log($"{TAG}OnUVCSelectSize:THETA V/Z1");
|
||||
//#endif
|
||||
// return FindSize(formats, 3840, 1920);
|
||||
// }
|
||||
// else if (device.IsTHETA_S)
|
||||
// {
|
||||
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
// Console.WriteLine($"{TAG}OnUVCSelectSize:THETA S");
|
||||
// Debug.Log($"{TAG}OnUVCSelectSize:THETA S");
|
||||
//#endif
|
||||
// return FindSize(formats, 1920, 1080);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
//#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
// Console.WriteLine($"{TAG}OnUVCSelectSize:other UVC device,{device}");
|
||||
// Debug.Log($"{TAG}OnUVCSelectSize:other UVC device,{device}");
|
||||
//#endif
|
||||
// return formats.Find(DefaultWidth, DefaultHeight);
|
||||
// }
|
||||
|
@ -172,7 +172,7 @@ namespace Serenegiant.UVC
|
|||
public void OnUVCStartEvent(UVCManager manager, UVCDevice device, Texture tex)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnUVCStartEvent:{device}");
|
||||
Debug.Log($"{TAG}OnUVCStartEvent:{device}");
|
||||
#endif
|
||||
HandleOnStartPreview(tex);
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ namespace Serenegiant.UVC
|
|||
public void OnUVCStopEvent(UVCManager manager, UVCDevice device)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}OnUVCStopEvent:{device}");
|
||||
Debug.Log($"{TAG}OnUVCStopEvent:{device}");
|
||||
#endif
|
||||
HandleOnStopPreview();
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ namespace Serenegiant.UVC
|
|||
found = true;
|
||||
}
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}UpdateTarget:material={material}");
|
||||
Debug.Log($"{TAG}UpdateTarget:material={material}");
|
||||
#endif
|
||||
}
|
||||
i++;
|
||||
|
@ -313,7 +313,7 @@ namespace Serenegiant.UVC
|
|||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine($"{TAG}RestoreTexture:Exception cought");
|
||||
Debug.Log($"{TAG}RestoreTexture:Exception cought");
|
||||
}
|
||||
SavedTextures[i] = null;
|
||||
quaternions[i] = Quaternion.identity;
|
||||
|
@ -335,7 +335,7 @@ namespace Serenegiant.UVC
|
|||
private void HandleOnStartPreview(Texture tex)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}HandleOnStartPreview:({tex})");
|
||||
Debug.Log($"{TAG}HandleOnStartPreview:({tex})");
|
||||
#endif
|
||||
int i = 0;
|
||||
foreach (var target in TargetMaterials)
|
||||
|
@ -343,7 +343,7 @@ namespace Serenegiant.UVC
|
|||
if (target is Material)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}HandleOnStartPreview:assign Texture to Material({target})");
|
||||
Debug.Log($"{TAG}HandleOnStartPreview:assign Texture to Material({target})");
|
||||
#endif
|
||||
SavedTextures[i++] = (target as Material).mainTexture;
|
||||
(target as Material).mainTexture = tex;
|
||||
|
@ -351,7 +351,7 @@ namespace Serenegiant.UVC
|
|||
else if (target is RawImage)
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}HandleOnStartPreview:assign Texture to RawImage({target})");
|
||||
Debug.Log($"{TAG}HandleOnStartPreview:assign Texture to RawImage({target})");
|
||||
#endif
|
||||
SavedTextures[i++] = (target as RawImage).texture;
|
||||
(target as RawImage).texture = tex;
|
||||
|
@ -365,12 +365,12 @@ namespace Serenegiant.UVC
|
|||
private void HandleOnStopPreview()
|
||||
{
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}HandleOnStopPreview:");
|
||||
Debug.Log($"{TAG}HandleOnStopPreview:");
|
||||
#endif
|
||||
// 描画先のテクスチャをもとに戻す
|
||||
RestoreTexture();
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}HandleOnStopPreview:finished");
|
||||
Debug.Log($"{TAG}HandleOnStopPreview:finished");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace Serenegiant.UVC
|
|||
}
|
||||
|
||||
#if (!NDEBUG && DEBUG && ENABLE_LOG)
|
||||
Console.WriteLine($"{TAG}Match({device}):result={result}");
|
||||
Debug.Log($"{TAG}Match({device}):result={result}");
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue