From b652f114703e854864ce7683ed26645d0bcd2c4f Mon Sep 17 00:00:00 2001 From: Junrou Nishida Date: Sun, 23 Jul 2023 10:11:54 +0900 Subject: [PATCH] feat: FaceDetector Sample --- .../Scripts/ImageSource/TextureFrame.cs | 5 + .../Samples/Common/Scripts/TaskApiRunner.cs | 107 ++ .../Common/Scripts/TaskApiRunner.cs.meta | 11 + .../Common/Scripts/VisionTaskApiRunner.cs | 91 ++ .../Scripts/VisionTaskApiRunner.cs.meta | 11 + .../MediaPipeUnity/Samples/Scenes/Tasks.meta | 8 + .../Samples/Scenes/Tasks/Face Detection.unity | 1074 +++++++++++++++++ .../Scenes/Tasks/Face Detection.unity.meta | 7 + .../Scenes/Tasks/FaceDetectorSample.cs | 80 ++ .../Scenes/Tasks/FaceDetectorSample.cs.meta | 11 + .../Unity/Experimental/TextureFrame.cs | 2 + 11 files changed, 1407 insertions(+) create mode 100644 Assets/MediaPipeUnity/Samples/Common/Scripts/TaskApiRunner.cs create mode 100644 Assets/MediaPipeUnity/Samples/Common/Scripts/TaskApiRunner.cs.meta create mode 100644 Assets/MediaPipeUnity/Samples/Common/Scripts/VisionTaskApiRunner.cs create mode 100644 Assets/MediaPipeUnity/Samples/Common/Scripts/VisionTaskApiRunner.cs.meta create mode 100644 Assets/MediaPipeUnity/Samples/Scenes/Tasks.meta create mode 100644 Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection.unity create mode 100644 Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection.unity.meta create mode 100644 Assets/MediaPipeUnity/Samples/Scenes/Tasks/FaceDetectorSample.cs create mode 100644 Assets/MediaPipeUnity/Samples/Scenes/Tasks/FaceDetectorSample.cs.meta diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFrame.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFrame.cs index 418f8ee15..af5fbc44e 100644 --- a/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFrame.cs +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/ImageSource/TextureFrame.cs @@ -239,6 +239,11 @@ public ImageFrame BuildImageFrame() return new ImageFrame(imageFormat, width, height, 4 * width, GetRawTextureData()); } + public Image BuildCPUImage() + { + return new Image(imageFormat, width, height, 4 * width, GetRawTextureData()); + } + public GpuBuffer BuildGpuBuffer(GlContext glContext) { #if UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX || UNITY_ANDROID diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/TaskApiRunner.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/TaskApiRunner.cs new file mode 100644 index 000000000..3ed0d9205 --- /dev/null +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/TaskApiRunner.cs @@ -0,0 +1,107 @@ +// Copyright (c) 2023 homuler +// +// Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file or at +// https://opensource.org/licenses/MIT. + +using System; +using System.Collections; +using UnityEngine; + +using Stopwatch = System.Diagnostics.Stopwatch; + +namespace Mediapipe.Unity +{ + public abstract class TaskApiRunner : MonoBehaviour + { +#pragma warning disable IDE1006 + // TODO: make it static + protected virtual string TAG => GetType().Name; +#pragma warning restore IDE1006 + + public Bootstrap bootstrap; + protected bool isPaused; + + private readonly Stopwatch _stopwatch = new(); + + protected virtual IEnumerator Start() + { + bootstrap = FindBootstrap(); + yield return new WaitUntil(() => bootstrap.isFinished); + + Play(); + } + + /// + /// Start the main program from the beginning. + /// + public virtual void Play() + { + isPaused = false; + _stopwatch.Restart(); + } + + /// + /// Pause the main program. + /// + public virtual void Pause() + { + isPaused = true; + } + + /// + /// Resume the main program. + /// If the main program has not begun, it'll do nothing. + /// + public virtual void Resume() + { + isPaused = false; + } + + /// + /// Stops the main program. + /// + public virtual void Stop() + { + isPaused = true; + _stopwatch.Stop(); + } + + private long GetCurrentTimestampMicrosec() + { + return _stopwatch.IsRunning ? -1 : _stopwatch.ElapsedTicks / (TimeSpan.TicksPerMillisecond / 1000); + } + + protected Timestamp GetCurrentTimestamp() + { + var microsec = GetCurrentTimestampMicrosec(); + return microsec < 0 ? Timestamp.Unset() : new Timestamp(microsec); + } + + protected Bootstrap FindBootstrap() + { + var bootstrapObj = GameObject.Find("Bootstrap"); + + if (bootstrapObj != null) + { + return bootstrapObj.GetComponent(); + } + + Logger.LogWarning(TAG, "Global Bootstrap instance is not found (maybe running a sample scene directly), " + + "so activating a fallback Bootstrap instance attached to each Solution object"); + + var bootstrap = GetComponent(); + bootstrap.enabled = true; + + // hide menu button when trying a single scene. + DisableMenuButton(); + return bootstrap; + } + + private void DisableMenuButton() + { + var menuButton = GameObject.Find("MenuButton"); + menuButton.SetActive(false); + } + } +} diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/TaskApiRunner.cs.meta b/Assets/MediaPipeUnity/Samples/Common/Scripts/TaskApiRunner.cs.meta new file mode 100644 index 000000000..0cdaa2747 --- /dev/null +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/TaskApiRunner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2bf52f7ed0f46b72888f6ee86ae79a2f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/VisionTaskApiRunner.cs b/Assets/MediaPipeUnity/Samples/Common/Scripts/VisionTaskApiRunner.cs new file mode 100644 index 000000000..babee1c8d --- /dev/null +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/VisionTaskApiRunner.cs @@ -0,0 +1,91 @@ +// Copyright (c) 2021 homuler +// +// Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file or at +// https://opensource.org/licenses/MIT. + +using System.Collections; +using UnityEngine; + +namespace Mediapipe.Unity +{ + public abstract class VisionTaskApiRunner : TaskApiRunner + { + [SerializeField] protected Screen screen; + + private Coroutine _coroutine; + + public RunningMode runningMode; + + public override void Play() + { + if (_coroutine != null) + { + Stop(); + } + base.Play(); + _coroutine = StartCoroutine(Run()); + } + + public override void Pause() + { + base.Pause(); + ImageSourceProvider.ImageSource.Pause(); + } + + public override void Resume() + { + base.Resume(); + var _ = StartCoroutine(ImageSourceProvider.ImageSource.Resume()); + } + + public override void Stop() + { + base.Stop(); + StopCoroutine(_coroutine); + ImageSourceProvider.ImageSource.Stop(); + } + + protected abstract IEnumerator Run(); + + protected virtual void SetupScreen(ImageSource imageSource) + { + // NOTE: The screen will be resized later, keeping the aspect ratio. + screen.Initialize(imageSource); + } + + protected virtual void RenderCurrentFrame(TextureFrame textureFrame) + { + screen.ReadSync(textureFrame); + } + + protected static void ReadFromImageSource(ImageSource imageSource, TextureFrame textureFrame) + { + var sourceTexture = imageSource.GetCurrentTexture(); + + // For some reason, when the image is coiped on GPU, latency tends to be high. + // So even when OpenGL ES is available, use CPU to copy images. + var textureType = sourceTexture.GetType(); + + if (textureType == typeof(WebCamTexture)) + { + textureFrame.ReadTextureFromOnCPU((WebCamTexture)sourceTexture); + } + else if (textureType == typeof(Texture2D)) + { + textureFrame.ReadTextureFromOnCPU((Texture2D)sourceTexture); + } + else + { + textureFrame.ReadTextureFromOnCPU(sourceTexture); + } + } + + protected static void SetupAnnotationController(AnnotationController annotationController, ImageSource imageSource, bool expectedToBeMirrored = false) where T : HierarchicalAnnotation + { + annotationController.isMirrored = expectedToBeMirrored ^ imageSource.isHorizontallyFlipped ^ imageSource.isFrontFacing; + annotationController.rotationAngle = imageSource.rotation.Reverse(); + annotationController.imageSize = new Vector2Int(imageSource.textureWidth, imageSource.textureHeight); + } + } +} diff --git a/Assets/MediaPipeUnity/Samples/Common/Scripts/VisionTaskApiRunner.cs.meta b/Assets/MediaPipeUnity/Samples/Common/Scripts/VisionTaskApiRunner.cs.meta new file mode 100644 index 000000000..f1e32c8d2 --- /dev/null +++ b/Assets/MediaPipeUnity/Samples/Common/Scripts/VisionTaskApiRunner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e80a3d78e5958821fb1c31ba5b6c6f21 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Tasks.meta b/Assets/MediaPipeUnity/Samples/Scenes/Tasks.meta new file mode 100644 index 000000000..eb6bd52f3 --- /dev/null +++ b/Assets/MediaPipeUnity/Samples/Scenes/Tasks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cfd559230598bc412a84f2ad250bdeef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection.unity b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection.unity new file mode 100644 index 000000000..034e08b1b --- /dev/null +++ b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection.unity @@ -0,0 +1,1074 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.44402248, g: 0.49316555, b: 0.5722324, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &338992141 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1006057041} + m_Modifications: + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5535674424067552597, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6320745076577806712, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + propertyPath: m_Name + value: FaceDetections Annotation + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 26114bc9cccb92454a468ea4d41f400a, type: 3} +--- !u!114 &338992142 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: -6338546567352850726, guid: 26114bc9cccb92454a468ea4d41f400a, + type: 3} + m_PrefabInstance: {fileID: 338992141} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d433cdb024dfd584696eeb11efb71102, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &420786853 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 420786856} + - component: {fileID: 420786855} + - component: {fileID: 420786854} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &420786854 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420786853} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &420786855 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420786853} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &420786856 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 420786853} + 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: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1006057040 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 8571076842648159878} + m_Modifications: + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014650, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3259285889726014651, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + propertyPath: m_Name + value: Annotatable Screen + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5713b959e3c77a58fb258133fc8e4aef, type: 3} +--- !u!4 &1006057041 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 7074087083388479136, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + m_PrefabInstance: {fileID: 1006057040} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1006057042 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8798066379235852099, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + m_PrefabInstance: {fileID: 1006057040} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1006057043 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 2020366215714292840, guid: 5713b959e3c77a58fb258133fc8e4aef, + type: 3} + m_PrefabInstance: {fileID: 1006057040} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 827c4431af677e057aa6f14170d0785c, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1006057044 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1006057042} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8741257e98d0a1560b37e577decc0e2b, type: 3} + m_Name: + m_EditorClassIdentifier: + annotation: {fileID: 338992142} + _threshold: 0 +--- !u!114 &1006057045 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1006057042} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3495500f1386ce3ee9a87dc859112641, type: 3} + m_Name: + m_EditorClassIdentifier: + annotation: {fileID: 338992142} + _threshold: 0 +--- !u!1 &1064799459 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1064799461} + - component: {fileID: 1064799460} + - component: {fileID: 1064799462} + - component: {fileID: 1064799463} + - component: {fileID: 1064799467} + - component: {fileID: 1064799466} + - component: {fileID: 1064799465} + - component: {fileID: 1064799464} + - component: {fileID: 1064799468} + m_Layer: 0 + m_Name: Solution + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1064799460 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1064799459} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90c6d9633837e7c06aeaebb5b7ba866a, type: 3} + m_Name: + m_EditorClassIdentifier: + bootstrap: {fileID: 0} + screen: {fileID: 1006057043} + graphRunner: {fileID: 1064799462} + textureFramePool: {fileID: 1064799463} + runningMode: 0 + _faceDetectionsAnnotationController: {fileID: 1006057044} +--- !u!4 &1064799461 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1064799459} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -1} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1064799462 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1064799459} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7bda1903daf198151820ccb68874ca67, type: 3} + m_Name: + m_EditorClassIdentifier: + _cpuConfig: {fileID: 4900000, guid: d0012308a4a6db23394e3599fc15e82c, type: 3} + _gpuConfig: {fileID: 4900000, guid: be38c22dedc4a1b02964b6d091e6bddb, type: 3} + _openGlEsConfig: {fileID: 4900000, guid: 6070cea8cbd80191199591327316f26c, type: 3} + _timeoutMicrosec: 50000 + modelType: 0 +--- !u!114 &1064799463 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1064799459} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d5da564da19cb6b7d8e4f97f269edc5d, type: 3} + m_Name: + m_EditorClassIdentifier: + _poolSize: 10 +--- !u!114 &1064799464 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1064799459} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 04085488e5fac35599866a2a6fceeda3, type: 3} + m_Name: + m_EditorClassIdentifier: + _availableSources: [] +--- !u!114 &1064799465 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1064799459} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bd7955705ab46c72b9124bb116a2dca9, type: 3} + m_Name: + m_EditorClassIdentifier: + _availableSources: [] + _defaultAvailableResolutions: + - width: 512 + height: 512 + frameRate: 0 + - width: 640 + height: 480 + frameRate: 0 + - width: 1280 + height: 720 + frameRate: 0 +--- !u!114 &1064799466 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1064799459} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 498146e99d4934673bd948c8be11227e, type: 3} + m_Name: + m_EditorClassIdentifier: + _preferableDefaultWidth: 1280 + _defaultAvailableResolutions: + - width: 176 + height: 144 + frameRate: 30 + - width: 320 + height: 240 + frameRate: 30 + - width: 424 + height: 240 + frameRate: 30 + - width: 640 + height: 360 + frameRate: 30 + - width: 640 + height: 480 + frameRate: 30 + - width: 848 + height: 480 + frameRate: 30 + - width: 960 + height: 540 + frameRate: 30 + - width: 1280 + height: 720 + frameRate: 30 + - width: 1600 + height: 896 + frameRate: 30 + - width: 1920 + height: 1080 + frameRate: 30 +--- !u!114 &1064799467 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1064799459} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4d846393f8d9f20fa64b924b0d95e68, type: 3} + m_Name: + m_EditorClassIdentifier: + _defaultImageSource: 0 + _preferableInferenceMode: 0 + _assetLoaderType: 2 + _enableGlog: 1 +--- !u!114 &1064799468 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1064799459} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0b86ba34db2c888778bdb2f439fd1c76, type: 3} + m_Name: + m_EditorClassIdentifier: + bootstrap: {fileID: 0} + screen: {fileID: 1006057043} + runningMode: 0 + _detectionResultAnnotationController: {fileID: 1006057045} +--- !u!1 &1806680259 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1806680261} + - component: {fileID: 1806680260} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1806680260 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1806680259} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1806680261 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1806680259} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &1969388814 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1969388817} + - component: {fileID: 1969388816} + - component: {fileID: 1969388815} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1969388815 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1969388814} + m_Enabled: 1 +--- !u!20 &1969388816 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1969388814} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1969388817 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1969388814} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &8571076842648159877 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4073763783843571378, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4073763783843571378, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4073763783843571378, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4073763783843571378, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692484344150001, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692484344150001, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692484344150001, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692484344150001, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692485022354238, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692485022354238, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692485022354238, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692485022354238, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692485785395896, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692485785395896, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692485785395896, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5158692485785395896, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426121, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_Name + value: Main Canvas + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426122, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_Camera + value: + objectReference: {fileID: 1969388816} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076842338426133, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076843237194833, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: solution + value: + objectReference: {fileID: 1064799460} + - target: {fileID: 8571076843237194833, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: _solution + value: + objectReference: {fileID: 1064799460} + - target: {fileID: 8571076843980202029, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: contents + value: + objectReference: {fileID: 7355513348742275121, guid: 8236d46ca3a43d373ae6ad281fea8fe0, + type: 3} + - target: {fileID: 8571076843980202029, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: _contents + value: + objectReference: {fileID: 7355513348742275121, guid: 8236d46ca3a43d373ae6ad281fea8fe0, + type: 3} + - target: {fileID: 8571076844286272849, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076844286272849, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076844286272849, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8571076844286272849, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 140d1d2c406167c50819d89f86d9092e, type: 3} +--- !u!224 &8571076842648159878 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 8571076844135231236, guid: 140d1d2c406167c50819d89f86d9092e, + type: 3} + m_PrefabInstance: {fileID: 8571076842648159877} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection.unity.meta b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection.unity.meta new file mode 100644 index 000000000..0d28dc00c --- /dev/null +++ b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/Face Detection.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6398790df6f5f3123a3d09434706eb95 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Tasks/FaceDetectorSample.cs b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/FaceDetectorSample.cs new file mode 100644 index 000000000..da1977c0e --- /dev/null +++ b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/FaceDetectorSample.cs @@ -0,0 +1,80 @@ +// Copyright (c) 2023 homuler +// +// Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file or at +// https://opensource.org/licenses/MIT. + +using System.Collections; +using UnityEngine; + +using FaceDetectionResult = Mediapipe.Tasks.Components.Containers.DetectionResult; + +namespace Mediapipe.Unity.FaceDetection +{ + public class FaceDetectorSample : VisionTaskApiRunner + { + [SerializeField] private DetectionResultAnnotationController _detectionResultAnnotationController; + + private Tasks.Vision.FaceDetector.FaceDetector _faceDetector; + + public override void Stop() + { + base.Stop(); + _faceDetector.Close(); + } + + protected override IEnumerator Run() + { + var options = new Tasks.Vision.FaceDetector.FaceDetectorOptions( + new Tasks.Core.BaseOptions(Tasks.Core.BaseOptions.Delegate.GPU, modelAssetPath: "blaze_face_short_range.tflite"), + runningMode: Tasks.Vision.Core.RunningMode.IMAGE + ); + _faceDetector = Tasks.Vision.FaceDetector.FaceDetector.CreateFromOptions(options); + var imageSource = ImageSourceProvider.ImageSource; + + yield return imageSource.Play(); + + if (!imageSource.isPrepared) + { + Logger.LogError(TAG, "Failed to start ImageSource, exiting..."); + yield break; + } + + // Use RGBA32 as the input format. + // TODO: When using GpuBuffer, MediaPipe assumes that the input format is BGRA, so maybe the following code needs to be fixed. + var textureFramePool = new Experimental.TextureFramePool(imageSource.textureWidth, imageSource.textureHeight, TextureFormat.RGBA32, 10); + SetupScreen(imageSource); + + SetupAnnotationController(_detectionResultAnnotationController, imageSource); + + while (true) + { + if (isPaused) + { + yield return new WaitWhile(() => isPaused); + } + + if (!textureFramePool.TryGetTextureFrame(out var textureFrame)) + { + yield return new WaitForEndOfFrame(); + continue; + } + + // Copy current image to TextureFrame + var req = textureFrame.ReadTextureAsync(imageSource.GetCurrentTexture(), true, false); + yield return new WaitUntil(() => req.done); + + if (req.hasError) + { + Debug.Log("req has error"); + } + + var image = textureFrame.BuildCPUImage(); + var result = _faceDetector.Detect(image); + // screen.texture = textureFrame.texture; + _detectionResultAnnotationController.DrawNow(result); + textureFrame.Release(); + } + } + } +} diff --git a/Assets/MediaPipeUnity/Samples/Scenes/Tasks/FaceDetectorSample.cs.meta b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/FaceDetectorSample.cs.meta new file mode 100644 index 000000000..cc8abc4e2 --- /dev/null +++ b/Assets/MediaPipeUnity/Samples/Scenes/Tasks/FaceDetectorSample.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0b86ba34db2c888778bdb2f439fd1c76 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Experimental/TextureFrame.cs b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Experimental/TextureFrame.cs index 2cd3f5a2e..119713634 100644 --- a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Experimental/TextureFrame.cs +++ b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Experimental/TextureFrame.cs @@ -214,6 +214,8 @@ public IntPtr GetNativeTexturePtr() public ImageFrame BuildImageFrame() => new ImageFrame(imageFormat, width, height, 4 * width, GetRawTextureData()); + public Image BuildCPUImage() => new Image(imageFormat, width, height, 4 * width, GetRawTextureData()); + public GpuBuffer BuildGpuBuffer(GlContext glContext) { #if UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX || UNITY_ANDROID