From b25430d68f4963940b6f79c5e7209e2a8f1bd6d6 Mon Sep 17 00:00:00 2001 From: Junrou Nishida Date: Fri, 8 Apr 2022 12:07:40 +0900 Subject: [PATCH] feat(sample): Pose Segmentation Mask (#520) * feat(sample): Pose Segmentation Mask * clear MaskAnnotation * use UnmaskShader --- .../HairSegmentationSolution.cs | 2 +- .../Pose Tracking Config Window.prefab | 1048 ++++++++++++++++- .../Scenes/Pose Tracking/Pose Tracking.unity | 173 ++- .../Pose Tracking/PoseTrackingConfig.cs | 32 + .../Scenes/Pose Tracking/PoseTrackingGraph.cs | 48 +- .../Pose Tracking/PoseTrackingSolution.cs | 28 +- .../Pose Tracking/pose_tracking_cpu.txt | 12 + .../Pose Tracking/pose_tracking_gpu.txt | 18 + .../Pose Tracking/pose_tracking_opengles.txt | 18 + .../Runtime/Objects/Mask Annotation.prefab | 7 +- .../Unity/Annotation/MaskAnnotation.cs | 50 +- .../Annotation/MaskAnnotationController.cs | 14 +- .../Runtime/Shaders/MaskShader.shader | 6 +- .../Runtime/Shaders/UnmaskShader.shader | 75 ++ .../Runtime/Shaders/UnmaskShader.shader.meta | 10 + 15 files changed, 1472 insertions(+), 69 deletions(-) create mode 100644 Packages/com.github.homuler.mediapipe/Runtime/Shaders/UnmaskShader.shader create mode 100644 Packages/com.github.homuler.mediapipe/Runtime/Shaders/UnmaskShader.shader.meta diff --git a/Assets/Mediapipe/Samples/Scenes/Hair Segmentation/HairSegmentationSolution.cs b/Assets/Mediapipe/Samples/Scenes/Hair Segmentation/HairSegmentationSolution.cs index b5d0f36c3..517989cce 100644 --- a/Assets/Mediapipe/Samples/Scenes/Hair Segmentation/HairSegmentationSolution.cs +++ b/Assets/Mediapipe/Samples/Scenes/Hair Segmentation/HairSegmentationSolution.cs @@ -21,7 +21,7 @@ protected override void OnStartRun() } SetupAnnotationController(_hairMaskAnnotationController, ImageSourceProvider.ImageSource); - _hairMaskAnnotationController.InitScreen(); + _hairMaskAnnotationController.InitScreen(512, 512); } protected override void AddTextureFrameToInputStream(TextureFrame textureFrame) diff --git a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/Pose Tracking Config Window.prefab b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/Pose Tracking Config Window.prefab index c67cb7c7c..e68ae7eac 100644 --- a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/Pose Tracking Config Window.prefab +++ b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/Pose Tracking Config Window.prefab @@ -707,6 +707,85 @@ MonoBehaviour: m_FlexibleWidth: 3 m_FlexibleHeight: -1 m_LayoutPriority: 1 +--- !u!1 &793513799547784342 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3837826705222396049} + - component: {fileID: 1178834386472419073} + - component: {fileID: 6254998617246818098} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3837826705222396049 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793513799547784342} + 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_Children: [] + m_Father: {fileID: 2870123806596001561} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1178834386472419073 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793513799547784342} + m_CullTransparentMesh: 1 +--- !u!114 &6254998617246818098 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793513799547784342} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 48 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 4 + m_MaxSize: 49 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: --- !u!1 &851359627644512490 GameObject: m_ObjectHideFlags: 0 @@ -1026,6 +1105,81 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1284386421812300328 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2006694631643175907} + - component: {fileID: 4245149630363313191} + - component: {fileID: 726752060595092164} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2006694631643175907 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1284386421812300328} + 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_Children: [] + m_Father: {fileID: 7428417509725373781} + m_RootOrder: 0 + 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: 64, y: 64} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4245149630363313191 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1284386421812300328} + m_CullTransparentMesh: 1 +--- !u!114 &726752060595092164 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1284386421812300328} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1 &1405683704952349807 GameObject: m_ObjectHideFlags: 0 @@ -1062,6 +1216,70 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: -20, y: -20} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1485668633319082834 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1638179762460407866} + - component: {fileID: 7415792135625936444} + m_Layer: 5 + m_Name: Smooth Segmentation + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1638179762460407866 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1485668633319082834} + 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_Children: + - {fileID: 2630794135778193553} + - {fileID: 3197614242989506035} + m_Father: {fileID: 7710130227850707868} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 1} +--- !u!114 &7415792135625936444 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1485668633319082834} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 24 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 3 + m_Spacing: 12 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!1 &1786383440610970579 GameObject: m_ObjectHideFlags: 0 @@ -1162,6 +1380,70 @@ MonoBehaviour: m_FlexibleWidth: 1 m_FlexibleHeight: -1 m_LayoutPriority: 1 +--- !u!1 &2251518035562831902 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7854262509834770875} + - component: {fileID: 9184387609937853310} + m_Layer: 5 + m_Name: Enable Segmentation + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7854262509834770875 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2251518035562831902} + 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_Children: + - {fileID: 7857229223289796941} + - {fileID: 2870123806596001561} + m_Father: {fileID: 7710130227850707868} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 1} +--- !u!114 &9184387609937853310 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2251518035562831902} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 24 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 3 + m_Spacing: 12 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!1 &2358664826247471437 GameObject: m_ObjectHideFlags: 0 @@ -2055,6 +2337,8 @@ RectTransform: - {fileID: 9098513968449949306} - {fileID: 6917543152734324474} - {fileID: 3528492529737658842} + - {fileID: 7854262509834770875} + - {fileID: 1638179762460407866} - {fileID: 1423722328293772700} - {fileID: 2718284562621885215} m_Father: {fileID: 8898856628389366212} @@ -2519,7 +2803,7 @@ MonoBehaviour: m_FlexibleWidth: 1 m_FlexibleHeight: -1 m_LayoutPriority: 1 ---- !u!1 &4788457841076235524 +--- !u!1 &4631746942731033764 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -2527,37 +2811,112 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 6492489026626009949} - - component: {fileID: 2167416268599610135} - - component: {fileID: 8639848040556647798} + - component: {fileID: 3265981638520901545} + - component: {fileID: 8425054123941487891} + - component: {fileID: 5465574252431458758} m_Layer: 5 - m_Name: Placeholder + m_Name: Checkmark m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!224 &6492489026626009949 +--- !u!224 &3265981638520901545 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4788457841076235524} + m_GameObject: {fileID: 4631746942731033764} 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_Children: [] - m_Father: {fileID: 2963911586529893088} + m_Father: {fileID: 9121467548767493653} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.5} - m_SizeDelta: {x: -20, y: -13} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &2167416268599610135 -CanvasRenderer: + 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: 64, y: 64} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8425054123941487891 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4631746942731033764} + m_CullTransparentMesh: 1 +--- !u!114 &5465574252431458758 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4631746942731033764} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4788457841076235524 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6492489026626009949} + - component: {fileID: 2167416268599610135} + - component: {fileID: 8639848040556647798} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6492489026626009949 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4788457841076235524} + 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_Children: [] + m_Father: {fileID: 2963911586529893088} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2167416268599610135 +CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -2629,7 +2988,7 @@ RectTransform: - {fileID: 3301638211435279773} - {fileID: 2963911586529893088} m_Father: {fileID: 7710130227850707868} - m_RootOrder: 4 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -3037,6 +3396,189 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 64} m_Pivot: {x: 0.5, y: 1} +--- !u!1 &5803003972351256928 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9121467548767493653} + - component: {fileID: 7015283870712219809} + - component: {fileID: 6459245391341358818} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9121467548767493653 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5803003972351256928} + 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_Children: + - {fileID: 3265981638520901545} + m_Father: {fileID: 2870123806596001561} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 64, y: 64} + m_Pivot: {x: 0, y: 1} +--- !u!222 &7015283870712219809 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5803003972351256928} + m_CullTransparentMesh: 1 +--- !u!114 &6459245391341358818 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5803003972351256928} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &6119542294742646704 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3197614242989506035} + - component: {fileID: 7573897169112445300} + - component: {fileID: 8623520885660511341} + m_Layer: 5 + m_Name: Toggle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3197614242989506035 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6119542294742646704} + 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_Children: + - {fileID: 7428417509725373781} + - {fileID: 9181410591197573882} + m_Father: {fileID: 1638179762460407866} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 72} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &7573897169112445300 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6119542294742646704} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 4052439275713122803} + toggleTransition: 1 + graphic: {fileID: 726752060595092164} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!114 &8623520885660511341 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6119542294742646704} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: 800 + m_PreferredHeight: -1 + m_FlexibleWidth: 3 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1 &6414537821100621688 GameObject: m_ObjectHideFlags: 0 @@ -3220,6 +3762,106 @@ MonoBehaviour: m_OnValueChanged: m_PersistentCalls: m_Calls: [] +--- !u!1 &6531809957905788706 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7857229223289796941} + - component: {fileID: 1326277824324674486} + - component: {fileID: 4508084882490843677} + - component: {fileID: 8931571156528007294} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7857229223289796941 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6531809957905788706} + 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_Children: [] + m_Father: {fileID: 7854262509834770875} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 72} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1326277824324674486 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6531809957905788706} + m_CullTransparentMesh: 1 +--- !u!114 &4508084882490843677 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6531809957905788706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 48 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 4 + m_MaxSize: 300 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enable Segmentation +--- !u!114 &8931571156528007294 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6531809957905788706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: 800 + m_PreferredHeight: -1 + m_FlexibleWidth: 1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1 &6655745174104396485 GameObject: m_ObjectHideFlags: 0 @@ -3251,7 +3893,7 @@ RectTransform: - {fileID: 7368247365119313596} - {fileID: 916782750758033152} m_Father: {fileID: 7710130227850707868} - m_RootOrder: 3 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -3908,15 +4550,91 @@ CanvasRenderer: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7462530992637723136} + m_GameObject: {fileID: 7462530992637723136} + m_CullTransparentMesh: 1 +--- !u!114 &1467593554654482418 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7462530992637723136} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 10915, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &7513066068166773413 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7428417509725373781} + - component: {fileID: 7557865733597141836} + - component: {fileID: 4052439275713122803} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7428417509725373781 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7513066068166773413} + 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_Children: + - {fileID: 2006694631643175907} + m_Father: {fileID: 3197614242989506035} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 64, y: 64} + m_Pivot: {x: 0, y: 1} +--- !u!222 &7557865733597141836 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7513066068166773413} m_CullTransparentMesh: 1 ---- !u!114 &1467593554654482418 +--- !u!114 &4052439275713122803 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7462530992637723136} + m_GameObject: {fileID: 7513066068166773413} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} @@ -3930,8 +4648,8 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 10915, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 0 + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 1 m_FillMethod: 4 @@ -4066,6 +4784,106 @@ MonoBehaviour: m_OnValueChanged: m_PersistentCalls: m_Calls: [] +--- !u!1 &7904543109929930736 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2630794135778193553} + - component: {fileID: 961034969571658595} + - component: {fileID: 4401107124708804951} + - component: {fileID: 2133988033825875212} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2630794135778193553 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7904543109929930736} + 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_Children: [] + m_Father: {fileID: 1638179762460407866} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 72} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &961034969571658595 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7904543109929930736} + m_CullTransparentMesh: 1 +--- !u!114 &4401107124708804951 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7904543109929930736} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 48 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 4 + m_MaxSize: 300 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Smooth Segmentation +--- !u!114 &2133988033825875212 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7904543109929930736} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: 800 + m_PreferredHeight: -1 + m_FlexibleWidth: 1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1 &8014084491893522992 GameObject: m_ObjectHideFlags: 0 @@ -4467,6 +5285,113 @@ MonoBehaviour: m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Pose Tracking Configuration +--- !u!1 &8633000943220407408 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2870123806596001561} + - component: {fileID: 4783642844950261202} + - component: {fileID: 1989723617351511131} + m_Layer: 5 + m_Name: Toggle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2870123806596001561 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8633000943220407408} + 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_Children: + - {fileID: 9121467548767493653} + - {fileID: 3837826705222396049} + m_Father: {fileID: 7854262509834770875} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 72} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &4783642844950261202 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8633000943220407408} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 6459245391341358818} + toggleTransition: 1 + graphic: {fileID: 5465574252431458758} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!114 &1989723617351511131 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8633000943220407408} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: 800 + m_PreferredHeight: -1 + m_FlexibleWidth: 3 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1 &8932836335194391051 GameObject: m_ObjectHideFlags: 0 @@ -4812,3 +5737,82 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: 1 m_LayoutPriority: 1 +--- !u!1 &9185152604027726580 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9181410591197573882} + - component: {fileID: 2822863369976895836} + - component: {fileID: 5210657814924477117} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9181410591197573882 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9185152604027726580} + 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_Children: [] + m_Father: {fileID: 3197614242989506035} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2822863369976895836 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9185152604027726580} + m_CullTransparentMesh: 1 +--- !u!114 &5210657814924477117 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9185152604027726580} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 48 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 4 + m_MaxSize: 49 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: diff --git a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/Pose Tracking.unity b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/Pose Tracking.unity index 3ddf61688..83809b5c1 100644 --- a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/Pose Tracking.unity +++ b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/Pose Tracking.unity @@ -415,18 +415,8 @@ MonoBehaviour: _timeoutMicrosec: 50000 modelComplexity: 1 smoothLandmarks: 1 - OnPoseDetectionOutput: - m_PersistentCalls: - m_Calls: [] - OnPoseLandmarksOutput: - m_PersistentCalls: - m_Calls: [] - OnPoseWorldLandmarksOutput: - m_PersistentCalls: - m_Calls: [] - OnRoiFromLandmarksOutput: - m_PersistentCalls: - m_Calls: [] + enableSegmentation: 1 + smoothSegmentation: 1 --- !u!114 &275874969 MonoBehaviour: m_ObjectHideFlags: 0 @@ -447,6 +437,7 @@ MonoBehaviour: _poseDetectionAnnotationController: {fileID: 1889892130} _poseLandmarksAnnotationController: {fileID: 1889892131} _poseWorldLandmarksAnnotationController: {fileID: 1936307555} + _segmentationMaskAnnotationController: {fileID: 1889892135} _roiFromLandmarksAnnotationController: {fileID: 1889892133} --- !u!114 &275874970 MonoBehaviour: @@ -1526,7 +1517,7 @@ PrefabInstance: - target: {fileID: 4965192403804369240, guid: 3b696480602fe21de85315216956bd42, type: 3} propertyPath: m_RootOrder - value: 2 + value: 3 objectReference: {fileID: 0} - target: {fileID: 4965192403804369240, guid: 3b696480602fe21de85315216956bd42, type: 3} @@ -2323,6 +2314,31 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: annotation: {fileID: 1286974200} +--- !u!114 &1889892134 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3259285889726014649, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + m_PrefabInstance: {fileID: 1889892127} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1889892135 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1889892129} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ece564ad16755f1ef94c4fe04bd7ce2e, type: 3} + m_Name: + m_EditorClassIdentifier: + annotation: {fileID: 2100215833} --- !u!1 &1936307553 GameObject: m_ObjectHideFlags: 0 @@ -2661,3 +2677,134 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2090815820} m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1001 &2100215832 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1889892128} + m_Modifications: + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347896, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1416249681263347897, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: m_Name + value: Mask Annotation + objectReference: {fileID: 0} + - target: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: _screen + value: + objectReference: {fileID: 1889892134} + - target: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: _color.a + value: 0.49803922 + objectReference: {fileID: 0} + - target: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: _color.b + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: _color.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: _color.r + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: _reverse + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: _threshold + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: _maskShader + value: + objectReference: {fileID: 4800000, guid: d684c6d125278d05fbb1904ee5103f3a, type: 3} + - target: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: _maxConfidence + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + propertyPath: _minConfidence + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 24d349d9c78db0f3d94d4657029f4c5e, type: 3} +--- !u!114 &2100215833 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 5850198979010014858, guid: 24d349d9c78db0f3d94d4657029f4c5e, + type: 3} + m_PrefabInstance: {fileID: 2100215832} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f993d16dcccfcecb6892ad3cc2ea76c8, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingConfig.cs b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingConfig.cs index 5083803ea..9fdfc2fc3 100644 --- a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingConfig.cs +++ b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingConfig.cs @@ -16,12 +16,16 @@ public class PoseTrackingConfig : ModalContents { private const string _ModelComplexityPath = "Scroll View/Viewport/Contents/Model Complexity/Dropdown"; private const string _SmoothLandmarksPath = "Scroll View/Viewport/Contents/Smooth Landmarks/Toggle"; + private const string _EnableSegmentationPath = "Scroll View/Viewport/Contents/Enable Segmentation/Toggle"; + private const string _SmoothSegmentationPath = "Scroll View/Viewport/Contents/Smooth Segmentation/Toggle"; private const string _RunningModePath = "Scroll View/Viewport/Contents/Running Mode/Dropdown"; private const string _TimeoutMillisecPath = "Scroll View/Viewport/Contents/Timeout Millisec/InputField"; private PoseTrackingSolution _solution; private Dropdown _modelComplexityInput; private Toggle _smoothLandmarksInput; + private Toggle _enableSegmentationInput; + private Toggle _smoothSegmentationInput; private Dropdown _runningModeInput; private InputField _timeoutMillisecInput; @@ -50,6 +54,18 @@ public void ToggleSmoothLandmarks() _isChanged = true; } + public void ToggleEnableSegmentation() + { + _solution.enableSegmentation = _enableSegmentationInput.isOn; + _isChanged = true; + } + + public void ToggleSmoothSegmentation() + { + _solution.smoothSegmentation = _smoothSegmentationInput.isOn; + _isChanged = true; + } + public void SwitchRunningMode() { _solution.runningMode = (RunningMode)_runningModeInput.value; @@ -69,6 +85,8 @@ private void InitializeContents() { InitializeModelComplexity(); InitializeSmoothLandmarksInput(); + InitializeEnableSegmentationInput(); + InitializeSmoothSegmentationInput(); InitializeRunningMode(); InitializeTimeoutMillisec(); } @@ -99,6 +117,20 @@ private void InitializeSmoothLandmarksInput() _smoothLandmarksInput.onValueChanged.AddListener(delegate { ToggleSmoothLandmarks(); }); } + private void InitializeEnableSegmentationInput() + { + _enableSegmentationInput = gameObject.transform.Find(_EnableSegmentationPath).gameObject.GetComponent(); + _enableSegmentationInput.isOn = _solution.enableSegmentation; + _enableSegmentationInput.onValueChanged.AddListener(delegate { ToggleEnableSegmentation(); }); + } + + private void InitializeSmoothSegmentationInput() + { + _smoothSegmentationInput = gameObject.transform.Find(_SmoothSegmentationPath).gameObject.GetComponent(); + _smoothSegmentationInput.isOn = _solution.smoothSegmentation; + _smoothSegmentationInput.onValueChanged.AddListener(delegate { ToggleSmoothSegmentation(); }); + } + private void InitializeRunningMode() { _runningModeInput = gameObject.transform.Find(_RunningModePath).gameObject.GetComponent(); diff --git a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingGraph.cs b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingGraph.cs index 4d7094811..a35d09efb 100644 --- a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingGraph.cs +++ b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingGraph.cs @@ -24,6 +24,8 @@ public enum ModelComplexity public ModelComplexity modelComplexity = ModelComplexity.Full; public bool smoothLandmarks = true; + public bool enableSegmentation = true; + public bool smoothSegmentation = true; private float _minDetectionConfidence = 0.5f; public float minDetectionConfidence @@ -57,6 +59,12 @@ public event EventHandler> OnPoseWorldLandmarksOut remove => _poseWorldLandmarksStream.RemoveListener(value); } + public event EventHandler> OnSegmentationMaskOutput + { + add => _segmentationMaskStream.AddListener(value); + remove => _segmentationMaskStream.RemoveListener(value); + } + public event EventHandler> OnRoiFromLandmarksOutput { add => _roiFromLandmarksStream.AddListener(value); @@ -67,11 +75,13 @@ public event EventHandler> OnRoiFromLandmarksOut private const string _PoseDetectionStreamName = "pose_detection"; private const string _PoseLandmarksStreamName = "pose_landmarks"; private const string _PoseWorldLandmarksStreamName = "pose_world_landmarks"; + private const string _SegmentationMaskStreamName = "segmentation_mask"; private const string _RoiFromLandmarksStreamName = "roi_from_landmarks"; private OutputStream _poseDetectionStream; private OutputStream _poseLandmarksStream; private OutputStream _poseWorldLandmarksStream; + private OutputStream _segmentationMaskStream; private OutputStream _roiFromLandmarksStream; public override void StartRun(ImageSource imageSource) @@ -81,6 +91,7 @@ public override void StartRun(ImageSource imageSource) _poseDetectionStream.StartPolling().AssertOk(); _poseLandmarksStream.StartPolling().AssertOk(); _poseWorldLandmarksStream.StartPolling().AssertOk(); + _segmentationMaskStream.StartPolling().AssertOk(); _roiFromLandmarksStream.StartPolling().AssertOk(); } StartRun(BuildSidePacket(imageSource)); @@ -94,6 +105,8 @@ public override void Stop() _poseLandmarksStream = null; _poseWorldLandmarksStream.RemoveAllListeners(); _poseWorldLandmarksStream = null; + _segmentationMaskStream.RemoveAllListeners(); + _segmentationMaskStream = null; _roiFromLandmarksStream.RemoveAllListeners(); _roiFromLandmarksStream = null; base.Stop(); @@ -104,15 +117,16 @@ public void AddTextureFrameToInputStream(TextureFrame textureFrame) AddTextureFrameToInputStream(_InputStreamName, textureFrame); } - public bool TryGetNext(out Detection poseDetection, out NormalizedLandmarkList poseLandmarks, out LandmarkList poseWorldLandmarks, out NormalizedRect roiFromLandmarks, bool allowBlock = true) + public bool TryGetNext(out Detection poseDetection, out NormalizedLandmarkList poseLandmarks, out LandmarkList poseWorldLandmarks, out ImageFrame segmentationMask, out NormalizedRect roiFromLandmarks, bool allowBlock = true) { var currentTimestampMicrosec = GetCurrentTimestampMicrosec(); var r1 = TryGetNext(_poseDetectionStream, out poseDetection, allowBlock, currentTimestampMicrosec); var r2 = TryGetNext(_poseLandmarksStream, out poseLandmarks, allowBlock, currentTimestampMicrosec); var r3 = TryGetNext(_poseWorldLandmarksStream, out poseWorldLandmarks, allowBlock, currentTimestampMicrosec); - var r4 = TryGetNext(_roiFromLandmarksStream, out roiFromLandmarks, allowBlock, currentTimestampMicrosec); + var r4 = TryGetNext(_segmentationMaskStream, out segmentationMask, allowBlock, currentTimestampMicrosec); + var r5 = TryGetNext(_roiFromLandmarksStream, out roiFromLandmarks, allowBlock, currentTimestampMicrosec); - return r1 || r2 || r3 || r4; + return r1 || r2 || r3 || r4 || r5; } protected override IList RequestDependentAssets() @@ -133,6 +147,8 @@ protected override Status ConfigureCalculatorGraph(CalculatorGraphConfig config) calculatorGraph, _PoseLandmarksStreamName, config.AddPacketPresenceCalculator(_PoseLandmarksStreamName), timeoutMicrosec); _poseWorldLandmarksStream = new OutputStream( calculatorGraph, _PoseWorldLandmarksStreamName, config.AddPacketPresenceCalculator(_PoseWorldLandmarksStreamName), timeoutMicrosec); + _segmentationMaskStream = new OutputStream( + calculatorGraph, _SegmentationMaskStreamName, config.AddPacketPresenceCalculator(_SegmentationMaskStreamName), timeoutMicrosec); _roiFromLandmarksStream = new OutputStream( calculatorGraph, _RoiFromLandmarksStreamName, config.AddPacketPresenceCalculator(_RoiFromLandmarksStreamName), timeoutMicrosec); } @@ -141,6 +157,7 @@ protected override Status ConfigureCalculatorGraph(CalculatorGraphConfig config) _poseDetectionStream = new OutputStream(calculatorGraph, _PoseDetectionStreamName, true, timeoutMicrosec); _poseLandmarksStream = new OutputStream(calculatorGraph, _PoseLandmarksStreamName, true, timeoutMicrosec); _poseWorldLandmarksStream = new OutputStream(calculatorGraph, _PoseWorldLandmarksStreamName, true, timeoutMicrosec); + _segmentationMaskStream = new OutputStream(calculatorGraph, _SegmentationMaskStreamName, true, timeoutMicrosec); _roiFromLandmarksStream = new OutputStream(calculatorGraph, _RoiFromLandmarksStreamName, true, timeoutMicrosec); } @@ -194,11 +211,36 @@ private SidePacket BuildSidePacket(ImageSource imageSource) var sidePacket = new SidePacket(); SetImageTransformationOptions(sidePacket, imageSource); + + // TODO: refactoring + // The orientation of the output image must match that of the input image. + var isInverted = CoordinateSystem.ImageCoordinate.IsInverted(imageSource.rotation); + var outputRotation = imageSource.rotation; + var outputHorizontallyFlipped = !isInverted && imageSource.isHorizontallyFlipped; + var outputVerticallyFlipped = (!runningMode.IsSynchronous() && imageSource.isVerticallyFlipped) ^ (isInverted && imageSource.isHorizontallyFlipped); + + if ((outputHorizontallyFlipped && outputVerticallyFlipped) || outputRotation == RotationAngle.Rotation180) + { + outputRotation = outputRotation.Add(RotationAngle.Rotation180); + outputHorizontallyFlipped = !outputHorizontallyFlipped; + outputVerticallyFlipped = !outputVerticallyFlipped; + } + + sidePacket.Emplace("output_rotation", new IntPacket((int)outputRotation)); + sidePacket.Emplace("output_horizontally_flipped", new BoolPacket(outputHorizontallyFlipped)); + sidePacket.Emplace("output_vertically_flipped", new BoolPacket(outputVerticallyFlipped)); + + Logger.LogDebug($"output_rotation = {outputRotation}, output_horizontally_flipped = {outputHorizontallyFlipped}, output_vertically_flipped = {outputVerticallyFlipped}"); + sidePacket.Emplace("model_complexity", new IntPacket((int)modelComplexity)); sidePacket.Emplace("smooth_landmarks", new BoolPacket(smoothLandmarks)); + sidePacket.Emplace("enable_segmentation", new BoolPacket(enableSegmentation)); + sidePacket.Emplace("smooth_segmentation", new BoolPacket(smoothSegmentation)); Logger.LogInfo(TAG, $"Model Complexity = {modelComplexity}"); Logger.LogInfo(TAG, $"Smooth Landmarks = {smoothLandmarks}"); + Logger.LogInfo(TAG, $"Enable Segmentation = {enableSegmentation}"); + Logger.LogInfo(TAG, $"Smooth Segmentation = {smoothSegmentation}"); return sidePacket; } diff --git a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingSolution.cs b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingSolution.cs index 59e0d4c81..9e5f873c1 100644 --- a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingSolution.cs +++ b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/PoseTrackingSolution.cs @@ -15,9 +15,9 @@ public class PoseTrackingSolution : ImageSourceSolution [SerializeField] private DetectionAnnotationController _poseDetectionAnnotationController; [SerializeField] private PoseLandmarkListAnnotationController _poseLandmarksAnnotationController; [SerializeField] private PoseWorldLandmarkListAnnotationController _poseWorldLandmarksAnnotationController; + [SerializeField] private MaskAnnotationController _segmentationMaskAnnotationController; [SerializeField] private NormalizedRectAnnotationController _roiFromLandmarksAnnotationController; - public PoseTrackingGraph.ModelComplexity modelComplexity { get => graphRunner.modelComplexity; @@ -30,6 +30,18 @@ public bool smoothLandmarks set => graphRunner.smoothLandmarks = value; } + public bool enableSegmentation + { + get => graphRunner.enableSegmentation; + set => graphRunner.enableSegmentation = value; + } + + public bool smoothSegmentation + { + get => graphRunner.smoothSegmentation; + set => graphRunner.smoothSegmentation = value; + } + protected override void SetupScreen(ImageSource imageSource) { base.SetupScreen(imageSource); @@ -43,6 +55,7 @@ protected override void OnStartRun() graphRunner.OnPoseDetectionOutput += OnPoseDetectionOutput; graphRunner.OnPoseLandmarksOutput += OnPoseLandmarksOutput; graphRunner.OnPoseWorldLandmarksOutput += OnPoseWorldLandmarksOutput; + graphRunner.OnSegmentationMaskOutput += OnSegmentationMaskOutput; graphRunner.OnRoiFromLandmarksOutput += OnRoiFromLandmarksOutput; } @@ -50,6 +63,8 @@ protected override void OnStartRun() SetupAnnotationController(_poseDetectionAnnotationController, imageSource); SetupAnnotationController(_poseLandmarksAnnotationController, imageSource); SetupAnnotationController(_poseWorldLandmarksAnnotationController, imageSource); + SetupAnnotationController(_segmentationMaskAnnotationController, imageSource); + _segmentationMaskAnnotationController.InitScreen(imageSource.textureWidth, imageSource.textureHeight); SetupAnnotationController(_roiFromLandmarksAnnotationController, imageSource); } @@ -63,20 +78,22 @@ protected override IEnumerator WaitForNextValue() Detection poseDetection = null; NormalizedLandmarkList poseLandmarks = null; LandmarkList poseWorldLandmarks = null; + ImageFrame segmentationMask = null; NormalizedRect roiFromLandmarks = null; if (runningMode == RunningMode.Sync) { - var _ = graphRunner.TryGetNext(out poseDetection, out poseLandmarks, out poseWorldLandmarks, out roiFromLandmarks, true); + var _ = graphRunner.TryGetNext(out poseDetection, out poseLandmarks, out poseWorldLandmarks, out segmentationMask, out roiFromLandmarks, true); } else if (runningMode == RunningMode.NonBlockingSync) { - yield return new WaitUntil(() => graphRunner.TryGetNext(out poseDetection, out poseLandmarks, out poseWorldLandmarks, out roiFromLandmarks, false)); + yield return new WaitUntil(() => graphRunner.TryGetNext(out poseDetection, out poseLandmarks, out poseWorldLandmarks, out segmentationMask, out roiFromLandmarks, false)); } _poseDetectionAnnotationController.DrawNow(poseDetection); _poseLandmarksAnnotationController.DrawNow(poseLandmarks); _poseWorldLandmarksAnnotationController.DrawNow(poseWorldLandmarks); + _segmentationMaskAnnotationController.DrawNow(segmentationMask); _roiFromLandmarksAnnotationController.DrawNow(roiFromLandmarks); } @@ -95,6 +112,11 @@ private void OnPoseWorldLandmarksOutput(object stream, OutputEventArgs eventArgs) + { + _segmentationMaskAnnotationController.DrawLater(eventArgs.value); + } + private void OnRoiFromLandmarksOutput(object stream, OutputEventArgs eventArgs) { _roiFromLandmarksAnnotationController.DrawLater(eventArgs.value); diff --git a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_cpu.txt b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_cpu.txt index 5f0c14340..a6b0325e1 100644 --- a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_cpu.txt +++ b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_cpu.txt @@ -63,8 +63,20 @@ node { input_stream: "IMAGE:transformed_input_video" input_side_packet: "MODEL_COMPLEXITY:model_complexity" input_side_packet: "SMOOTH_LANDMARKS:smooth_landmarks" + input_side_packet: "ENABLE_SEGMENTATION:enable_segmentation" + input_side_packet: "SMOOTH_SEGMENTATION:smooth_segmentation" output_stream: "LANDMARKS:pose_landmarks" output_stream: "WORLD_LANDMARKS:pose_world_landmarks" + output_stream: "SEGMENTATION_MASK:segmentation_mask_rotated" output_stream: "DETECTION:pose_detection" output_stream: "ROI_FROM_LANDMARKS:roi_from_landmarks" } + +node: { + calculator: "ImageTransformationCalculator" + input_stream: "IMAGE:segmentation_mask_rotated" + input_side_packet: "ROTATION_DEGREES:output_rotation" + input_side_packet: "FLIP_HORIZONTALLY:output_horizontally_flipped" + input_side_packet: "FLIP_VERTICALLY:output_vertically_flipped" + output_stream: "IMAGE:segmentation_mask" +} diff --git a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_gpu.txt b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_gpu.txt index 5b76a30c8..49feec757 100644 --- a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_gpu.txt +++ b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_gpu.txt @@ -70,8 +70,26 @@ node { input_stream: "IMAGE:transformed_input_video" input_side_packet: "MODEL_COMPLEXITY:model_complexity" input_side_packet: "SMOOTH_LANDMARKS:smooth_landmarks" + input_side_packet: "ENABLE_SEGMENTATION:enable_segmentation" + input_side_packet: "SMOOTH_SEGMENTATION:smooth_segmentation" output_stream: "LANDMARKS:pose_landmarks" output_stream: "WORLD_LANDMARKS:pose_world_landmarks" + output_stream: "SEGMENTATION_MASK:segmentation_mask_gpu" output_stream: "DETECTION:pose_detection" output_stream: "ROI_FROM_LANDMARKS:roi_from_landmarks" } + +node: { + calculator: "ImageTransformationCalculator" + input_stream: "IMAGE_GPU:segmentation_mask_gpu" + input_side_packet: "ROTATION_DEGREES:output_rotation" + input_side_packet: "FLIP_HORIZONTALLY:output_horizontally_flipped" + input_side_packet: "FLIP_VERTICALLY:output_vertically_flipped" + output_stream: "IMAGE_GPU:segmentation_mask_unrotated_gpu" +} + +node: { + calculator: "GpuBufferToImageFrameCalculator" + input_stream: "segmentation_mask_unrotated_gpu" + output_stream: "segmentation_mask" +} diff --git a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_opengles.txt b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_opengles.txt index a7a05d673..98422981d 100644 --- a/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_opengles.txt +++ b/Assets/Mediapipe/Samples/Scenes/Pose Tracking/pose_tracking_opengles.txt @@ -63,8 +63,26 @@ node { input_stream: "IMAGE:transformed_input_video" input_side_packet: "MODEL_COMPLEXITY:model_complexity" input_side_packet: "SMOOTH_LANDMARKS:smooth_landmarks" + input_side_packet: "ENABLE_SEGMENTATION:enable_segmentation" + input_side_packet: "SMOOTH_SEGMENTATION:smooth_segmentation" output_stream: "LANDMARKS:pose_landmarks" output_stream: "WORLD_LANDMARKS:pose_world_landmarks" + output_stream: "SEGMENTATION_MASK:segmentation_mask_gpu" output_stream: "DETECTION:pose_detection" output_stream: "ROI_FROM_LANDMARKS:roi_from_landmarks" } + +node: { + calculator: "ImageTransformationCalculator" + input_stream: "IMAGE_GPU:segmentation_mask_gpu" + input_side_packet: "ROTATION_DEGREES:output_rotation" + input_side_packet: "FLIP_HORIZONTALLY:output_horizontally_flipped" + input_side_packet: "FLIP_VERTICALLY:output_vertically_flipped" + output_stream: "IMAGE_GPU:segmentation_mask_unrotated_gpu" +} + +node: { + calculator: "GpuBufferToImageFrameCalculator" + input_stream: "segmentation_mask_unrotated_gpu" + output_stream: "segmentation_mask" +} diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Objects/Mask Annotation.prefab b/Packages/com.github.homuler.mediapipe/Runtime/Objects/Mask Annotation.prefab index 8cf913ef4..063d2c538 100644 --- a/Packages/com.github.homuler.mediapipe/Runtime/Objects/Mask Annotation.prefab +++ b/Packages/com.github.homuler.mediapipe/Runtime/Objects/Mask Annotation.prefab @@ -43,5 +43,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f993d16dcccfcecb6892ad3cc2ea76c8, type: 3} m_Name: m_EditorClassIdentifier: - screen: {fileID: 0} - color: {r: 0, g: 0, b: 1, a: 1} + _screen: {fileID: 0} + _maskShader: {fileID: 0} + _maskTexture: {fileID: 0} + _color: {r: 0, g: 0, b: 1, a: 1} + _threshold: 0.9 diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Annotation/MaskAnnotation.cs b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Annotation/MaskAnnotation.cs index cececef97..7ddb281a6 100644 --- a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Annotation/MaskAnnotation.cs +++ b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Annotation/MaskAnnotation.cs @@ -22,26 +22,30 @@ public class MaskAnnotation : HierarchicalAnnotation [SerializeField] private Shader _maskShader; [SerializeField] private Texture2D _maskTexture; [SerializeField] private Color _color = Color.blue; - [SerializeField, Range(0, 1)] private float _minConfidence = 0.9f; + [SerializeField, Range(0, 1)] private float _threshold = 0.9f; + private Material _prevMaterial; private Material _material; private GraphicsBuffer _maskBuffer; private void OnEnable() { ApplyMaskTexture(_maskTexture, _color); - ApplyMinConfidence(_minConfidence); + ApplyThreshold(_threshold); } private void OnDisable() { - ApplyMinConfidence(1.1f); // larger than the maximum value (1.0). + if (_prevMaterial != null) + { + ApplyMaterial(_prevMaterial); + } } private void OnValidate() { ApplyMaskTexture(_maskTexture, _color); - ApplyMinConfidence(_minConfidence); + ApplyThreshold(_threshold); } private void OnDestroy() @@ -52,10 +56,8 @@ private void OnDestroy() } } - public void InitScreen(int width, int height) + public void Init(int width, int height) { - _screen.color = new Color(1, 1, 1, 1); - _material = new Material(_maskShader) { renderQueue = (int)RenderQueue.Transparent @@ -65,26 +67,31 @@ public void InitScreen(int width, int height) ApplyMaskTexture(_maskTexture, _color); _material.SetInt("_Width", width); _material.SetInt("_Height", height); - ApplyMinConfidence(_minConfidence); + ApplyThreshold(_threshold); InitMaskBuffer(width, height); - - _screen.material = _material; } public void Draw(float[] mask, int width, int height) { + if (mask == null) + { + ApplyMaterial(_prevMaterial); + return; + } + if (mask.Length != width * height) { throw new ArgumentException("mask size must equal width * height"); } + ApplyMaterial(_material); _maskBuffer.SetData(mask); } private Texture2D CreateMonoColorTexture(Color color) { var texture = new Texture2D(1, 1, TextureFormat.RGBA32, false); - var textureColor = new Color32((byte)(255 * color.r), (byte)(255 * color.g), (byte)(255 * color.b), 255); + var textureColor = new Color32((byte)(255 * color.r), (byte)(255 * color.g), (byte)(255 * color.b), (byte)(255 * color.a)); texture.SetPixels32(new Color32[] { textureColor }); texture.Apply(); @@ -102,19 +109,32 @@ private void InitMaskBuffer(int width, int height) _material.SetBuffer("_MaskBuffer", _maskBuffer); } - private void ApplyMaskTexture(Texture maskTexture, Color color) + private void ApplyMaterial(Material material) + { + if (_prevMaterial == null) + { + // backup + _prevMaterial = _screen.material; + } + if (_screen.material != material) + { + _screen.material = material; + } + } + + private void ApplyMaskTexture(Texture maskTexture, Color maskColor) { if (_material != null) { - _material.SetTexture("_MaskTex", maskTexture == null ? CreateMonoColorTexture(color) : maskTexture); + _material.SetTexture("_MaskTex", maskTexture == null ? CreateMonoColorTexture(maskColor) : maskTexture); } } - private void ApplyMinConfidence(float minConfidence) + private void ApplyThreshold(float threshold) { if (_material != null) { - _material.SetFloat("_MinConfidence", minConfidence); + _material.SetFloat("_Threshold", threshold); } } } diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Annotation/MaskAnnotationController.cs b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Annotation/MaskAnnotationController.cs index 941b00cc3..c6e04b57b 100644 --- a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Annotation/MaskAnnotationController.cs +++ b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Annotation/MaskAnnotationController.cs @@ -4,22 +4,22 @@ // license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -using UnityEngine; - namespace Mediapipe.Unity { public class MaskAnnotationController : AnnotationController { - [SerializeField] private int _maskWidth = 512; - [SerializeField] private int _maskHeight = 512; + private int _maskWidth; + private int _maskHeight; private ImageFrame _currentTarget; private float[] _maskArray; - public void InitScreen() + public void InitScreen(int maskWidth, int maskHeight) { + _maskWidth = maskWidth; + _maskHeight = maskHeight; _maskArray = new float[_maskWidth * _maskHeight]; - annotation.InitScreen(_maskWidth, _maskHeight); + annotation.Init(_maskWidth, _maskHeight); } public void DrawNow(ImageFrame target) @@ -47,7 +47,7 @@ private void UpdateMaskArray(ImageFrame imageFrame) protected override void SyncNow() { isStale = false; - annotation.Draw(_maskArray, _maskWidth, _maskHeight); + annotation.Draw(_currentTarget == null ? null : _maskArray, _maskWidth, _maskHeight); } } } diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Shaders/MaskShader.shader b/Packages/com.github.homuler.mediapipe/Runtime/Shaders/MaskShader.shader index ad46ab16e..2ed63f52e 100644 --- a/Packages/com.github.homuler.mediapipe/Runtime/Shaders/MaskShader.shader +++ b/Packages/com.github.homuler.mediapipe/Runtime/Shaders/MaskShader.shader @@ -6,7 +6,7 @@ Shader "Unlit/MediaPipe/Mask Shader" _MaskTex ("Mask Texture", 2D) = "blue" {} _Width ("Mask Width", Int) = 0 _Height ("Mask Height", Int) = 0 - _MinConfidence ("Min Confidence", Range(0.0, 1.0)) = 0.9 + _Threshold ("Threshold", Range(0.0, 1.0)) = 0.9 } SubShader @@ -53,7 +53,7 @@ Shader "Unlit/MediaPipe/Mask Shader" int _Width; int _Height; - float _MinConfidence; + float _Threshold; uniform StructuredBuffer _MaskBuffer; fixed4 frag (v2f i) : SV_Target @@ -63,7 +63,7 @@ Shader "Unlit/MediaPipe/Mask Shader" fixed4 maskCol = tex2D(_MaskTex, i.uv); int idx = int(i.uv.y * _Height) * _Width + int(i.uv.x * _Width); float mask = _MaskBuffer[idx]; - fixed4 col = lerp(mainCol, lerp(mainCol, maskCol, mask), step(_MinConfidence, mask)); + fixed4 col = lerp(mainCol, lerp(mainCol, maskCol, mask), step(_Threshold, mask)); // apply fog UNITY_APPLY_FOG(i.fogCoord, col); diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Shaders/UnmaskShader.shader b/Packages/com.github.homuler.mediapipe/Runtime/Shaders/UnmaskShader.shader new file mode 100644 index 000000000..6c8dbe3c2 --- /dev/null +++ b/Packages/com.github.homuler.mediapipe/Runtime/Shaders/UnmaskShader.shader @@ -0,0 +1,75 @@ +Shader "Unlit/MediaPipe/Unmask Shader" +{ + Properties + { + _MainTex ("Main Texture", 2D) = "" {} + _MaskTex ("Mask Texture", 2D) = "blue" {} + _Width ("Mask Width", Int) = 0 + _Height ("Mask Height", Int) = 0 + _Threshold ("Threshold", Range(0.0, 1.0)) = 0.9 + } + + SubShader + { + Tags { "RenderType"="Transparent" } + LOD 100 + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + // make fog work + #pragma multi_compile_fog + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + UNITY_FOG_COORDS(1) + float4 vertex : SV_POSITION; + }; + + sampler2D _MainTex; + float4 _MainTex_ST; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + UNITY_TRANSFER_FOG(o,o.vertex); + return o; + } + + sampler2D _MaskTex; + + int _Width; + int _Height; + float _Threshold; + uniform StructuredBuffer _MaskBuffer; + + fixed4 frag (v2f i) : SV_Target + { + // sample the texture + fixed4 mainCol = tex2D(_MainTex, i.uv); + fixed4 maskCol = tex2D(_MaskTex, i.uv); + int idx = int(i.uv.y * _Height) * _Width + int(i.uv.x * _Width); + float mask = _MaskBuffer[idx]; + fixed4 col = lerp(maskCol, lerp(maskCol, mainCol, mask), step(_Threshold, mask)); + + // apply fog + UNITY_APPLY_FOG(i.fogCoord, col); + return col; + } + ENDCG + } + } +} diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Shaders/UnmaskShader.shader.meta b/Packages/com.github.homuler.mediapipe/Runtime/Shaders/UnmaskShader.shader.meta new file mode 100644 index 000000000..df2e146e7 --- /dev/null +++ b/Packages/com.github.homuler.mediapipe/Runtime/Shaders/UnmaskShader.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: d684c6d125278d05fbb1904ee5103f3a +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: