Skip to content

Commit

Permalink
feat: render annotations in PoseTracking scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler committed Sep 22, 2020
1 parent 1dcc469 commit 269a081
Show file tree
Hide file tree
Showing 19 changed files with 570 additions and 44 deletions.
8 changes: 8 additions & 0 deletions Assets/Mediapipe/Examples/PoseTracking/Objects.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8155280967966332756
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8155280967966332758}
- component: {fileID: -7409172497499427214}
m_Layer: 0
m_Name: PoseTrackingAnnotation
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8155280967966332758
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8155280967966332756}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -20}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &-7409172497499427214
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8155280967966332756}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 178c0f33a7c561b3db556cab0a69aa75, type: 3}
m_Name:
m_EditorClassIdentifier:
poseLandmarkListPrefab: {fileID: 2712965234984282611, guid: 52f3167d117fe05eb8f7ae8c84e4d403,
type: 3}
poseRectPrefab: {fileID: 1405412484651109527, guid: c5c846cc7bbefdfa7af64f9d29912b70,
type: 3}
poseDetectionPrefab: {fileID: 1405412484651109527, guid: 3779864e7ead10e31b03fc362f4746de,
type: 3}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 496037458}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: -20}
m_LocalRotation: {x: 0, y: 0.7071068, z: -0.7071068, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 20}
m_LocalScale: {x: 4, y: 1, z: 3}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 90, y: 180, z: 0}
--- !u!1 &624144232
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -648,6 +648,75 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 28}
m_Pivot: {x: 0.5, y: 1}
--- !u!1001 &801731346
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 8155280967966332756, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_Name
value: PoseTrackingAnnotation
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalPosition.z
value: -20
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6fb79028edccf260ca12e555356b54e8, type: 3}
--- !u!1 &908513300
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -829,10 +898,11 @@ MonoBehaviour:
m_GameObject: {fileID: 925659076}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cea363b8acfcfa735bfdcfd689867426, type: 3}
m_Script: {fileID: 11500000, guid: abbc7949365b640f6a456f280c4e6ff3, type: 3}
m_Name:
m_EditorClassIdentifier:
config: {fileID: 4900000, guid: bd31758744d1fc66e931e56e8167a463, type: 3}
useGPU: 0
--- !u!4 &925659078
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -923,13 +993,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 985747842}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 10}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1005407104
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1647,13 +1717,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1909744802}
m_LocalRotation: {x: 0.10938167, y: 0.8754261, z: -0.40821788, w: 0.23456976}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: 150, z: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &2121214992
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 496037458}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: -20}
m_LocalRotation: {x: 0, y: 0.7071068, z: -0.7071068, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 20}
m_LocalScale: {x: 4, y: 1, z: 3}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 90, y: 180, z: 0}
--- !u!1 &624144232
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -829,10 +829,11 @@ MonoBehaviour:
m_GameObject: {fileID: 925659076}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 21893f3cd88c5cc5787eec55c54ade8a, type: 3}
m_Script: {fileID: 11500000, guid: abbc7949365b640f6a456f280c4e6ff3, type: 3}
m_Name:
m_EditorClassIdentifier:
config: {fileID: 4900000, guid: b577f637ebbd98034a6ed0c0536dfba2, type: 3}
useGPU: 1
--- !u!4 &925659078
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -923,13 +924,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 985747842}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 10}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1005407104
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1328,6 +1329,75 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1327619890}
m_CullTransparentMesh: 0
--- !u!1001 &1374077077
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 8155280967966332756, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_Name
value: PoseTrackingAnnotation
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalPosition.z
value: -20
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8155280967966332758, guid: 6fb79028edccf260ca12e555356b54e8,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6fb79028edccf260ca12e555356b54e8, type: 3}
--- !u!1 &1547322621
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1647,13 +1717,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1909744802}
m_LocalRotation: {x: 0.10938167, y: 0.8754261, z: -0.40821788, w: 0.23456976}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: 150, z: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &2121214992
GameObject:
m_ObjectHideFlags: 0
Expand Down
8 changes: 8 additions & 0 deletions Assets/Mediapipe/Examples/PoseTracking/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Mediapipe;
using UnityEngine;

public class PoseTrackingAnnotationController : AnnotationController {
[SerializeField] GameObject poseLandmarkListPrefab = null;
[SerializeField] GameObject poseDetectionPrefab = null;

private GameObject poseLandmarkListAnnotation;
private GameObject poseDetectionAnnotation;

void Awake() {
poseLandmarkListAnnotation = Instantiate(poseLandmarkListPrefab);
poseDetectionAnnotation = Instantiate(poseDetectionPrefab);
}

public override void Clear() {
poseLandmarkListAnnotation.GetComponent<PoseLandmarkListAnnotationController>().Clear();
poseDetectionAnnotation.GetComponent<DetectionAnnotationController>().Clear();
}

public void Draw(Transform screenTransform, NormalizedLandmarkList poseLandmarkList, Detection poseDetection, bool isFlipped = false)
{
poseLandmarkListAnnotation.GetComponent<PoseLandmarkListAnnotationController>().Draw(screenTransform, poseLandmarkList, isFlipped);
poseDetectionAnnotation.GetComponent<DetectionAnnotationController>().Draw(screenTransform, poseDetection, isFlipped);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 269a081

Please sign in to comment.