diff --git a/Assets/FaceMaskExample/Editor/FaceMaskDataEditor.cs b/Assets/FaceMaskExample/Editor/FaceMaskDataEditor.cs
index 3a0b2b3..f49437b 100644
--- a/Assets/FaceMaskExample/Editor/FaceMaskDataEditor.cs
+++ b/Assets/FaceMaskExample/Editor/FaceMaskDataEditor.cs
@@ -1,10 +1,9 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
namespace FaceMaskExample
{
- [CustomEditor (typeof(FaceMaskData))]
+ [CustomEditor(typeof(FaceMaskData))]
public class FaceMaskDataEditor : Editor
{
SerializedProperty image;
@@ -16,176 +15,191 @@ namespace FaceMaskExample
bool isDrag = false;
int currentPointID = -1;
- private void OnEnable ()
+ private void OnEnable()
{
- image = serializedObject.FindProperty ("_image");
- isDynamicMode = serializedObject.FindProperty ("isDynamicMode");
- enableColorCorrection = serializedObject.FindProperty ("enableColorCorrection");
- faceRect = serializedObject.FindProperty ("_faceRect");
- landmarkPoints = serializedObject.FindProperty ("_landmarkPoints");
+ image = serializedObject.FindProperty("_image");
+ isDynamicMode = serializedObject.FindProperty("isDynamicMode");
+ enableColorCorrection = serializedObject.FindProperty("enableColorCorrection");
+ faceRect = serializedObject.FindProperty("_faceRect");
+ landmarkPoints = serializedObject.FindProperty("_landmarkPoints");
}
- public override void OnInspectorGUI ()
+ public override void OnInspectorGUI()
{
- serializedObject.Update ();
+ serializedObject.Update();
Texture2D tex = image.objectReferenceValue as Texture2D;
// Draw image.
- if (tex != null) {
- GUILayout.Box (GUIContent.none, GUILayout.Width (tex.width), GUILayout.Height (tex.height));
- Rect imageRect = GUILayoutUtility.GetLastRect ();
- GUI.DrawTexture (imageRect, tex);
+ if (tex != null)
+ {
+ GUILayout.Box(GUIContent.none, GUILayout.Width(tex.width), GUILayout.Height(tex.height));
+ Rect imageRect = GUILayoutUtility.GetLastRect();
+ GUI.DrawTexture(imageRect, tex);
- if (!isDynamicMode.boolValue) {
+ if (!isDynamicMode.boolValue)
+ {
// Draw face rect.
- DrawFaceRect (imageRect, faceRect.rectValue, Color.red);
+ DrawFaceRect(imageRect, faceRect.rectValue, Color.red);
// Draw landmark points.
- DrawFaceLandmark (imageRect, landmarkPoints, Color.green, Color.blue);
+ DrawFaceLandmark(imageRect, landmarkPoints, Color.green, Color.blue);
// Update mouse cursor.
- for (int i = 0; i < landmarkPoints.arraySize; i++) {
- Vector2 pt = landmarkPoints.GetArrayElementAtIndex (i).vector2Value;
+ for (int i = 0; i < landmarkPoints.arraySize; i++)
+ {
+ Vector2 pt = landmarkPoints.GetArrayElementAtIndex(i).vector2Value;
pt.x += imageRect.x;
pt.y += imageRect.y;
- Rect r = new Rect (pt.x - 4, pt.y - 4, 8, 8);
- EditorGUIUtility.AddCursorRect (r, MouseCursor.MoveArrow);
+ Rect r = new Rect(pt.x - 4, pt.y - 4, 8, 8);
+ EditorGUIUtility.AddCursorRect(r, MouseCursor.MoveArrow);
}
// Mouse event.
- if (Event.current.type == EventType.MouseDown) {
- Rect mousePosRect = new Rect (Event.current.mousePosition.x - 4, Event.current.mousePosition.y - 4, 8, 8);
- int id = GetPointID (imageRect, landmarkPoints, mousePosRect);
- if (id >= 0) {
+ if (Event.current.type == EventType.MouseDown)
+ {
+ Rect mousePosRect = new Rect(Event.current.mousePosition.x - 4, Event.current.mousePosition.y - 4, 8, 8);
+ int id = GetPointID(imageRect, landmarkPoints, mousePosRect);
+ if (id >= 0)
+ {
isDrag = true;
currentPointID = id;
}
- Repaint ();
+ Repaint();
}
- if (Event.current.type == EventType.MouseDrag) {
- if (isDrag && currentPointID >= 0) {
- Vector2 newPt = new Vector2 (Event.current.mousePosition.x - imageRect.x, Event.current.mousePosition.y - imageRect.y);
- newPt.x = Mathf.Clamp (newPt.x, 0, tex.width);
- newPt.y = Mathf.Clamp (newPt.y, 0, tex.height);
- landmarkPoints.GetArrayElementAtIndex (currentPointID).vector2Value = newPt;
+ if (Event.current.type == EventType.MouseDrag)
+ {
+ if (isDrag && currentPointID >= 0)
+ {
+ Vector2 newPt = new Vector2(Event.current.mousePosition.x - imageRect.x, Event.current.mousePosition.y - imageRect.y);
+ newPt.x = Mathf.Clamp(newPt.x, 0, tex.width);
+ newPt.y = Mathf.Clamp(newPt.y, 0, tex.height);
+ landmarkPoints.GetArrayElementAtIndex(currentPointID).vector2Value = newPt;
- if (!imageRect.Contains (Event.current.mousePosition)) {
+ if (!imageRect.Contains(Event.current.mousePosition))
+ {
isDrag = false;
currentPointID = -1;
}
}
- Repaint ();
+ Repaint();
}
- if (Event.current.type == EventType.MouseUp) {
- if (isDrag && currentPointID >= 0) {
- Vector2 newPt = new Vector2 (Event.current.mousePosition.x - imageRect.x, Event.current.mousePosition.y - imageRect.y);
- newPt.x = Mathf.Clamp (newPt.x, 0, tex.width);
- newPt.y = Mathf.Clamp (newPt.y, 0, tex.height);
- landmarkPoints.GetArrayElementAtIndex (currentPointID).vector2Value = newPt;
+ if (Event.current.type == EventType.MouseUp)
+ {
+ if (isDrag && currentPointID >= 0)
+ {
+ Vector2 newPt = new Vector2(Event.current.mousePosition.x - imageRect.x, Event.current.mousePosition.y - imageRect.y);
+ newPt.x = Mathf.Clamp(newPt.x, 0, tex.width);
+ newPt.y = Mathf.Clamp(newPt.y, 0, tex.height);
+ landmarkPoints.GetArrayElementAtIndex(currentPointID).vector2Value = newPt;
}
isDrag = false;
currentPointID = -1;
- Repaint ();
+ Repaint();
}
- if (currentPointID > -1 && currentPointID < landmarkPoints.arraySize) {
- Vector2 pt = landmarkPoints.GetArrayElementAtIndex (currentPointID).vector2Value;
+ if (currentPointID > -1 && currentPointID < landmarkPoints.arraySize)
+ {
+ Vector2 pt = landmarkPoints.GetArrayElementAtIndex(currentPointID).vector2Value;
pt.x += imageRect.x;
pt.y += imageRect.y;
Handles.color = Color.yellow;
- Handles.DrawSolidDisc (pt, Vector3.forward, 3f);
+ Handles.DrawSolidDisc(pt, Vector3.forward, 3f);
}
}
}
// Display input field.
- EditorGUILayout.PropertyField (image);
- EditorGUILayout.PropertyField (isDynamicMode);
- EditorGUILayout.PropertyField (enableColorCorrection);
- EditorGUILayout.PropertyField (faceRect);
- EditorGUILayout.PropertyField (landmarkPoints, true);
+ EditorGUILayout.PropertyField(image);
+ EditorGUILayout.PropertyField(isDynamicMode);
+ EditorGUILayout.PropertyField(enableColorCorrection);
+ EditorGUILayout.PropertyField(faceRect);
+ EditorGUILayout.PropertyField(landmarkPoints, true);
- serializedObject.ApplyModifiedProperties ();
+ serializedObject.ApplyModifiedProperties();
}
- private void DrawFaceRect (Rect imageRect, Rect faceRect, Color color)
+ private void DrawFaceRect(Rect imageRect, Rect faceRect, Color color)
{
faceRect.x += imageRect.x;
faceRect.y += imageRect.y;
Handles.color = color;
- Handles.DrawSolidRectangleWithOutline (faceRect, new Color (0, 0, 0, 0), Color.white);
+ Handles.DrawSolidRectangleWithOutline(faceRect, new Color(0, 0, 0, 0), Color.white);
}
- private void DrawFaceLandmark (Rect imageRect, SerializedProperty landmarkPoints, Color lineColor, Color pointColor)
+ private void DrawFaceLandmark(Rect imageRect, SerializedProperty landmarkPoints, Color lineColor, Color pointColor)
{
- if (landmarkPoints.isArray && landmarkPoints.arraySize == 68) {
+ if (landmarkPoints.isArray && landmarkPoints.arraySize == 68)
+ {
Handles.color = lineColor;
for (int i = 1; i <= 16; ++i)
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (i).vector2Value, landmarkPoints.GetArrayElementAtIndex (i - 1).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(i).vector2Value, landmarkPoints.GetArrayElementAtIndex(i - 1).vector2Value);
for (int i = 28; i <= 30; ++i)
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (i).vector2Value, landmarkPoints.GetArrayElementAtIndex (i - 1).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(i).vector2Value, landmarkPoints.GetArrayElementAtIndex(i - 1).vector2Value);
for (int i = 18; i <= 21; ++i)
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (i).vector2Value, landmarkPoints.GetArrayElementAtIndex (i - 1).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(i).vector2Value, landmarkPoints.GetArrayElementAtIndex(i - 1).vector2Value);
for (int i = 23; i <= 26; ++i)
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (i).vector2Value, landmarkPoints.GetArrayElementAtIndex (i - 1).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(i).vector2Value, landmarkPoints.GetArrayElementAtIndex(i - 1).vector2Value);
for (int i = 31; i <= 35; ++i)
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (i).vector2Value, landmarkPoints.GetArrayElementAtIndex (i - 1).vector2Value);
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (30).vector2Value, landmarkPoints.GetArrayElementAtIndex (35).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(i).vector2Value, landmarkPoints.GetArrayElementAtIndex(i - 1).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(30).vector2Value, landmarkPoints.GetArrayElementAtIndex(35).vector2Value);
for (int i = 37; i <= 41; ++i)
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (i).vector2Value, landmarkPoints.GetArrayElementAtIndex (i - 1).vector2Value);
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (36).vector2Value, landmarkPoints.GetArrayElementAtIndex (41).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(i).vector2Value, landmarkPoints.GetArrayElementAtIndex(i - 1).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(36).vector2Value, landmarkPoints.GetArrayElementAtIndex(41).vector2Value);
for (int i = 43; i <= 47; ++i)
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (i).vector2Value, landmarkPoints.GetArrayElementAtIndex (i - 1).vector2Value);
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (42).vector2Value, landmarkPoints.GetArrayElementAtIndex (47).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(i).vector2Value, landmarkPoints.GetArrayElementAtIndex(i - 1).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(42).vector2Value, landmarkPoints.GetArrayElementAtIndex(47).vector2Value);
for (int i = 49; i <= 59; ++i)
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (i).vector2Value, landmarkPoints.GetArrayElementAtIndex (i - 1).vector2Value);
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (48).vector2Value, landmarkPoints.GetArrayElementAtIndex (59).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(i).vector2Value, landmarkPoints.GetArrayElementAtIndex(i - 1).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(48).vector2Value, landmarkPoints.GetArrayElementAtIndex(59).vector2Value);
for (int i = 61; i <= 67; ++i)
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (i).vector2Value, landmarkPoints.GetArrayElementAtIndex (i - 1).vector2Value);
- DrawLine (imageRect, landmarkPoints.GetArrayElementAtIndex (60).vector2Value, landmarkPoints.GetArrayElementAtIndex (67).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(i).vector2Value, landmarkPoints.GetArrayElementAtIndex(i - 1).vector2Value);
+ DrawLine(imageRect, landmarkPoints.GetArrayElementAtIndex(60).vector2Value, landmarkPoints.GetArrayElementAtIndex(67).vector2Value);
// Draw Points.
Handles.color = pointColor;
- for (int i = 0; i < landmarkPoints.arraySize; i++) {
- Vector2 pt = landmarkPoints.GetArrayElementAtIndex (i).vector2Value;
+ for (int i = 0; i < landmarkPoints.arraySize; i++)
+ {
+ Vector2 pt = landmarkPoints.GetArrayElementAtIndex(i).vector2Value;
pt.x += imageRect.x;
pt.y += imageRect.y;
- Handles.DrawSolidDisc (pt, Vector3.forward, 2f);
+ Handles.DrawSolidDisc(pt, Vector3.forward, 2f);
}
}
}
- private void DrawLine (Rect imageRect, Vector2 pt1, Vector2 pt2)
+ private void DrawLine(Rect imageRect, Vector2 pt1, Vector2 pt2)
{
pt1.x += imageRect.x;
pt1.y += imageRect.y;
pt2.x += imageRect.x;
pt2.y += imageRect.y;
- Handles.DrawLine (pt1, pt2);
+ Handles.DrawLine(pt1, pt2);
}
- private int GetPointID (Rect imageRect, SerializedProperty landmarkPoints, Rect rect)
+ private int GetPointID(Rect imageRect, SerializedProperty landmarkPoints, Rect rect)
{
- if (landmarkPoints.isArray && landmarkPoints.arraySize == 68) {
- for (int i = 0; i < landmarkPoints.arraySize; i++) {
- Vector2 pt = landmarkPoints.GetArrayElementAtIndex (i).vector2Value;
+ if (landmarkPoints.isArray && landmarkPoints.arraySize == 68)
+ {
+ for (int i = 0; i < landmarkPoints.arraySize; i++)
+ {
+ Vector2 pt = landmarkPoints.GetArrayElementAtIndex(i).vector2Value;
pt.x += imageRect.x;
pt.y += imageRect.y;
- if (rect.Contains (pt))
+ if (rect.Contains(pt))
return i;
}
diff --git a/Assets/FaceMaskExample/Editor/FaceMaskExampleMenuItem.cs b/Assets/FaceMaskExample/Editor/FaceMaskExampleMenuItem.cs
index 23e692d..6bc7e23 100644
--- a/Assets/FaceMaskExample/Editor/FaceMaskExampleMenuItem.cs
+++ b/Assets/FaceMaskExample/Editor/FaceMaskExampleMenuItem.cs
@@ -1,11 +1,8 @@
#if UNITY_5 || UNITY_5_3_OR_NEWER
-using UnityEngine;
-using UnityEditor;
using System;
using System.IO;
-using System.Linq;
-using System.Text.RegularExpressions;
-using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
namespace FaceMaskExample
{
@@ -14,23 +11,23 @@ namespace FaceMaskExample
///
/// Create face mask tracked mesh prefab.
///
- [MenuItem ("Tools/Face Mask Example/Create Face Mask Prefab")]
- private static void CreateFaceMaskPrefab ()
+ [MenuItem("Tools/Face Mask Example/Create Face Mask Prefab")]
+ private static void CreateFaceMaskPrefab()
{
float width = 512f;
float height = 512f;
string basePath = "Assets/FaceMaskExample/FaceMaskPrefab/";
- GameObject newObj = new GameObject ("FaceMaskTrackedMesh");
+ GameObject newObj = new GameObject("FaceMaskTrackedMesh");
//Add MeshFilter Component.
- MeshFilter meshFilter = newObj.AddComponent ();
+ MeshFilter meshFilter = newObj.AddComponent();
// Create Mesh.
- meshFilter.mesh = new Mesh ();
+ meshFilter.mesh = new Mesh();
Mesh mesh = meshFilter.sharedMesh;
mesh.name = "DlibFaceLandmark68Mesh";
-
+
// Mesh_vertices
Vector3[] vertices = new Vector3[68] {
new Vector3 (117, 250),
@@ -116,13 +113,14 @@ namespace FaceMaskExample
new Vector3 (242, 383)
};
- Vector3[] vertices2 = (Vector3[])vertices.Clone ();
- for (int j = 0; j < vertices2.Length; j++) {
- vertices2 [j].x = (vertices2 [j].x - width / 2f) / width;
- vertices2 [j].y = (height / 2f - vertices2 [j].y) / height;
+ Vector3[] vertices2 = (Vector3[])vertices.Clone();
+ for (int j = 0; j < vertices2.Length; j++)
+ {
+ vertices2[j].x = (vertices2[j].x - width / 2f) / width;
+ vertices2[j].y = (height / 2f - vertices2[j].y) / height;
}
mesh.vertices = vertices2;
-
+
// Mesh_triangles
int[] triangles = new int[327] {
// Around the right eye 21
@@ -219,7 +217,7 @@ namespace FaceMaskExample
34, 35, 52,
33, 34, 52,
33, 52, 51,
-
+
48, 49, 60,
48, 60, 59,
49, 50, 61,
@@ -250,25 +248,26 @@ namespace FaceMaskExample
63, 64, 65
};
mesh.triangles = triangles;
-
+
// Mesh_uv
Vector2[] uv = new Vector2[68];
- for (int j = 0; j < uv.Length; j++) {
- uv [j].x = vertices [j].x / width;
- uv [j].y = (height - vertices [j].y) / height;
+ for (int j = 0; j < uv.Length; j++)
+ {
+ uv[j].x = vertices[j].x / width;
+ uv[j].y = (height - vertices[j].y) / height;
}
mesh.uv = uv;
- mesh.uv2 = (Vector2[])uv.Clone ();
+ mesh.uv2 = (Vector2[])uv.Clone();
- mesh.RecalculateNormals ();
+ mesh.RecalculateNormals();
// Add Collider Component.
- MeshCollider meshCollider = newObj.AddComponent ();
- meshCollider.sharedMesh = CreatePrimitiveQuadMesh ();
+ MeshCollider meshCollider = newObj.AddComponent();
+ meshCollider.sharedMesh = CreatePrimitiveQuadMesh();
// Add Renderer Component.
- MeshRenderer meshRenderer = newObj.AddComponent ();
- Material material = new Material (Shader.Find ("Hide/FaceMaskShader"));
+ MeshRenderer meshRenderer = newObj.AddComponent();
+ Material material = new Material(Shader.Find("Hide/FaceMaskShader"));
// Create alpha mask texture.
Vector2[] facialContourUVPoints = new Vector2[] {
@@ -330,78 +329,99 @@ namespace FaceMaskExample
uv [67]
};
- Texture2D alphaMaskTexture = AlphaMaskTextureCreater.CreateAlphaMaskTexture (width, height, facialContourUVPoints, /*rightEyeContourUVPoints, leftEyeContourUVPoints,*/mouthContourUVPoints);
+ Texture2D alphaMaskTexture = AlphaMaskTextureCreater.CreateAlphaMaskTexture(width, height, facialContourUVPoints, /*rightEyeContourUVPoints, leftEyeContourUVPoints,*/mouthContourUVPoints);
string alphaMaskTexturePath = basePath + "FaceMaskAlphaMask.png";
- byte[] pngData = alphaMaskTexture.EncodeToPNG ();
+ byte[] pngData = alphaMaskTexture.EncodeToPNG();
- if (CreateWithoutFolder (basePath)) {
- File.WriteAllBytes (alphaMaskTexturePath, pngData);
- AssetDatabase.ImportAsset (alphaMaskTexturePath, ImportAssetOptions.ForceUpdate);
- AssetDatabase.SaveAssets ();
+ if (CreateWithoutFolder(basePath))
+ {
+ File.WriteAllBytes(alphaMaskTexturePath, pngData);
+ AssetDatabase.ImportAsset(alphaMaskTexturePath, ImportAssetOptions.ForceUpdate);
+ AssetDatabase.SaveAssets();
+
+ Debug.Log("Create asset \"" + basePath + "FaceMaskAlphaMask.png\"");
}
- TextureImporter importer = TextureImporter.GetAtPath (alphaMaskTexturePath) as TextureImporter;
+ TextureImporter importer = TextureImporter.GetAtPath(alphaMaskTexturePath) as TextureImporter;
importer.textureType = TextureImporterType.Default;
importer.mipmapEnabled = false;
importer.wrapMode = TextureWrapMode.Clamp;
importer.maxTextureSize = 1024;
-// importer.textureFormat = TextureImporterFormat.RGBA16;
- EditorUtility.SetDirty (importer);
- AssetDatabase.ImportAsset (alphaMaskTexturePath, ImportAssetOptions.ForceUpdate);
- AssetDatabase.SaveAssets ();
+ //importer.textureFormat = TextureImporterFormat.RGBA16;
+ EditorUtility.SetDirty(importer);
+ AssetDatabase.ImportAsset(alphaMaskTexturePath, ImportAssetOptions.ForceUpdate);
+ AssetDatabase.SaveAssets();
- GameObject.DestroyImmediate (alphaMaskTexture);
- alphaMaskTexture = AssetDatabase.LoadAssetAtPath (alphaMaskTexturePath, typeof(Texture2D)) as Texture2D;
- material.SetTexture ("_MaskTex", alphaMaskTexture);
+ GameObject.DestroyImmediate(alphaMaskTexture);
+ alphaMaskTexture = AssetDatabase.LoadAssetAtPath(alphaMaskTexturePath, typeof(Texture2D)) as Texture2D;
+ material.SetTexture("_MaskTex", alphaMaskTexture);
meshRenderer.material = material;
// Add TracedMesh Compornent.
- newObj.AddComponent ();
+ newObj.AddComponent();
// Save FaceMask Assets.
- if (CreateWithoutFolder (basePath)) {
- AssetDatabase.CreateAsset (material, basePath + "FaceMaskMaterial.mat");
- AssetDatabase.CreateAsset (mesh, basePath + "DlibFaceLandmark68Mesh.asset");
- AssetDatabase.SaveAssets ();
+ if (CreateWithoutFolder(basePath))
+ {
+ AssetDatabase.CreateAsset(material, basePath + "FaceMaskMaterial.mat");
+ AssetDatabase.CreateAsset(mesh, basePath + "DlibFaceLandmark68Mesh.asset");
+ AssetDatabase.SaveAssets();
- UnityEngine.Object prefab = AssetDatabase.LoadAssetAtPath (basePath + "FaceMaskTrackedMesh.prefab", typeof(UnityEngine.Object));
- if (prefab == null) {
- UnityEditor.PrefabUtility.CreatePrefab (basePath + "FaceMaskTrackedMesh.prefab", newObj);
- } else {
- UnityEditor.PrefabUtility.ReplacePrefab (newObj, prefab);
+ string prefab_path = basePath + "FaceMaskTrackedMesh.prefab";
+
+#if UNITY_2018_3_OR_NEWER
+ PrefabUtility.SaveAsPrefabAsset(newObj, prefab_path);
+#else
+ UnityEngine.Object prefab = AssetDatabase.LoadAssetAtPath(prefab_path, typeof(UnityEngine.Object));
+ if (prefab == null)
+ {
+ PrefabUtility.CreatePrefab(prefab_path, newObj);
}
- AssetDatabase.SaveAssets ();
+ else
+ {
+ PrefabUtility.ReplacePrefab(newObj, prefab);
+ }
+#endif
+
+ AssetDatabase.SaveAssets();
+
+ Debug.Log("Create asset \"" + basePath + "FaceMaskMaterial.mat\"");
+ Debug.Log("Create asset \"" + basePath + "DlibFaceLandmark68Mesh.asset\"");
+ Debug.Log("Create asset \"" + basePath + "FaceMaskTrackedMesh.prefab\"");
}
- GameObject.DestroyImmediate (newObj);
+ GameObject.DestroyImmediate(newObj);
}
- private static Mesh CreatePrimitiveQuadMesh ()
+ private static Mesh CreatePrimitiveQuadMesh()
{
- GameObject gameObject = GameObject.CreatePrimitive (PrimitiveType.Quad);
- Mesh mesh = gameObject.GetComponent ().sharedMesh;
- GameObject.DestroyImmediate (gameObject);
+ GameObject gameObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
+ Mesh mesh = gameObject.GetComponent().sharedMesh;
+ GameObject.DestroyImmediate(gameObject);
return mesh;
}
- private static bool CreateWithoutFolder (string filename)
+ private static bool CreateWithoutFolder(string filename)
{
- string directory = Path.GetDirectoryName (filename);
+ string directory = Path.GetDirectoryName(filename);
- if (Directory.Exists (directory + "/") == true)
+ if (Directory.Exists(directory + "/") == true)
return true;
- string[] values = directory.Split (new char[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
+ string[] values = directory.Split(new char[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
string checkFolder = string.Empty;
- foreach (var folder in values) {
+ foreach (var folder in values)
+ {
string baseFolder = checkFolder;
- if (!string.IsNullOrEmpty (checkFolder)) {
- baseFolder = Path.GetDirectoryName (checkFolder);
+ if (!string.IsNullOrEmpty(checkFolder))
+ {
+ baseFolder = Path.GetDirectoryName(checkFolder);
}
checkFolder += folder;
- if (System.IO.Directory.Exists (checkFolder + "/") != true) {
- UnityEditor.AssetDatabase.CreateFolder (baseFolder, folder);
+ if (Directory.Exists(checkFolder + "/") != true)
+ {
+ AssetDatabase.CreateFolder(baseFolder, folder);
}
checkFolder += "/";
}
diff --git a/Assets/FaceMaskExample/FaceMaskExample.cs b/Assets/FaceMaskExample/FaceMaskExample.cs
index e604439..5eab322 100644
--- a/Assets/FaceMaskExample/FaceMaskExample.cs
+++ b/Assets/FaceMaskExample/FaceMaskExample.cs
@@ -1,8 +1,7 @@
-using System.Collections;
+using OpenCVForUnity.CoreModule;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
-using OpenCVForUnity.CoreModule;
namespace FaceMaskExample
{
@@ -17,79 +16,79 @@ namespace FaceMaskExample
static float verticalNormalizedPosition = 1f;
// Use this for initialization
- void Start ()
+ void Start()
{
exampleTitle.text = "FaceMask Example " + Application.version;
- versionInfo.text = Core.NATIVE_LIBRARY_NAME + " " + OpenCVForUnity.UnityUtils.Utils.getVersion () + " (" + Core.VERSION + ")";
- versionInfo.text += " / " + "dlibfacelandmarkdetector" + " " + DlibFaceLandmarkDetector.UnityUtils.Utils.getVersion ();
+ versionInfo.text = Core.NATIVE_LIBRARY_NAME + " " + OpenCVForUnity.UnityUtils.Utils.getVersion() + " (" + Core.VERSION + ")";
+ versionInfo.text += " / " + "dlibfacelandmarkdetector" + " " + DlibFaceLandmarkDetector.UnityUtils.Utils.getVersion();
versionInfo.text += " / UnityEditor " + Application.unityVersion;
versionInfo.text += " / ";
- #if UNITY_EDITOR
+#if UNITY_EDITOR
versionInfo.text += "Editor";
- #elif UNITY_STANDALONE_WIN
+#elif UNITY_STANDALONE_WIN
versionInfo.text += "Windows";
- #elif UNITY_STANDALONE_OSX
+#elif UNITY_STANDALONE_OSX
versionInfo.text += "Mac OSX";
- #elif UNITY_STANDALONE_LINUX
+#elif UNITY_STANDALONE_LINUX
versionInfo.text += "Linux";
- #elif UNITY_ANDROID
+#elif UNITY_ANDROID
versionInfo.text += "Android";
- #elif UNITY_IOS
+#elif UNITY_IOS
versionInfo.text += "iOS";
- #elif UNITY_WSA
+#elif UNITY_WSA
versionInfo.text += "WSA";
- #elif UNITY_WEBGL
+#elif UNITY_WEBGL
versionInfo.text += "WebGL";
- #endif
+#endif
versionInfo.text += " ";
- #if ENABLE_MONO
+#if ENABLE_MONO
versionInfo.text += "Mono";
- #elif ENABLE_IL2CPP
+#elif ENABLE_IL2CPP
versionInfo.text += "IL2CPP";
- #elif ENABLE_DOTNET
+#elif ENABLE_DOTNET
versionInfo.text += ".NET";
- #endif
+#endif
scrollRect.verticalNormalizedPosition = verticalNormalizedPosition;
}
// Update is called once per frame
- void Update ()
+ void Update()
{
}
- public void OnScrollRectValueChanged ()
+ public void OnScrollRectValueChanged()
{
verticalNormalizedPosition = scrollRect.verticalNormalizedPosition;
}
- public void OnShowLicenseButtonClick ()
+ public void OnShowLicenseButtonClick()
{
- SceneManager.LoadScene ("ShowLicense");
+ SceneManager.LoadScene("ShowLicense");
}
- public void OnTexture2DFaceMaskExampleButtonClick ()
+ public void OnTexture2DFaceMaskExampleButtonClick()
{
- SceneManager.LoadScene ("Texture2DFaceMaskExample");
+ SceneManager.LoadScene("Texture2DFaceMaskExample");
}
- public void OnVideoCaptureFaceMaskExampleButtonClick ()
+ public void OnVideoCaptureFaceMaskExampleButtonClick()
{
- SceneManager.LoadScene ("VideoCaptureFaceMaskExample");
+ SceneManager.LoadScene("VideoCaptureFaceMaskExample");
}
- public void OnWebCamTextureFaceMaskExampleButtonClick ()
+ public void OnWebCamTextureFaceMaskExampleButtonClick()
{
- SceneManager.LoadScene ("WebCamTextureFaceMaskExample");
+ SceneManager.LoadScene("WebCamTextureFaceMaskExample");
}
- public void OnWebCamTextureFaceMaskAdditionalExampleButtonClick ()
+ public void OnWebCamTextureFaceMaskAdditionalExampleButtonClick()
{
- SceneManager.LoadScene ("WebCamTextureFaceMaskAdditionalExample");
+ SceneManager.LoadScene("WebCamTextureFaceMaskAdditionalExample");
}
}
}
\ No newline at end of file
diff --git a/Assets/FaceMaskExample/FaceMaskPrefab/DlibFaceLandmark68Mesh.asset b/Assets/FaceMaskExample/FaceMaskPrefab/DlibFaceLandmark68Mesh.asset
index bf6c048..ad2cb70 100644
--- a/Assets/FaceMaskExample/FaceMaskPrefab/DlibFaceLandmark68Mesh.asset
+++ b/Assets/FaceMaskExample/FaceMaskPrefab/DlibFaceLandmark68Mesh.asset
@@ -3,15 +3,17 @@
--- !u!43 &4300000
Mesh:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_Name: DlibFaceLandmark68Mesh
- serializedVersion: 8
+ serializedVersion: 9
m_SubMeshes:
- serializedVersion: 2
firstByte: 0
indexCount: 327
topology: 0
+ baseVertex: 0
firstVertex: 0
vertexCount: 68
localAABB:
@@ -29,10 +31,10 @@ Mesh:
m_IsReadable: 1
m_KeepVertices: 1
m_KeepIndices: 1
+ m_IndexFormat: 0
m_IndexBuffer: 000024000100010024002900010029001f00290028001f0028001d001f00280027001d0027001c001d0027001b001c00270015001b002600150027001400150026002500140026002500130014001200130025001200250024001100120024000000110024002400250029002500280029002500260028002600270028002d0010000f002e002d000f002e000f0023002f002e0023001d002f0023002a002f001d001c002a001d001b002a001c001b0016002a0016002b002a00160017002b0017002c002b00170018002c00180019002c002c0019002d0019001a002d002d001a0010002c002d002e002f002c002e002b002c002f002a002b002f00140017001500150017001600150016001b001d001e001f001d0023001e001e0020001f001e00210020001e00220021001e002300220001001f00020002001f00030023000f000e0023000e000d002100330032002000210032001f00200032001f00320031001f003100300003001f00300003003000040004003000050030003b00050005003b0006003b003a0006003a00070006003a003900070039000800070039000900080039003800090038000a000900380037000a0037000b000a00370036000b0036000c000b0036000d000c0023000d003600230036003500230035003400220023003400210022003400210034003300300031003c0030003c003b00310032003d0031003d003c003c0043003b003b0043003a00320033003d0033003e003d00430042003a00420039003a00330034003f0033003f003e00420041003800420038003900340035003f00350040003f004100400037004100370038003500360040004000360037003c003d0043003d003e0043003e00420043003e003f0041003e00410042003f0040004100
- m_Skin: []
m_VertexData:
- m_CurrentChannels: 27
+ serializedVersion: 2
m_VertexCount: 68
m_Channels:
- stream: 0
@@ -47,6 +49,10 @@ Mesh:
offset: 0
format: 0
dimension: 0
+ - stream: 0
+ offset: 0
+ format: 0
+ dimension: 0
- stream: 0
offset: 24
format: 0
@@ -67,6 +73,26 @@ Mesh:
offset: 0
format: 0
dimension: 0
+ - stream: 0
+ offset: 0
+ format: 0
+ dimension: 0
+ - stream: 0
+ offset: 0
+ format: 0
+ dimension: 0
+ - stream: 0
+ offset: 0
+ format: 0
+ dimension: 0
+ - stream: 0
+ offset: 0
+ format: 0
+ dimension: 0
+ - stream: 0
+ offset: 0
+ format: 0
+ dimension: 0
m_DataSize: 2720
_typelessdata: 00008bbe0000403c000000000000000000000000000080bf00006a3e0000033f00006a3e0000033f000084be00008cbd000000000000000000000000000080bf0000783e0000dd3e0000783e0000dd3e00007abe000014be000000000000000000000000000080bf0000833e0000b63e0000833e0000b63e000070be000062be000000000000000000000000000080bf0000883e00008f3e0000883e00008f3e00005cbe000094be000000000000000000000000000080bf0000923e0000583e0000923e0000583e000032be0000b1be000000000000000000000000000080bf0000a73e00001e3e0000a73e00001e3e000000be0000cbbe000000000000000000000000ffff7fbf0000c03e0000d43d0000c03e0000d43d000088bd0000e0be000000000000000000000000000080bf0000de3e0000803d0000de3e0000803d0000203c0000e5be000000000000000000000000ffff7fbf0080023f0000583d0080023f0000583d0000b03d0000debe000000000000000000000000ffff7fbf0000163f0000883d0000163f0000883d0000103e0000c5be000000000000000000000000000080bf0000243f0000ec3d0000243f0000ec3d0000423e0000a9be000000000000000000000000000080bf0080303f00002e3e0080303f00002e3e0000683e00008abe000000000000000000000000000080bf00003a3f00006c3e00003a3f00006c3e00007e3e00004abe000000000000000000000000000080bf00803f3f00009b3e00803f3f00009b3e0000833e0000fcbd000000000000000000000000ffff7fbf0080413f0000c13e0080413f0000c13e0000883e000048bd000000000000000000000000000080bf0000443f0000e73e0000443f0000e73e00008d3e0000f03c000000000000000000000000000080bf0080463f0080073f0080463f0080073f000072be0000803d000000000000000000000000000080bf0000873e0000103f0000873e0000103f000052be0000cc3d000000000000000000000000000080bf0000973e0080193f0000973e0080193f000022be0000f03d000000000000000000000000ffff7fbf0000af3e00001e3f0000af3e00001e3f0000d8bd0000003e000000000000000000000000ffff7fbf0000ca3e0000203f0000ca3e0000203f000060bd0000cc3d000000000000000000000000000080bf0000e43e0080193f0000e43e0080193f0000483d0000cc3d000000000000000000000000000080bf00800c3f0080193f00800c3f0080193f0000d03d0000023e000000000000000000000000ffff7fbf00001a3f0080203f00001a3f0080203f00001c3e0000f43d000000000000000000000000ffff7fbf0000273f00801e3f0000273f00801e3f00004c3e0000cc3d000000000000000000000000000080bf0000333f0080193f0000333f0080193f00006c3e0000883d000000000000000000000000000080bf00003b3f0000113f00003b3f0000113f000000bb0000603d000000000000000000000000ffff7fbf0000ff3e00000e3f0000ff3e00000e3f000000000000803b000000000000000000000000000080bf0000003f0000013f0000003f0000013f0000003b000038bd000000000000000000000000000080bf0080003f0000e93e0080003f0000e93e0000803b0000c8bd000000000000000000000000000080bf0000013f0000ce3e0000013f0000ce3e000050bd000004be000000000000000000000000000080bf0000e63e0000be3e0000e63e0000be3e0000d0bc00000abe000000000000000000000000000080bf0000f33e0000bb3e0000f33e0000bb3e0000c03b000012be000000000000000000000000ffff7fbf0080013f0000b73e0080013f0000b73e0000103d000008be000000000000000000000000000080bf0000093f0000bc3e0000093f0000bc3e0000803d000000be000000000000000000000000000080bf0000103f0000c03e0000103f0000c03e000030be0000183d000000000000000000000000ffff7fbf0000a83e0080093f0000a83e0080093f000014be0000583d000000000000000000000000000080bf0000b63e00800d3f0000b63e00800d3f0000e0bd0000583d000000000000000000000000000080bf0000c83e00800d3f0000c83e00800d3f0000a8bd0000083d000000000000000000000000000080bf0000d63e0080083f0000d63e0080083f0000e4bd0000f03c000000000000000000000000ffff7fbf0000c73e0080073f0000c73e0080073f000014be0000e03c000000000000000000000000000080bf0000b63e0000073f0000b63e0000073f0000a03d0000103d000000000000000000000000000080bf0000143f0000093f0000143f0000093f0000d83d0000603d000000000000000000000000000080bf00001b3f00000e3f00001b3f00000e3f00000e3e0000603d000000000000000000000000ffff7fbf0080233f00000e3f0080233f00000e3f00002a3e0000283d000000000000000000000000000080bf00802a3f00800a3f00802a3f00800a3f0000103e0000003d000000000000000000000000000080bf0000243f0000083f0000243f0000083f0000dc3d0000003d000000000000000000000000ffff7fbf00801b3f0000083f00801b3f0000083f0000e8bd000068be000000000000000000000000000080bf0000c63e00008c3e0000c63e00008c3e000094bd000050be000000000000000000000000000080bf0000db3e0000983e0000db3e0000983e0000e0bc00004abe000000000000000000000000000080bf0000f23e00009b3e0000f23e00009b3e0000203c000050be000000000000000000000000000080bf0080023f0000983e0080023f0000983e0000403d00004abe000000000000000000000000000080bf00000c3f00009b3e00000c3f00009b3e0000b43d00004abe000000000000000000000000000080bf0080163f00009b3e0080163f00009b3e0000043e00005ebe000000000000000000000000000080bf0000213f0000913e0000213f0000913e0000bc3d000083be000000000000000000000000000080bf0080173f00007a3e0080173f00007a3e0000503d00008cbe000000000000000000000000000080bf00000d3f0000683e00000d3f0000683e0000203c00008ebe000000000000000000000000000080bf0080023f0000643e0080023f0000643e0000f0bc00008cbe000000000000000000000000000080bf0000f13e0000683e0000f13e0000683e000098bd000084be000000000000000000000000ffff7fbf0000da3e0000783e0000da3e0000783e0000ccbd00006abe000000000000000000000000000080bf0000cd3e00008b3e0000cd3e00008b3e0000e0bc000066be000000000000000000000000ffff7fbf0000f23e00008d3e0000f23e00008d3e0000203c00006abe000000000000000000000000ffff7fbf0080023f00008b3e0080023f00008b3e0000403d000064be000000000000000000000000000080bf00000c3f00008e3e00000c3f00008e3e0000e83d000060be000000000000000000000000000080bf00001d3f0000903e00001d3f0000903e0000483d00007cbe000000000000000000000000ffff7fbf00800c3f0000823e00800c3f0000823e0000203c000080be000000000000000000000000000080bf0080023f0000803e0080023f0000803e0000e0bc00007ebe000000000000000000000000000080bf0000f23e0000813e0000f23e0000813e
m_CompressedMesh:
@@ -127,4 +153,10 @@ Mesh:
m_MeshUsageFlags: 0
m_BakedConvexCollisionMesh:
m_BakedTriangleCollisionMesh:
+ m_MeshMetrics[0]: 1
+ m_MeshMetrics[1]: 1
m_MeshOptimized: 0
+ m_StreamData:
+ offset: 0
+ size: 0
+ path:
diff --git a/Assets/FaceMaskExample/FaceMaskPrefab/DlibFaceLandmark68Mesh.asset.meta b/Assets/FaceMaskExample/FaceMaskPrefab/DlibFaceLandmark68Mesh.asset.meta
index 4056c09..f792f17 100644
--- a/Assets/FaceMaskExample/FaceMaskPrefab/DlibFaceLandmark68Mesh.asset.meta
+++ b/Assets/FaceMaskExample/FaceMaskPrefab/DlibFaceLandmark68Mesh.asset.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
guid: 67f7db10ac869ee479d4495c3d7af34d
-timeCreated: 1563459566
-licenseType: Free
NativeFormatImporter:
+ externalObjects: {}
mainObjectFileID: 4300000
userData:
assetBundleName:
diff --git a/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskAlphaMask.png.meta b/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskAlphaMask.png.meta
index 0e28713..20b38f9 100644
--- a/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskAlphaMask.png.meta
+++ b/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskAlphaMask.png.meta
@@ -1,10 +1,9 @@
fileFormatVersion: 2
guid: 470faf94133e4a741bb9abe37e1dfb1f
-timeCreated: 1563459565
-licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
- serializedVersion: 4
+ externalObjects: {}
+ serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
@@ -12,6 +11,8 @@ TextureImporter:
linearTexture: 0
fadeOut: 0
borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
@@ -20,6 +21,8 @@ TextureImporter:
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
@@ -27,10 +30,13 @@ TextureImporter:
textureFormat: 1
maxTextureSize: 2048
textureSettings:
+ serializedVersion: 2
filterMode: -1
aniso: -1
- mipBias: -1
- wrapMode: 1
+ mipBias: -100
+ wrapU: 1
+ wrapV: 1
+ wrapW: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
@@ -39,30 +45,44 @@ TextureImporter:
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
- spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
+ singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- - buildTarget: DefaultTexturePlatform
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
maxTextureSize: 1024
+ resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
+ androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ vertices: []
+ indices:
+ edges: []
+ weights: []
spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
diff --git a/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskMaterial.mat b/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskMaterial.mat
index 19a1bb1..1a3c74d 100644
--- a/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskMaterial.mat
+++ b/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskMaterial.mat
@@ -4,8 +4,9 @@
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_Name: FaceMaskMaterial
m_Shader: {fileID: 4800000, guid: 007b092c44f554a4698c59144e1a2b7f, type: 3}
m_ShaderKeywords:
diff --git a/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskMaterial.mat.meta b/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskMaterial.mat.meta
index 87fc472..9aa60ab 100644
--- a/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskMaterial.mat.meta
+++ b/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskMaterial.mat.meta
@@ -1,8 +1,7 @@
fileFormatVersion: 2
guid: 61fa2fcb482ca224e991e0be29d75304
-timeCreated: 1563459565
-licenseType: Free
NativeFormatImporter:
+ externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
diff --git a/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskTrackedMesh.prefab b/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskTrackedMesh.prefab
index d853947..9977486 100644
--- a/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskTrackedMesh.prefab
+++ b/Assets/FaceMaskExample/FaceMaskPrefab/FaceMaskTrackedMesh.prefab
@@ -1,22 +1,12 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
---- !u!1001 &100100000
-Prefab:
- m_ObjectHideFlags: 1
- serializedVersion: 2
- m_Modification:
- m_TransformParent: {fileID: 0}
- m_Modifications: []
- m_RemovedComponents: []
- m_ParentPrefab: {fileID: 0}
- m_RootGameObject: {fileID: 1615476950310458}
- m_IsPrefabParent: 1
--- !u!1 &1615476950310458
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 100100000}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 4924589846472214}
- component: {fileID: 33685472964065464}
@@ -32,9 +22,10 @@ GameObject:
m_IsActive: 1
--- !u!4 &4924589846472214
Transform:
- m_ObjectHideFlags: 1
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 100100000}
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1615476950310458}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -43,18 +34,44 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!33 &33685472964065464
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1615476950310458}
+ m_Mesh: {fileID: 4300000, guid: 67f7db10ac869ee479d4495c3d7af34d, type: 2}
+--- !u!64 &64284030821688990
+MeshCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1615476950310458}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 3
+ m_Convex: 0
+ m_CookingOptions: 14
+ m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &23560507476807706
MeshRenderer:
- m_ObjectHideFlags: 1
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 100100000}
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1615476950310458}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 61fa2fcb482ca224e991e0be29d75304, type: 2}
m_StaticBatchInfo:
@@ -67,6 +84,7 @@ MeshRenderer:
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
@@ -75,32 +93,12 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
---- !u!33 &33685472964065464
-MeshFilter:
- m_ObjectHideFlags: 1
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 100100000}
- m_GameObject: {fileID: 1615476950310458}
- m_Mesh: {fileID: 4300000, guid: 67f7db10ac869ee479d4495c3d7af34d, type: 2}
---- !u!64 &64284030821688990
-MeshCollider:
- m_ObjectHideFlags: 1
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 100100000}
- m_GameObject: {fileID: 1615476950310458}
- m_Material: {fileID: 0}
- m_IsTrigger: 0
- m_Enabled: 1
- serializedVersion: 2
- m_Convex: 0
- m_InflateMesh: 0
- m_SkinWidth: 0.01
- m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &114170669961178786
MonoBehaviour:
- m_ObjectHideFlags: 1
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 100100000}
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1615476950310458}
m_Enabled: 1
m_EditorHideFlags: 0
diff --git a/Assets/FaceMaskExample/ReadMe.pdf b/Assets/FaceMaskExample/ReadMe.pdf
index 03e7727..262d591 100644
Binary files a/Assets/FaceMaskExample/ReadMe.pdf and b/Assets/FaceMaskExample/ReadMe.pdf differ
diff --git a/Assets/FaceMaskExample/RectangleTracker/Scripts/RectangleTracker.cs b/Assets/FaceMaskExample/RectangleTracker/Scripts/RectangleTracker.cs
index 48825ec..d9c40e3 100644
--- a/Assets/FaceMaskExample/RectangleTracker/Scripts/RectangleTracker.cs
+++ b/Assets/FaceMaskExample/RectangleTracker/Scripts/RectangleTracker.cs
@@ -1,8 +1,8 @@
-using System;
+using OpenCVForUnity.CoreModule;
+using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
-using OpenCVForUnity.CoreModule;
using Rect = OpenCVForUnity.CoreModule.Rect;
namespace OpenCVForUnity.RectangleTrack
@@ -10,22 +10,26 @@ namespace OpenCVForUnity.RectangleTrack
///
/// Rectangle tracker.
/// Referring to https://github.com/Itseez/opencv/blob/master/modules/objdetect/src/detection_based_tracker.cpp.
- /// v 1.0.3
+ /// v 1.0.4
///
public class RectangleTracker
{
- public List trackedObjects {
+ public List trackedObjects
+ {
get { return _trackedObjects; }
}
private List _trackedObjects;
- public TrackerParameters trackerParameters {
+ public TrackerParameters trackerParameters
+ {
get { return _trackerParameters; }
- set {
- if (value == null) {
- throw new ArgumentNullException ("value");
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
}
_trackerParameters = value;
}
@@ -34,44 +38,53 @@ namespace OpenCVForUnity.RectangleTrack
private TrackerParameters _trackerParameters;
- public List weightsPositionsSmoothing {
+ public List weightsPositionsSmoothing
+ {
get { return _weightsPositionsSmoothing; }
- set {
- if (value == null) {
- throw new ArgumentNullException ("value");
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
}
_weightsPositionsSmoothing = value;
}
}
- private List _weightsPositionsSmoothing = new List ();
+ private List _weightsPositionsSmoothing = new List();
- public List weightsSizesSmoothing {
+ public List weightsSizesSmoothing
+ {
get { return _weightsSizesSmoothing; }
- set {
- if (value == null) {
- throw new ArgumentNullException ("value");
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException("value");
}
_weightsSizesSmoothing = value;
}
}
- private List _weightsSizesSmoothing = new List ();
+ private List _weightsSizesSmoothing = new List();
- public RectangleTracker (TrackerParameters trackerParamerers = null)
+ public RectangleTracker(TrackerParameters trackerParamerers = null)
{
- _trackedObjects = new List ();
+ _trackedObjects = new List();
- if (trackerParamerers != null) {
+ if (trackerParamerers != null)
+ {
this._trackerParameters = trackerParamerers;
- } else {
- this._trackerParameters = new TrackerParameters ();
+ }
+ else
+ {
+ this._trackerParameters = new TrackerParameters();
}
- _weightsPositionsSmoothing.Add (1);
- _weightsSizesSmoothing.Add (0.5f);
- _weightsSizesSmoothing.Add (0.3f);
- _weightsSizesSmoothing.Add (0.2f);
+ _weightsPositionsSmoothing.Add(1);
+ _weightsSizesSmoothing.Add(0.5f);
+ _weightsSizesSmoothing.Add(0.3f);
+ _weightsSizesSmoothing.Add(0.2f);
}
public enum TrackedRectState : int
@@ -81,66 +94,76 @@ namespace OpenCVForUnity.RectangleTrack
}
- public void GetObjects (List result, bool smoothing = true)
+ public void GetObjects(List result, bool smoothing = true)
{
- result.Clear ();
+ result.Clear();
int count = _trackedObjects.Count;
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++)
+ {
Rect r;
- if (smoothing) {
- r = GetSmoothingRect (i);
- } else {
- r = _trackedObjects [i].position;
+ if (smoothing)
+ {
+ r = GetSmoothingRect(i);
+ }
+ else
+ {
+ r = _trackedObjects[i].position;
}
- if (_trackedObjects [i].state > TrackedState.NEW_DISPLAYED && _trackedObjects [i].state < TrackedState.NEW_HIDED)
- result.Add (r);
+ if (_trackedObjects[i].state > TrackedState.NEW_DISPLAYED && _trackedObjects[i].state < TrackedState.NEW_HIDED)
+ result.Add(r);
//LOGD("DetectionBasedTracker::process: found a object with SIZE %d x %d, rect={%d, %d, %d x %d}", r.width, r.height, r.x, r.y, r.width, r.height);
//Debug.Log("GetObjects" + r.width + " " + r.height + " " + r.x + " " + r.y + " " + r.width + " " + r.height + " " + trackedObjects[i].state + " " + trackedObjects[i].numDetectedFrames + " " + trackedObjects[i].numFramesNotDetected);
}
}
- public void GetObjects (List result, bool smoothing = true)
+ public void GetObjects(List result, bool smoothing = true)
{
- result.Clear ();
+ result.Clear();
int count = _trackedObjects.Count;
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++)
+ {
Rect r;
- if (smoothing) {
- r = GetSmoothingRect (i);
- } else {
- r = _trackedObjects [i].position;
+ if (smoothing)
+ {
+ r = GetSmoothingRect(i);
+ }
+ else
+ {
+ r = _trackedObjects[i].position;
}
- result.Add (new TrackedRect (_trackedObjects [i].id, r, _trackedObjects [i].state, _trackedObjects [i].numDetectedFrames, _trackedObjects [i].numFramesNotDetected));
+ result.Add(new TrackedRect(_trackedObjects[i].id, r, _trackedObjects[i].state, _trackedObjects[i].numDetectedFrames, _trackedObjects[i].numFramesNotDetected));
//LOGD("DetectionBasedTracker::process: found a object with SIZE %d x %d, rect={%d, %d, %d x %d}", r.width, r.height, r.x, r.y, r.width, r.height);
//Debug.Log("GetObjects" + r.width + " " + r.height + " " + r.x + " " + r.y + " " + r.width + " " + r.height + " " + trackedObjects[i].state + " " + trackedObjects[i].numDetectedFrames + " " + trackedObjects[i].numFramesNotDetected);
}
}
- public void UpdateTrackedObjects (List detectedObjects)
+ public void UpdateTrackedObjects(List detectedObjects)
{
if (detectedObjects == null)
- throw new ArgumentNullException ("detectedObjects");
+ throw new ArgumentNullException("detectedObjects");
- Rect[] correctionRects = CreateCorrectionBySpeedOfRects ();
+ Rect[] correctionRects = CreateCorrectionBySpeedOfRects();
int N1 = (int)_trackedObjects.Count;
int N2 = (int)detectedObjects.Count;
- for (int i = 0; i < N1; i++) {
- _trackedObjects [i].numDetectedFrames++;
+ for (int i = 0; i < N1; i++)
+ {
+ _trackedObjects[i].numDetectedFrames++;
}
- int[] correspondence = Enumerable.Repeat ((int)TrackedRectState.NEW_RECTANGLE, N2).ToArray ();
+ int[] correspondence = Enumerable.Repeat((int)TrackedRectState.NEW_RECTANGLE, N2).ToArray();
- for (int i = 0; i < N1; i++) {
- TrackedObject curObject = _trackedObjects [i];
+ for (int i = 0; i < N1; i++)
+ {
+ TrackedObject curObject = _trackedObjects[i];
int bestIndex = -1;
int bestArea = -1;
@@ -149,82 +172,101 @@ namespace OpenCVForUnity.RectangleTrack
//if (numpositions > 0) UnityEngine.Debug.LogError("numpositions > 0 is false");
//OpenCVRect prevRect = curObject.lastPositions[numpositions - 1];
- Rect prevRect = correctionRects [i];
+ Rect prevRect = correctionRects[i];
- for (int j = 0; j < N2; j++) {
- if (correspondence [j] >= 0) {
+ for (int j = 0; j < N2; j++)
+ {
+ if (correspondence[j] >= 0)
+ {
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: j=" + j + " is rejected, because it has correspondence=" + correspondence[j]);
continue;
}
- if (correspondence [j] != (int)TrackedRectState.NEW_RECTANGLE) {
+ if (correspondence[j] != (int)TrackedRectState.NEW_RECTANGLE)
+ {
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: j=" + j + " is rejected, because it is intersected with another rectangle");
continue;
}
- if (IsCollideByRectangle (prevRect, detectedObjects [j], _trackerParameters.coeffRectangleOverlap)) {
- Rect r = Intersect (prevRect, detectedObjects [j]);
- if ((r.width > 0) && (r.height > 0)) {
+ if (IsCollideByRectangle(prevRect, detectedObjects[j], _trackerParameters.coeffRectangleOverlap))
+ {
+ Rect r = Intersect(prevRect, detectedObjects[j]);
+ if ((r.width > 0) && (r.height > 0))
+ {
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: There is intersection between prevRect and detectedRect r={" + r.x + ", " + r.y + ", " + r.width + ", " + r.height + "]");
- correspondence [j] = (int)TrackedRectState.INTERSECTED_RECTANGLE;
+ correspondence[j] = (int)TrackedRectState.INTERSECTED_RECTANGLE;
- if (r.area () > bestArea) {
+ if (r.area() > bestArea)
+ {
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: The area of intersection is " + r.area() + " it is better than bestArea= " + bestArea);
bestIndex = j;
- bestArea = (int)r.area ();
+ bestArea = (int)r.area();
}
}
}
}
- if (bestIndex >= 0) {
+ if (bestIndex >= 0)
+ {
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: The best correspondence for i=" + i + " is j=" + bestIndex);
- correspondence [bestIndex] = i;
+ correspondence[bestIndex] = i;
- Rect bestRect = detectedObjects [bestIndex];
+ Rect bestRect = detectedObjects[bestIndex];
- for (int j = 0; j < N2; j++) {
- if (correspondence [j] >= 0)
+ for (int j = 0; j < N2; j++)
+ {
+ if (correspondence[j] >= 0)
continue;
- if (IsCollideByRectangle (detectedObjects [j], bestRect, _trackerParameters.coeffRectangleOverlap)) {
- Rect r = Intersect (detectedObjects [j], bestRect);
+ if (IsCollideByRectangle(detectedObjects[j], bestRect, _trackerParameters.coeffRectangleOverlap))
+ {
+ Rect r = Intersect(detectedObjects[j], bestRect);
- if ((r.width > 0) && (r.height > 0)) {
+ if ((r.width > 0) && (r.height > 0))
+ {
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: Found intersection between rectangles j= " + j + " and bestIndex= " + bestIndex + " rectangle j= " + j + " is marked as intersected");
- correspondence [j] = (int)TrackedRectState.INTERSECTED_RECTANGLE;
+ correspondence[j] = (int)TrackedRectState.INTERSECTED_RECTANGLE;
}
}
}
- } else {
+ }
+ else
+ {
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: There is no correspondence for i= " + i);
curObject.numFramesNotDetected++;
}
}
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: start second cycle");
- for (int j = 0; j < N2; j++) {
- int i = correspondence [j];
- if (i >= 0) {//add position
+ for (int j = 0; j < N2; j++)
+ {
+ int i = correspondence[j];
+ if (i >= 0)
+ {//add position
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: add position");
- _trackedObjects [i].lastPositions.Add (detectedObjects [j]);
- while ((int)_trackedObjects [i].lastPositions.Count > (int)_trackerParameters.numLastPositionsToTrack) {
- _trackedObjects [i].lastPositions.Remove (_trackedObjects [i].lastPositions [0]);
+ _trackedObjects[i].lastPositions.Add(detectedObjects[j]);
+ while ((int)_trackedObjects[i].lastPositions.Count > (int)_trackerParameters.numLastPositionsToTrack)
+ {
+ _trackedObjects[i].lastPositions.Remove(_trackedObjects[i].lastPositions[0]);
}
- _trackedObjects [i].numFramesNotDetected = 0;
- if (_trackedObjects [i].state != TrackedState.DELETED)
- _trackedObjects [i].state = TrackedState.DISPLAYED;
- } else if (i == (int)TrackedRectState.NEW_RECTANGLE) { //new object
+ _trackedObjects[i].numFramesNotDetected = 0;
+ if (_trackedObjects[i].state != TrackedState.DELETED)
+ _trackedObjects[i].state = TrackedState.DISPLAYED;
+ }
+ else if (i == (int)TrackedRectState.NEW_RECTANGLE)
+ { //new object
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: new object");
- _trackedObjects.Add (new TrackedObject (detectedObjects [j]));
- } else {
+ _trackedObjects.Add(new TrackedObject(detectedObjects[j]));
+ }
+ else
+ {
//Debug.Log("DetectionBasedTracker::updateTrackedObjects: was auxiliary intersection");
}
}
@@ -232,187 +274,225 @@ namespace OpenCVForUnity.RectangleTrack
int t = 0;
TrackedObject it;
- while (t < _trackedObjects.Count) {
- it = _trackedObjects [t];
+ while (t < _trackedObjects.Count)
+ {
+ it = _trackedObjects[t];
- if (it.state == TrackedState.DELETED) {
- _trackedObjects.Remove (it);
- } else if ((it.numFramesNotDetected > _trackerParameters.maxTrackLifetime)//ALL
- ||
- ((it.numDetectedFrames <= _trackerParameters.numStepsToWaitBeforeFirstShow)
- &&
- (it.numFramesNotDetected > _trackerParameters.numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown))) {
+ if (it.state == TrackedState.DELETED)
+ {
+ _trackedObjects.Remove(it);
+ }
+ else if ((it.numFramesNotDetected > _trackerParameters.maxTrackLifetime)//ALL
+ ||
+ ((it.numDetectedFrames <= _trackerParameters.numStepsToWaitBeforeFirstShow)
+ &&
+ (it.numFramesNotDetected > _trackerParameters.numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown)))
+ {
it.state = TrackedState.DELETED;
t++;
- } else if (it.state >= TrackedState.DISPLAYED) {//DISPLAYED, NEW_DISPLAYED, HIDED
+ }
+ else if (it.state >= TrackedState.DISPLAYED)
+ {//DISPLAYED, NEW_DISPLAYED, HIDED
- if (it.numDetectedFrames < _trackerParameters.numStepsToWaitBeforeFirstShow) {
+ if (it.numDetectedFrames < _trackerParameters.numStepsToWaitBeforeFirstShow)
+ {
it.state = TrackedState.PENDING;
- } else if (it.numDetectedFrames == _trackerParameters.numStepsToWaitBeforeFirstShow) {
+ }
+ else if (it.numDetectedFrames == _trackerParameters.numStepsToWaitBeforeFirstShow)
+ {
//i, trackedObjects[i].numDetectedFrames, innerParameters.numStepsToWaitBeforeFirstShow);
it.state = TrackedState.NEW_DISPLAYED;
- } else if (it.numFramesNotDetected == _trackerParameters.numStepsToShowWithoutDetecting) {
+ }
+ else if (it.numFramesNotDetected == _trackerParameters.numStepsToShowWithoutDetecting)
+ {
it.state = TrackedState.NEW_HIDED;
- } else if (it.numFramesNotDetected > _trackerParameters.numStepsToShowWithoutDetecting) {
+ }
+ else if (it.numFramesNotDetected > _trackerParameters.numStepsToShowWithoutDetecting)
+ {
it.state = TrackedState.HIDED;
}
t++;
- } else {//NEW
+ }
+ else
+ {//NEW
t++;
}
}
}
- public Rect[] CreateCorrectionBySpeedOfRects ()
+ public Rect[] CreateCorrectionBySpeedOfRects()
{
//Debug.Log("DetectionBasedTracker::process: get _rectsWhereRegions from previous positions");
Rect[] rectsWhereRegions = new Rect[_trackedObjects.Count];
int count = _trackedObjects.Count;
- for (int i = 0; i < count; i++) {
- int n = _trackedObjects [i].lastPositions.Count;
+ for (int i = 0; i < count; i++)
+ {
+ int n = _trackedObjects[i].lastPositions.Count;
//if (n > 0) UnityEngine.Debug.LogError("n > 0 is false");
- Rect r = _trackedObjects [i].lastPositions [n - 1].clone ();
- /*
- if (r.area() == 0)
- {
- Debug.Log("DetectionBasedTracker::process: ERROR: ATTENTION: strange algorithm's behavior: trackedObjects[i].rect() is empty");
- continue;
- }
- */
+ Rect r = _trackedObjects[i].lastPositions[n - 1].clone();
+
+ //if (r.area() == 0)
+ //{
+ // Debug.Log("DetectionBasedTracker::process: ERROR: ATTENTION: strange algorithm's behavior: trackedObjects[i].rect() is empty");
+ // continue;
+ //}
//correction by speed of rectangle
- if (n > 1) {
- Point center = CenterRect (r);
- Point center_prev = CenterRect (_trackedObjects [i].lastPositions [n - 2]);
- Point shift = new Point ((center.x - center_prev.x) * _trackerParameters.coeffObjectSpeedUsingInPrediction,
+ if (n > 1)
+ {
+ Point center = CenterRect(r);
+ Point center_prev = CenterRect(_trackedObjects[i].lastPositions[n - 2]);
+ Point shift = new Point((center.x - center_prev.x) * _trackerParameters.coeffObjectSpeedUsingInPrediction,
(center.y - center_prev.y) * _trackerParameters.coeffObjectSpeedUsingInPrediction);
- r.x += (int)Math.Round (shift.x);
- r.y += (int)Math.Round (shift.y);
+ r.x += (int)Math.Round(shift.x);
+ r.y += (int)Math.Round(shift.y);
}
- rectsWhereRegions [i] = r;
+ rectsWhereRegions[i] = r;
}
return rectsWhereRegions;
}
- private Point CenterRect (Rect r)
+ public Rect[] CreateRawRects()
{
- return new Point (r.x + (r.width / 2), r.y + (r.height / 2));
+ Rect[] rectsWhereRegions = new Rect[_trackedObjects.Count];
+
+ int count = _trackedObjects.Count;
+ for (int i = 0; i < count; i++)
+ {
+ rectsWhereRegions[i] = _trackedObjects[i].position;
+ }
+
+ return rectsWhereRegions;
}
- private Rect GetSmoothingRect (int i)
+ private Point CenterRect(Rect r)
+ {
+ return new Point(r.x + (r.width / 2), r.y + (r.height / 2));
+ }
+
+ private Rect GetSmoothingRect(int i)
{
//Debug.Log("trackedObjects[i].numFramesNotDetected: " + trackedObjects[i].numFramesNotDetected);
List weightsSizesSmoothing = _weightsSizesSmoothing;
List weightsPositionsSmoothing = _weightsPositionsSmoothing;
- List lastPositions = _trackedObjects [i].lastPositions;
+ List lastPositions = _trackedObjects[i].lastPositions;
int N = lastPositions.Count;
- if (N <= 0) {
- Debug.Log ("DetectionBasedTracker::calcTrackedObjectPositionToShow: ERROR: no positions for i=" + i);
- return new Rect ();
+ if (N <= 0)
+ {
+ Debug.Log("DetectionBasedTracker::calcTrackedObjectPositionToShow: ERROR: no positions for i=" + i);
+ return new Rect();
}
- int Nsize = Math.Min (N, (int)weightsSizesSmoothing.Count);
- int Ncenter = Math.Min (N, (int)weightsPositionsSmoothing.Count);
+ int Nsize = Math.Min(N, (int)weightsSizesSmoothing.Count);
+ int Ncenter = Math.Min(N, (int)weightsPositionsSmoothing.Count);
- Point center = new Point ();
+ Point center = new Point();
double w = 0, h = 0;
- if (Nsize > 0) {
+ if (Nsize > 0)
+ {
double sum = 0;
- for (int j = 0; j < Nsize; j++) {
+ for (int j = 0; j < Nsize; j++)
+ {
int k = N - j - 1;
- w += lastPositions [k].width * weightsSizesSmoothing [j];
- h += lastPositions [k].height * weightsSizesSmoothing [j];
- sum += weightsSizesSmoothing [j];
+ w += lastPositions[k].width * weightsSizesSmoothing[j];
+ h += lastPositions[k].height * weightsSizesSmoothing[j];
+ sum += weightsSizesSmoothing[j];
}
w /= sum;
h /= sum;
- } else {
- w = lastPositions [N - 1].width;
- h = lastPositions [N - 1].height;
+ }
+ else
+ {
+ w = lastPositions[N - 1].width;
+ h = lastPositions[N - 1].height;
}
- if (Ncenter > 0) {
+ if (Ncenter > 0)
+ {
double sum = 0;
- for (int j = 0; j < Ncenter; j++) {
+ for (int j = 0; j < Ncenter; j++)
+ {
int k = N - j - 1;
- Point tl = lastPositions [k].tl ();
- Point br = lastPositions [k].br ();
+ Point tl = lastPositions[k].tl();
+ Point br = lastPositions[k].br();
Point c1;
- c1 = new Point (tl.x * 0.5f, tl.y * 0.5f);
+ c1 = new Point(tl.x * 0.5f, tl.y * 0.5f);
Point c2;
- c2 = new Point (br.x * 0.5f, br.y * 0.5f);
- c1 = new Point (c1.x + c2.x, c1.y + c2.y);
+ c2 = new Point(br.x * 0.5f, br.y * 0.5f);
+ c1 = new Point(c1.x + c2.x, c1.y + c2.y);
- center = new Point (center.x + (c1.x * weightsPositionsSmoothing [j]), center.y + (c1.y * weightsPositionsSmoothing [j]));
- sum += weightsPositionsSmoothing [j];
+ center = new Point(center.x + (c1.x * weightsPositionsSmoothing[j]), center.y + (c1.y * weightsPositionsSmoothing[j]));
+ sum += weightsPositionsSmoothing[j];
}
- center = new Point (center.x * (1 / sum), center.y * (1 / sum));
- } else {
+ center = new Point(center.x * (1 / sum), center.y * (1 / sum));
+ }
+ else
+ {
int k = N - 1;
- Point tl = lastPositions [k].tl ();
- Point br = lastPositions [k].br ();
+ Point tl = lastPositions[k].tl();
+ Point br = lastPositions[k].br();
Point c1;
- c1 = new Point (tl.x * 0.5f, tl.y * 0.5f);
+ c1 = new Point(tl.x * 0.5f, tl.y * 0.5f);
Point c2;
- c2 = new Point (br.x * 0.5f, br.y * 0.5f);
+ c2 = new Point(br.x * 0.5f, br.y * 0.5f);
- center = new Point (c1.x + c2.x, c1.y + c2.y);
+ center = new Point(c1.x + c2.x, c1.y + c2.y);
}
- Point tl2 = new Point (center.x - (w * 0.5f), center.y - (h * 0.5f));
- Rect res = new Rect ((int)Math.Round (tl2.x), (int)Math.Round (tl2.y), (int)Math.Round (w), (int)Math.Round (h));
+ Point tl2 = new Point(center.x - (w * 0.5f), center.y - (h * 0.5f));
+ Rect res = new Rect((int)Math.Round(tl2.x), (int)Math.Round(tl2.y), (int)Math.Round(w), (int)Math.Round(h));
//Debug.Log("DetectionBasedTracker::calcTrackedObjectPositionToShow: Result for i=" + i + ": {" + res.x + ", " + res.y + ", " + res.width + ", " + res.height + "}");
return res;
}
- public void Reset ()
+ public void Reset()
{
- _trackedObjects.Clear ();
+ _trackedObjects.Clear();
}
- private Rect Intersect (Rect a, Rect b)
+ private Rect Intersect(Rect a, Rect b)
{
- int x1 = Math.Max (a.x, b.x);
- int x2 = Math.Min (a.x + a.width, b.x + b.width);
- int y1 = Math.Max (a.y, b.y);
- int y2 = Math.Min (a.y + a.height, b.y + b.height);
+ int x1 = Math.Max(a.x, b.x);
+ int x2 = Math.Min(a.x + a.width, b.x + b.width);
+ int y1 = Math.Max(a.y, b.y);
+ int y2 = Math.Min(a.y + a.height, b.y + b.height);
if (x2 >= x1 && y2 >= y1)
- return new Rect (x1, y1, x2 - x1, y2 - y1);
+ return new Rect(x1, y1, x2 - x1, y2 - y1);
else
- return new Rect ();
+ return new Rect();
}
- /*
- private bool IsCollideByCircle(Rect a, Rect b, float coeffRectangleOverlap)
- {
- int r1 = (int)(a.width / 2.0f);
- int r2 = (int)(b.width / 2.0f);
- int px1 = a.x + r1;
- int py1 = a.y + r1;
- int px2 = b.x + r2;
- int py2 = b.y + r2;
- if ((px2 - px1) * (px2 - px1) + (py2 - py1) * (py2 - py1) <= (r1 + r2) * (r1 + r2) * coeffRectangleOverlap)
- return true;
- else
- return false;
- }
- */
- private bool IsCollideByRectangle (Rect a, Rect b, float coeffRectangleOverlap)
+ //private bool IsCollideByCircle(Rect a, Rect b, float coeffRectangleOverlap)
+ //{
+ // int r1 = (int)(a.width / 2.0f);
+ // int r2 = (int)(b.width / 2.0f);
+ // int px1 = a.x + r1;
+ // int py1 = a.y + r1;
+ // int px2 = b.x + r2;
+ // int py2 = b.y + r2;
+
+ // if ((px2 - px1) * (px2 - px1) + (py2 - py1) * (py2 - py1) <= (r1 + r2) * (r1 + r2) * coeffRectangleOverlap)
+ // return true;
+ // else
+ // return false;
+ //}
+
+ private bool IsCollideByRectangle(Rect a, Rect b, float coeffRectangleOverlap)
{
int mw = (int)(a.width * coeffRectangleOverlap);
int mh = (int)(a.height * coeffRectangleOverlap);
@@ -434,9 +514,9 @@ namespace OpenCVForUnity.RectangleTrack
return false;
}
- public void Dispose ()
+ public void Dispose()
{
- Reset ();
+ Reset();
}
}
}
diff --git a/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackedObject.cs b/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackedObject.cs
index bdb1a3d..6a0c8df 100644
--- a/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackedObject.cs
+++ b/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackedObject.cs
@@ -22,27 +22,28 @@ namespace OpenCVForUnity.RectangleTrack
public int id;
public TrackedState state;
- public Rect position {
- get { return lastPositions [lastPositions.Count - 1].clone (); }
+ public Rect position
+ {
+ get { return lastPositions[lastPositions.Count - 1].clone(); }
}
static private int _id = 0;
- public TrackedObject (Rect rect)
+ public TrackedObject(Rect rect)
{
- lastPositions = new PositionsVector ();
-
+ lastPositions = new PositionsVector();
+
numDetectedFrames = 1;
numFramesNotDetected = 0;
state = TrackedState.NEW;
- lastPositions.Add (rect.clone ());
+ lastPositions.Add(rect.clone());
- _id = GetNextId ();
+ _id = GetNextId();
id = _id;
}
- static int GetNextId ()
+ static int GetNextId()
{
_id++;
return _id;
diff --git a/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackedRect.cs b/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackedRect.cs
index 7e36de6..155b40d 100644
--- a/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackedRect.cs
+++ b/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackedRect.cs
@@ -9,8 +9,8 @@ namespace OpenCVForUnity.RectangleTrack
public int id;
public TrackedState state;
- public TrackedRect (int id, Rect rect, TrackedState state, int numDetectedFrames, int numFramesNotDetected)
- : base (rect.x, rect.y, rect.width, rect.height)
+ public TrackedRect(int id, Rect rect, TrackedState state, int numDetectedFrames, int numFramesNotDetected)
+ : base(rect.x, rect.y, rect.width, rect.height)
{
this.numDetectedFrames = numDetectedFrames;
this.numFramesNotDetected = numFramesNotDetected;
diff --git a/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackerParameters.cs b/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackerParameters.cs
index bc9f214..d527a6e 100644
--- a/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackerParameters.cs
+++ b/Assets/FaceMaskExample/RectangleTracker/Scripts/TrackerParameters.cs
@@ -12,13 +12,13 @@
public float coeffObjectSpeedUsingInPrediction = 0.8f;
public float coeffRectangleOverlap = 0.7f;
- public TrackerParameters ()
+ public TrackerParameters()
{
}
- public TrackerParameters Clone ()
+ public TrackerParameters Clone()
{
- TrackerParameters trackerParameters = new TrackerParameters ();
+ TrackerParameters trackerParameters = new TrackerParameters();
trackerParameters.numLastPositionsToTrack = numLastPositionsToTrack;
trackerParameters.numStepsToWaitBeforeFirstShow = numStepsToWaitBeforeFirstShow;
trackerParameters.numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown = numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown;
diff --git a/Assets/FaceMaskExample/Scripts/FaceMaskColorCorrector/FaceMaskColorCorrector.cs b/Assets/FaceMaskExample/Scripts/FaceMaskColorCorrector/FaceMaskColorCorrector.cs
index 210e655..932c771 100644
--- a/Assets/FaceMaskExample/Scripts/FaceMaskColorCorrector/FaceMaskColorCorrector.cs
+++ b/Assets/FaceMaskExample/Scripts/FaceMaskColorCorrector/FaceMaskColorCorrector.cs
@@ -1,9 +1,8 @@
-using UnityEngine;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using OpenCVForUnity.CoreModule;
+using OpenCVForUnity.CoreModule;
using OpenCVForUnity.ImgprocModule;
+using System;
+using System.Collections.Generic;
+using UnityEngine;
using Rect = OpenCVForUnity.CoreModule.Rect;
namespace FaceMaskExample
@@ -17,159 +16,172 @@ namespace FaceMaskExample
Point[] src_facialContourPoints;
Point[] dst_facialContourPoints;
- public FaceMaskColorCorrector ()
+ public FaceMaskColorCorrector()
{
- LUTTexDict = new Dictionary ();
+ LUTTexDict = new Dictionary();
src_facialContourPoints = new Point[9];
- for (int i = 0; i < src_facialContourPoints.Length; i++) {
- src_facialContourPoints [i] = new Point ();
+ for (int i = 0; i < src_facialContourPoints.Length; i++)
+ {
+ src_facialContourPoints[i] = new Point();
}
dst_facialContourPoints = new Point[9];
- for (int i = 0; i < dst_facialContourPoints.Length; i++) {
- dst_facialContourPoints [i] = new Point ();
+ for (int i = 0; i < dst_facialContourPoints.Length; i++)
+ {
+ dst_facialContourPoints[i] = new Point();
}
}
- public virtual void CreateLUTTex (int id)
+ public virtual void CreateLUTTex(int id)
{
- if (!LUTTexDict.ContainsKey (id))
- LUTTexDict.Add (id, new Texture2D (256, 1, TextureFormat.RGB24, false));
+ if (!LUTTexDict.ContainsKey(id))
+ LUTTexDict.Add(id, new Texture2D(256, 1, TextureFormat.RGB24, false));
}
- public virtual Texture2D UpdateLUTTex (int id, Mat src, Mat dst, List src_landmarkPoints, List dst_landmarkPoints)
+ public virtual Texture2D UpdateLUTTex(int id, Mat src, Mat dst, List src_landmarkPoints, List dst_landmarkPoints)
{
- if (src_mask != null && (src.width () != src_mask.width () || src.height () != src_mask.height ())) {
- src_mask.Dispose ();
+ if (src_mask != null && (src.width() != src_mask.width() || src.height() != src_mask.height()))
+ {
+ src_mask.Dispose();
src_mask = null;
}
- src_mask = src_mask ?? new Mat (src.rows (), src.cols (), CvType.CV_8UC1, Scalar.all (0));
+ src_mask = src_mask ?? new Mat(src.rows(), src.cols(), CvType.CV_8UC1, Scalar.all(0));
- if (dst_mask != null && (dst.width () != dst_mask.width () || dst.height () != dst_mask.height ())) {
- dst_mask.Dispose ();
+ if (dst_mask != null && (dst.width() != dst_mask.width() || dst.height() != dst_mask.height()))
+ {
+ dst_mask.Dispose();
dst_mask = null;
}
- dst_mask = dst_mask ?? new Mat (dst.rows (), dst.cols (), CvType.CV_8UC1, Scalar.all (0));
+ dst_mask = dst_mask ?? new Mat(dst.rows(), dst.cols(), CvType.CV_8UC1, Scalar.all(0));
// Get facial contour points.
- GetFacialContourPoints (src_landmarkPoints, src_facialContourPoints);
- GetFacialContourPoints (dst_landmarkPoints, dst_facialContourPoints);
+ GetFacialContourPoints(src_landmarkPoints, src_facialContourPoints);
+ GetFacialContourPoints(dst_landmarkPoints, dst_facialContourPoints);
// Get facial contour rect.
- Rect src_facialContourRect = Imgproc.boundingRect (new MatOfPoint (src_facialContourPoints));
- Rect dst_facialContourRect = Imgproc.boundingRect (new MatOfPoint (dst_facialContourPoints));
- src_facialContourRect = src_facialContourRect.intersect (new Rect (0, 0, src.width (), src.height ()));
- dst_facialContourRect = dst_facialContourRect.intersect (new Rect (0, 0, dst.width (), dst.height ()));
+ Rect src_facialContourRect = Imgproc.boundingRect(new MatOfPoint(src_facialContourPoints));
+ Rect dst_facialContourRect = Imgproc.boundingRect(new MatOfPoint(dst_facialContourPoints));
+ src_facialContourRect = src_facialContourRect.intersect(new Rect(0, 0, src.width(), src.height()));
+ dst_facialContourRect = dst_facialContourRect.intersect(new Rect(0, 0, dst.width(), dst.height()));
- Mat src_ROI = new Mat (src, src_facialContourRect);
- Mat dst_ROI = new Mat (dst, dst_facialContourRect);
- Mat src_mask_ROI = new Mat (src_mask, src_facialContourRect);
- Mat dst_mask_ROI = new Mat (dst_mask, dst_facialContourRect);
+ Mat src_ROI = new Mat(src, src_facialContourRect);
+ Mat dst_ROI = new Mat(dst, dst_facialContourRect);
+ Mat src_mask_ROI = new Mat(src_mask, src_facialContourRect);
+ Mat dst_mask_ROI = new Mat(dst_mask, dst_facialContourRect);
- GetPointsInFrame (src_mask_ROI, src_facialContourPoints, src_facialContourPoints);
- GetPointsInFrame (dst_mask_ROI, dst_facialContourPoints, dst_facialContourPoints);
+ GetPointsInFrame(src_mask_ROI, src_facialContourPoints, src_facialContourPoints);
+ GetPointsInFrame(dst_mask_ROI, dst_facialContourPoints, dst_facialContourPoints);
- src_mask_ROI.setTo (new Scalar (0));
- dst_mask_ROI.setTo (new Scalar (0));
- Imgproc.fillConvexPoly (src_mask_ROI, new MatOfPoint (src_facialContourPoints), new Scalar (255));
- Imgproc.fillConvexPoly (dst_mask_ROI, new MatOfPoint (dst_facialContourPoints), new Scalar (255));
+ src_mask_ROI.setTo(new Scalar(0));
+ dst_mask_ROI.setTo(new Scalar(0));
+ Imgproc.fillConvexPoly(src_mask_ROI, new MatOfPoint(src_facialContourPoints), new Scalar(255));
+ Imgproc.fillConvexPoly(dst_mask_ROI, new MatOfPoint(dst_facialContourPoints), new Scalar(255));
Texture2D LUTTex;
- if (LUTTexDict.ContainsKey (id)) {
- LUTTex = LUTTexDict [id];
- } else {
- LUTTex = new Texture2D (256, 1, TextureFormat.RGB24, false);
- LUTTexDict.Add (id, LUTTex);
+ if (LUTTexDict.ContainsKey(id))
+ {
+ LUTTex = LUTTexDict[id];
+ }
+ else
+ {
+ LUTTex = new Texture2D(256, 1, TextureFormat.RGB24, false);
+ LUTTexDict.Add(id, LUTTex);
}
- FaceMaskShaderUtils.CalculateLUT (src_ROI, dst_ROI, src_mask_ROI, dst_mask_ROI, LUTTex);
+ FaceMaskShaderUtils.CalculateLUT(src_ROI, dst_ROI, src_mask_ROI, dst_mask_ROI, LUTTex);
return LUTTex;
}
- public virtual void DeleteLUTTex (int id)
+ public virtual void DeleteLUTTex(int id)
{
- if (LUTTexDict.ContainsKey (id)) {
- Texture2D.Destroy (LUTTexDict [id]);
- LUTTexDict.Remove (id);
+ if (LUTTexDict.ContainsKey(id))
+ {
+ Texture2D.Destroy(LUTTexDict[id]);
+ LUTTexDict.Remove(id);
}
}
- public virtual Texture2D GetLUTTex (int id)
+ public virtual Texture2D GetLUTTex(int id)
{
- if (LUTTexDict.ContainsKey (id)) {
- return LUTTexDict [id];
+ if (LUTTexDict.ContainsKey(id))
+ {
+ return LUTTexDict[id];
}
return null;
}
- protected virtual void GetFacialContourPoints (List landmark_points, Point[] dst_points)
+ protected virtual void GetFacialContourPoints(List landmark_points, Point[] dst_points)
{
if (landmark_points.Count < 9)
- throw new ArgumentException ("Invalid landmark_points.");
+ throw new ArgumentException("Invalid landmark_points.");
if (dst_points.Length != 9)
- throw new ArgumentException ("Invalid points.");
+ throw new ArgumentException("Invalid points.");
- dst_points [0].x = landmark_points [0].x;
- dst_points [0].y = landmark_points [0].y;
- dst_points [1].x = landmark_points [3].x;
- dst_points [1].y = landmark_points [3].y;
- dst_points [2].x = landmark_points [5].x;
- dst_points [2].y = landmark_points [5].y;
- dst_points [3].x = landmark_points [8].x;
- dst_points [3].y = landmark_points [8].y;
- dst_points [4].x = landmark_points [11].x;
- dst_points [4].y = landmark_points [11].y;
- dst_points [5].x = landmark_points [13].x;
- dst_points [5].y = landmark_points [13].y;
- dst_points [6].x = landmark_points [16].x;
- dst_points [6].y = landmark_points [16].y;
- float nose_length_x = landmark_points [27].x - landmark_points [30].x;
- float nose_length_y = landmark_points [27].y - landmark_points [30].y;
- dst_points [7].x = landmark_points [26].x + nose_length_x;
- dst_points [7].y = landmark_points [26].y + nose_length_y;
- dst_points [8].x = landmark_points [17].x + nose_length_x;
- dst_points [8].y = landmark_points [17].y + nose_length_y;
+ dst_points[0].x = landmark_points[0].x;
+ dst_points[0].y = landmark_points[0].y;
+ dst_points[1].x = landmark_points[3].x;
+ dst_points[1].y = landmark_points[3].y;
+ dst_points[2].x = landmark_points[5].x;
+ dst_points[2].y = landmark_points[5].y;
+ dst_points[3].x = landmark_points[8].x;
+ dst_points[3].y = landmark_points[8].y;
+ dst_points[4].x = landmark_points[11].x;
+ dst_points[4].y = landmark_points[11].y;
+ dst_points[5].x = landmark_points[13].x;
+ dst_points[5].y = landmark_points[13].y;
+ dst_points[6].x = landmark_points[16].x;
+ dst_points[6].y = landmark_points[16].y;
+ float nose_length_x = landmark_points[27].x - landmark_points[30].x;
+ float nose_length_y = landmark_points[27].y - landmark_points[30].y;
+ dst_points[7].x = landmark_points[26].x + nose_length_x;
+ dst_points[7].y = landmark_points[26].y + nose_length_y;
+ dst_points[8].x = landmark_points[17].x + nose_length_x;
+ dst_points[8].y = landmark_points[17].y + nose_length_y;
}
- protected virtual void GetPointsInFrame (Mat frame, Point[] points, Point[] dst_points)
+ protected virtual void GetPointsInFrame(Mat frame, Point[] points, Point[] dst_points)
{
if (points.Length != dst_points.Length)
- throw new ArgumentException ("points.Length != dst_points.Length");
+ throw new ArgumentException("points.Length != dst_points.Length");
- Size wholesize = new Size ();
- Point ofs = new Point ();
- frame.locateROI (wholesize, ofs);
+ Size wholesize = new Size();
+ Point ofs = new Point();
+ frame.locateROI(wholesize, ofs);
- for (int i = 0; i < points.Length; i++) {
- dst_points [i].x = points [i].x - ofs.x;
- dst_points [i].y = points [i].y - ofs.y;
+ for (int i = 0; i < points.Length; i++)
+ {
+ dst_points[i].x = points[i].x - ofs.x;
+ dst_points[i].y = points[i].y - ofs.y;
}
}
- public virtual void Reset ()
+ public virtual void Reset()
{
- foreach (var key in LUTTexDict.Keys) {
- Texture2D.Destroy (LUTTexDict [key]);
+ foreach (var key in LUTTexDict.Keys)
+ {
+ Texture2D.Destroy(LUTTexDict[key]);
}
- LUTTexDict.Clear ();
+ LUTTexDict.Clear();
}
- public virtual void Dispose ()
+ public virtual void Dispose()
{
- if (src_mask != null) {
- src_mask.Dispose ();
+ if (src_mask != null)
+ {
+ src_mask.Dispose();
src_mask = null;
}
- if (dst_mask != null) {
- dst_mask.Dispose ();
+ if (dst_mask != null)
+ {
+ dst_mask.Dispose();
dst_mask = null;
}
- Reset ();
+ Reset();
}
}
}
\ No newline at end of file
diff --git a/Assets/FaceMaskExample/Scripts/FaceMaskColorCorrector/FaceMaskShaderUtils.cs b/Assets/FaceMaskExample/Scripts/FaceMaskColorCorrector/FaceMaskShaderUtils.cs
index 2138909..9aa75be 100644
--- a/Assets/FaceMaskExample/Scripts/FaceMaskColorCorrector/FaceMaskShaderUtils.cs
+++ b/Assets/FaceMaskExample/Scripts/FaceMaskColorCorrector/FaceMaskShaderUtils.cs
@@ -1,55 +1,56 @@
-using UnityEngine;
-using System;
-using System.Collections.Generic;
-using System.Collections;
-using OpenCVForUnity.CoreModule;
-using OpenCVForUnity.UnityUtils;
+using OpenCVForUnity.CoreModule;
using OpenCVForUnity.UtilsModule;
+using System;
+using UnityEngine;
namespace FaceMaskExample
{
public class FaceMaskShaderUtils
{
// Match histograms of 'src' to that of 'dst', according to both masks.
- public static void CalculateLUT (Mat src, Mat dst, Mat src_mask, Mat dst_mask, Texture2D LUTTex)
+ public static void CalculateLUT(Mat src, Mat dst, Mat src_mask, Mat dst_mask, Texture2D LUTTex)
{
- if (src.channels () < 3)
- throw new ArgumentException ("src.channels() < 3");
+ if (src.channels() < 3)
+ throw new ArgumentException("src.channels() < 3");
- if (dst.channels () < 3)
- throw new ArgumentException ("dst.channels() < 3");
+ if (dst.channels() < 3)
+ throw new ArgumentException("dst.channels() < 3");
- if (src_mask.channels () != 1)
- throw new ArgumentException ("src_mask.channels() != 1");
+ if (src_mask.channels() != 1)
+ throw new ArgumentException("src_mask.channels() != 1");
- if (dst_mask.channels () != 1)
- throw new ArgumentException ("dst_mask.channels() != 1");
+ if (dst_mask.channels() != 1)
+ throw new ArgumentException("dst_mask.channels() != 1");
- if (src_mask != null && src.total () != src_mask.total ())
- throw new ArgumentException ("src.total() != src_mask.total()");
+ if (src_mask != null && src.total() != src_mask.total())
+ throw new ArgumentException("src.total() != src_mask.total()");
- if (dst_mask != null && dst.total () != dst_mask.total ())
- throw new ArgumentException ("dst.total() != dst_mask.total()");
+ if (dst_mask != null && dst.total() != dst_mask.total())
+ throw new ArgumentException("dst.total() != dst_mask.total()");
if (LUTTex.width != 256 || LUTTex.height != 1 || LUTTex.format != TextureFormat.RGB24)
- throw new ArgumentException ("Invalid LUTTex.");
+ throw new ArgumentException("Invalid LUTTex.");
byte[] LUT = new byte[3 * 256];
double[][] src_hist = new double[3][];
- for (int i = 0; i < src_hist.Length; i++) {
- src_hist [i] = new double[256];
+ for (int i = 0; i < src_hist.Length; i++)
+ {
+ src_hist[i] = new double[256];
}
double[][] dst_hist = new double[3][];
- for (int i = 0; i < dst_hist.Length; i++) {
- dst_hist [i] = new double[256];
+ for (int i = 0; i < dst_hist.Length; i++)
+ {
+ dst_hist[i] = new double[256];
}
double[][] src_cdf = new double[3][];
- for (int i = 0; i < src_cdf.Length; i++) {
- src_cdf [i] = new double[256];
+ for (int i = 0; i < src_cdf.Length; i++)
+ {
+ src_cdf[i] = new double[256];
}
double[][] dst_cdf = new double[3][];
- for (int i = 0; i < dst_cdf.Length; i++) {
- dst_cdf [i] = new double[256];
+ for (int i = 0; i < dst_cdf.Length; i++)
+ {
+ dst_cdf[i] = new double[256];
}
double[] src_histMax = new double[3];
@@ -57,61 +58,69 @@ namespace FaceMaskExample
byte[] src_mask_byte = null;
byte[] dst_mask_byte = null;
- if (src_mask != null) {
- src_mask_byte = new byte[src_mask.total () * src_mask.channels ()];
- MatUtils.copyFromMat (src_mask, src_mask_byte);
+ if (src_mask != null)
+ {
+ src_mask_byte = new byte[src_mask.total() * src_mask.channels()];
+ MatUtils.copyFromMat(src_mask, src_mask_byte);
}
- if (dst_mask != null) {
- dst_mask_byte = new byte[dst_mask.total () * dst_mask.channels ()];
- MatUtils.copyFromMat (dst_mask, dst_mask_byte);
+ if (dst_mask != null)
+ {
+ dst_mask_byte = new byte[dst_mask.total() * dst_mask.channels()];
+ MatUtils.copyFromMat(dst_mask, dst_mask_byte);
}
- byte[] src_byte = new byte[src.total () * src.channels ()];
- MatUtils.copyFromMat (src, src_byte);
- byte[] dst_byte = new byte[dst.total () * dst.channels ()];
- MatUtils.copyFromMat (dst, dst_byte);
+ byte[] src_byte = new byte[src.total() * src.channels()];
+ MatUtils.copyFromMat(src, src_byte);
+ byte[] dst_byte = new byte[dst.total() * dst.channels()];
+ MatUtils.copyFromMat(dst, dst_byte);
int pixel_i = 0;
- int channels = src.channels ();
- int total = (int)src.total ();
- if (src_mask_byte != null) {
- for (int i = 0; i < total; i++) {
- if (src_mask_byte [i] != 0) {
- byte c = src_byte [pixel_i];
- src_hist [0] [c]++;
- if (src_hist [0] [c] > src_histMax [0])
- src_histMax [0] = src_hist [0] [c];
+ int channels = src.channels();
+ int total = (int)src.total();
+ if (src_mask_byte != null)
+ {
+ for (int i = 0; i < total; i++)
+ {
+ if (src_mask_byte[i] != 0)
+ {
+ byte c = src_byte[pixel_i];
+ src_hist[0][c]++;
+ if (src_hist[0][c] > src_histMax[0])
+ src_histMax[0] = src_hist[0][c];
- c = src_byte [pixel_i + 1];
- src_hist [1] [c]++;
- if (src_hist [1] [c] > src_histMax [1])
- src_histMax [1] = src_hist [1] [c];
+ c = src_byte[pixel_i + 1];
+ src_hist[1][c]++;
+ if (src_hist[1][c] > src_histMax[1])
+ src_histMax[1] = src_hist[1][c];
- c = src_byte [pixel_i + 2];
- src_hist [2] [c]++;
- if (src_hist [2] [c] > src_histMax [2])
- src_histMax [2] = src_hist [2] [c];
+ c = src_byte[pixel_i + 2];
+ src_hist[2][c]++;
+ if (src_hist[2][c] > src_histMax[2])
+ src_histMax[2] = src_hist[2][c];
}
// Advance to next pixel
pixel_i += channels;
}
- } else {
- for (int i = 0; i < total; i++) {
- byte c = src_byte [pixel_i];
- src_hist [0] [c]++;
- if (src_hist [0] [c] > src_histMax [0])
- src_histMax [0] = src_hist [0] [c];
+ }
+ else
+ {
+ for (int i = 0; i < total; i++)
+ {
+ byte c = src_byte[pixel_i];
+ src_hist[0][c]++;
+ if (src_hist[0][c] > src_histMax[0])
+ src_histMax[0] = src_hist[0][c];
- c = src_byte [pixel_i + 1];
- src_hist [1] [c]++;
- if (src_hist [1] [c] > src_histMax [1])
- src_histMax [1] = src_hist [1] [c];
+ c = src_byte[pixel_i + 1];
+ src_hist[1][c]++;
+ if (src_hist[1][c] > src_histMax[1])
+ src_histMax[1] = src_hist[1][c];
- c = src_byte [pixel_i + 2];
- src_hist [2] [c]++;
- if (src_hist [2] [c] > src_histMax [2])
- src_histMax [2] = src_hist [2] [c];
+ c = src_byte[pixel_i + 2];
+ src_hist[2][c]++;
+ if (src_hist[2][c] > src_histMax[2])
+ src_histMax[2] = src_hist[2][c];
// Advance to next pixel
pixel_i += channels;
@@ -119,45 +128,51 @@ namespace FaceMaskExample
}
pixel_i = 0;
- channels = dst.channels ();
- total = (int)dst.total ();
- if (dst_mask_byte != null) {
- for (int i = 0; i < total; i++) {
- if (dst_mask_byte [i] != 0) {
- byte c = dst_byte [pixel_i];
- dst_hist [0] [c]++;
- if (dst_hist [0] [c] > dst_histMax [0])
- dst_histMax [0] = dst_hist [0] [c];
+ channels = dst.channels();
+ total = (int)dst.total();
+ if (dst_mask_byte != null)
+ {
+ for (int i = 0; i < total; i++)
+ {
+ if (dst_mask_byte[i] != 0)
+ {
+ byte c = dst_byte[pixel_i];
+ dst_hist[0][c]++;
+ if (dst_hist[0][c] > dst_histMax[0])
+ dst_histMax[0] = dst_hist[0][c];
- c = dst_byte [pixel_i + 1];
- dst_hist [1] [c]++;
- if (dst_hist [1] [c] > dst_histMax [1])
- dst_histMax [1] = dst_hist [1] [c];
+ c = dst_byte[pixel_i + 1];
+ dst_hist[1][c]++;
+ if (dst_hist[1][c] > dst_histMax[1])
+ dst_histMax[1] = dst_hist[1][c];
- c = dst_byte [pixel_i + 2];
- dst_hist [2] [c]++;
- if (dst_hist [2] [c] > dst_histMax [2])
- dst_histMax [2] = dst_hist [2] [c];
+ c = dst_byte[pixel_i + 2];
+ dst_hist[2][c]++;
+ if (dst_hist[2][c] > dst_histMax[2])
+ dst_histMax[2] = dst_hist[2][c];
}
// Advance to next pixel
pixel_i += channels;
}
- } else {
- for (int i = 0; i < total; i++) {
- byte c = dst_byte [pixel_i];
- dst_hist [0] [c]++;
- if (dst_hist [0] [c] > dst_histMax [0])
- dst_histMax [0] = dst_hist [0] [c];
+ }
+ else
+ {
+ for (int i = 0; i < total; i++)
+ {
+ byte c = dst_byte[pixel_i];
+ dst_hist[0][c]++;
+ if (dst_hist[0][c] > dst_histMax[0])
+ dst_histMax[0] = dst_hist[0][c];
- c = dst_byte [pixel_i + 1];
- dst_hist [1] [c]++;
- if (dst_hist [1] [c] > dst_histMax [1])
- dst_histMax [1] = dst_hist [1] [c];
+ c = dst_byte[pixel_i + 1];
+ dst_hist[1][c]++;
+ if (dst_hist[1][c] > dst_histMax[1])
+ dst_histMax[1] = dst_hist[1][c];
- c = dst_byte [pixel_i + 2];
- dst_hist [2] [c]++;
- if (dst_hist [2] [c] > dst_histMax [2])
- dst_histMax [2] = dst_hist [2] [c];
+ c = dst_byte[pixel_i + 2];
+ dst_hist[2][c]++;
+ if (dst_hist[2][c] > dst_histMax[2])
+ dst_histMax[2] = dst_hist[2][c];
// Advance to next pixel
pixel_i += channels;
@@ -165,55 +180,62 @@ namespace FaceMaskExample
}
//normalize hist
- for (int i = 0; i < 256; i++) {
- src_hist [0] [i] /= src_histMax [0];
- src_hist [1] [i] /= src_histMax [1];
- src_hist [2] [i] /= src_histMax [2];
+ for (int i = 0; i < 256; i++)
+ {
+ src_hist[0][i] /= src_histMax[0];
+ src_hist[1][i] /= src_histMax[1];
+ src_hist[2][i] /= src_histMax[2];
- dst_hist [0] [i] /= dst_histMax [0];
- dst_hist [1] [i] /= dst_histMax [1];
- dst_hist [2] [i] /= dst_histMax [2];
+ dst_hist[0][i] /= dst_histMax[0];
+ dst_hist[1][i] /= dst_histMax[1];
+ dst_hist[2][i] /= dst_histMax[2];
}
// Calc cumulative distribution function (CDF)
- src_cdf [0] [0] = src_hist [0] [0];
- src_cdf [1] [0] = src_hist [1] [0];
- src_cdf [2] [0] = src_hist [2] [0];
- dst_cdf [0] [0] = dst_hist [0] [0];
- dst_cdf [1] [0] = dst_hist [1] [0];
- dst_cdf [2] [0] = dst_hist [2] [0];
- for (int i = 1; i < 256; i++) {
- src_cdf [0] [i] = src_cdf [0] [i - 1] + src_hist [0] [i];
- src_cdf [1] [i] = src_cdf [1] [i - 1] + src_hist [1] [i];
- src_cdf [2] [i] = src_cdf [2] [i - 1] + src_hist [2] [i];
+ src_cdf[0][0] = src_hist[0][0];
+ src_cdf[1][0] = src_hist[1][0];
+ src_cdf[2][0] = src_hist[2][0];
+ dst_cdf[0][0] = dst_hist[0][0];
+ dst_cdf[1][0] = dst_hist[1][0];
+ dst_cdf[2][0] = dst_hist[2][0];
+ for (int i = 1; i < 256; i++)
+ {
+ src_cdf[0][i] = src_cdf[0][i - 1] + src_hist[0][i];
+ src_cdf[1][i] = src_cdf[1][i - 1] + src_hist[1][i];
+ src_cdf[2][i] = src_cdf[2][i - 1] + src_hist[2][i];
- dst_cdf [0] [i] = dst_cdf [0] [i - 1] + dst_hist [0] [i];
- dst_cdf [1] [i] = dst_cdf [1] [i - 1] + dst_hist [1] [i];
- dst_cdf [2] [i] = dst_cdf [2] [i - 1] + dst_hist [2] [i];
+ dst_cdf[0][i] = dst_cdf[0][i - 1] + dst_hist[0][i];
+ dst_cdf[1][i] = dst_cdf[1][i - 1] + dst_hist[1][i];
+ dst_cdf[2][i] = dst_cdf[2][i - 1] + dst_hist[2][i];
}
// Normalize CDF
- for (int i = 0; i < 256; i++) {
- src_cdf [0] [i] /= src_cdf [0] [255];
- src_cdf [1] [i] /= src_cdf [1] [255];
- src_cdf [2] [i] /= src_cdf [2] [255];
+ for (int i = 0; i < 256; i++)
+ {
+ src_cdf[0][i] /= src_cdf[0][255];
+ src_cdf[1][i] /= src_cdf[1][255];
+ src_cdf[2][i] /= src_cdf[2][255];
- dst_cdf [0] [i] /= dst_cdf [0] [255];
- dst_cdf [1] [i] /= dst_cdf [1] [255];
- dst_cdf [2] [i] /= dst_cdf [2] [255];
+ dst_cdf[0][i] /= dst_cdf[0][255];
+ dst_cdf[1][i] /= dst_cdf[1][255];
+ dst_cdf[2][i] /= dst_cdf[2][255];
}
// Create lookup table
const double HISTMATCH_EPSILON = 0.000001f;
- for (int i = 0; i < 3; i++) {
+ for (int i = 0; i < 3; i++)
+ {
int last = 0;
- for (int j = 0; j < 256; j++) {
- double F1j = src_cdf [i] [j];
+ for (int j = 0; j < 256; j++)
+ {
+ double F1j = src_cdf[i][j];
- for (int k = last; k < 256; k++) {
- double F2k = dst_cdf [i] [k];
- if (Math.Abs (F2k - F1j) < HISTMATCH_EPSILON || F2k > F1j) {
- LUT [(j * 3) + i] = (byte)k;
+ for (int k = last; k < 256; k++)
+ {
+ double F2k = dst_cdf[i][k];
+ if (Math.Abs(F2k - F1j) < HISTMATCH_EPSILON || F2k > F1j)
+ {
+ LUT[(j * 3) + i] = (byte)k;
last = k;
break;
}
@@ -221,8 +243,8 @@ namespace FaceMaskExample
}
}
- LUTTex.LoadRawTextureData (LUT);
- LUTTex.Apply (false);
+ LUTTex.LoadRawTextureData(LUT);
+ LUTTex.Apply(false);
}
}
}
\ No newline at end of file
diff --git a/Assets/FaceMaskExample/Scripts/FaceMaskData/FaceMaskData.cs b/Assets/FaceMaskExample/Scripts/FaceMaskData/FaceMaskData.cs
index b9d0f5b..39a4688 100644
--- a/Assets/FaceMaskExample/Scripts/FaceMaskData/FaceMaskData.cs
+++ b/Assets/FaceMaskExample/Scripts/FaceMaskData/FaceMaskData.cs
@@ -1,13 +1,13 @@
-using UnityEngine;
-using System.Collections;
-using System.Collections.Generic;
+using System.Collections.Generic;
+using UnityEngine;
public class FaceMaskData : MonoBehaviour
{
[SerializeField]
private Texture2D _image;
- public Texture2D image {
+ public Texture2D image
+ {
get { return this._image; }
set { this._image = value; }
}
@@ -15,25 +15,26 @@ public class FaceMaskData : MonoBehaviour
///
/// Determines if to use dynamically detected points.
///
- [TooltipAttribute ("Determines if to use dynamically detected points.")]
+ [TooltipAttribute("Determines if to use dynamically detected points.")]
public bool isDynamicMode = true;
///
/// Determines if to enable color correction.
///
- [TooltipAttribute ("Determines if to enable color correction.")]
+ [TooltipAttribute("Determines if to enable color correction.")]
public bool enableColorCorrection = true;
[SerializeField]
- private Rect _faceRect = new Rect (78, 95, 151, 150);
+ private Rect _faceRect = new Rect(78, 95, 151, 150);
- public Rect faceRect {
+ public Rect faceRect
+ {
get { return this._faceRect; }
set { this._faceRect = value; }
}
[SerializeField]
- private List _landmarkPoints = new List () {
+ private List _landmarkPoints = new List() {
new Vector2 (84, 148),
new Vector2 (84, 167),
new Vector2 (86, 187),
@@ -104,7 +105,8 @@ public class FaceMaskData : MonoBehaviour
new Vector2 (144, 218)
};
- public List landmarkPoints {
+ public List landmarkPoints
+ {
get { return this._landmarkPoints; }
set { this._landmarkPoints = value; }
}
diff --git a/Assets/FaceMaskExample/Scripts/NoiseFilter/LowPassPointsFilter.cs b/Assets/FaceMaskExample/Scripts/NoiseFilter/LowPassPointsFilter.cs
index f962649..ecb88ce 100644
--- a/Assets/FaceMaskExample/Scripts/NoiseFilter/LowPassPointsFilter.cs
+++ b/Assets/FaceMaskExample/Scripts/NoiseFilter/LowPassPointsFilter.cs
@@ -1,14 +1,14 @@
-using System;
+using OpenCVForUnity.CoreModule;
+using OpenCVForUnity.ImgprocModule;
+using System;
using System.Collections.Generic;
using UnityEngine;
-using OpenCVForUnity.CoreModule;
-using OpenCVForUnity.ImgprocModule;
namespace FaceMaskExample
{
///
/// Low Pass Points Filter.
- /// v 1.0.2
+ /// v 1.0.4
///
public class LowPassPointsFilter : PointsFilterBase
{
@@ -18,11 +18,12 @@ namespace FaceMaskExample
List lastPoints;
- public LowPassPointsFilter (int numberOfElements) : base (numberOfElements)
- {
- lastPoints = new List ();
- for (int i = 0; i < numberOfElements; i++) {
- lastPoints.Add (new Vector2 ());
+ public LowPassPointsFilter(int numberOfElements) : base(numberOfElements)
+ {
+ lastPoints = new List();
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ lastPoints.Add(new Vector2());
}
}
@@ -34,51 +35,68 @@ namespace FaceMaskExample
/// Output points.
/// if true, draws debug points.
/// Output points.
- public override List Process (Mat img, List srcPoints, List dstPoints = null, bool drawDebugPoints = false)
+ public override List Process(Mat img, List srcPoints, List dstPoints = null, bool drawDebugPoints = false)
{
- if (srcPoints != null && srcPoints.Count != numberOfElements) {
- throw new ArgumentException ("The number of elements is different.");
+ if (srcPoints != null && srcPoints.Count != numberOfElements)
+ {
+ throw new ArgumentException("The number of elements is different.");
}
- if (srcPoints != null) {
-
- if (dstPoints == null) {
- dstPoints = new List ();
+ if (srcPoints != null)
+ {
+
+ if (dstPoints == null)
+ {
+ dstPoints = new List();
}
- if (dstPoints != null && dstPoints.Count != numberOfElements) {
- dstPoints.Clear ();
- for (int i = 0; i < numberOfElements; i++) {
- dstPoints.Add (new Vector2 ());
+ if (dstPoints != null && dstPoints.Count != numberOfElements)
+ {
+ dstPoints.Clear();
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ dstPoints.Add(new Vector2());
}
}
- if (flag) {
- for (int i = 0; i < numberOfElements; i++) {
- double diff = Math.Sqrt (Math.Pow (srcPoints [i].x - lastPoints [i].x, 2.0) + Math.Pow (srcPoints [i].y - lastPoints [i].y, 2.0));
- if (diff > diffLawPass) {
- lastPoints [i] = srcPoints [i];
+ if (flag)
+ {
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ double diff = Math.Sqrt(Math.Pow(srcPoints[i].x - lastPoints[i].x, 2.0) + Math.Pow(srcPoints[i].y - lastPoints[i].y, 2.0));
+ if (diff > diffLawPass)
+ {
+ lastPoints[i] = srcPoints[i];
if (drawDebugPoints)
- Imgproc.circle (img, new Point (srcPoints [i].x, srcPoints [i].y), 1, new Scalar (0, 255, 0, 255), -1);
- } else {
- if (drawDebugPoints)
- Imgproc.circle (img, new Point (lastPoints [i].x, lastPoints [i].y), 1, new Scalar (255, 0, 0, 255), -1);
+ Imgproc.circle(img, new Point(srcPoints[i].x, srcPoints[i].y), 1, new Scalar(0, 255, 0, 255), -1);
}
- dstPoints [i] = lastPoints [i];
+ else
+ {
+ if (drawDebugPoints)
+ Imgproc.circle(img, new Point(lastPoints[i].x, lastPoints[i].y), 1, new Scalar(255, 0, 0, 255), -1);
+ }
+ dstPoints[i] = lastPoints[i];
}
- } else {
- for (int i = 0; i < numberOfElements; i++) {
- lastPoints [i] = srcPoints [i];
- dstPoints [i] = srcPoints [i];
+ }
+ else
+ {
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ lastPoints[i] = srcPoints[i];
+ dstPoints[i] = srcPoints[i];
}
- if (drawDebugPoints) {
- for (int i = 0; i < numberOfElements; i++) {
- Imgproc.circle (img, new Point (srcPoints [i].x, srcPoints [i].y), 1, new Scalar (0, 0, 255, 255), -1);
+ if (drawDebugPoints)
+ {
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ Imgproc.circle(img, new Point(srcPoints[i].x, srcPoints[i].y), 1, new Scalar(0, 0, 255, 255), -1);
}
}
flag = true;
}
return dstPoints;
- } else {
+ }
+ else
+ {
return dstPoints == null ? srcPoints : dstPoints;
}
}
@@ -86,21 +104,22 @@ namespace FaceMaskExample
///
/// Resets filter.
///
- public override void Reset ()
+ public override void Reset()
{
flag = false;
- for (int i = 0; i < lastPoints.Count; i++) {
- lastPoints [i] = new Vector2 ();
+ for (int i = 0; i < lastPoints.Count; i++)
+ {
+ lastPoints[i] = new Vector2();
}
}
///
/// To release the resources for the initialized method.
///
- public override void Dispose ()
+ public override void Dispose()
{
if (lastPoints != null)
- lastPoints.Clear ();
+ lastPoints.Clear();
}
}
}
\ No newline at end of file
diff --git a/Assets/FaceMaskExample/Scripts/NoiseFilter/OFPointsFilter.cs b/Assets/FaceMaskExample/Scripts/NoiseFilter/OFPointsFilter.cs
index 1d1f96d..3c1bd7f 100644
--- a/Assets/FaceMaskExample/Scripts/NoiseFilter/OFPointsFilter.cs
+++ b/Assets/FaceMaskExample/Scripts/NoiseFilter/OFPointsFilter.cs
@@ -1,15 +1,15 @@
-using System;
-using System.Collections.Generic;
-using UnityEngine;
-using OpenCVForUnity.CoreModule;
+using OpenCVForUnity.CoreModule;
using OpenCVForUnity.ImgprocModule;
using OpenCVForUnity.VideoModule;
+using System;
+using System.Collections.Generic;
+using UnityEngine;
namespace FaceMaskExample
{
///
/// Optical Flow Points Filter.
- /// v 1.0.3
+ /// v 1.0.4
///
public class OFPointsFilter : PointsFilterBase
{
@@ -28,13 +28,13 @@ namespace FaceMaskExample
MatOfByte status;
MatOfFloat err;
- public OFPointsFilter (int numberOfElements) : base (numberOfElements)
- {
+ public OFPointsFilter(int numberOfElements) : base(numberOfElements)
+ {
diffDlib = diffDlib * (double)numberOfElements / 68.0;
- prevTrackPtsMat = new MatOfPoint ();
+ prevTrackPtsMat = new MatOfPoint();
// Initialize Optical Flow
- InitializeOpticalFlow ();
+ InitializeOpticalFlow();
}
///
@@ -45,106 +45,140 @@ namespace FaceMaskExample
/// Output points.
/// if true, draws debug points.
/// Output points.
- public override List Process (Mat img, List srcPoints, List dstPoints = null, bool drawDebugPoints = false)
+ public override List Process(Mat img, List srcPoints, List dstPoints = null, bool drawDebugPoints = false)
{
- if (srcPoints != null && srcPoints.Count != numberOfElements) {
- throw new ArgumentException ("The number of elements is different.");
+ if (srcPoints != null && srcPoints.Count != numberOfElements)
+ {
+ throw new ArgumentException("The number of elements is different.");
}
- if (srcPoints == null) {
+ if (srcPoints == null)
+ {
return dstPoints == null ? srcPoints : dstPoints;
}
- if (!flag) {
- if (img.channels () == 4) {
- Imgproc.cvtColor (img, prevgray, Imgproc.COLOR_RGBA2GRAY);
- } else if (img.channels () == 3) {
- Imgproc.cvtColor (img, prevgray, Imgproc.COLOR_RGB2GRAY);
- } else {
- if (prevgray.total () == 0) {
- prevgray = img.clone ();
- } else {
- img.copyTo (prevgray);
+ if (!flag)
+ {
+ if (img.channels() == 4)
+ {
+ Imgproc.cvtColor(img, prevgray, Imgproc.COLOR_RGBA2GRAY);
+ }
+ else if (img.channels() == 3)
+ {
+ Imgproc.cvtColor(img, prevgray, Imgproc.COLOR_RGB2GRAY);
+ }
+ else
+ {
+ if (prevgray.total() == 0)
+ {
+ prevgray = img.clone();
+ }
+ else
+ {
+ img.copyTo(prevgray);
}
}
- for (int i = 0; i < numberOfElements; i++) {
- prevTrackPts [i] = new Point (srcPoints [i].x, srcPoints [i].y);
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ prevTrackPts[i] = new Point(srcPoints[i].x, srcPoints[i].y);
}
flag = true;
}
- if (srcPoints != null) {
+ if (srcPoints != null)
+ {
- if (dstPoints == null) {
- dstPoints = new List ();
+ if (dstPoints == null)
+ {
+ dstPoints = new List();
}
- if (dstPoints != null && dstPoints.Count != numberOfElements) {
- dstPoints.Clear ();
- for (int i = 0; i < numberOfElements; i++) {
- dstPoints.Add (new Vector2 ());
+ if (dstPoints != null && dstPoints.Count != numberOfElements)
+ {
+ dstPoints.Clear();
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ dstPoints.Add(new Vector2());
}
}
- if (img.channels () == 4) {
- Imgproc.cvtColor (img, gray, Imgproc.COLOR_RGBA2GRAY);
- } else if (img.channels () == 3) {
- Imgproc.cvtColor (img, gray, Imgproc.COLOR_RGB2GRAY);
- } else {
- if (gray.total () == 0) {
- gray = img.clone ();
- } else {
- img.copyTo (gray);
+ if (img.channels() == 4)
+ {
+ Imgproc.cvtColor(img, gray, Imgproc.COLOR_RGBA2GRAY);
+ }
+ else if (img.channels() == 3)
+ {
+ Imgproc.cvtColor(img, gray, Imgproc.COLOR_RGB2GRAY);
+ }
+ else
+ {
+ if (gray.total() == 0)
+ {
+ gray = img.clone();
+ }
+ else
+ {
+ img.copyTo(gray);
}
}
- if (prevgray.total () > 0) {
- mOP2fPrevTrackPts.fromList (prevTrackPts);
- mOP2fNextTrackPts.fromList (nextTrackPts);
- Video.calcOpticalFlowPyrLK (prevgray, gray, mOP2fPrevTrackPts, mOP2fNextTrackPts, status, err);
- prevTrackPts = mOP2fPrevTrackPts.toList ();
- nextTrackPts = mOP2fNextTrackPts.toList ();
+ if (prevgray.total() > 0)
+ {
+ mOP2fPrevTrackPts.fromList(prevTrackPts);
+ mOP2fNextTrackPts.fromList(nextTrackPts);
+ Video.calcOpticalFlowPyrLK(prevgray, gray, mOP2fPrevTrackPts, mOP2fNextTrackPts, status, err);
+ prevTrackPts = mOP2fPrevTrackPts.toList();
+ nextTrackPts = mOP2fNextTrackPts.toList();
// clac diffDlib
- prevTrackPtsMat.fromList (prevTrackPts);
- OpenCVForUnity.CoreModule.Rect rect = Imgproc.boundingRect (prevTrackPtsMat);
- double diffDlib = this.diffDlib * rect.area () / 40000.0 * diffCheckSensitivity;
+ prevTrackPtsMat.fromList(prevTrackPts);
+ OpenCVForUnity.CoreModule.Rect rect = Imgproc.boundingRect(prevTrackPtsMat);
+ double diffDlib = this.diffDlib * rect.area() / 40000.0 * diffCheckSensitivity;
// if the face is moving so fast, use dlib to detect the face
- double diff = calDistanceDiff (prevTrackPts, nextTrackPts);
+ double diff = calDistanceDiff(prevTrackPts, nextTrackPts);
if (drawDebugPoints)
- Debug.Log ("variance:" + diff);
- if (diff > diffDlib) {
- for (int i = 0; i < numberOfElements; i++) {
- nextTrackPts [i].x = srcPoints [i].x;
- nextTrackPts [i].y = srcPoints [i].y;
+ Debug.Log("variance:" + diff);
+ if (diff > diffDlib)
+ {
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ nextTrackPts[i].x = srcPoints[i].x;
+ nextTrackPts[i].y = srcPoints[i].y;
- dstPoints [i] = srcPoints [i];
+ dstPoints[i] = srcPoints[i];
}
- if (drawDebugPoints) {
- Debug.Log ("DLIB");
- for (int i = 0; i < numberOfElements; i++) {
- Imgproc.circle (img, new Point (srcPoints [i].x, srcPoints [i].y), 2, new Scalar (255, 0, 0, 255), -1);
+ if (drawDebugPoints)
+ {
+ Debug.Log("DLIB");
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ Imgproc.circle(img, new Point(srcPoints[i].x, srcPoints[i].y), 2, new Scalar(255, 0, 0, 255), -1);
}
}
- } else {
+ }
+ else
+ {
// In this case, use Optical Flow
- for (int i = 0; i < numberOfElements; i++) {
- dstPoints [i] = new Vector2 ((float)nextTrackPts [i].x, (float)nextTrackPts [i].y);
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ dstPoints[i] = new Vector2((float)nextTrackPts[i].x, (float)nextTrackPts[i].y);
}
- if (drawDebugPoints) {
- Debug.Log ("Optical Flow");
- for (int i = 0; i < numberOfElements; i++) {
- Imgproc.circle (img, nextTrackPts [i], 2, new Scalar (0, 0, 255, 255), -1);
+ if (drawDebugPoints)
+ {
+ Debug.Log("Optical Flow");
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ Imgproc.circle(img, nextTrackPts[i], 2, new Scalar(0, 0, 255, 255), -1);
}
}
}
}
- Swap (ref prevTrackPts, ref nextTrackPts);
- Swap (ref prevgray, ref gray);
+ Swap(ref prevTrackPts, ref nextTrackPts);
+ Swap(ref prevgray, ref gray);
}
return dstPoints;
}
@@ -152,77 +186,83 @@ namespace FaceMaskExample
///
/// Resets filter.
///
- public override void Reset ()
+ public override void Reset()
{
flag = false;
// Reset Optical Flow
- for (int i = 0; i < numberOfElements; i++) {
- prevTrackPts [i].x = 0.0;
- prevTrackPts [i].y = 0.0;
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ prevTrackPts[i].x = 0.0;
+ prevTrackPts[i].y = 0.0;
}
- for (int i = 0; i < numberOfElements; i++) {
- nextTrackPts [i].x = 0.0;
- nextTrackPts [i].y = 0.0;
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ nextTrackPts[i].x = 0.0;
+ nextTrackPts[i].y = 0.0;
}
- if (prevgray != null) {
- prevgray.Dispose ();
- prevgray = new Mat ();
+ if (prevgray != null)
+ {
+ prevgray.Dispose();
+ prevgray = new Mat();
}
- if (gray != null) {
- gray.Dispose ();
- gray = new Mat ();
+ if (gray != null)
+ {
+ gray.Dispose();
+ gray = new Mat();
}
}
///
/// To release the resources for the initialized method.
///
- public override void Dispose ()
+ public override void Dispose()
{
- DisposeOpticalFlow ();
+ DisposeOpticalFlow();
if (prevTrackPtsMat != null)
- prevTrackPtsMat.Dispose ();
+ prevTrackPtsMat.Dispose();
}
- protected virtual void InitializeOpticalFlow ()
+ protected virtual void InitializeOpticalFlow()
{
- prevTrackPts = new List ();
- for (int i = 0; i < numberOfElements; i++) {
- prevTrackPts.Add (new Point (0, 0));
+ prevTrackPts = new List();
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ prevTrackPts.Add(new Point(0, 0));
}
- nextTrackPts = new List ();
- for (int i = 0; i < numberOfElements; i++) {
- nextTrackPts.Add (new Point (0, 0));
+ nextTrackPts = new List();
+ for (int i = 0; i < numberOfElements; i++)
+ {
+ nextTrackPts.Add(new Point(0, 0));
}
- prevgray = new Mat ();
- gray = new Mat ();
- mOP2fPrevTrackPts = new MatOfPoint2f ();
- mOP2fNextTrackPts = new MatOfPoint2f ();
- status = new MatOfByte ();
- err = new MatOfFloat ();
+ prevgray = new Mat();
+ gray = new Mat();
+ mOP2fPrevTrackPts = new MatOfPoint2f();
+ mOP2fNextTrackPts = new MatOfPoint2f();
+ status = new MatOfByte();
+ err = new MatOfFloat();
}
- protected virtual void DisposeOpticalFlow ()
+ protected virtual void DisposeOpticalFlow()
{
if (prevTrackPts != null)
- prevTrackPts.Clear ();
+ prevTrackPts.Clear();
if (nextTrackPts != null)
- nextTrackPts.Clear ();
+ nextTrackPts.Clear();
if (prevgray != null)
- prevgray.Dispose ();
+ prevgray.Dispose();
if (gray != null)
- gray.Dispose ();
+ gray.Dispose();
if (mOP2fPrevTrackPts != null)
- mOP2fPrevTrackPts.Dispose ();
+ mOP2fPrevTrackPts.Dispose();
if (mOP2fNextTrackPts != null)
- mOP2fNextTrackPts.Dispose ();
+ mOP2fNextTrackPts.Dispose();
if (status != null)
- status.Dispose ();
+ status.Dispose();
if (err != null)
- err.Dispose ();
+ err.Dispose();
}
}
}
\ No newline at end of file
diff --git a/Assets/FaceMaskExample/Scripts/NoiseFilter/PointsFilterBase.cs b/Assets/FaceMaskExample/Scripts/NoiseFilter/PointsFilterBase.cs
index 1db96de..074da46 100644
--- a/Assets/FaceMaskExample/Scripts/NoiseFilter/PointsFilterBase.cs
+++ b/Assets/FaceMaskExample/Scripts/NoiseFilter/PointsFilterBase.cs
@@ -1,19 +1,19 @@
-using System;
+using OpenCVForUnity.CoreModule;
+using System;
using System.Collections.Generic;
using UnityEngine;
-using OpenCVForUnity.CoreModule;
namespace FaceMaskExample
{
///
/// Points Filter Base.
- /// v 1.0.1
+ /// v 1.0.4
///
public abstract class PointsFilterBase
{
protected int numberOfElements;
- public PointsFilterBase (int numberOfElements)
+ public PointsFilterBase(int numberOfElements)
{
this.numberOfElements = numberOfElements;
}
@@ -26,40 +26,43 @@ namespace FaceMaskExample
/// Output points.
/// if true, draws debug points.
/// Output points.
- public abstract List Process (Mat img, List srcPoints, List dstPoints = null, bool drawDebugPoints = false);
+ public abstract List Process(Mat img, List srcPoints, List dstPoints = null, bool drawDebugPoints = false);
///
/// Resets filter.
///
- public abstract void Reset ();
+ public abstract void Reset();
///
/// To release the resources for the initialized method.
///
- public abstract void Dispose ();
+ public abstract void Dispose();
// This function is to calculate the variance
- protected virtual double calDistanceDiff (List curPoints, List lastPoints)
+ protected virtual double calDistanceDiff(IList curPoints, IList lastPoints)
{
double variance = 0.0;
double sum = 0.0;
- List diffs = new List ();
- if (curPoints.Count == lastPoints.Count) {
- for (int i = 0; i < curPoints.Count; i++) {
- double diff = Math.Sqrt (Math.Pow (curPoints [i].x - lastPoints [i].x, 2.0) + Math.Pow (curPoints [i].y - lastPoints [i].y, 2.0));
+ List diffs = new List();
+ if (curPoints.Count == lastPoints.Count)
+ {
+ for (int i = 0; i < curPoints.Count; i++)
+ {
+ double diff = Math.Sqrt(Math.Pow(curPoints[i].x - lastPoints[i].x, 2.0) + Math.Pow(curPoints[i].y - lastPoints[i].y, 2.0));
sum += diff;
- diffs.Add (diff);
+ diffs.Add(diff);
}
double mean = sum / diffs.Count;
- for (int i = 0; i < curPoints.Count; i++) {
- variance += Math.Pow (diffs [i] - mean, 2);
+ for (int i = 0; i < curPoints.Count; i++)
+ {
+ variance += Math.Pow(diffs[i] - mean, 2);
}
return variance / diffs.Count;
}
return variance;
}
- protected virtual void Swap (ref T a, ref T b)
+ protected virtual void Swap(ref T a, ref T b)
{
var t = a;
a = b;
diff --git a/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/ObjectPool.cs b/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/ObjectPool.cs
index baba487..340ad97 100644
--- a/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/ObjectPool.cs
+++ b/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/ObjectPool.cs
@@ -13,114 +13,132 @@ namespace FaceMaskExample
[SerializeField]
private int interval = 1;
- private List pooledObjectList = new List ();
+ private List pooledObjectList = new List();
private IEnumerator removeObjectCheckCoroutine;
- void OnEnable ()
+ void OnEnable()
{
- if (interval > 0) {
- removeObjectCheckCoroutine = RemoveObjectCheck ();
- StartCoroutine (removeObjectCheckCoroutine);
+ if (interval > 0)
+ {
+ removeObjectCheckCoroutine = RemoveObjectCheck();
+ StartCoroutine(removeObjectCheckCoroutine);
}
}
- void OnDisable ()
+ void OnDisable()
{
- if (removeObjectCheckCoroutine != null) {
- StopCoroutine (removeObjectCheckCoroutine);
+ if (removeObjectCheckCoroutine != null)
+ {
+ StopCoroutine(removeObjectCheckCoroutine);
removeObjectCheckCoroutine = null;
}
}
- void OnDestroy ()
+ void OnDestroy()
{
- DestroyAllObjects ();
+ DestroyAllObjects();
}
- public int Interval {
- get {
+ public int Interval
+ {
+ get
+ {
return interval;
}
- set {
- if (interval != value) {
+ set
+ {
+ if (interval != value)
+ {
interval = value;
- if (removeObjectCheckCoroutine != null) {
- StopCoroutine (removeObjectCheckCoroutine);
+ if (removeObjectCheckCoroutine != null)
+ {
+ StopCoroutine(removeObjectCheckCoroutine);
removeObjectCheckCoroutine = null;
}
- if (interval > 0) {
- removeObjectCheckCoroutine = RemoveObjectCheck ();
- StartCoroutine (removeObjectCheckCoroutine);
+ if (interval > 0)
+ {
+ removeObjectCheckCoroutine = RemoveObjectCheck();
+ StartCoroutine(removeObjectCheckCoroutine);
}
}
}
}
- public GameObject GetInstance ()
+ public GameObject GetInstance()
{
- return GetInstance (transform);
+ return GetInstance(transform);
}
- public GameObject GetInstance (Transform parent)
+ public GameObject GetInstance(Transform parent)
{
- if (prefab == null) {
- Debug.LogWarning ("prefab object is not set.");
+ if (prefab == null)
+ {
+ Debug.LogWarning("prefab object is not set.");
return null;
}
- pooledObjectList.RemoveAll ((obj) => obj == null);
+ pooledObjectList.RemoveAll((obj) => obj == null);
- foreach (GameObject obj in pooledObjectList) {
- if (obj.activeSelf == false) {
- obj.SetActive (true);
+ foreach (GameObject obj in pooledObjectList)
+ {
+ if (obj.activeSelf == false)
+ {
+ obj.SetActive(true);
return obj;
}
}
- if (pooledObjectList.Count < maxCount) {
- GameObject obj = (GameObject)GameObject.Instantiate (prefab);
- obj.SetActive (true);
- obj.transform.SetParent (parent, false);
- pooledObjectList.Add (obj);
+ if (pooledObjectList.Count < maxCount)
+ {
+ GameObject obj = (GameObject)GameObject.Instantiate(prefab);
+ obj.SetActive(true);
+ obj.transform.SetParent(parent, false);
+ pooledObjectList.Add(obj);
return obj;
}
return null;
}
- IEnumerator RemoveObjectCheck ()
+ IEnumerator RemoveObjectCheck()
{
- while (true) {
- RemoveObject (prepareCount);
- yield return new WaitForSeconds (interval);
+ while (true)
+ {
+ RemoveObject(prepareCount);
+ yield return new WaitForSeconds(interval);
}
}
- public void RemoveObject (int max)
+ public void RemoveObject(int max)
{
- if (pooledObjectList.Count > max) {
-
+ if (pooledObjectList.Count > max)
+ {
+
int needRemoveCount = pooledObjectList.Count - max;
- foreach (GameObject obj in pooledObjectList.ToArray()) {
- if (needRemoveCount == 0) {
+ foreach (GameObject obj in pooledObjectList.ToArray())
+ {
+ if (needRemoveCount == 0)
+ {
break;
}
- if (obj.activeSelf == false) {
- pooledObjectList.Remove (obj);
- Destroy (obj);
+ if (obj.activeSelf == false)
+ {
+ pooledObjectList.Remove(obj);
+ Destroy(obj);
needRemoveCount--;
}
}
}
}
- public void DestroyAllObjects ()
+ public void DestroyAllObjects()
{
- foreach (var obj in pooledObjectList) {
- Destroy (obj);
+ foreach (var obj in pooledObjectList)
+ {
+ Destroy(obj);
}
- pooledObjectList.Clear ();
+ pooledObjectList.Clear();
}
}
}
\ No newline at end of file
diff --git a/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/TrackedMesh.cs b/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/TrackedMesh.cs
index 91b0a5f..9007506 100644
--- a/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/TrackedMesh.cs
+++ b/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/TrackedMesh.cs
@@ -3,62 +3,71 @@ using UnityEngine;
namespace FaceMaskExample
{
- [RequireComponent (typeof(MeshRenderer), typeof(MeshFilter), typeof(MeshCollider))]
+ [RequireComponent(typeof(MeshRenderer), typeof(MeshFilter), typeof(MeshCollider))]
public class TrackedMesh : MonoBehaviour
{
- public MeshFilter meshFilter {
+ public MeshFilter meshFilter
+ {
get { return _meshFilter; }
}
protected MeshFilter _meshFilter;
- public MeshRenderer meshRenderer {
+ public MeshRenderer meshRenderer
+ {
get { return _meshRenderer; }
}
protected MeshRenderer _meshRenderer;
- public MeshCollider meshCollider {
+ public MeshCollider meshCollider
+ {
get { return _meshCollider; }
}
protected MeshCollider _meshCollider;
- public int id {
+ public int id
+ {
get { return _id; }
set { _id = value; }
}
protected int _id = 0;
- public Material material {
+ public Material material
+ {
get { return _meshRenderer.material; }
}
- public Material sharedMaterial {
+ public Material sharedMaterial
+ {
get { return _meshRenderer.sharedMaterial; }
}
- void Awake ()
+ void Awake()
{
- _meshFilter = this.GetComponent ();
- _meshRenderer = this.GetComponent ();
- _meshCollider = this.GetComponent ();
+ _meshFilter = this.GetComponent();
+ _meshRenderer = this.GetComponent();
+ _meshCollider = this.GetComponent();
if (_meshRenderer.material == null)
- throw new Exception ("material does not exist.");
+ throw new Exception("material does not exist.");
_meshRenderer.sortingOrder = 32767;
}
- void OnDestroy ()
+ void OnDestroy()
{
- if (_meshFilter != null && _meshFilter.mesh != null) {
- DestroyImmediate (_meshFilter.mesh);
+ if (_meshFilter != null && _meshFilter.mesh != null)
+ {
+ DestroyImmediate(_meshFilter.mesh);
}
- if (_meshRenderer != null && _meshRenderer.materials != null) {
- foreach (var m in _meshRenderer.materials) {
- DestroyImmediate (m);
+ if (_meshRenderer != null && _meshRenderer.materials != null)
+ {
+ foreach (var m in _meshRenderer.materials)
+ {
+ DestroyImmediate(m);
}
}
}
diff --git a/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/TrackedMeshOverlay.cs b/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/TrackedMeshOverlay.cs
index d70bd0b..f07ff2e 100644
--- a/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/TrackedMeshOverlay.cs
+++ b/Assets/FaceMaskExample/Scripts/TrackedMeshOverlay/TrackedMeshOverlay.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using UnityEngine;
-using OpenCVForUnity.RectangleTrack;
namespace FaceMaskExample
{
@@ -13,24 +12,31 @@ namespace FaceMaskExample
[SerializeField]
protected GameObject _baseObject;
- public GameObject baseObject {
- get {
+ public GameObject baseObject
+ {
+ get
+ {
return _baseObject;
}
- set {
+ set
+ {
_baseObject = value;
- SetBaseObject (_baseObject);
+ SetBaseObject(_baseObject);
}
}
- public float width {
- get {
+ public float width
+ {
+ get
+ {
return targetWidth;
}
}
- public float height {
- get {
+ public float height
+ {
+ get
+ {
return targetHeight;
}
}
@@ -40,75 +46,82 @@ namespace FaceMaskExample
protected float targetHeight = 0;
protected Transform overlayTransform;
protected ObjectPool objectPool;
- protected Dictionary showingObjects = new Dictionary ();
+ protected Dictionary showingObjects = new Dictionary();
- void Awake ()
+ void Awake()
{
- Initialize ("TrackedMeshOverlay");
+ Initialize("TrackedMeshOverlay");
}
- void OnDestroy ()
+ void OnDestroy()
{
overlayTransform = null;
targetTransform = null;
targetWidth = 0;
targetHeight = 0;
- showingObjects.Clear ();
- if (objectPool != null) {
- Destroy (objectPool.gameObject);
+ showingObjects.Clear();
+ if (objectPool != null)
+ {
+ Destroy(objectPool.gameObject);
objectPool = null;
}
}
- protected virtual GameObject GetPoolObject (Transform parent)
+ protected virtual GameObject GetPoolObject(Transform parent)
{
if (objectPool == null)
return null;
- GameObject newObj = objectPool.GetInstance (parent);
- if (newObj != null) {
- newObj.transform.SetParent (parent, false);
+ GameObject newObj = objectPool.GetInstance(parent);
+ if (newObj != null)
+ {
+ newObj.transform.SetParent(parent, false);
return newObj;
- } else {
+ }
+ else
+ {
return null;
}
}
- protected virtual void Initialize (String name)
+ protected virtual void Initialize(String name)
{
- GameObject obj = new GameObject (name);
+ GameObject obj = new GameObject(name);
overlayTransform = obj.transform;
overlayTransform.parent = gameObject.transform.parent;
if (_baseObject != null)
- SetBaseObject (_baseObject);
+ SetBaseObject(_baseObject);
}
- protected virtual void SetBaseObject (GameObject obj)
+ protected virtual void SetBaseObject(GameObject obj)
{
- if (obj.GetComponent () == null) {
- Debug.LogWarning ("This gameObject is not TrackedMesh.");
+ if (obj.GetComponent() == null)
+ {
+ Debug.LogWarning("This gameObject is not TrackedMesh.");
return;
}
- if (objectPool != null) {
- Destroy (objectPool);
+ if (objectPool != null)
+ {
+ Destroy(objectPool);
}
- objectPool = overlayTransform.gameObject.AddComponent ();
+ objectPool = overlayTransform.gameObject.AddComponent();
objectPool.prefab = obj;
objectPool.maxCount = poolSize;
objectPool.prepareCount = (int)poolSize / 2;
objectPool.Interval = interval;
}
- public virtual void UpdateOverlayTransform (Transform targetTransform)
+ public virtual void UpdateOverlayTransform(Transform targetTransform)
{
- if (targetTransform == null) {
+ if (targetTransform == null)
+ {
this.targetTransform = null;
return;
}
-
+
targetWidth = targetTransform.localScale.x;
targetHeight = targetTransform.localScale.y;
this.targetTransform = targetTransform;
@@ -117,83 +130,95 @@ namespace FaceMaskExample
overlayTransform.localScale = targetTransform.localScale;
}
- public virtual TrackedMesh GetObjectById (int id)
+ public virtual TrackedMesh GetObjectById(int id)
{
- if (showingObjects.ContainsKey (id)) {
- return showingObjects [id];
+ if (showingObjects.ContainsKey(id))
+ {
+ return showingObjects[id];
}
return null;
}
- public virtual TrackedMesh CreateObject (int id, Texture2D tex = null)
+ public virtual TrackedMesh CreateObject(int id, Texture2D tex = null)
{
if (_baseObject == null)
- Debug.LogError ("The baseObject does not exist.");
+ Debug.LogError("The baseObject does not exist.");
- if (!showingObjects.ContainsKey (id)) {
- GameObject obj = GetPoolObject (overlayTransform);
+ if (!showingObjects.ContainsKey(id))
+ {
+ GameObject obj = GetPoolObject(overlayTransform);
if (obj == null)
return null;
- TrackedMesh tm = obj.GetComponent ();
- if (tm != null) {
+ TrackedMesh tm = obj.GetComponent();
+ if (tm != null)
+ {
tm.id = id;
tm.transform.localPosition = Vector3.zero;
- tm.transform.localRotation = new Quaternion ();
+ tm.transform.localRotation = new Quaternion();
tm.transform.localScale = Vector3.one;
- if (tex != null) {
- Renderer tmRenderer = tm.transform.GetComponent ();
- tmRenderer.sharedMaterial.SetTexture ("_MainTex", tex);
+ if (tex != null)
+ {
+ Renderer tmRenderer = tm.transform.GetComponent();
+ tmRenderer.sharedMaterial.SetTexture("_MainTex", tex);
}
- showingObjects.Add (id, tm);
+ showingObjects.Add(id, tm);
}
return tm;
- } else {
+ }
+ else
+ {
return null;
}
}
- public virtual void UpdateObject (int id, Vector3[] vertices, int[] triangles = null, Vector2[] uv = null, Vector2[] uv2 = null)
+ public virtual void UpdateObject(int id, Vector3[] vertices, int[] triangles = null, Vector2[] uv = null, Vector2[] uv2 = null)
{
- if (showingObjects.ContainsKey (id)) {
- TrackedMesh tm = showingObjects [id];
+ if (showingObjects.ContainsKey(id))
+ {
+ TrackedMesh tm = showingObjects[id];
if (vertices.Length != tm.meshFilter.mesh.vertices.Length)
- Debug.LogError ("The number of vertices does not match.");
+ Debug.LogError("The number of vertices does not match.");
tm.meshFilter.mesh.vertices = vertices;
- if (triangles != null) {
+ if (triangles != null)
+ {
tm.meshFilter.mesh.triangles = triangles;
}
- if (uv != null) {
+ if (uv != null)
+ {
tm.meshFilter.mesh.uv = uv;
}
- if (uv2 != null) {
+ if (uv2 != null)
+ {
tm.meshFilter.mesh.uv2 = uv2;
}
- tm.meshFilter.mesh.RecalculateBounds ();
- tm.meshFilter.mesh.RecalculateNormals ();
+ tm.meshFilter.mesh.RecalculateBounds();
+ tm.meshFilter.mesh.RecalculateNormals();
}
}
- public virtual void DeleteObject (int id)
+ public virtual void DeleteObject(int id)
{
- if (showingObjects.ContainsKey (id)) {
- if (showingObjects [id] != null)
- showingObjects [id].gameObject.SetActive (false);
- showingObjects.Remove (id);
+ if (showingObjects.ContainsKey(id))
+ {
+ if (showingObjects[id] != null)
+ showingObjects[id].gameObject.SetActive(false);
+ showingObjects.Remove(id);
}
}
- public virtual void Reset ()
+ public virtual void Reset()
{
- foreach (int key in showingObjects.Keys) {
- if (showingObjects [key] != null)
- showingObjects [key].gameObject.SetActive (false);
+ foreach (int key in showingObjects.Keys)
+ {
+ if (showingObjects[key] != null)
+ showingObjects[key].gameObject.SetActive(false);
}
-
- showingObjects.Clear ();
+
+ showingObjects.Clear();
}
}
}
\ No newline at end of file
diff --git a/Assets/FaceMaskExample/Scripts/Utils/AlphaMaskTextureCreater.cs b/Assets/FaceMaskExample/Scripts/Utils/AlphaMaskTextureCreater.cs
index 0e334c0..49890f2 100644
--- a/Assets/FaceMaskExample/Scripts/Utils/AlphaMaskTextureCreater.cs
+++ b/Assets/FaceMaskExample/Scripts/Utils/AlphaMaskTextureCreater.cs
@@ -1,8 +1,7 @@
-using UnityEngine;
-using System.Collections;
-using OpenCVForUnity.CoreModule;
+using OpenCVForUnity.CoreModule;
using OpenCVForUnity.ImgprocModule;
using OpenCVForUnity.UnityUtils;
+using UnityEngine;
namespace FaceMaskExample
{
@@ -16,42 +15,45 @@ namespace FaceMaskExample
/// The texture height.
/// The base area.(An array of points in UV coordinate system)
/// Exclusion areas.(An array of points in UV coordinate system)
- public static Texture2D CreateAlphaMaskTexture (float width, float height, Vector2[] baseArea, params Vector2[][] exclusionAreas)
+ public static Texture2D CreateAlphaMaskTexture(float width, float height, Vector2[] baseArea, params Vector2[][] exclusionAreas)
{
- Mat baseAreaMaskMat = new Mat ((int)height, (int)width, CvType.CV_8UC4);
- baseAreaMaskMat.setTo (new Scalar (0, 0, 0, 255));
+ Mat baseAreaMaskMat = new Mat((int)height, (int)width, CvType.CV_8UC4);
+ baseAreaMaskMat.setTo(new Scalar(0, 0, 0, 255));
Point[] baseAreaPoints = new Point[baseArea.Length];
- for (int i = 0; i < baseArea.Length; i++) {
- baseAreaPoints [i] = new Point (baseArea [i].x * width, height - baseArea [i].y * height);
+ for (int i = 0; i < baseArea.Length; i++)
+ {
+ baseAreaPoints[i] = new Point(baseArea[i].x * width, height - baseArea[i].y * height);
}
- Imgproc.fillConvexPoly (baseAreaMaskMat, new MatOfPoint (baseAreaPoints), Scalar.all (255), Imgproc.LINE_AA, 0);
-// Imgproc.erode(baseAreaMaskMat, baseAreaMaskMat, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size (width * 0.01, height * 0.01)), new Point(-1, -1), 1, Core.BORDER_CONSTANT, new Scalar(0, 0, 0, 255));
- Imgproc.blur (baseAreaMaskMat, baseAreaMaskMat, new Size (width * 0.03, height * 0.03));
-
-
- Mat exclusionAreaMaskMat = new Mat ((int)height, (int)width, CvType.CV_8UC4);
- exclusionAreaMaskMat.setTo (new Scalar (0, 0, 0, 255));
- foreach (Vector2[] exclusionArea in exclusionAreas) {
+ Imgproc.fillConvexPoly(baseAreaMaskMat, new MatOfPoint(baseAreaPoints), Scalar.all(255), Imgproc.LINE_AA, 0);
+ //Imgproc.erode(baseAreaMaskMat, baseAreaMaskMat, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size (width * 0.01, height * 0.01)), new Point(-1, -1), 1, Core.BORDER_CONSTANT, new Scalar(0, 0, 0, 255));
+ Imgproc.blur(baseAreaMaskMat, baseAreaMaskMat, new Size(width * 0.03, height * 0.03));
+
+
+ Mat exclusionAreaMaskMat = new Mat((int)height, (int)width, CvType.CV_8UC4);
+ exclusionAreaMaskMat.setTo(new Scalar(0, 0, 0, 255));
+ foreach (Vector2[] exclusionArea in exclusionAreas)
+ {
Point[] points = new Point[exclusionArea.Length];
- for (int i = 0; i < exclusionArea.Length; i++) {
- points [i] = new Point (exclusionArea [i].x * width, height - exclusionArea [i].y * height);
+ for (int i = 0; i < exclusionArea.Length; i++)
+ {
+ points[i] = new Point(exclusionArea[i].x * width, height - exclusionArea[i].y * height);
}
- Imgproc.fillConvexPoly (exclusionAreaMaskMat, new MatOfPoint (points), Scalar.all (255), Imgproc.LINE_AA, 0);
+ Imgproc.fillConvexPoly(exclusionAreaMaskMat, new MatOfPoint(points), Scalar.all(255), Imgproc.LINE_AA, 0);
}
-// Imgproc.dilate(exclusionAreaMaskMat, exclusionAreaMaskMat, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size (width * 0.002, height * 0.002)), new Point(-1, -1), 1, Core.BORDER_CONSTANT, new Scalar(0));
- Imgproc.blur (exclusionAreaMaskMat, exclusionAreaMaskMat, new Size (width * 0.01, height * 0.01), new Point (-1, -1), Core.BORDER_CONSTANT);
+ //Imgproc.dilate(exclusionAreaMaskMat, exclusionAreaMaskMat, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size (width * 0.002, height * 0.002)), new Point(-1, -1), 1, Core.BORDER_CONSTANT, new Scalar(0));
+ Imgproc.blur(exclusionAreaMaskMat, exclusionAreaMaskMat, new Size(width * 0.01, height * 0.01), new Point(-1, -1), Core.BORDER_CONSTANT);
- Mat maskMat = new Mat ((int)height, (int)width, CvType.CV_8UC4);
- Core.bitwise_xor (baseAreaMaskMat, exclusionAreaMaskMat, maskMat);
+ Mat maskMat = new Mat((int)height, (int)width, CvType.CV_8UC4);
+ Core.bitwise_xor(baseAreaMaskMat, exclusionAreaMaskMat, maskMat);
- Texture2D texture = new Texture2D ((int)width, (int)height, TextureFormat.RGB24, false);
- Utils.matToTexture2D (maskMat, texture);
+ Texture2D texture = new Texture2D((int)width, (int)height, TextureFormat.RGB24, false);
+ Utils.matToTexture2D(maskMat, texture);
+
+ maskMat.Dispose();
+ baseAreaMaskMat.Dispose();
+ exclusionAreaMaskMat.Dispose();
- maskMat.Dispose ();
- baseAreaMaskMat.Dispose ();
- exclusionAreaMaskMat.Dispose ();
-
return texture;
}
}
diff --git a/Assets/FaceMaskExample/Scripts/Utils/FpsMonitor.cs b/Assets/FaceMaskExample/Scripts/Utils/FpsMonitor.cs
index c356f69..6c3d77c 100644
--- a/Assets/FaceMaskExample/Scripts/Utils/FpsMonitor.cs
+++ b/Assets/FaceMaskExample/Scripts/Utils/FpsMonitor.cs
@@ -1,6 +1,5 @@
-using UnityEngine;
-using System.Collections;
-using System.Collections.Generic;
+using System.Collections.Generic;
+using UnityEngine;
namespace FaceMaskExample
{
@@ -28,11 +27,11 @@ namespace FaceMaskExample
const float INNER_Y = 5f;
const float GUI_CONSOLE_HEIGHT = 50f;
- public Vector2 offset = new Vector2 (MARGIN_X, MARGIN_Y);
+ public Vector2 offset = new Vector2(MARGIN_X, MARGIN_Y);
public bool boxVisible = true;
public float boxWidth = GUI_WIDTH;
public float boxHeight = GUI_HEIGHT;
- public Vector2 padding = new Vector2 (INNER_X, INNER_Y);
+ public Vector2 padding = new Vector2(INNER_X, INNER_Y);
public float consoleHeight = GUI_CONSOLE_HEIGHT;
GUIStyle console_labelStyle;
@@ -48,13 +47,13 @@ namespace FaceMaskExample
int oldScrWidth;
int oldScrHeight;
- Dictionary outputDict = new Dictionary ();
+ Dictionary outputDict = new Dictionary();
public string consoleText;
// Use this for initialization
- void Start ()
+ void Start()
{
- console_labelStyle = new GUIStyle ();
+ console_labelStyle = new GUIStyle();
console_labelStyle.fontSize = 32;
console_labelStyle.fontStyle = FontStyle.Normal;
console_labelStyle.wordWrap = true;
@@ -62,116 +61,127 @@ namespace FaceMaskExample
oldScrWidth = Screen.width;
oldScrHeight = Screen.height;
- LocateGUI ();
+ LocateGUI();
}
// Update is called once per frame
- void Update ()
+ void Update()
{
tick++;
elapsed += Time.deltaTime;
- if (elapsed >= 1f) {
+ if (elapsed >= 1f)
+ {
fps = tick / elapsed;
tick = 0;
elapsed = 0;
}
}
- void OnGUI ()
+ void OnGUI()
{
- if (oldScrWidth != Screen.width || oldScrHeight != Screen.height) {
- LocateGUI ();
+ if (oldScrWidth != Screen.width || oldScrHeight != Screen.height)
+ {
+ LocateGUI();
}
oldScrWidth = Screen.width;
oldScrHeight = Screen.height;
- if (boxVisible) {
- GUI.Box (outer, "");
- }
-
- GUILayout.BeginArea (inner);
+ if (boxVisible)
{
- GUILayout.BeginVertical ();
- GUILayout.Label ("fps : " + fps.ToString ("F1"));
- foreach (KeyValuePair pair in outputDict) {
- GUILayout.Label (pair.Key + " : " + pair.Value);
- }
- GUILayout.EndVertical ();
+ GUI.Box(outer, "");
}
- GUILayout.EndArea ();
- if (!string.IsNullOrEmpty (consoleText)) {
- if (boxVisible) {
- GUI.Box (console_outer, "");
- }
-
- GUILayout.BeginArea (console_inner);
+ GUILayout.BeginArea(inner);
+ {
+ GUILayout.BeginVertical();
+ GUILayout.Label("fps : " + fps.ToString("F1"));
+ foreach (KeyValuePair pair in outputDict)
{
- GUILayout.BeginVertical ();
- GUILayout.Label (consoleText, console_labelStyle);
- GUILayout.EndVertical ();
+ GUILayout.Label(pair.Key + " : " + pair.Value);
}
- GUILayout.EndArea ();
+ GUILayout.EndVertical();
+ }
+ GUILayout.EndArea();
+
+ if (!string.IsNullOrEmpty(consoleText))
+ {
+ if (boxVisible)
+ {
+ GUI.Box(console_outer, "");
+ }
+
+ GUILayout.BeginArea(console_inner);
+ {
+ GUILayout.BeginVertical();
+ GUILayout.Label(consoleText, console_labelStyle);
+ GUILayout.EndVertical();
+ }
+ GUILayout.EndArea();
}
}
- public void Add (string key, string value)
+ public void Add(string key, string value)
{
- if (outputDict.ContainsKey (key)) {
- outputDict [key] = value;
- } else {
- outputDict.Add (key, value);
+ if (outputDict.ContainsKey(key))
+ {
+ outputDict[key] = value;
+ }
+ else
+ {
+ outputDict.Add(key, value);
}
}
- public void Remove (string key)
+ public void Remove(string key)
{
- outputDict.Remove (key);
+ outputDict.Remove(key);
}
- public void Clear ()
+ public void Clear()
{
- outputDict.Clear ();
+ outputDict.Clear();
}
- public void LocateGUI ()
+ public void LocateGUI()
{
- x = GetAlignedX (alignment, boxWidth);
- y = GetAlignedY (alignment, boxHeight);
- outer = new Rect (x, y, boxWidth, boxHeight);
- inner = new Rect (x + padding.x, y + padding.y, boxWidth, boxHeight);
+ x = GetAlignedX(alignment, boxWidth);
+ y = GetAlignedY(alignment, boxHeight);
+ outer = new Rect(x, y, boxWidth, boxHeight);
+ inner = new Rect(x + padding.x, y + padding.y, boxWidth, boxHeight);
- console_x = GetAlignedX (Alignment.LeftBottom, Screen.width);
- console_y = GetAlignedY (Alignment.LeftBottom, consoleHeight);
- console_outer = new Rect (console_x, console_y, Screen.width - offset.x * 2, consoleHeight);
- console_inner = new Rect (console_x + padding.x, console_y + padding.y, Screen.width - offset.x * 2 - padding.x, consoleHeight);
+ console_x = GetAlignedX(Alignment.LeftBottom, Screen.width);
+ console_y = GetAlignedY(Alignment.LeftBottom, consoleHeight);
+ console_outer = new Rect(console_x, console_y, Screen.width - offset.x * 2, consoleHeight);
+ console_inner = new Rect(console_x + padding.x, console_y + padding.y, Screen.width - offset.x * 2 - padding.x, consoleHeight);
}
- float GetAlignedX (Alignment anchor, float w)
+ float GetAlignedX(Alignment anchor, float w)
{
- switch (anchor) {
- default:
- case Alignment.LeftTop:
- case Alignment.LeftBottom:
- return offset.x;
+ switch (anchor)
+ {
+ default:
+ case Alignment.LeftTop:
+ case Alignment.LeftBottom:
+ return offset.x;
- case Alignment.RightTop:
- case Alignment.RightBottom:
- return Screen.width - w - offset.x;
+ case Alignment.RightTop:
+ case Alignment.RightBottom:
+ return Screen.width - w - offset.x;
}
}
- float GetAlignedY (Alignment anchor, float h)
+ float GetAlignedY(Alignment anchor, float h)
{
- switch (anchor) {
- default:
- case Alignment.LeftTop:
- case Alignment.RightTop:
- return offset.y;
+ switch (anchor)
+ {
+ default:
+ case Alignment.LeftTop:
+ case Alignment.RightTop:
+ return offset.y;
- case Alignment.LeftBottom:
- case Alignment.RightBottom:
- return Screen.height - h - offset.y;
+ case Alignment.LeftBottom:
+ case Alignment.RightBottom:
+ return Screen.height - h - offset.y;
}
}
}
diff --git a/Assets/FaceMaskExample/Scripts/Utils/FrontalFaceChecker.cs b/Assets/FaceMaskExample/Scripts/Utils/FrontalFaceChecker.cs
index 02c5d42..bf9fa67 100644
--- a/Assets/FaceMaskExample/Scripts/Utils/FrontalFaceChecker.cs
+++ b/Assets/FaceMaskExample/Scripts/Utils/FrontalFaceChecker.cs
@@ -1,9 +1,8 @@
-using System;
-using System.Collections;
+using OpenCVForUnity.Calib3dModule;
+using OpenCVForUnity.CoreModule;
+using System;
using System.Collections.Generic;
using UnityEngine;
-using OpenCVForUnity.CoreModule;
-using OpenCVForUnity.Calib3dModule;
namespace FaceMaskExample
{
@@ -16,7 +15,7 @@ namespace FaceMaskExample
float imageWidth;
float imageHeight;
Point[] landmarkPoints = new Point[7];
- Matrix4x4 transformationM = new Matrix4x4 ();
+ Matrix4x4 transformationM = new Matrix4x4();
MatOfPoint3f objectPoints;
MatOfPoint2f imagePoints;
Mat rvec;
@@ -32,72 +31,73 @@ namespace FaceMaskExample
///
/// Width of the image which was used in the face landmark detection.
/// Height of the image which was used in the face landmark detection.
- public FrontalFaceChecker (float width, float height)
+ public FrontalFaceChecker(float width, float height)
{
imageWidth = width;
imageHeight = height;
- for (int i = 0; i < landmarkPoints.Length; i++) {
- landmarkPoints [i] = new Point (0, 0);
+ for (int i = 0; i < landmarkPoints.Length; i++)
+ {
+ landmarkPoints[i] = new Point(0, 0);
}
- objectPoints = new MatOfPoint3f (
- new Point3 (-34, 90, 83),//l eye (Interpupillary breadth)
- new Point3 (34, 90, 83),//r eye (Interpupillary breadth)
- new Point3 (0.0, 50, 120),//nose (Nose top)
- new Point3 (-26, 15, 83),//l mouse (Mouth breadth)
- new Point3 (26, 15, 83),//r mouse (Mouth breadth)
- new Point3 (-79, 90, 0.0),//l ear (Bitragion breadth)
- new Point3 (79, 90, 0.0)//r ear (Bitragion breadth)
+ objectPoints = new MatOfPoint3f(
+ new Point3(-34, 90, 83),//l eye (Interpupillary breadth)
+ new Point3(34, 90, 83),//r eye (Interpupillary breadth)
+ new Point3(0.0, 50, 120),//nose (Nose top)
+ new Point3(-26, 15, 83),//l mouse (Mouth breadth)
+ new Point3(26, 15, 83),//r mouse (Mouth breadth)
+ new Point3(-79, 90, 0.0),//l ear (Bitragion breadth)
+ new Point3(79, 90, 0.0)//r ear (Bitragion breadth)
);
-
- imagePoints = new MatOfPoint2f ();
- rvec = new Mat (3, 1, CvType.CV_64FC1);
- tvec = new Mat (3, 1, CvType.CV_64FC1);
+ imagePoints = new MatOfPoint2f();
- rotM = new Mat (3, 3, CvType.CV_64FC1);
-
- float max_d = Mathf.Max (imageHeight, imageWidth);
- camMatrix = new Mat (3, 3, CvType.CV_64FC1);
- camMatrix.put (0, 0, max_d);
- camMatrix.put (0, 1, 0);
- camMatrix.put (0, 2, imageWidth / 2.0f);
- camMatrix.put (1, 0, 0);
- camMatrix.put (1, 1, max_d);
- camMatrix.put (1, 2, imageHeight / 2.0f);
- camMatrix.put (2, 0, 0);
- camMatrix.put (2, 1, 0);
- camMatrix.put (2, 2, 1.0f);
-
- distCoeffs = new MatOfDouble (0, 0, 0, 0);
-
- invertYM = Matrix4x4.TRS (Vector3.zero, Quaternion.identity, new Vector3 (1, -1, 1));
- invertZM = Matrix4x4.TRS (Vector3.zero, Quaternion.identity, new Vector3 (1, 1, -1));
+ rvec = new Mat(3, 1, CvType.CV_64FC1);
+ tvec = new Mat(3, 1, CvType.CV_64FC1);
+
+ rotM = new Mat(3, 3, CvType.CV_64FC1);
+
+ float max_d = Mathf.Max(imageHeight, imageWidth);
+ camMatrix = new Mat(3, 3, CvType.CV_64FC1);
+ camMatrix.put(0, 0, max_d);
+ camMatrix.put(0, 1, 0);
+ camMatrix.put(0, 2, imageWidth / 2.0f);
+ camMatrix.put(1, 0, 0);
+ camMatrix.put(1, 1, max_d);
+ camMatrix.put(1, 2, imageHeight / 2.0f);
+ camMatrix.put(2, 0, 0);
+ camMatrix.put(2, 1, 0);
+ camMatrix.put(2, 2, 1.0f);
+
+ distCoeffs = new MatOfDouble(0, 0, 0, 0);
+
+ invertYM = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1, -1, 1));
+ invertZM = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1, 1, -1));
}
- public void Dispose ()
+ public void Dispose()
{
if (objectPoints != null && !objectPoints.IsDisposed)
- objectPoints.Dispose ();
+ objectPoints.Dispose();
if (imagePoints != null && !imagePoints.IsDisposed)
- imagePoints.Dispose ();
+ imagePoints.Dispose();
if (rvec != null && !rvec.IsDisposed)
- rvec.Dispose ();
+ rvec.Dispose();
if (tvec != null && !tvec.IsDisposed)
- tvec.Dispose ();
+ tvec.Dispose();
if (rotM != null && !rotM.IsDisposed)
- rotM.Dispose ();
+ rotM.Dispose();
if (camMatrix != null && !camMatrix.IsDisposed)
- camMatrix.Dispose ();
+ camMatrix.Dispose();
if (distCoeffs != null && !distCoeffs.IsDisposed)
- distCoeffs.Dispose ();
+ distCoeffs.Dispose();
}
///
@@ -105,70 +105,75 @@ namespace FaceMaskExample
///
/// Frontal face angles.
/// Points of face landmark which was detected with Dlib.
- public Vector3 GetFrontalFaceAngles (List points)
+ public Vector3 GetFrontalFaceAngles(List points)
{
if (points.Count < 68)
- throw new ArgumentException ("Invalid face landmark points", "points");
+ throw new ArgumentException("Invalid face landmark points", "points");
- landmarkPoints [0].x = (points [38].x + points [41].x) / 2;
- landmarkPoints [0].y = (points [38].y + points [41].y) / 2;
- landmarkPoints [1].x = (points [43].x + points [46].x) / 2;
- landmarkPoints [1].y = (points [43].y + points [46].y) / 2;
- landmarkPoints [2].x = points [30].x;
- landmarkPoints [2].y = points [30].y;
- landmarkPoints [3].x = points [48].x;
- landmarkPoints [3].y = points [48].y;
- landmarkPoints [4].x = points [54].x;
- landmarkPoints [4].y = points [54].y;
- landmarkPoints [5].x = points [0].x;
- landmarkPoints [5].y = points [0].y;
- landmarkPoints [6].x = points [16].x;
- landmarkPoints [6].y = points [16].y;
+ landmarkPoints[0].x = (points[38].x + points[41].x) / 2;
+ landmarkPoints[0].y = (points[38].y + points[41].y) / 2;
+ landmarkPoints[1].x = (points[43].x + points[46].x) / 2;
+ landmarkPoints[1].y = (points[43].y + points[46].y) / 2;
+ landmarkPoints[2].x = points[30].x;
+ landmarkPoints[2].y = points[30].y;
+ landmarkPoints[3].x = points[48].x;
+ landmarkPoints[3].y = points[48].y;
+ landmarkPoints[4].x = points[54].x;
+ landmarkPoints[4].y = points[54].y;
+ landmarkPoints[5].x = points[0].x;
+ landmarkPoints[5].y = points[0].y;
+ landmarkPoints[6].x = points[16].x;
+ landmarkPoints[6].y = points[16].y;
// Normalize points.
- Point centerOffset = landmarkPoints [2] - new Point (imageWidth / 2, imageHeight / 2);
- for (int i = 0; i < landmarkPoints.Length; i++) {
- landmarkPoints [i] = landmarkPoints [i] - centerOffset;
+ Point centerOffset = landmarkPoints[2] - new Point(imageWidth / 2, imageHeight / 2);
+ for (int i = 0; i < landmarkPoints.Length; i++)
+ {
+ landmarkPoints[i] = landmarkPoints[i] - centerOffset;
}
- imagePoints.fromArray (landmarkPoints);
+ imagePoints.fromArray(landmarkPoints);
- Calib3d.solvePnP (objectPoints, imagePoints, camMatrix, distCoeffs, rvec, tvec);
+ Calib3d.solvePnP(objectPoints, imagePoints, camMatrix, distCoeffs, rvec, tvec);
- double tvec_z = tvec.get (2, 0) [0];
+ double tvec_z = tvec.get(2, 0)[0];
-// Debug.Log (rvec.dump());
-// Debug.Log (tvec.dump());
+ //Debug.Log (rvec.dump());
+ //Debug.Log (tvec.dump());
- if (!double.IsNaN (tvec_z)) {
- Calib3d.Rodrigues (rvec, rotM);
-
-// Debug.Log (rotM.dump());
+ if (!double.IsNaN(tvec_z))
+ {
+ Calib3d.Rodrigues(rvec, rotM);
+
+ //Debug.Log (rotM.dump());
+
+ transformationM.SetRow(0, new Vector4((float)rotM.get(0, 0)[0], (float)rotM.get(0, 1)[0], (float)rotM.get(0, 2)[0], (float)tvec.get(0, 0)[0]));
+ transformationM.SetRow(1, new Vector4((float)rotM.get(1, 0)[0], (float)rotM.get(1, 1)[0], (float)rotM.get(1, 2)[0], (float)tvec.get(1, 0)[0]));
+ transformationM.SetRow(2, new Vector4((float)rotM.get(2, 0)[0], (float)rotM.get(2, 1)[0], (float)rotM.get(2, 2)[0], (float)tvec.get(2, 0)[0]));
+ transformationM.SetRow(3, new Vector4(0, 0, 0, 1));
- transformationM.SetRow (0, new Vector4 ((float)rotM.get (0, 0) [0], (float)rotM.get (0, 1) [0], (float)rotM.get (0, 2) [0], (float)tvec.get (0, 0) [0]));
- transformationM.SetRow (1, new Vector4 ((float)rotM.get (1, 0) [0], (float)rotM.get (1, 1) [0], (float)rotM.get (1, 2) [0], (float)tvec.get (1, 0) [0]));
- transformationM.SetRow (2, new Vector4 ((float)rotM.get (2, 0) [0], (float)rotM.get (2, 1) [0], (float)rotM.get (2, 2) [0], (float)tvec.get (2, 0) [0]));
- transformationM.SetRow (3, new Vector4 (0, 0, 0, 1));
-
transformationM = invertYM * transformationM * invertZM;
-
- Vector3 angles = ExtractRotationFromMatrix (ref transformationM).eulerAngles;
-// Debug.Log ("angles " + angles.x + " " + angles.y + " " + angles.z);
+ Vector3 angles = ExtractRotationFromMatrix(ref transformationM).eulerAngles;
+
+ //Debug.Log ("angles " + angles.x + " " + angles.y + " " + angles.z);
float rotationX = (angles.x > 180) ? angles.x - 360 : angles.x;
float rotationY = (angles.y > 180) ? angles.y - 360 : angles.y;
float rotationZ = (tvec_z >= 0) ? (angles.z > 180) ? angles.z - 360 : angles.z : 180 - angles.z;
- if (tvec_z < 0) {
+ if (tvec_z < 0)
+ {
rotationX = -rotationX;
rotationY = -rotationY;
rotationZ = -rotationZ;
}
- return new Vector3 (rotationX, rotationY, rotationZ);
- } else {
- return new Vector3 (0, 0, 0);
+ return new Vector3(rotationX, rotationY, rotationZ);
+ }
+ else
+ {
+ return new Vector3(0, 0, 0);
}
}
@@ -177,16 +182,16 @@ namespace FaceMaskExample
///
/// Frontal face rate.(a value of 0 to 1)
/// Points of face landmark which was detected with Dlib.
- public float GetFrontalFaceRate (List points)
+ public float GetFrontalFaceRate(List points)
{
- Vector3 angles = GetFrontalFaceAngles (points);
+ Vector3 angles = GetFrontalFaceAngles(points);
-// Debug.Log ("angles " + angles.x + " " + angles.y + " " + angles.z);
+ //Debug.Log ("angles " + angles.x + " " + angles.y + " " + angles.z);
- float angle = Mathf.Max (Mathf.Abs (angles.x), Mathf.Abs (angles.y));
+ float angle = Mathf.Max(Mathf.Abs(angles.x), Mathf.Abs(angles.y));
float rate = (angle <= 90) ? angle / 90 : 1;
-// Debug.Log ("ratio " + (1.0f - rate));
+ //Debug.Log ("ratio " + (1.0f - rate));
return 1.0f - rate;
}
@@ -199,19 +204,19 @@ namespace FaceMaskExample
///
/// Quaternion representation of rotation transform.
///
- private Quaternion ExtractRotationFromMatrix (ref Matrix4x4 matrix)
+ private Quaternion ExtractRotationFromMatrix(ref Matrix4x4 matrix)
{
Vector3 forward;
forward.x = matrix.m02;
forward.y = matrix.m12;
forward.z = matrix.m22;
-
+
Vector3 upwards;
upwards.x = matrix.m01;
upwards.y = matrix.m11;
upwards.z = matrix.m21;
-
- return Quaternion.LookRotation (forward, upwards);
+
+ return Quaternion.LookRotation(forward, upwards);
}
}
}
diff --git a/Assets/FaceMaskExample/Scripts/Utils/OpenCVForUnityUtils.cs b/Assets/FaceMaskExample/Scripts/Utils/OpenCVForUnityUtils.cs
index b2f9151..1cb43f6 100644
--- a/Assets/FaceMaskExample/Scripts/Utils/OpenCVForUnityUtils.cs
+++ b/Assets/FaceMaskExample/Scripts/Utils/OpenCVForUnityUtils.cs
@@ -1,10 +1,9 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using DlibFaceLandmarkDetector;
+using DlibFaceLandmarkDetector;
using OpenCVForUnity.CoreModule;
using OpenCVForUnity.ImgprocModule;
+using System;
+using System.Collections.Generic;
+using UnityEngine;
namespace FaceMaskExample
{
@@ -18,12 +17,21 @@ namespace FaceMaskExample
///
/// Face landmark detector.
/// Image mat.
- public static void SetImage (FaceLandmarkDetector faceLandmarkDetector, Mat imgMat)
+ public static void SetImage(FaceLandmarkDetector faceLandmarkDetector, Mat imgMat)
{
- if (!imgMat.isContinuous ()) {
- throw new ArgumentException ("imgMat.isContinuous() must be true.");
- }
- faceLandmarkDetector.SetImage ((IntPtr)imgMat.dataAddr (), imgMat.width (), imgMat.height (), (int)imgMat.elemSize ());
+ if (faceLandmarkDetector == null)
+ throw new ArgumentNullException("faceLandmarkDetector");
+ if (faceLandmarkDetector != null)
+ faceLandmarkDetector.ThrowIfDisposed();
+
+ if (imgMat == null)
+ throw new ArgumentNullException("imgMat");
+ if (imgMat != null)
+ imgMat.ThrowIfDisposed();
+ if (!imgMat.isContinuous())
+ throw new ArgumentException("imgMat.isContinuous() must be true.");
+
+ faceLandmarkDetector.SetImage((IntPtr)imgMat.dataAddr(), imgMat.width(), imgMat.height(), (int)imgMat.elemSize());
}
///
@@ -33,9 +41,21 @@ namespace FaceMaskExample
/// Rect.
/// Color.
/// Thickness.
- public static void DrawFaceRect (Mat imgMat, UnityEngine.Rect rect, Scalar color, int thickness)
+ public static void DrawFaceRect(Mat imgMat, UnityEngine.Rect rect, Scalar color, int thickness)
{
- Imgproc.rectangle (imgMat, new Point (rect.xMin, rect.yMin), new Point (rect.xMax, rect.yMax), color, thickness);
+ Imgproc.rectangle(imgMat, new Point(rect.xMin, rect.yMin), new Point(rect.xMax, rect.yMax), color, thickness);
+ }
+
+ ///
+ /// Draws a face rect.
+ ///
+ /// Image mat.
+ /// Rect.
+ /// Color.
+ /// Thickness.
+ public static void DrawFaceRect(Mat imgMat, OpenCVForUnity.CoreModule.Rect rect, Scalar color, int thickness)
+ {
+ Imgproc.rectangle(imgMat, rect, color, thickness);
}
///
@@ -45,12 +65,15 @@ namespace FaceMaskExample
/// RectDetection.
/// Color.
/// Thickness.
- public static void DrawFaceRect (Mat imgMat, DlibFaceLandmarkDetector.FaceLandmarkDetector.RectDetection rect, Scalar color, int thickness)
- {
+ public static void DrawFaceRect(Mat imgMat, DlibFaceLandmarkDetector.FaceLandmarkDetector.RectDetection rect, Scalar color, int thickness)
+ {
+ if (rect == null)
+ throw new ArgumentNullException("rect");
+
UnityEngine.Rect _rect = rect.rect;
- Imgproc.putText (imgMat, "detection_confidence : " + rect.detection_confidence, new Point (_rect.xMin, _rect.yMin - 20), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
- Imgproc.putText (imgMat, "weight_index : " + rect.weight_index, new Point (_rect.xMin, _rect.yMin - 5), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
- Imgproc.rectangle (imgMat, new Point (_rect.xMin, _rect.yMin), new Point (_rect.xMax, _rect.yMax), color, thickness);
+ Imgproc.putText(imgMat, "detection_confidence : " + rect.detection_confidence, new Point(_rect.xMin, _rect.yMin - 20), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar(255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
+ Imgproc.putText(imgMat, "weight_index : " + rect.weight_index, new Point(_rect.xMin, _rect.yMin - 5), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar(255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
+ Imgproc.rectangle(imgMat, new Point(_rect.xMin, _rect.yMin), new Point(_rect.xMax, _rect.yMax), color, thickness);
}
///
@@ -60,301 +83,603 @@ namespace FaceMaskExample
/// Detected object's data. [left, top, width, height, detection_confidence, weight_index]
/// Color.
/// Thickness.
- public static void DrawFaceRect (Mat imgMat, double[] rect, Scalar color, int thickness)
- {
+ public static void DrawFaceRect(Mat imgMat, double[] rect, Scalar color, int thickness)
+ {
+ if (rect == null)
+ throw new ArgumentNullException("rect");
+
if (rect.Length > 4)
- Imgproc.putText (imgMat, "detection_confidence : " + rect [4], new Point (rect [0], rect [1] - 20), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
+ Imgproc.putText(imgMat, "detection_confidence : " + rect[4], new Point(rect[0], rect[1] - 20), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar(255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
if (rect.Length > 5)
- Imgproc.putText (imgMat, "weight_index : " + rect [5], new Point (rect [0], rect [1] - 5), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
- Imgproc.rectangle (imgMat, new Point (rect [0], rect [1]), new Point (rect [0] + rect [2], rect [1] + rect [3]), color, thickness);
+ Imgproc.putText(imgMat, "weight_index : " + rect[5], new Point(rect[0], rect[1] - 5), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar(255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
+ Imgproc.rectangle(imgMat, new Point(rect[0], rect[1]), new Point(rect[0] + rect[2], rect[1] + rect[3]), color, thickness);
}
///
/// Draws a face landmark.
- /// This method supports 68 landmark points.
+ /// This method supports 68,17,6,5 landmark points.
///
/// Image mat.
/// Points.
/// Color.
/// Thickness.
/// Determines if draw index numbers.
- public static void DrawFaceLandmark (Mat imgMat, List points, Scalar color, int thickness, bool drawIndexNumbers = false)
+ public static void DrawFaceLandmark(Mat imgMat, IList points, Scalar color, int thickness, bool drawIndexNumbers = false)
{
- if (points.Count == 5) {
+ if (points == null)
+ throw new ArgumentNullException("points");
- Imgproc.line (imgMat, new Point (points [0].x, points [0].y), new Point (points [1].x, points [1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [1].x, points [1].y), new Point (points [4].x, points [4].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [4].x, points [4].y), new Point (points [3].x, points [3].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [3].x, points [3].y), new Point (points [2].x, points [2].y), color, thickness);
+ if (points.Count == 5)
+ {
+
+ Imgproc.line(imgMat, new Point(points[0].x, points[0].y), new Point(points[1].x, points[1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[1].x, points[1].y), new Point(points[4].x, points[4].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[4].x, points[4].y), new Point(points[3].x, points[3].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[3].x, points[3].y), new Point(points[2].x, points[2].y), color, thickness);
+
+ }
+ else if (points.Count == 6)
+ {
+
+ Imgproc.line(imgMat, new Point(points[2].x, points[2].y), new Point(points[3].x, points[3].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[4].x, points[4].y), new Point(points[5].x, points[5].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[3].x, points[3].y), new Point(points[0].x, points[0].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[4].x, points[4].y), new Point(points[0].x, points[0].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[0].x, points[0].y), new Point(points[1].x, points[1].y), color, thickness);
+
+ }
+ else if (points.Count == 17)
+ {
+
+ Imgproc.line(imgMat, new Point(points[2].x, points[2].y), new Point(points[9].x, points[9].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[9].x, points[9].y), new Point(points[3].x, points[3].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[3].x, points[3].y), new Point(points[10].x, points[10].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[10].x, points[10].y), new Point(points[2].x, points[2].y), color, thickness);
+
+ Imgproc.line(imgMat, new Point(points[4].x, points[4].y), new Point(points[11].x, points[11].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[11].x, points[11].y), new Point(points[5].x, points[5].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[5].x, points[5].y), new Point(points[12].x, points[12].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[12].x, points[12].y), new Point(points[4].x, points[4].y), color, thickness);
+
+ Imgproc.line(imgMat, new Point(points[3].x, points[3].y), new Point(points[0].x, points[0].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[4].x, points[4].y), new Point(points[0].x, points[0].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[0].x, points[0].y), new Point(points[1].x, points[1].y), color, thickness);
+
+ for (int i = 14; i <= 16; ++i)
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[16].x, points[16].y), new Point(points[13].x, points[13].y), color, thickness);
+
+ for (int i = 6; i <= 8; i++)
+ Imgproc.circle(imgMat, new Point(points[i].x, points[i].y), 2, color, -1);
+
+ }
+ else if (points.Count == 68)
+ {
- } else if (points.Count == 68) {
-
for (int i = 1; i <= 16; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+
for (int i = 28; i <= 30; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+
for (int i = 18; i <= 21; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
for (int i = 23; i <= 26; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
for (int i = 31; i <= 35; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [30].x, points [30].y), new Point (points [35].x, points [35].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[30].x, points[30].y), new Point(points[35].x, points[35].y), color, thickness);
+
for (int i = 37; i <= 41; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [36].x, points [36].y), new Point (points [41].x, points [41].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[36].x, points[36].y), new Point(points[41].x, points[41].y), color, thickness);
+
for (int i = 43; i <= 47; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [42].x, points [42].y), new Point (points [47].x, points [47].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[42].x, points[42].y), new Point(points[47].x, points[47].y), color, thickness);
+
for (int i = 49; i <= 59; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [48].x, points [48].y), new Point (points [59].x, points [59].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[48].x, points[48].y), new Point(points[59].x, points[59].y), color, thickness);
+
for (int i = 61; i <= 67; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [60].x, points [60].y), new Point (points [67].x, points [67].y), color, thickness);
- } else {
- for (int i = 0; i < points.Count; i++) {
- Imgproc.circle (imgMat, new Point (points [i].x, points [i].y), 2, color, -1);
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[60].x, points[60].y), new Point(points[67].x, points[67].y), color, thickness);
+ }
+ else
+ {
+ for (int i = 0; i < points.Count; i++)
+ {
+ Imgproc.circle(imgMat, new Point(points[i].x, points[i].y), 2, color, -1);
}
}
// Draw the index number of facelandmark points.
- if (drawIndexNumbers) {
+ if (drawIndexNumbers)
+ {
for (int i = 0; i < points.Count; ++i)
- Imgproc.putText (imgMat, i.ToString (), new Point (points [i].x, points [i].y), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
+ Imgproc.putText(imgMat, i.ToString(), new Point(points[i].x, points[i].y), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar(255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
}
}
///
/// Draws a face landmark.
- /// This method supports 68 landmark points.
+ /// This method supports 68,17,6,5 landmark points.
///
/// Image mat.
/// Points.
/// Color.
/// Thickness.
/// Determines if draw index numbers.
- public static void DrawFaceLandmark (Mat imgMat, List points, Scalar color, int thickness, bool drawIndexNumbers = false)
+ public static void DrawFaceLandmark(Mat imgMat, IList points, Scalar color, int thickness, bool drawIndexNumbers = false)
{
- if (points.Count == 5) {
+ if (points == null)
+ throw new ArgumentNullException("points");
- Imgproc.line (imgMat, points [0], points [1], color, thickness);
- Imgproc.line (imgMat, points [1], points [4], color, thickness);
- Imgproc.line (imgMat, points [4], points [3], color, thickness);
- Imgproc.line (imgMat, points [3], points [2], color, thickness);
+ if (points.Count == 5)
+ {
- } else if (points.Count == 68) {
+ Imgproc.line(imgMat, points[0], points[1], color, thickness);
+ Imgproc.line(imgMat, points[1], points[4], color, thickness);
+ Imgproc.line(imgMat, points[4], points[3], color, thickness);
+ Imgproc.line(imgMat, points[3], points[2], color, thickness);
+
+ }
+ else if (points.Count == 6)
+ {
+
+ Imgproc.line(imgMat, points[2], points[3], color, thickness);
+ Imgproc.line(imgMat, points[4], points[5], color, thickness);
+ Imgproc.line(imgMat, points[3], points[0], color, thickness);
+ Imgproc.line(imgMat, points[4], points[0], color, thickness);
+ Imgproc.line(imgMat, points[0], points[1], color, thickness);
+
+ }
+ else if (points.Count == 17)
+ {
+
+ Imgproc.line(imgMat, points[2], points[9], color, thickness);
+ Imgproc.line(imgMat, points[9], points[3], color, thickness);
+ Imgproc.line(imgMat, points[3], points[10], color, thickness);
+ Imgproc.line(imgMat, points[10], points[2], color, thickness);
+
+ Imgproc.line(imgMat, points[4], points[11], color, thickness);
+ Imgproc.line(imgMat, points[11], points[5], color, thickness);
+ Imgproc.line(imgMat, points[5], points[12], color, thickness);
+ Imgproc.line(imgMat, points[12], points[4], color, thickness);
+
+ Imgproc.line(imgMat, points[3], points[0], color, thickness);
+ Imgproc.line(imgMat, points[4], points[0], color, thickness);
+ Imgproc.line(imgMat, points[0], points[1], color, thickness);
+
+ for (int i = 14; i <= 16; ++i)
+ Imgproc.line(imgMat, points[i], points[i - 1], color, thickness);
+ Imgproc.line(imgMat, points[16], points[13], color, thickness);
+
+ for (int i = 6; i <= 8; i++)
+ Imgproc.circle(imgMat, points[i], 2, color, -1);
+
+ }
+ else if (points.Count == 68)
+ {
for (int i = 1; i <= 16; ++i)
- Imgproc.line (imgMat, points [i], points [i - 1], color, thickness);
+ Imgproc.line(imgMat, points[i], points[i - 1], color, thickness);
for (int i = 28; i <= 30; ++i)
- Imgproc.line (imgMat, points [i], points [i - 1], color, thickness);
+ Imgproc.line(imgMat, points[i], points[i - 1], color, thickness);
for (int i = 18; i <= 21; ++i)
- Imgproc.line (imgMat, points [i], points [i - 1], color, thickness);
+ Imgproc.line(imgMat, points[i], points[i - 1], color, thickness);
for (int i = 23; i <= 26; ++i)
- Imgproc.line (imgMat, points [i], points [i - 1], color, thickness);
+ Imgproc.line(imgMat, points[i], points[i - 1], color, thickness);
for (int i = 31; i <= 35; ++i)
- Imgproc.line (imgMat, points [i], points [i - 1], color, thickness);
- Imgproc.line (imgMat, points [30], points [35], color, thickness);
+ Imgproc.line(imgMat, points[i], points[i - 1], color, thickness);
+ Imgproc.line(imgMat, points[30], points[35], color, thickness);
for (int i = 37; i <= 41; ++i)
- Imgproc.line (imgMat, points [i], points [i - 1], color, thickness);
- Imgproc.line (imgMat, points [36], points [41], color, thickness);
+ Imgproc.line(imgMat, points[i], points[i - 1], color, thickness);
+ Imgproc.line(imgMat, points[36], points[41], color, thickness);
for (int i = 43; i <= 47; ++i)
- Imgproc.line (imgMat, points [i], points [i - 1], color, thickness);
- Imgproc.line (imgMat, points [42], points [47], color, thickness);
+ Imgproc.line(imgMat, points[i], points[i - 1], color, thickness);
+ Imgproc.line(imgMat, points[42], points[47], color, thickness);
for (int i = 49; i <= 59; ++i)
- Imgproc.line (imgMat, points [i], points [i - 1], color, thickness);
- Imgproc.line (imgMat, points [48], points [59], color, thickness);
+ Imgproc.line(imgMat, points[i], points[i - 1], color, thickness);
+ Imgproc.line(imgMat, points[48], points[59], color, thickness);
for (int i = 61; i <= 67; ++i)
- Imgproc.line (imgMat, points [i], points [i - 1], color, thickness);
- Imgproc.line (imgMat, points [60], points [67], color, thickness);
- } else {
- for (int i = 0; i < points.Count; i++) {
- Imgproc.circle (imgMat, points [i], 2, color, -1);
+ Imgproc.line(imgMat, points[i], points[i - 1], color, thickness);
+ Imgproc.line(imgMat, points[60], points[67], color, thickness);
+ }
+ else
+ {
+ for (int i = 0; i < points.Count; i++)
+ {
+ Imgproc.circle(imgMat, points[i], 2, color, -1);
}
}
// Draw the index number of facelandmark points.
- if (drawIndexNumbers) {
+ if (drawIndexNumbers)
+ {
for (int i = 0; i < points.Count; ++i)
- Imgproc.putText (imgMat, i.ToString (), points [i], Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
+ Imgproc.putText(imgMat, i.ToString(), points[i], Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar(255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
}
}
///
/// Draws a face landmark.
- /// This method supports 68 landmark points.
+ /// This method supports 68,17,6,5 landmark points.
///
/// Image mat.
/// Detected object landmark data.[x_0, y_0, x_1, y_1, ...]
/// Color.
/// Thickness.
/// Determines if draw index numbers.
- public static void DrawFaceLandmark (Mat imgMat, double[] points, Scalar color, int thickness, bool drawIndexNumbers = false)
+ public static void DrawFaceLandmark(Mat imgMat, double[] points, Scalar color, int thickness, bool drawIndexNumbers = false)
{
- List _points = new List ();
- for (int i = 0; i < points.Length; i = i + 2) {
- _points.Add (new Vector2 ((float)points [i], (float)points [i + 1]));
+ if (points == null)
+ throw new ArgumentNullException("points");
+
+ List _points = new List();
+ for (int i = 0; i < points.Length; i = i + 2)
+ {
+ _points.Add(new Vector2((float)points[i], (float)points[i + 1]));
}
- DrawFaceLandmark (imgMat, _points, color, thickness, drawIndexNumbers);
+ DrawFaceLandmark(imgMat, _points, color, thickness, drawIndexNumbers);
+ }
+
+
+
+
+ ///
+ /// Convert Vector2 list to Vector2 array.
+ ///
+ /// List of Vector2.
+ /// Array of Vector2.
+ /// Array of Vector2.
+ public static Vector2[] ConvertVector2ListToVector2Array(IList src, Vector2[] dst = null)
+ {
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst != null && src.Count != dst.Length)
+ throw new ArgumentException("src.Count != dst.Length");
+
+ if (dst == null)
+ {
+ dst = new Vector2[src.Count];
+ }
+
+ for (int i = 0; i < src.Count; ++i)
+ {
+ dst[i].x = src[i].x;
+ dst[i].y = src[i].y;
+ }
+
+ return dst;
}
///
- /// Convert vector2 list to point list.
+ /// Convert Vector2 list to Point list.
///
- /// List of vector2.
- /// List of point.
- /// List of point.
- public static List ConvertVector2ListToPointList (List vecs, List pts = null)
+ /// List of Vector2.
+ /// List of Point.
+ /// List of Point.
+ public static List ConvertVector2ListToPointList(IList src, List dst = null)
{
- if (pts == null) {
- pts = new List ();
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst == null)
+ {
+ dst = new List();
}
- if (pts.Count != vecs.Count) {
- pts.Clear ();
- for (int i = 0; i < vecs.Count; i++) {
- pts.Add (new Point ());
+ if (dst.Count != src.Count)
+ {
+ dst.Clear();
+ for (int i = 0; i < src.Count; i++)
+ {
+ dst.Add(new Point());
}
}
- for (int i = 0; i < vecs.Count; ++i) {
- pts [i].x = vecs [i].x;
- pts [i].y = vecs [i].y;
+ for (int i = 0; i < src.Count; ++i)
+ {
+ dst[i].x = src[i].x;
+ dst[i].y = src[i].y;
}
- return pts;
+ return dst;
}
///
- /// Convert vector2 list to array.
+ /// Convert Vector2 list to Point array.
///
- /// List of vector2.
- /// Array of double.
+ /// List of Vector2.
+ /// Array of Point.
+ /// Array of Point.
+ public static Point[] ConvertVector2ListToPointArray(IList src, Point[] dst = null)
+ {
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst != null && src.Count != dst.Length)
+ throw new ArgumentException("src.Count != dst.Length");
+
+ if (dst == null)
+ {
+ dst = new Point[src.Count];
+ }
+
+ for (int i = 0; i < src.Count; ++i)
+ {
+ dst[i] = new Point(src[i].x, src[i].y);
+ }
+
+ return dst;
+ }
+
+ ///
+ /// Convert Vector2 list to array.
+ ///
+ /// List of Vector2.
+ /// Array of double.
/// Array of double.
- public static double[] ConvertVector2ListToArray (List vecs, double[] arr = null)
+ public static double[] ConvertVector2ListToArray(IList src, double[] dst = null)
{
- if (arr == null || (arr != null && arr.Length != vecs.Count * 2)) {
- arr = new double[vecs.Count * 2];
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst != null && src.Count * 2 != dst.Length)
+ throw new ArgumentException("src.Count * 2 != dst.Length");
+
+ if (dst == null)
+ {
+ dst = new double[src.Count * 2];
}
- for (int i = 0; i < vecs.Count; ++i) {
- arr [i * 2] = vecs [i].x;
- arr [i * 2 + 1] = vecs [i].y;
+ for (int i = 0; i < src.Count; ++i)
+ {
+ dst[i * 2] = src[i].x;
+ dst[i * 2 + 1] = src[i].y;
}
- return arr;
+ return dst;
+ }
+
+
+
+
+ ///
+ /// Convert Point list to Point array.
+ ///
+ /// List of Point.
+ /// Array of Point.
+ /// Array of Point.
+ public static Point[] ConvertPointListToPointArray(IList src, Point[] dst = null)
+ {
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst != null && src.Count != dst.Length)
+ throw new ArgumentException("src.Count != dst.Length");
+
+ if (dst == null)
+ {
+ dst = new Point[src.Count];
+ }
+
+ for (int i = 0; i < src.Count; ++i)
+ {
+ dst[i] = new Point(src[i].x, src[i].y);
+ }
+
+ return dst;
}
///
- /// Convert point list to vector2 list.
+ /// Convert Point list to Vector2 list.
///
- /// List of point.
- /// List of vector2.
- /// List of vector2.
- public static List ConvertPointListToVector2List (List pts, List vecs = null)
+ /// List of Point.
+ /// List of Vector2.
+ /// List of Vector2.
+ public static List ConvertPointListToVector2List(IList src, List dst = null)
{
- if (vecs == null) {
- vecs = new List ();
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst == null)
+ {
+ dst = new List();
}
- if (vecs.Count != pts.Count) {
- vecs.Clear ();
- for (int i = 0; i < pts.Count; i++) {
- vecs.Add (new Vector2 ());
- }
+ dst.Clear();
+
+ for (int i = 0; i < src.Count; ++i)
+ {
+ dst.Add(new Vector2((float)src[i].x, (float)src[i].y));
}
- for (int i = 0; i < pts.Count; ++i) {
- vecs.Add (new Vector2 ((float)pts [i].x, (float)pts [i].y));
- }
-
- return vecs;
+ return dst;
}
///
- /// Convert point list to array.
+ /// Convert Point list to Vector2 array.
///
- /// List of point.
- /// Array of double.
+ /// List of Point.
+ /// Array of Vector2.
+ /// Array of Vector2.
+ public static Vector2[] ConvertPointListToVector2Array(IList src, Vector2[] dst = null)
+ {
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst != null && src.Count != dst.Length)
+ throw new ArgumentException("src.Count != dst.Length");
+
+ if (dst == null)
+ {
+ dst = new Vector2[src.Count];
+ }
+
+ for (int i = 0; i < src.Count; ++i)
+ {
+ dst[i].x = (float)src[i].x;
+ dst[i].y = (float)src[i].y;
+ }
+
+ return dst;
+ }
+
+ ///
+ /// Convert Point list to array.
+ ///
+ /// List of Point.
+ /// Array of double.
/// Array of double.
- public static double[] ConvertPointListToArray (List pts, double[] arr = null)
+ public static double[] ConvertPointListToArray(IList src, double[] dst = null)
{
- if (arr == null || (arr != null && arr.Length != pts.Count * 2)) {
- arr = new double[pts.Count * 2];
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst != null && src.Count * 2 != dst.Length)
+ throw new ArgumentException("src.Count * 2 != dst.Length");
+
+ if (dst == null)
+ {
+ dst = new double[src.Count * 2];
}
- for (int i = 0; i < pts.Count; ++i) {
- arr [i * 2] = pts [i].x;
- arr [i * 2 + 1] = pts [i].y;
+ for (int i = 0; i < src.Count; ++i)
+ {
+ dst[i * 2] = src[i].x;
+ dst[i * 2 + 1] = src[i].y;
}
- return arr;
+ return dst;
+ }
+
+
+
+
+ ///
+ /// Convert array to Vector2 list.
+ ///
+ /// Array of double.
+ /// List of Vector2.
+ /// List of Vector2.
+ public static List ConvertArrayToVector2List(double[] src, List dst = null)
+ {
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst == null)
+ {
+ dst = new List();
+ }
+
+ dst.Clear();
+
+ int len = src.Length / 2;
+ for (int i = 0; i < len; ++i)
+ {
+ dst.Add(new Vector2((float)src[i * 2], (float)src[i * 2 + 1]));
+ }
+
+ return dst;
}
///
- /// Convert array to vector2 list.
+ /// Convert array to Vector2 array.
///
- /// Array of double.
- /// List of vector2.
- /// List of vector2.
- public static List ConvertArrayToVector2List (double[] arr, List vecs = null)
+ /// Array of double.
+ /// Array of Vector2.
+ /// Array of Vector2.
+ public static Vector2[] ConvertArrayToVector2Array(double[] src, Vector2[] dst = null)
{
- if (vecs == null) {
- vecs = new List ();
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst != null && src.Length / 2 != dst.Length)
+ throw new ArgumentException("src.Length / 2 != dst.Length");
+
+ if (dst == null)
+ {
+ dst = new Vector2[src.Length / 2];
}
- if (vecs.Count != arr.Length / 2) {
- vecs.Clear ();
- for (int i = 0; i < arr.Length / 2; i++) {
- vecs.Add (new Vector2 ());
- }
+ for (int i = 0; i < dst.Length; ++i)
+ {
+ dst[i].x = (float)src[i * 2];
+ dst[i].y = (float)src[i * 2 + 1];
}
- for (int i = 0; i < vecs.Count; ++i) {
- vecs [i] = new Vector2 ((float)arr [i * 2], (float)arr [i * 2 + 1]);
- }
-
- return vecs;
+ return dst;
}
///
- /// Convert array to point list.
+ /// Convert array to Point list.
///
- /// Array of double.
- /// List of point.
- /// List of point.
- public static List ConvertArrayToPointList (double[] arr, List pts = null)
+ /// Array of double.
+ /// List of Point.
+ /// List of Point.
+ public static List ConvertArrayToPointList(double[] src, List dst = null)
{
- if (pts == null) {
- pts = new List ();
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst == null)
+ {
+ dst = new List();
}
- if (pts.Count != arr.Length / 2) {
- pts.Clear ();
- for (int i = 0; i < arr.Length / 2; i++) {
- pts.Add (new Point ());
+ if (dst.Count != src.Length / 2)
+ {
+ dst.Clear();
+ for (int i = 0; i < src.Length / 2; i++)
+ {
+ dst.Add(new Point());
}
}
- for (int i = 0; i < pts.Count; ++i) {
- pts [i].x = arr [i * 2];
- pts [i].y = arr [i * 2 + 1];
+ for (int i = 0; i < dst.Count; ++i)
+ {
+ dst[i].x = src[i * 2];
+ dst[i].y = src[i * 2 + 1];
}
- return pts;
+ return dst;
+ }
+
+ ///
+ /// Convert array to Point array.
+ ///
+ /// Array of double.
+ /// Array of Point.
+ /// Array of Point.
+ public static Point[] ConvertArrayToPointArray(double[] src, Point[] dst = null)
+ {
+ if (src == null)
+ throw new ArgumentNullException("src");
+
+ if (dst != null && src.Length / 2 != dst.Length)
+ throw new ArgumentException("src.Length / 2 != dst.Length");
+
+ if (dst == null)
+ {
+ dst = new Point[src.Length / 2];
+ }
+
+ for (int i = 0; i < dst.Length; ++i)
+ {
+ dst[i] = new Point(src[i * 2], src[i * 2 + 1]);
+ }
+
+ return dst;
}
}
}
diff --git a/Assets/FaceMaskExample/ShowLicense.cs b/Assets/FaceMaskExample/ShowLicense.cs
index e8010cf..aca98b7 100644
--- a/Assets/FaceMaskExample/ShowLicense.cs
+++ b/Assets/FaceMaskExample/ShowLicense.cs
@@ -1,6 +1,5 @@
using UnityEngine;
using UnityEngine.SceneManagement;
-using System.Collections;
namespace FaceMaskExample
{
@@ -10,20 +9,20 @@ namespace FaceMaskExample
public class ShowLicense : MonoBehaviour
{
// Use this for initialization
- void Start ()
+ void Start()
{
}
// Update is called once per frame
- void Update ()
+ void Update()
{
}
- public void OnBackButtonClick ()
+ public void OnBackButtonClick()
{
- SceneManager.LoadScene ("FaceMaskExample");
+ SceneManager.LoadScene("FaceMaskExample");
}
}
}
diff --git a/Assets/FaceMaskExample/ShowLicense.unity b/Assets/FaceMaskExample/ShowLicense.unity
index 271321e..4976bbf 100644
--- a/Assets/FaceMaskExample/ShowLicense.unity
+++ b/Assets/FaceMaskExample/ShowLicense.unity
@@ -13,7 +13,7 @@ OcclusionCullingSettings:
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
- serializedVersion: 8
+ serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
@@ -39,6 +39,7 @@ RenderSettings:
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
+ m_UseRadianceAmbientProbe: 0
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
@@ -49,16 +50,14 @@ LightmapSettings:
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
- m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
- serializedVersion: 9
+ serializedVersion: 10
m_Resolution: 1
m_BakeResolution: 50
- m_TextureWidth: 1024
- m_TextureHeight: 1024
+ m_AtlasSize: 1024
m_AO: 1
m_AOMaxDistance: 1
m_CompAOExponent: 1
@@ -88,6 +87,7 @@ LightmapSettings:
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 0
--- !u!196 &5
@@ -109,13 +109,17 @@ NavMeshSettings:
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
+ debug:
+ m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &300643201
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100010, guid: e4ed316126173e54da8ebe67c2421b33, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100010, guid: e4ed316126173e54da8ebe67c2421b33,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 300643204}
- component: {fileID: 300643203}
@@ -130,9 +134,10 @@ GameObject:
--- !u!114 &300643202
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400016, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400016, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 300643201}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -145,8 +150,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -155,19 +158,23 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &300643203
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22200008, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22200008, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 300643201}
+ m_CullTransparentMesh: 0
--- !u!224 &300643204
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400010, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22400010, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 300643201}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -184,9 +191,11 @@ RectTransform:
--- !u!1 &813140185
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100012, guid: e4ed316126173e54da8ebe67c2421b33, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100012, guid: e4ed316126173e54da8ebe67c2421b33,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 813140186}
- component: {fileID: 813140189}
@@ -202,9 +211,10 @@ GameObject:
--- !u!224 &813140186
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400012, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22400012, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 813140185}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -215,15 +225,16 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
- m_AnchoredPosition: {x: 0.000012397766, y: -0.000091552734}
+ m_AnchoredPosition: {x: 0, y: 0.00004486633}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &813140187
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400020, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400020, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 813140185}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -235,9 +246,10 @@ MonoBehaviour:
--- !u!114 &813140188
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400018, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400018, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 813140185}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -250,8 +262,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 20
@@ -265,44 +275,169 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
- m_Text: "IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r\n\r\n
- By downloading, copying, installing or using the software you agree to this license.\r\n
- If you do not agree to this license, do not download, install,\r\n copy or use
- the software.\r\n\r\n\r\n License Agreement\r\n For
- Open Source Computer Vision Library\r\n\r\nCopyright (C) 2000-2008, Intel Corporation,
- all rights reserved.\r\nCopyright (C) 2008-2011, Willow Garage Inc., all rights
- reserved.\r\nThird party copyrights are property of their respective owners.\r\n\r\nRedistribution
- and use in source and binary forms, with or without modification,\r\nare permitted
- provided that the following conditions are met:\r\n\r\n * Redistributions of
- source code must retain the above copyright notice,\r\n this list of conditions
- and the following disclaimer.\r\n\r\n * Redistributions in binary form must reproduce
- the above copyright notice,\r\n this list of conditions and the following disclaimer
- in the documentation\r\n and/or other materials provided with the distribution.\r\n\r\n
- \ * The name of the copyright holders may not be used to endorse or promote products\r\n
- \ derived from this software without specific prior written permission.\r\n\r\nThis
- software is provided by the copyright holders and contributors \"as is\" and\r\nany
- express or implied warranties, including, but not limited to, the implied\r\nwarranties
- of merchantability and fitness for a particular purpose are disclaimed.\r\nIn
- no event shall the Intel Corporation or contributors be liable for any direct,\r\nindirect,
- incidental, special, exemplary, or consequential damages\r\n(including, but not
- limited to, procurement of substitute goods or services;\r\nloss of use, data,
- or profits; or business interruption) however caused\r\nand on any theory of liability,
- whether in contract, strict liability,\r\nor tort (including negligence or otherwise)
- arising in any way out of\r\nthe use of this software, even if advised of the
- possibility of such damage.\r\n"
+ m_Text: "This software includes the work that is distributed in the Apache License
+ 2.0.\r\n\r\n Apache License\r\n Version
+ 2.0, January 2004\r\n http://www.apache.org/licenses/\r\n\r\n
+ \ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r\n\r\n 1. Definitions.\r\n\r\n
+ \ \"License\" shall mean the terms and conditions for use, reproduction,\r\n
+ \ and distribution as defined by Sections 1 through 9 of this document.\r\n\r\n
+ \ \"Licensor\" shall mean the copyright owner or entity authorized by\r\n
+ \ the copyright owner that is granting the License.\r\n\r\n \"Legal Entity\"
+ shall mean the union of the acting entity and all\r\n other entities that
+ control, are controlled by, or are under common\r\n control with that entity.
+ For the purposes of this definition,\r\n \"control\" means (i) the power,
+ direct or indirect, to cause the\r\n direction or management of such entity,
+ whether by contract or\r\n otherwise, or (ii) ownership of fifty percent
+ (50%) or more of the\r\n outstanding shares, or (iii) beneficial ownership
+ of such entity.\r\n\r\n \"You\" (or \"Your\") shall mean an individual or
+ Legal Entity\r\n exercising permissions granted by this License.\r\n\r\n
+ \ \"Source\" form shall mean the preferred form for making modifications,\r\n
+ \ including but not limited to software source code, documentation\r\n source,
+ and configuration files.\r\n\r\n \"Object\" form shall mean any form resulting
+ from mechanical\r\n transformation or translation of a Source form, including
+ but\r\n not limited to compiled object code, generated documentation,\r\n
+ \ and conversions to other media types.\r\n\r\n \"Work\" shall mean the
+ work of authorship, whether in Source or\r\n Object form, made available
+ under the License, as indicated by a\r\n copyright notice that is included
+ in or attached to the work\r\n (an example is provided in the Appendix below).\r\n\r\n
+ \ \"Derivative Works\" shall mean any work, whether in Source or Object\r\n
+ \ form, that is based on (or derived from) the Work and for which the\r\n
+ \ editorial revisions, annotations, elaborations, or other modifications\r\n
+ \ represent, as a whole, an original work of authorship. For the purposes\r\n
+ \ of this License, Derivative Works shall not include works that remain\r\n
+ \ separable from, or merely link (or bind by name) to the interfaces of,\r\n
+ \ the Work and Derivative Works thereof.\r\n\r\n \"Contribution\" shall
+ mean any work of authorship, including\r\n the original version of the Work
+ and any modifications or additions\r\n to that Work or Derivative Works thereof,
+ that is intentionally\r\n submitted to Licensor for inclusion in the Work
+ by the copyright owner\r\n or by an individual or Legal Entity authorized
+ to submit on behalf of\r\n the copyright owner. For the purposes of this
+ definition, \"submitted\"\r\n means any form of electronic, verbal, or written
+ communication sent\r\n to the Licensor or its representatives, including
+ but not limited to\r\n communication on electronic mailing lists, source
+ code control systems,\r\n and issue tracking systems that are managed by,
+ or on behalf of, the\r\n Licensor for the purpose of discussing and improving
+ the Work, but\r\n excluding communication that is conspicuously marked or
+ otherwise\r\n designated in writing by the copyright owner as \"Not a Contribution.\"\r\n\r\n
+ \ \"Contributor\" shall mean Licensor and any individual or Legal Entity\r\n
+ \ on behalf of whom a Contribution has been received by Licensor and\r\n subsequently
+ incorporated within the Work.\r\n\r\n 2. Grant of Copyright License. Subject
+ to the terms and conditions of\r\n this License, each Contributor hereby
+ grants to You a perpetual,\r\n worldwide, non-exclusive, no-charge, royalty-free,
+ irrevocable\r\n copyright license to reproduce, prepare Derivative Works
+ of,\r\n publicly display, publicly perform, sublicense, and distribute the\r\n
+ \ Work and such Derivative Works in Source or Object form.\r\n\r\n 3. Grant
+ of Patent License. Subject to the terms and conditions of\r\n this License,
+ each Contributor hereby grants to You a perpetual,\r\n worldwide, non-exclusive,
+ no-charge, royalty-free, irrevocable\r\n (except as stated in this section)
+ patent license to make, have made,\r\n use, offer to sell, sell, import,
+ and otherwise transfer the Work,\r\n where such license applies only to those
+ patent claims licensable\r\n by such Contributor that are necessarily infringed
+ by their\r\n Contribution(s) alone or by combination of their Contribution(s)\r\n
+ \ with the Work to which such Contribution(s) was submitted. If You\r\n institute
+ patent litigation against any entity (including a\r\n cross-claim or counterclaim
+ in a lawsuit) alleging that the Work\r\n or a Contribution incorporated within
+ the Work constitutes direct\r\n or contributory patent infringement, then
+ any patent licenses\r\n granted to You under this License for that Work shall
+ terminate\r\n as of the date such litigation is filed.\r\n\r\n 4. Redistribution.
+ You may reproduce and distribute copies of the\r\n Work or Derivative Works
+ thereof in any medium, with or without\r\n modifications, and in Source or
+ Object form, provided that You\r\n meet the following conditions:\r\n\r\n
+ \ (a) You must give any other recipients of the Work or\r\n Derivative
+ Works a copy of this License; and\r\n\r\n (b) You must cause any modified
+ files to carry prominent notices\r\n stating that You changed the files;
+ and\r\n\r\n (c) You must retain, in the Source form of any Derivative Works\r\n
+ \ that You distribute, all copyright, patent, trademark, and\r\n attribution
+ notices from the Source form of the Work,\r\n excluding those notices
+ that do not pertain to any part of\r\n the Derivative Works; and\r\n\r\n
+ \ (d) If the Work includes a \"NOTICE\" text file as part of its\r\n distribution,
+ then any Derivative Works that You distribute must\r\n include a readable
+ copy of the attribution notices contained\r\n within such NOTICE file,
+ excluding those notices that do not\r\n pertain to any part of the Derivative
+ Works, in at least one\r\n of the following places: within a NOTICE text
+ file distributed\r\n as part of the Derivative Works; within the Source
+ form or\r\n documentation, if provided along with the Derivative Works;
+ or,\r\n within a display generated by the Derivative Works, if and\r\n
+ \ wherever such third-party notices normally appear. The contents\r\n
+ \ of the NOTICE file are for informational purposes only and\r\n do
+ not modify the License. You may add Your own attribution\r\n notices
+ within Derivative Works that You distribute, alongside\r\n or as an addendum
+ to the NOTICE text from the Work, provided\r\n that such additional attribution
+ notices cannot be construed\r\n as modifying the License.\r\n\r\n You
+ may add Your own copyright statement to Your modifications and\r\n may provide
+ additional or different license terms and conditions\r\n for use, reproduction,
+ or distribution of Your modifications, or\r\n for any such Derivative Works
+ as a whole, provided Your use,\r\n reproduction, and distribution of the
+ Work otherwise complies with\r\n the conditions stated in this License.\r\n\r\n
+ \ 5. Submission of Contributions. Unless You explicitly state otherwise,\r\n
+ \ any Contribution intentionally submitted for inclusion in the Work\r\n by
+ You to the Licensor shall be under the terms and conditions of\r\n this License,
+ without any additional terms or conditions.\r\n Notwithstanding the above,
+ nothing herein shall supersede or modify\r\n the terms of any separate license
+ agreement you may have executed\r\n with Licensor regarding such Contributions.\r\n\r\n
+ \ 6. Trademarks. This License does not grant permission to use the trade\r\n
+ \ names, trademarks, service marks, or product names of the Licensor,\r\n
+ \ except as required for reasonable and customary use in describing the\r\n
+ \ origin of the Work and reproducing the content of the NOTICE file.\r\n\r\n
+ \ 7. Disclaimer of Warranty. Unless required by applicable law or\r\n agreed
+ to in writing, Licensor provides the Work (and each\r\n Contributor provides
+ its Contributions) on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or\r\n implied, including, without limitation,
+ any warranties or conditions\r\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY,
+ or FITNESS FOR A\r\n PARTICULAR PURPOSE. You are solely responsible for determining
+ the\r\n appropriateness of using or redistributing the Work and assume any\r\n
+ \ risks associated with Your exercise of permissions under this License.\r\n\r\n
+ \ 8. Limitation of Liability. In no event and under no legal theory,\r\n whether
+ in tort (including negligence), contract, or otherwise,\r\n unless required
+ by applicable law (such as deliberate and grossly\r\n negligent acts) or
+ agreed to in writing, shall any Contributor be\r\n liable to You for damages,
+ including any direct, indirect, special,\r\n incidental, or consequential
+ damages of any character arising as a\r\n result of this License or out of
+ the use or inability to use the\r\n Work (including but not limited to damages
+ for loss of goodwill,\r\n work stoppage, computer failure or malfunction,
+ or any and all\r\n other commercial damages or losses), even if such Contributor\r\n
+ \ has been advised of the possibility of such damages.\r\n\r\n 9. Accepting
+ Warranty or Additional Liability. While redistributing\r\n the Work or Derivative
+ Works thereof, You may choose to offer,\r\n and charge a fee for, acceptance
+ of support, warranty, indemnity,\r\n or other liability obligations and/or
+ rights consistent with this\r\n License. However, in accepting such obligations,
+ You may act only\r\n on Your own behalf and on Your sole responsibility,
+ not on behalf\r\n of any other Contributor, and only if You agree to indemnify,\r\n
+ \ defend, and hold each Contributor harmless for any liability\r\n incurred
+ by, or claims asserted against, such Contributor by reason\r\n of your accepting
+ any such warranty or additional liability.\r\n\r\n END OF TERMS AND CONDITIONS\r\n\r\n
+ \ APPENDIX: How to apply the Apache License to your work.\r\n\r\n To apply
+ the Apache License to your work, attach the following\r\n boilerplate notice,
+ with the fields enclosed by brackets \"[]\"\r\n replaced with your own identifying
+ information. (Don't include\r\n the brackets!) The text should be enclosed
+ in the appropriate\r\n comment syntax for the file format. We also recommend
+ that a\r\n file or class name and description of purpose be included on the\r\n
+ \ same \"printed page\" as the copyright notice for easier\r\n identification
+ within third-party archives.\r\n\r\n Copyright [yyyy] [name of copyright owner]\r\n\r\n
+ \ Licensed under the Apache License, Version 2.0 (the \"License\");\r\n you
+ may not use this file except in compliance with the License.\r\n You may obtain
+ a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n
+ \ Unless required by applicable law or agreed to in writing, software\r\n distributed
+ under the License is distributed on an \"AS IS\" BASIS,\r\n WITHOUT WARRANTIES
+ OR CONDITIONS OF ANY KIND, either express or implied.\r\n See the License for
+ the specific language governing permissions and\r\n limitations under the License."
--- !u!222 &813140189
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22200010, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22200010, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 813140185}
+ m_CullTransparentMesh: 0
--- !u!1 &905987153
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100008, guid: e4ed316126173e54da8ebe67c2421b33, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100008, guid: e4ed316126173e54da8ebe67c2421b33,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 905987154}
m_Layer: 5
@@ -315,9 +450,10 @@ GameObject:
--- !u!224 &905987154
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400008, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22400008, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 905987153}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -335,9 +471,11 @@ RectTransform:
--- !u!1 &1207454862
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100014, guid: e4ed316126173e54da8ebe67c2421b33, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100014, guid: e4ed316126173e54da8ebe67c2421b33,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1207454863}
- component: {fileID: 1207454866}
@@ -353,9 +491,10 @@ GameObject:
--- !u!224 &1207454863
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400014, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22400014, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1207454862}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -374,9 +513,10 @@ RectTransform:
--- !u!114 &1207454864
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400022, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400022, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1207454862}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -391,9 +531,10 @@ MonoBehaviour:
--- !u!114 &1207454865
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400024, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400024, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1207454862}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -413,9 +554,10 @@ MonoBehaviour:
--- !u!223 &1207454866
Canvas:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22300000, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22300000, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1207454862}
m_Enabled: 1
serializedVersion: 3
@@ -434,9 +576,11 @@ Canvas:
--- !u!1 &1288247988
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100016, guid: e4ed316126173e54da8ebe67c2421b33, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100016, guid: e4ed316126173e54da8ebe67c2421b33,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1288247989}
m_Layer: 5
@@ -449,9 +593,10 @@ GameObject:
--- !u!224 &1288247989
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400016, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22400016, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1288247988}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -470,9 +615,11 @@ RectTransform:
--- !u!1 &1815817330
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100004, guid: e4ed316126173e54da8ebe67c2421b33, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100004, guid: e4ed316126173e54da8ebe67c2421b33,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1815817331}
- component: {fileID: 1815817334}
@@ -488,9 +635,10 @@ GameObject:
--- !u!224 &1815817331
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400004, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22400004, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1815817330}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -508,9 +656,10 @@ RectTransform:
--- !u!114 &1815817332
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400010, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400010, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1815817330}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -556,14 +705,13 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
--- !u!114 &1815817333
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400012, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400012, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1815817330}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -576,8 +724,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -586,19 +732,24 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &1815817334
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22200004, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22200004, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1815817330}
+ m_CullTransparentMesh: 0
--- !u!1 &1845963478
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100000, guid: 1ccccd5701fc6ee48964a3c728b8ab62, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100000, guid: 1ccccd5701fc6ee48964a3c728b8ab62,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1845963482}
- component: {fileID: 1845963481}
@@ -613,9 +764,10 @@ GameObject:
--- !u!114 &1845963480
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400002, guid: 1ccccd5701fc6ee48964a3c728b8ab62,
+ m_CorrespondingSourceObject: {fileID: 11400002, guid: 1ccccd5701fc6ee48964a3c728b8ab62,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1845963478}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -632,9 +784,10 @@ MonoBehaviour:
--- !u!114 &1845963481
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400004, guid: 1ccccd5701fc6ee48964a3c728b8ab62,
+ m_CorrespondingSourceObject: {fileID: 11400004, guid: 1ccccd5701fc6ee48964a3c728b8ab62,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1845963478}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -647,8 +800,10 @@ MonoBehaviour:
--- !u!4 &1845963482
Transform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 400000, guid: 1ccccd5701fc6ee48964a3c728b8ab62, type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 400000, guid: 1ccccd5701fc6ee48964a3c728b8ab62,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1845963478}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -660,9 +815,10 @@ Transform:
--- !u!1 &2009915974
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 2009915980}
- component: {fileID: 2009915979}
@@ -679,8 +835,9 @@ GameObject:
--- !u!114 &2009915975
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2009915974}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -690,27 +847,35 @@ MonoBehaviour:
--- !u!81 &2009915976
AudioListener:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2009915974}
m_Enabled: 1
--- !u!124 &2009915977
Behaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2009915974}
m_Enabled: 1
--- !u!20 &2009915979
Camera:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2009915974}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
+ m_projectionMatrixMode: 1
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_GateFitMode: 2
+ m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
@@ -732,16 +897,17 @@ Camera:
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 1
+ m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
- m_StereoMirrorMode: 0
--- !u!4 &2009915980
Transform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2009915974}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
@@ -753,9 +919,11 @@ Transform:
--- !u!1 &2027945392
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100002, guid: e4ed316126173e54da8ebe67c2421b33, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100002, guid: e4ed316126173e54da8ebe67c2421b33,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 2027945393}
- component: {fileID: 2027945396}
@@ -771,9 +939,10 @@ GameObject:
--- !u!224 &2027945393
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400002, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22400002, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2027945392}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -791,9 +960,10 @@ RectTransform:
--- !u!114 &2027945394
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400006, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400006, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2027945392}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -828,19 +998,18 @@ MonoBehaviour:
m_HandleRect: {fileID: 300643204}
m_Direction: 2
m_Value: 1
- m_Size: 0.66089743
+ m_Size: 0.14562789
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.Scrollbar+ScrollEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
--- !u!114 &2027945395
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400008, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400008, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2027945392}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -853,8 +1022,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -863,19 +1030,24 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &2027945396
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22200002, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22200002, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2027945392}
+ m_CullTransparentMesh: 0
--- !u!1 &2040852814
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100000, guid: e4ed316126173e54da8ebe67c2421b33, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100000, guid: e4ed316126173e54da8ebe67c2421b33,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 2040852815}
- component: {fileID: 2040852819}
@@ -892,9 +1064,10 @@ GameObject:
--- !u!224 &2040852815
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400000, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22400000, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2040852814}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -912,9 +1085,10 @@ RectTransform:
--- !u!114 &2040852816
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400000, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400000, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2040852814}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -927,8 +1101,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
@@ -937,19 +1109,23 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &2040852817
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22200000, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22200000, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2040852814}
+ m_CullTransparentMesh: 0
--- !u!114 &2040852818
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400002, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400002, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2040852814}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -960,9 +1136,10 @@ MonoBehaviour:
--- !u!114 &2040852819
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400004, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400004, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2040852814}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -987,14 +1164,14 @@ MonoBehaviour:
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.ScrollRect+ScrollRectEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
--- !u!1 &2092781163
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100006, guid: e4ed316126173e54da8ebe67c2421b33, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100006, guid: e4ed316126173e54da8ebe67c2421b33,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 2092781164}
- component: {fileID: 2092781166}
@@ -1009,9 +1186,10 @@ GameObject:
--- !u!224 &2092781164
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400006, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22400006, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2092781163}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1028,9 +1206,10 @@ RectTransform:
--- !u!114 &2092781165
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400014, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 11400014, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2092781163}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1043,8 +1222,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@@ -1062,7 +1239,9 @@ MonoBehaviour:
--- !u!222 &2092781166
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22200006, guid: e4ed316126173e54da8ebe67c2421b33,
+ m_CorrespondingSourceObject: {fileID: 22200006, guid: e4ed316126173e54da8ebe67c2421b33,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2092781163}
+ m_CullTransparentMesh: 0
diff --git a/Assets/FaceMaskExample/Texture2DFaceMaskExample/Texture2DFaceMaskExample.cs b/Assets/FaceMaskExample/Texture2DFaceMaskExample/Texture2DFaceMaskExample.cs
index a6445d2..06de84c 100644
--- a/Assets/FaceMaskExample/Texture2DFaceMaskExample/Texture2DFaceMaskExample.cs
+++ b/Assets/FaceMaskExample/Texture2DFaceMaskExample/Texture2DFaceMaskExample.cs
@@ -1,15 +1,14 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using UnityEngine;
-using UnityEngine.UI;
-using UnityEngine.SceneManagement;
-using DlibFaceLandmarkDetector;
-using OpenCVForUnity.ObjdetectModule;
+using DlibFaceLandmarkDetector;
using OpenCVForUnity.CoreModule;
using OpenCVForUnity.ImgprocModule;
+using OpenCVForUnity.ObjdetectModule;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using UnityEngine.SceneManagement;
+using UnityEngine.UI;
using Rect = OpenCVForUnity.CoreModule.Rect;
namespace FaceMaskExample
@@ -17,7 +16,7 @@ namespace FaceMaskExample
///
/// Texture2D FaceMask Example
///
- [RequireComponent (typeof(TrackedMeshOverlay))]
+ [RequireComponent(typeof(TrackedMeshOverlay))]
public class Texture2DFaceMaskExample : MonoBehaviour
{
///
@@ -53,14 +52,14 @@ namespace FaceMaskExample
///
/// The frontal face rate lower limit.
///
- [Range (0.0f, 1.0f)]
+ [Range(0.0f, 1.0f)]
public float frontalFaceRateLowerLimit = 0.85f;
///
/// Determines if displays face rects.
///
public bool displayFaceRects = false;
-
+
///
/// The toggle for switching face rects display state
///
@@ -75,12 +74,12 @@ namespace FaceMaskExample
/// The toggle for switching debug face points display state.
///
public Toggle displayDebugFacePointsToggle;
-
+
///
/// The image texture.
///
Texture2D imgTexture;
-
+
///
/// The cascade.
///
@@ -111,45 +110,47 @@ namespace FaceMaskExample
///
string sp_human_face_68_dat_filepath;
- #if UNITY_WEBGL && !UNITY_EDITOR
+#if UNITY_WEBGL
IEnumerator getFilePath_Coroutine;
- #endif
+#endif
// Use this for initialization
- void Start ()
+ void Start()
{
- #if UNITY_WEBGL && !UNITY_EDITOR
- getFilePath_Coroutine = GetFilePath ();
- StartCoroutine (getFilePath_Coroutine);
- #else
- haarcascade_frontalface_alt_xml_filepath = OpenCVForUnity.UnityUtils.Utils.getFilePath ("haarcascade_frontalface_alt.xml");
- sp_human_face_68_dat_filepath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath ("sp_human_face_68.dat");
- Run ();
- #endif
+#if UNITY_WEBGL
+ getFilePath_Coroutine = GetFilePath();
+ StartCoroutine(getFilePath_Coroutine);
+#else
+ haarcascade_frontalface_alt_xml_filepath = OpenCVForUnity.UnityUtils.Utils.getFilePath("haarcascade_frontalface_alt.xml");
+ sp_human_face_68_dat_filepath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("sp_human_face_68.dat");
+ Run();
+#endif
}
- #if UNITY_WEBGL && !UNITY_EDITOR
- private IEnumerator GetFilePath ()
+#if UNITY_WEBGL
+ private IEnumerator GetFilePath()
{
- var getFilePathAsync_0_Coroutine = OpenCVForUnity.UnityUtils.Utils.getFilePathAsync ("haarcascade_frontalface_alt.xml", (result) => {
+ var getFilePathAsync_0_Coroutine = OpenCVForUnity.UnityUtils.Utils.getFilePathAsync("haarcascade_frontalface_alt.xml", (result) =>
+ {
haarcascade_frontalface_alt_xml_filepath = result;
});
yield return getFilePathAsync_0_Coroutine;
- var getFilePathAsync_1_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync ("sp_human_face_68.dat", (result) => {
+ var getFilePathAsync_1_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync("sp_human_face_68.dat", (result) =>
+ {
sp_human_face_68_dat_filepath = result;
});
yield return getFilePathAsync_1_Coroutine;
getFilePath_Coroutine = null;
- Run ();
+ Run();
}
- #endif
+#endif
- private void Run ()
+ private void Run()
{
- meshOverlay = this.GetComponent ();
+ meshOverlay = this.GetComponent();
displayFaceRectsToggle.isOn = displayFaceRects;
useDlibFaceDetecterToggle.isOn = useDlibFaceDetecter;
@@ -158,13 +159,13 @@ namespace FaceMaskExample
displayDebugFacePointsToggle.isOn = displayDebugFacePoints;
if (imgTexture == null)
- imgTexture = Resources.Load ("family") as Texture2D;
+ imgTexture = Resources.Load("family") as Texture2D;
- gameObject.transform.localScale = new Vector3 (imgTexture.width, imgTexture.height, 1);
- Debug.Log ("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
+ gameObject.transform.localScale = new Vector3(imgTexture.width, imgTexture.height, 1);
+ Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
- meshOverlay.UpdateOverlayTransform (gameObject.transform);
- meshOverlay.Reset ();
+ meshOverlay.UpdateOverlayTransform(gameObject.transform);
+ meshOverlay.Reset();
float width = 0;
@@ -174,265 +175,307 @@ namespace FaceMaskExample
float widthScale = (float)Screen.width / width;
float heightScale = (float)Screen.height / height;
- if (widthScale < heightScale) {
+ if (widthScale < heightScale)
+ {
Camera.main.orthographicSize = (width * (float)Screen.height / (float)Screen.width) / 2;
- } else {
+ }
+ else
+ {
Camera.main.orthographicSize = height / 2;
}
- Mat rgbaMat = new Mat (imgTexture.height, imgTexture.width, CvType.CV_8UC4);
+ Mat rgbaMat = new Mat(imgTexture.height, imgTexture.width, CvType.CV_8UC4);
- OpenCVForUnity.UnityUtils.Utils.texture2DToMat (imgTexture, rgbaMat);
- Debug.Log ("rgbaMat ToString " + rgbaMat.ToString ());
+ OpenCVForUnity.UnityUtils.Utils.texture2DToMat(imgTexture, rgbaMat);
+ Debug.Log("rgbaMat ToString " + rgbaMat.ToString());
if (faceLandmarkDetector == null)
- faceLandmarkDetector = new FaceLandmarkDetector (sp_human_face_68_dat_filepath);
+ faceLandmarkDetector = new FaceLandmarkDetector(sp_human_face_68_dat_filepath);
- faceMaskColorCorrector = faceMaskColorCorrector ?? new FaceMaskColorCorrector ();
- FrontalFaceChecker frontalFaceChecker = new FrontalFaceChecker (width, height);
+ faceMaskColorCorrector = faceMaskColorCorrector ?? new FaceMaskColorCorrector();
+ FrontalFaceChecker frontalFaceChecker = new FrontalFaceChecker(width, height);
// detect faces.
- List detectResult = new List ();
- if (useDlibFaceDetecter) {
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, rgbaMat);
- List result = faceLandmarkDetector.Detect ();
-
- foreach (var unityRect in result) {
- detectResult.Add (new Rect ((int)unityRect.x, (int)unityRect.y, (int)unityRect.width, (int)unityRect.height));
- }
- } else {
- if (cascade == null)
- cascade = new CascadeClassifier (haarcascade_frontalface_alt_xml_filepath);
-// if (cascade.empty ()) {
-// Debug.LogError ("cascade file is not loaded.Please copy from “FaceTrackerExample/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
-// }
-
- // convert image to greyscale.
- Mat gray = new Mat ();
- Imgproc.cvtColor (rgbaMat, gray, Imgproc.COLOR_RGBA2GRAY);
+ List detectResult = new List();
+ if (useDlibFaceDetecter)
+ {
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, rgbaMat);
+ List result = faceLandmarkDetector.Detect();
- MatOfRect faces = new MatOfRect ();
- Imgproc.equalizeHist (gray, gray);
- cascade.detectMultiScale (gray, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size (gray.cols () * 0.05, gray.cols () * 0.05), new Size ());
+ foreach (var unityRect in result)
+ {
+ detectResult.Add(new Rect((int)unityRect.x, (int)unityRect.y, (int)unityRect.width, (int)unityRect.height));
+ }
+ }
+ else
+ {
+ if (cascade == null)
+ cascade = new CascadeClassifier(haarcascade_frontalface_alt_xml_filepath);
+ //if (cascade.empty())
+ //{
+ // Debug.LogError("cascade file is not loaded.Please copy from “FaceTrackerExample/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
+ //}
+
+ // convert image to greyscale.
+ Mat gray = new Mat();
+ Imgproc.cvtColor(rgbaMat, gray, Imgproc.COLOR_RGBA2GRAY);
+
+ MatOfRect faces = new MatOfRect();
+ Imgproc.equalizeHist(gray, gray);
+ cascade.detectMultiScale(gray, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size(gray.cols() * 0.05, gray.cols() * 0.05), new Size());
//Debug.Log ("faces " + faces.dump ());
-
- detectResult = faces.toList ();
+
+ detectResult = faces.toList();
// corrects the deviation of a detection result between OpenCV and Dlib.
- foreach (Rect r in detectResult) {
+ foreach (Rect r in detectResult)
+ {
r.y += (int)(r.height * 0.1f);
}
-
- gray.Dispose ();
- }
-
+
+ gray.Dispose();
+ }
+
// detect face landmark points.
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, rgbaMat);
- List> landmarkPoints = new List> ();
- foreach (var openCVRect in detectResult) {
- UnityEngine.Rect rect = new UnityEngine.Rect (openCVRect.x, openCVRect.y, openCVRect.width, openCVRect.height);
-
- Debug.Log ("face : " + rect);
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, rgbaMat);
+ List> landmarkPoints = new List>();
+ foreach (var openCVRect in detectResult)
+ {
+ UnityEngine.Rect rect = new UnityEngine.Rect(openCVRect.x, openCVRect.y, openCVRect.width, openCVRect.height);
+
+ Debug.Log("face : " + rect);
//OpenCVForUnityUtils.DrawFaceRect(imgMat, rect, new Scalar(255, 0, 0, 255), 2);
-
- List points = faceLandmarkDetector.DetectLandmark (rect);
+
+ List points = faceLandmarkDetector.DetectLandmark(rect);
//OpenCVForUnityUtils.DrawFaceLandmark(imgMat, points, new Scalar(0, 255, 0, 255), 2);
- landmarkPoints.Add (points);
+ landmarkPoints.Add(points);
}
// mask faces.
int[] face_nums = new int[landmarkPoints.Count];
- for (int i = 0; i < face_nums.Length; i++) {
- face_nums [i] = i;
+ for (int i = 0; i < face_nums.Length; i++)
+ {
+ face_nums[i] = i;
}
- face_nums = face_nums.OrderBy (i => System.Guid.NewGuid ()).ToArray ();
+ face_nums = face_nums.OrderBy(i => System.Guid.NewGuid()).ToArray();
float imageWidth = meshOverlay.width;
- float imageHeight = meshOverlay.height;
+ float imageHeight = meshOverlay.height;
float maskImageWidth = imgTexture.width;
float maskImageHeight = imgTexture.height;
TrackedMesh tm;
- for (int i = 0; i < face_nums.Length; i++) {
+ for (int i = 0; i < face_nums.Length; i++)
+ {
+
+ meshOverlay.CreateObject(i, imgTexture);
+ tm = meshOverlay.GetObjectById(i);
- meshOverlay.CreateObject (i, imgTexture);
- tm = meshOverlay.GetObjectById (i);
-
Vector3[] vertices = tm.meshFilter.mesh.vertices;
- if (vertices.Length == landmarkPoints [face_nums [i]].Count) {
- for (int j = 0; j < vertices.Length; j++) {
- vertices [j].x = landmarkPoints [face_nums [i]] [j].x / imageWidth - 0.5f;
- vertices [j].y = 0.5f - landmarkPoints [face_nums [i]] [j].y / imageHeight;
+ if (vertices.Length == landmarkPoints[face_nums[i]].Count)
+ {
+ for (int j = 0; j < vertices.Length; j++)
+ {
+ vertices[j].x = landmarkPoints[face_nums[i]][j].x / imageWidth - 0.5f;
+ vertices[j].y = 0.5f - landmarkPoints[face_nums[i]][j].y / imageHeight;
}
}
Vector2[] uv = tm.meshFilter.mesh.uv;
- if (uv.Length == landmarkPoints [face_nums [0]].Count) {
- for (int jj = 0; jj < uv.Length; jj++) {
- uv [jj].x = landmarkPoints [face_nums [0]] [jj].x / maskImageWidth;
- uv [jj].y = (maskImageHeight - landmarkPoints [face_nums [0]] [jj].y) / maskImageHeight;
+ if (uv.Length == landmarkPoints[face_nums[0]].Count)
+ {
+ for (int jj = 0; jj < uv.Length; jj++)
+ {
+ uv[jj].x = landmarkPoints[face_nums[0]][jj].x / maskImageWidth;
+ uv[jj].y = (maskImageHeight - landmarkPoints[face_nums[0]][jj].y) / maskImageHeight;
}
}
- meshOverlay.UpdateObject (i, vertices, null, uv);
-
- if (enableColorCorrection) {
- faceMaskColorCorrector.CreateLUTTex (i);
- Texture2D LUTTex = faceMaskColorCorrector.UpdateLUTTex (i, rgbaMat, rgbaMat, landmarkPoints [face_nums [0]], landmarkPoints [face_nums [i]]);
- tm.sharedMaterial.SetTexture ("_LUTTex", LUTTex);
- tm.sharedMaterial.SetFloat ("_ColorCorrection", 1f);
- } else {
- tm.sharedMaterial.SetFloat ("_ColorCorrection", 0f);
+ meshOverlay.UpdateObject(i, vertices, null, uv);
+
+ if (enableColorCorrection)
+ {
+ faceMaskColorCorrector.CreateLUTTex(i);
+ Texture2D LUTTex = faceMaskColorCorrector.UpdateLUTTex(i, rgbaMat, rgbaMat, landmarkPoints[face_nums[0]], landmarkPoints[face_nums[i]]);
+ tm.sharedMaterial.SetTexture("_LUTTex", LUTTex);
+ tm.sharedMaterial.SetFloat("_ColorCorrection", 1f);
+ }
+ else
+ {
+ tm.sharedMaterial.SetFloat("_ColorCorrection", 0f);
}
// filter non frontal faces.
- if (filterNonFrontalFaces && frontalFaceChecker.GetFrontalFaceRate (landmarkPoints [i]) < frontalFaceRateLowerLimit) {
- tm.sharedMaterial.SetFloat ("_Fade", 1f);
- } else {
- tm.sharedMaterial.SetFloat ("_Fade", 0.3f);
+ if (filterNonFrontalFaces && frontalFaceChecker.GetFrontalFaceRate(landmarkPoints[i]) < frontalFaceRateLowerLimit)
+ {
+ tm.sharedMaterial.SetFloat("_Fade", 1f);
+ }
+ else
+ {
+ tm.sharedMaterial.SetFloat("_Fade", 0.3f);
}
}
-
+
// draw face rects.
- if (displayFaceRects) {
- int ann = face_nums [0];
- UnityEngine.Rect rect_ann = new UnityEngine.Rect (detectResult [ann].x, detectResult [ann].y, detectResult [ann].width, detectResult [ann].height);
- OpenCVForUnityUtils.DrawFaceRect (rgbaMat, rect_ann, new Scalar (255, 255, 0, 255), 2);
+ if (displayFaceRects)
+ {
+ int ann = face_nums[0];
+ UnityEngine.Rect rect_ann = new UnityEngine.Rect(detectResult[ann].x, detectResult[ann].y, detectResult[ann].width, detectResult[ann].height);
+ OpenCVForUnityUtils.DrawFaceRect(rgbaMat, rect_ann, new Scalar(255, 255, 0, 255), 2);
int bob = 0;
- for (int i = 1; i < face_nums.Length; i++) {
- bob = face_nums [i];
- UnityEngine.Rect rect_bob = new UnityEngine.Rect (detectResult [bob].x, detectResult [bob].y, detectResult [bob].width, detectResult [bob].height);
- OpenCVForUnityUtils.DrawFaceRect (rgbaMat, rect_bob, new Scalar (255, 0, 0, 255), 2);
+ for (int i = 1; i < face_nums.Length; i++)
+ {
+ bob = face_nums[i];
+ UnityEngine.Rect rect_bob = new UnityEngine.Rect(detectResult[bob].x, detectResult[bob].y, detectResult[bob].width, detectResult[bob].height);
+ OpenCVForUnityUtils.DrawFaceRect(rgbaMat, rect_bob, new Scalar(255, 0, 0, 255), 2);
}
}
// draw face points.
- if (displayDebugFacePoints) {
- for (int i = 0; i < landmarkPoints.Count; i++) {
- OpenCVForUnityUtils.DrawFaceLandmark (rgbaMat, landmarkPoints [i], new Scalar (0, 255, 0, 255), 2);
+ if (displayDebugFacePoints)
+ {
+ for (int i = 0; i < landmarkPoints.Count; i++)
+ {
+ OpenCVForUnityUtils.DrawFaceLandmark(rgbaMat, landmarkPoints[i], new Scalar(0, 255, 0, 255), 2);
}
}
- Texture2D texture = new Texture2D (rgbaMat.cols (), rgbaMat.rows (), TextureFormat.RGBA32, false);
- OpenCVForUnity.UnityUtils.Utils.matToTexture2D (rgbaMat, texture);
- gameObject.transform.GetComponent ().material.mainTexture = texture;
+ Texture2D texture = new Texture2D(rgbaMat.cols(), rgbaMat.rows(), TextureFormat.RGBA32, false);
+ OpenCVForUnity.UnityUtils.Utils.matToTexture2D(rgbaMat, texture);
+ gameObject.transform.GetComponent().material.mainTexture = texture;
- frontalFaceChecker.Dispose ();
- rgbaMat.Dispose ();
+ frontalFaceChecker.Dispose();
+ rgbaMat.Dispose();
}
///
/// Raises the destroy event.
///
- void OnDestroy ()
+ void OnDestroy()
{
if (faceMaskColorCorrector != null)
- faceMaskColorCorrector.Dispose ();
+ faceMaskColorCorrector.Dispose();
if (faceLandmarkDetector != null)
- faceLandmarkDetector.Dispose ();
+ faceLandmarkDetector.Dispose();
if (cascade != null)
- cascade.Dispose ();
+ cascade.Dispose();
- #if UNITY_WEBGL && !UNITY_EDITOR
- if (getFilePath_Coroutine != null) {
- StopCoroutine (getFilePath_Coroutine);
- ((IDisposable)getFilePath_Coroutine).Dispose ();
+#if UNITY_WEBGL
+ if (getFilePath_Coroutine != null)
+ {
+ StopCoroutine(getFilePath_Coroutine);
+ ((IDisposable)getFilePath_Coroutine).Dispose();
}
- #endif
+#endif
}
///
/// Raises the back button click event.
///
- public void OnBackButtonClick ()
+ public void OnBackButtonClick()
{
- SceneManager.LoadScene ("FaceMaskExample");
+ SceneManager.LoadScene("FaceMaskExample");
}
///
/// Raises the shuffle button click event.
///
- public void OnShuffleButtonClick ()
+ public void OnShuffleButtonClick()
{
if (imgTexture != null)
- Run ();
+ Run();
}
///
/// Raises the use Dlib face detector toggle value changed event.
///
- public void OnUseDlibFaceDetecterToggleValueChanged ()
+ public void OnUseDlibFaceDetecterToggleValueChanged()
{
- if (useDlibFaceDetecterToggle.isOn) {
+ if (useDlibFaceDetecterToggle.isOn)
+ {
useDlibFaceDetecter = true;
- } else {
+ }
+ else
+ {
useDlibFaceDetecter = false;
}
if (imgTexture != null)
- Run ();
+ Run();
}
///
/// Raises the enable color correction toggle value changed event.
///
- public void OnEnableColorCorrectionToggleValueChanged ()
+ public void OnEnableColorCorrectionToggleValueChanged()
{
- if (enableColorCorrectionToggle.isOn) {
+ if (enableColorCorrectionToggle.isOn)
+ {
enableColorCorrection = true;
- } else {
+ }
+ else
+ {
enableColorCorrection = false;
}
if (imgTexture != null)
- Run ();
+ Run();
}
///
/// Raises the filter non frontal faces toggle value changed event.
///
- public void OnFilterNonFrontalFacesToggleValueChanged ()
+ public void OnFilterNonFrontalFacesToggleValueChanged()
{
- if (filterNonFrontalFacesToggle.isOn) {
+ if (filterNonFrontalFacesToggle.isOn)
+ {
filterNonFrontalFaces = true;
- } else {
+ }
+ else
+ {
filterNonFrontalFaces = false;
}
if (imgTexture != null)
- Run ();
+ Run();
}
///
/// Raises the display face rects toggle value changed event.
///
- public void OnDisplayFaceRectsToggleValueChanged ()
+ public void OnDisplayFaceRectsToggleValueChanged()
{
- if (displayFaceRectsToggle.isOn) {
+ if (displayFaceRectsToggle.isOn)
+ {
displayFaceRects = true;
- } else {
+ }
+ else
+ {
displayFaceRects = false;
}
-
+
if (imgTexture != null)
- Run ();
+ Run();
}
///
/// Raises the display debug face points toggle value changed event.
///
- public void OnDisplayDebugFacePointsToggleValueChanged ()
+ public void OnDisplayDebugFacePointsToggleValueChanged()
{
- if (displayDebugFacePointsToggle.isOn) {
+ if (displayDebugFacePointsToggle.isOn)
+ {
displayDebugFacePoints = true;
- } else {
+ }
+ else
+ {
displayDebugFacePoints = false;
}
if (imgTexture != null)
- Run ();
+ Run();
}
}
}
\ No newline at end of file
diff --git a/Assets/FaceMaskExample/VideoCaptureFaceMaskExample/VideoCaptureFaceMaskExample.cs b/Assets/FaceMaskExample/VideoCaptureFaceMaskExample/VideoCaptureFaceMaskExample.cs
index 6e4a124..4e4a27f 100644
--- a/Assets/FaceMaskExample/VideoCaptureFaceMaskExample/VideoCaptureFaceMaskExample.cs
+++ b/Assets/FaceMaskExample/VideoCaptureFaceMaskExample/VideoCaptureFaceMaskExample.cs
@@ -1,17 +1,15 @@
-using System;
+using DlibFaceLandmarkDetector;
+using OpenCVForUnity.CoreModule;
+using OpenCVForUnity.ImgprocModule;
+using OpenCVForUnity.ObjdetectModule;
+using OpenCVForUnity.RectangleTrack;
+using OpenCVForUnity.UnityUtils.Helper;
+using System;
using System.Collections;
using System.Collections.Generic;
-using System.IO;
using UnityEngine;
-using UnityEngine.UI;
using UnityEngine.SceneManagement;
-using DlibFaceLandmarkDetector;
-using OpenCVForUnity.RectangleTrack;
-using OpenCVForUnity.CoreModule;
-using OpenCVForUnity.ObjdetectModule;
-using OpenCVForUnity.VideoioModule;
-using OpenCVForUnity.ImgprocModule;
-using VideoCapture = OpenCVForUnity.VideoioModule.VideoCapture;
+using UnityEngine.UI;
using Rect = OpenCVForUnity.CoreModule.Rect;
namespace FaceMaskExample
@@ -19,22 +17,22 @@ namespace FaceMaskExample
///
/// VideoCapture FaceMask Example
///
- [RequireComponent (typeof(TrackedMeshOverlay))]
+ [RequireComponent(typeof(VideoCaptureToMatHelper), typeof(TrackedMeshOverlay))]
public class VideoCaptureFaceMaskExample : MonoBehaviour
{
- [HeaderAttribute ("FaceMaskData")]
+ [HeaderAttribute("FaceMaskData")]
///
/// The face mask data list.
///
public List faceMaskDatas;
- [HeaderAttribute ("Option")]
+ [HeaderAttribute("Option")]
///
/// Determines if use dlib face detector.
///
- public bool useDlibFaceDetecter = true;
+ public bool useDlibFaceDetecter = false;
///
/// The use dlib face detecter toggle.
@@ -74,14 +72,14 @@ namespace FaceMaskExample
///
/// The frontal face rate lower limit.
///
- [Range (0.0f, 1.0f)]
- public float frontalFaceRateLowerLimit;
+ [Range(0.0f, 1.0f)]
+ public float frontalFaceRateLowerLimit = 0.85f;
///
/// Determines if displays face rects.
///
public bool displayFaceRects = false;
-
+
///
/// The toggle for switching face rects display state
///
@@ -97,36 +95,16 @@ namespace FaceMaskExample
///
public Toggle displayDebugFacePointsToggle;
- ///
- /// The width of the frame.
- ///
- double frameWidth = 320;
-
- ///
- /// The height of the frame.
- ///
- double frameHeight = 240;
-
- ///
- /// The capture.
- ///
- VideoCapture capture;
-
- ///
- /// The rgb mat.
- ///
- Mat rgbMat;
-
///
/// The gray mat.
///
Mat grayMat;
-
+
///
/// The texture.
///
Texture2D texture;
-
+
///
/// The cascade.
///
@@ -137,6 +115,16 @@ namespace FaceMaskExample
///
RectangleTracker rectangleTracker;
+ ///
+ /// The video capture to mat helper.
+ ///
+ VideoCaptureToMatHelper sourceToMatHelper;
+
+ ///
+ /// VIDEO_FILENAME
+ ///
+ protected static readonly string VIDEO_FILENAME = "dance_mjpeg.mjpeg";
+
///
/// The face landmark detector.
///
@@ -161,7 +149,7 @@ namespace FaceMaskExample
/// The frontal face checker.
///
FrontalFaceChecker frontalFaceChecker;
-
+
///
/// The mesh overlay.
///
@@ -181,12 +169,12 @@ namespace FaceMaskExample
/// The Shader.PropertyToID for "_LUTTex".
///
int shader_LUTTexID;
-
+
///
/// The face mask texture.
///
Texture2D faceMaskTexture;
-
+
///
/// The face mask mat.
///
@@ -196,12 +184,12 @@ namespace FaceMaskExample
/// The index number of face mask data.
///
int faceMaskDataIndex = 0;
-
+
///
/// The detected face rect in mask mat.
///
UnityEngine.Rect faceRectInMask;
-
+
///
/// The detected face landmark points in mask mat.
///
@@ -218,330 +206,427 @@ namespace FaceMaskExample
string sp_human_face_68_dat_filepath;
///
- /// The couple_avi_filepath.
+ /// The FPS monitor.
///
- string couple_avi_filepath;
+ FpsMonitor fpsMonitor;
- #if UNITY_WEBGL && !UNITY_EDITOR
+#if UNITY_WEBGL
IEnumerator getFilePath_Coroutine;
- #endif
+#endif
// Use this for initialization
- void Start ()
+ void Start()
{
- capture = new VideoCapture ();
+ fpsMonitor = GetComponent();
- #if UNITY_WEBGL && !UNITY_EDITOR
- getFilePath_Coroutine = GetFilePath ();
- StartCoroutine (getFilePath_Coroutine);
- #else
- haarcascade_frontalface_alt_xml_filepath = OpenCVForUnity.UnityUtils.Utils.getFilePath ("haarcascade_frontalface_alt.xml");
- sp_human_face_68_dat_filepath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath ("sp_human_face_68.dat");
- couple_avi_filepath = OpenCVForUnity.UnityUtils.Utils.getFilePath ("dance.avi");
- Run ();
- #endif
+ sourceToMatHelper = gameObject.GetComponent();
+
+#if UNITY_WEBGL
+ getFilePath_Coroutine = GetFilePath();
+ StartCoroutine(getFilePath_Coroutine);
+#else
+ haarcascade_frontalface_alt_xml_filepath = OpenCVForUnity.UnityUtils.Utils.getFilePath("haarcascade_frontalface_alt.xml");
+ sp_human_face_68_dat_filepath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("sp_human_face_68.dat");
+ Run();
+#endif
}
- #if UNITY_WEBGL && !UNITY_EDITOR
- private IEnumerator GetFilePath ()
+#if UNITY_WEBGL
+ private IEnumerator GetFilePath()
{
- var getFilePathAsync_0_Coroutine = OpenCVForUnity.UnityUtils.Utils.getFilePathAsync ("haarcascade_frontalface_alt.xml", (result) => {
+ var getFilePathAsync_0_Coroutine = OpenCVForUnity.UnityUtils.Utils.getFilePathAsync("haarcascade_frontalface_alt.xml", (result) =>
+ {
haarcascade_frontalface_alt_xml_filepath = result;
});
yield return getFilePathAsync_0_Coroutine;
- var getFilePathAsync_1_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync ("sp_human_face_68.dat", (result) => {
+ var getFilePathAsync_1_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync("sp_human_face_68.dat", (result) =>
+ {
sp_human_face_68_dat_filepath = result;
});
yield return getFilePathAsync_1_Coroutine;
- var getFilePathAsync_2_Coroutine = OpenCVForUnity.UnityUtils.Utils.getFilePathAsync ("dance.avi", (result) => {
- couple_avi_filepath = result;
- });
- yield return getFilePathAsync_2_Coroutine;
-
getFilePath_Coroutine = null;
- Run ();
+ Run();
}
- #endif
+#endif
- private void Run ()
+ private void Run()
{
- meshOverlay = this.GetComponent ();
+ meshOverlay = this.GetComponent();
- shader_FadeID = Shader.PropertyToID ("_Fade");
- shader_ColorCorrectionID = Shader.PropertyToID ("_ColorCorrection");
- shader_LUTTexID = Shader.PropertyToID ("_LUTTex");
+ shader_FadeID = Shader.PropertyToID("_Fade");
+ shader_ColorCorrectionID = Shader.PropertyToID("_ColorCorrection");
+ shader_LUTTexID = Shader.PropertyToID("_LUTTex");
- rectangleTracker = new RectangleTracker ();
+ rectangleTracker = new RectangleTracker();
- frontalFaceChecker = new FrontalFaceChecker ((float)frameWidth, (float)frameHeight);
+ faceLandmarkDetector = new FaceLandmarkDetector(sp_human_face_68_dat_filepath);
- faceLandmarkDetector = new FaceLandmarkDetector (sp_human_face_68_dat_filepath);
-
- lowPassFilterDict = new Dictionary ();
- opticalFlowFilterDict = new Dictionary ();
-
- faceMaskColorCorrector = new FaceMaskColorCorrector ();
-
- rgbMat = new Mat ();
-
- capture.open (couple_avi_filepath);
-
- if (capture.isOpened ()) {
- Debug.Log ("capture.isOpened() true");
- } else {
- Debug.Log ("capture.isOpened() false");
- }
-
-
- Debug.Log ("CAP_PROP_FORMAT: " + capture.get (Videoio.CAP_PROP_FORMAT));
- Debug.Log ("CAP_PROP_POS_MSEC: " + capture.get (Videoio.CAP_PROP_POS_MSEC));
- Debug.Log ("CAP_PROP_POS_FRAMES: " + capture.get (Videoio.CAP_PROP_POS_FRAMES));
- Debug.Log ("CAP_PROP_POS_AVI_RATIO: " + capture.get (Videoio.CAP_PROP_POS_AVI_RATIO));
- Debug.Log ("CAP_PROP_FRAME_COUNT: " + capture.get (Videoio.CAP_PROP_FRAME_COUNT));
- Debug.Log ("CAP_PROP_FPS: " + capture.get (Videoio.CAP_PROP_FPS));
- Debug.Log ("CAP_PROP_FRAME_WIDTH: " + capture.get (Videoio.CAP_PROP_FRAME_WIDTH));
- Debug.Log ("CAP_PROP_FRAME_HEIGHT: " + capture.get (Videoio.CAP_PROP_FRAME_HEIGHT));
-
-
- texture = new Texture2D ((int)(frameWidth), (int)(frameHeight), TextureFormat.RGB24, false);
- gameObject.transform.localScale = new Vector3 ((float)frameWidth, (float)frameHeight, 1);
- float widthScale = (float)Screen.width / (float)frameWidth;
- float heightScale = (float)Screen.height / (float)frameHeight;
- if (widthScale < heightScale) {
- Camera.main.orthographicSize = ((float)frameWidth * (float)Screen.height / (float)Screen.width) / 2;
- } else {
- Camera.main.orthographicSize = (float)frameHeight / 2;
- }
-
- gameObject.GetComponent ().material.mainTexture = texture;
-
- meshOverlay.UpdateOverlayTransform (gameObject.transform);
-
-
- grayMat = new Mat ((int)frameHeight, (int)frameWidth, CvType.CV_8UC1);
- cascade = new CascadeClassifier (haarcascade_frontalface_alt_xml_filepath);
-// if (cascade.empty ()) {
-// Debug.LogError ("cascade file is not loaded.Please copy from “FaceTrackerExample/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
-// }
+ lowPassFilterDict = new Dictionary();
+ opticalFlowFilterDict = new Dictionary();
+ faceMaskColorCorrector = new FaceMaskColorCorrector();
+
+ if (string.IsNullOrEmpty(sourceToMatHelper.requestedVideoFilePath))
+ sourceToMatHelper.requestedVideoFilePath = VIDEO_FILENAME;
+ sourceToMatHelper.outputColorFormat = VideoCaptureToMatHelper.ColorFormat.RGB;
+ sourceToMatHelper.Initialize();
+
displayFaceRectsToggle.isOn = displayFaceRects;
useDlibFaceDetecterToggle.isOn = useDlibFaceDetecter;
enableNoiseFilterToggle.isOn = enableNoiseFilter;
enableColorCorrectionToggle.isOn = enableColorCorrection;
filterNonFrontalFacesToggle.isOn = filterNonFrontalFaces;
displayDebugFacePointsToggle.isOn = displayDebugFacePoints;
+
+ }
- OnChangeFaceMaskButtonClick ();
+ ///
+ /// Raises the video capture to mat helper initialized event.
+ ///
+ public void OnVideoCaptureToMatHelperInitialized()
+ {
+ Debug.Log("OnVideoCaptureToMatHelperInitialized");
+
+ Mat rgbMat = sourceToMatHelper.GetMat();
+
+ texture = new Texture2D(rgbMat.cols(), rgbMat.rows(), TextureFormat.RGB24, false);
+
+
+ gameObject.transform.localScale = new Vector3(rgbMat.cols(), rgbMat.rows(), 1);
+ Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
+
+ if (fpsMonitor != null)
+ {
+ fpsMonitor.Add("width", rgbMat.width().ToString());
+ fpsMonitor.Add("height", rgbMat.height().ToString());
+ fpsMonitor.Add("orientation", Screen.orientation.ToString());
+ }
+
+
+ float width = gameObject.transform.localScale.x;
+ float height = gameObject.transform.localScale.y;
+
+ float widthScale = (float)Screen.width / width;
+ float heightScale = (float)Screen.height / height;
+ if (widthScale < heightScale)
+ {
+ Camera.main.orthographicSize = (width * (float)Screen.height / (float)Screen.width) / 2;
+ }
+ else
+ {
+ Camera.main.orthographicSize = height / 2;
+ }
+
+ gameObject.GetComponent().material.mainTexture = texture;
+
+ grayMat = new Mat(rgbMat.rows(), rgbMat.cols(), CvType.CV_8UC1);
+ cascade = new CascadeClassifier(haarcascade_frontalface_alt_xml_filepath);
+ //if (cascade.empty())
+ //{
+ // Debug.LogError("cascade file is not loaded.Please copy from “FaceTrackerExample/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
+ //}
+
+ frontalFaceChecker = new FrontalFaceChecker(width, height);
+
+ meshOverlay.UpdateOverlayTransform(gameObject.transform);
+
+ OnChangeFaceMaskButtonClick();
+
+ }
+
+ ///
+ /// Raises the video capture to mat helper disposed event.
+ ///
+ public void OnVideoCaptureToMatHelperDisposed()
+ {
+ Debug.Log("OnVideoCaptureToMatHelperDisposed");
+
+ grayMat.Dispose();
+
+ if (texture != null)
+ {
+ Texture2D.Destroy(texture);
+ texture = null;
+ }
+
+ rectangleTracker.Reset();
+ meshOverlay.Reset();
+
+ foreach (var key in lowPassFilterDict.Keys)
+ {
+ lowPassFilterDict[key].Dispose();
+ }
+ lowPassFilterDict.Clear();
+ foreach (var key in opticalFlowFilterDict.Keys)
+ {
+ opticalFlowFilterDict[key].Dispose();
+ }
+ opticalFlowFilterDict.Clear();
+
+ faceMaskColorCorrector.Reset();
+
+ frontalFaceChecker.Dispose();
+ }
+
+ ///
+ /// Raises the video capture to mat helper error occurred event.
+ ///
+ /// Error code.
+ public void OnVideoCaptureToMatHelperErrorOccurred(VideoCaptureToMatHelper.ErrorCode errorCode)
+ {
+ Debug.Log("OnVideoCaptureToMatHelperErrorOccurred " + errorCode);
+
+ if (fpsMonitor != null)
+ {
+ fpsMonitor.consoleText = "ErrorCode: " + errorCode;
+ }
}
// Update is called once per frame
- void Update ()
+ void Update()
{
- // loop play.
- if (capture.get (Videoio.CAP_PROP_POS_FRAMES) >= capture.get (Videoio.CAP_PROP_FRAME_COUNT))
- capture.set (Videoio.CAP_PROP_POS_FRAMES, 0);
-
- if (capture.grab ()) {
-
- capture.retrieve (rgbMat, 0);
-
- Imgproc.cvtColor (rgbMat, rgbMat, Imgproc.COLOR_BGR2RGB);
- //Debug.Log ("Mat toString " + rgbMat.ToString ());
-
+ if (sourceToMatHelper.IsPlaying() && sourceToMatHelper.DidUpdateThisFrame())
+ {
+
+ Mat rgbMat = sourceToMatHelper.GetMat();
+
// detect faces.
- List detectResult = new List ();
- if (useDlibFaceDetecter) {
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, rgbMat);
- List result = faceLandmarkDetector.Detect ();
+ List detectResult = new List();
+ if (useDlibFaceDetecter)
+ {
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, rgbMat);
+ List result = faceLandmarkDetector.Detect();
- foreach (var unityRect in result) {
- detectResult.Add (new Rect ((int)unityRect.x, (int)unityRect.y, (int)unityRect.width, (int)unityRect.height));
+ foreach (var unityRect in result)
+ {
+ detectResult.Add(new Rect((int)unityRect.x, (int)unityRect.y, (int)unityRect.width, (int)unityRect.height));
}
- } else {
+ }
+ else
+ {
// convert image to greyscale.
- Imgproc.cvtColor (rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY);
+ Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY);
- using (Mat equalizeHistMat = new Mat ())
- using (MatOfRect faces = new MatOfRect ()) {
- Imgproc.equalizeHist (grayMat, equalizeHistMat);
+ using (Mat equalizeHistMat = new Mat())
+ using (MatOfRect faces = new MatOfRect())
+ {
+ Imgproc.equalizeHist(grayMat, equalizeHistMat);
- cascade.detectMultiScale (equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size (equalizeHistMat.cols () * 0.15, equalizeHistMat.cols () * 0.15), new Size ());
+ cascade.detectMultiScale(equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size(equalizeHistMat.cols() * 0.15, equalizeHistMat.cols() * 0.15), new Size());
- detectResult = faces.toList ();
-
- // corrects the deviation of a detection result between OpenCV and Dlib.
- foreach (Rect r in detectResult) {
- r.y += (int)(r.height * 0.1f);
- }
+ detectResult = faces.toList();
}
- }
+
+ // corrects the deviation of a detection result between OpenCV and Dlib.
+ foreach (Rect r in detectResult)
+ {
+ r.y += (int)(r.height * 0.1f);
+ }
+ }
+
// face tracking.
- rectangleTracker.UpdateTrackedObjects (detectResult);
- List trackedRects = new List ();
- rectangleTracker.GetObjects (trackedRects, true);
+ rectangleTracker.UpdateTrackedObjects(detectResult);
+ List trackedRects = new List();
+ rectangleTracker.GetObjects(trackedRects, true);
// create noise filter.
- foreach (var openCVRect in trackedRects) {
- if (openCVRect.state == TrackedState.NEW) {
- if (!lowPassFilterDict.ContainsKey (openCVRect.id))
- lowPassFilterDict.Add (openCVRect.id, new LowPassPointsFilter ((int)faceLandmarkDetector.GetShapePredictorNumParts ()));
- if (!opticalFlowFilterDict.ContainsKey (openCVRect.id))
- opticalFlowFilterDict.Add (openCVRect.id, new OFPointsFilter ((int)faceLandmarkDetector.GetShapePredictorNumParts ()));
- } else if (openCVRect.state == TrackedState.DELETED) {
- if (lowPassFilterDict.ContainsKey (openCVRect.id)) {
- lowPassFilterDict [openCVRect.id].Dispose ();
- lowPassFilterDict.Remove (openCVRect.id);
+ foreach (var openCVRect in trackedRects)
+ {
+ if (openCVRect.state == TrackedState.NEW)
+ {
+ if (!lowPassFilterDict.ContainsKey(openCVRect.id))
+ lowPassFilterDict.Add(openCVRect.id, new LowPassPointsFilter((int)faceLandmarkDetector.GetShapePredictorNumParts()));
+ if (!opticalFlowFilterDict.ContainsKey(openCVRect.id))
+ opticalFlowFilterDict.Add(openCVRect.id, new OFPointsFilter((int)faceLandmarkDetector.GetShapePredictorNumParts()));
+ }
+ else if (openCVRect.state == TrackedState.DELETED)
+ {
+ if (lowPassFilterDict.ContainsKey(openCVRect.id))
+ {
+ lowPassFilterDict[openCVRect.id].Dispose();
+ lowPassFilterDict.Remove(openCVRect.id);
}
- if (opticalFlowFilterDict.ContainsKey (openCVRect.id)) {
- opticalFlowFilterDict [openCVRect.id].Dispose ();
- opticalFlowFilterDict.Remove (openCVRect.id);
+ if (opticalFlowFilterDict.ContainsKey(openCVRect.id))
+ {
+ opticalFlowFilterDict[openCVRect.id].Dispose();
+ opticalFlowFilterDict.Remove(openCVRect.id);
}
}
}
// create LUT texture.
- foreach (var openCVRect in trackedRects) {
- if (openCVRect.state == TrackedState.NEW) {
- faceMaskColorCorrector.CreateLUTTex (openCVRect.id);
- } else if (openCVRect.state == TrackedState.DELETED) {
- faceMaskColorCorrector.DeleteLUTTex (openCVRect.id);
+ foreach (var openCVRect in trackedRects)
+ {
+ if (openCVRect.state == TrackedState.NEW)
+ {
+ faceMaskColorCorrector.CreateLUTTex(openCVRect.id);
+ }
+ else if (openCVRect.state == TrackedState.DELETED)
+ {
+ faceMaskColorCorrector.DeleteLUTTex(openCVRect.id);
}
}
-
// detect face landmark points.
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, rgbMat);
- List> landmarkPoints = new List> ();
- for (int i = 0; i < trackedRects.Count; i++) {
- TrackedRect tr = trackedRects [i];
- UnityEngine.Rect rect = new UnityEngine.Rect (tr.x, tr.y, tr.width, tr.height);
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, rgbMat);
+ List> landmarkPoints = new List>();
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ TrackedRect tr = trackedRects[i];
+ UnityEngine.Rect rect = new UnityEngine.Rect(tr.x, tr.y, tr.width, tr.height);
- List points = faceLandmarkDetector.DetectLandmark (rect);
+ List points = faceLandmarkDetector.DetectLandmark(rect);
// apply noise filter.
- if (enableNoiseFilter) {
- if (tr.state > TrackedState.NEW && tr.state < TrackedState.DELETED) {
- opticalFlowFilterDict [tr.id].Process (rgbMat, points, points);
- lowPassFilterDict [tr.id].Process (rgbMat, points, points);
+ if (enableNoiseFilter)
+ {
+ if (tr.state > TrackedState.NEW && tr.state < TrackedState.DELETED)
+ {
+ opticalFlowFilterDict[tr.id].Process(rgbMat, points, points);
+ lowPassFilterDict[tr.id].Process(rgbMat, points, points);
}
}
- landmarkPoints.Add (points);
+ landmarkPoints.Add(points);
}
-
+
// face masking.
- if (faceMaskTexture != null && landmarkPoints.Count >= 1) { // Apply face masking between detected faces and a face mask image.
+ if (faceMaskTexture != null && landmarkPoints.Count >= 1)
+ { // Apply face masking between detected faces and a face mask image.
float maskImageWidth = faceMaskTexture.width;
float maskImageHeight = faceMaskTexture.height;
-
+
TrackedRect tr;
- for (int i = 0; i < trackedRects.Count; i++) {
- tr = trackedRects [i];
-
- if (tr.state == TrackedState.NEW) {
- meshOverlay.CreateObject (tr.id, faceMaskTexture);
- }
- if (tr.state < TrackedState.DELETED) {
- MaskFace (meshOverlay, tr, landmarkPoints [i], faceLandmarkPointsInMask, maskImageWidth, maskImageHeight);
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ tr = trackedRects[i];
- if (enableColorCorrection) {
- CorrectFaceMaskColor (tr.id, faceMaskMat, rgbMat, faceLandmarkPointsInMask, landmarkPoints [i]);
+ if (tr.state == TrackedState.NEW)
+ {
+ meshOverlay.CreateObject(tr.id, faceMaskTexture);
+ }
+ if (tr.state < TrackedState.DELETED)
+ {
+ MaskFace(meshOverlay, tr, landmarkPoints[i], faceLandmarkPointsInMask, maskImageWidth, maskImageHeight);
+
+ if (enableColorCorrection)
+ {
+ CorrectFaceMaskColor(tr.id, faceMaskMat, rgbMat, faceLandmarkPointsInMask, landmarkPoints[i]);
}
- } else if (tr.state == TrackedState.DELETED) {
- meshOverlay.DeleteObject (tr.id);
+ }
+ else if (tr.state == TrackedState.DELETED)
+ {
+ meshOverlay.DeleteObject(tr.id);
}
}
- } else if (landmarkPoints.Count >= 1) { // Apply face masking between detected faces.
-
+ }
+ else if (landmarkPoints.Count >= 1)
+ { // Apply face masking between detected faces.
+
float maskImageWidth = texture.width;
float maskImageHeight = texture.height;
-
+
TrackedRect tr;
- for (int i = 0; i < trackedRects.Count; i++) {
- tr = trackedRects [i];
-
- if (tr.state == TrackedState.NEW) {
- meshOverlay.CreateObject (tr.id, texture);
- }
- if (tr.state < TrackedState.DELETED) {
- MaskFace (meshOverlay, tr, landmarkPoints [i], landmarkPoints [0], maskImageWidth, maskImageHeight);
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ tr = trackedRects[i];
- if (enableColorCorrection) {
- CorrectFaceMaskColor (tr.id, rgbMat, rgbMat, landmarkPoints [0], landmarkPoints [i]);
+ if (tr.state == TrackedState.NEW)
+ {
+ meshOverlay.CreateObject(tr.id, texture);
+ }
+ if (tr.state < TrackedState.DELETED)
+ {
+ MaskFace(meshOverlay, tr, landmarkPoints[i], landmarkPoints[0], maskImageWidth, maskImageHeight);
+
+ if (enableColorCorrection)
+ {
+ CorrectFaceMaskColor(tr.id, rgbMat, rgbMat, landmarkPoints[0], landmarkPoints[i]);
}
- } else if (tr.state == TrackedState.DELETED) {
- meshOverlay.DeleteObject (tr.id);
+ }
+ else if (tr.state == TrackedState.DELETED)
+ {
+ meshOverlay.DeleteObject(tr.id);
}
}
}
-
+
// draw face rects.
- if (displayFaceRects) {
- for (int i = 0; i < detectResult.Count; i++) {
- UnityEngine.Rect rect = new UnityEngine.Rect (detectResult [i].x, detectResult [i].y, detectResult [i].width, detectResult [i].height);
- OpenCVForUnityUtils.DrawFaceRect (rgbMat, rect, new Scalar (255, 0, 0, 255), 2);
+ if (displayFaceRects)
+ {
+ for (int i = 0; i < detectResult.Count; i++)
+ {
+ UnityEngine.Rect rect = new UnityEngine.Rect(detectResult[i].x, detectResult[i].y, detectResult[i].width, detectResult[i].height);
+ OpenCVForUnityUtils.DrawFaceRect(rgbMat, rect, new Scalar(255, 0, 0, 255), 2);
}
-
- for (int i = 0; i < trackedRects.Count; i++) {
- UnityEngine.Rect rect = new UnityEngine.Rect (trackedRects [i].x, trackedRects [i].y, trackedRects [i].width, trackedRects [i].height);
- OpenCVForUnityUtils.DrawFaceRect (rgbMat, rect, new Scalar (255, 255, 0, 255), 2);
-// Imgproc.putText (rgbMat, " " + frontalFaceChecker.GetFrontalFaceAngles (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
-// Imgproc.putText (rgbMat, " " + frontalFaceChecker.GetFrontalFaceRate (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
+
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ UnityEngine.Rect rect = new UnityEngine.Rect(trackedRects[i].x, trackedRects[i].y, trackedRects[i].width, trackedRects[i].height);
+ OpenCVForUnityUtils.DrawFaceRect(rgbMat, rect, new Scalar(255, 255, 0, 255), 2);
+ //Imgproc.putText (rgbMat, " " + frontalFaceChecker.GetFrontalFaceAngles (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
+ //Imgproc.putText (rgbMat, " " + frontalFaceChecker.GetFrontalFaceRate (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
}
}
-
+
// draw face points.
- if (displayDebugFacePoints) {
- for (int i = 0; i < landmarkPoints.Count; i++) {
- OpenCVForUnityUtils.DrawFaceLandmark (rgbMat, landmarkPoints [i], new Scalar (0, 255, 0, 255), 2);
+ if (displayDebugFacePoints)
+ {
+ for (int i = 0; i < landmarkPoints.Count; i++)
+ {
+ OpenCVForUnityUtils.DrawFaceLandmark(rgbMat, landmarkPoints[i], new Scalar(0, 255, 0, 255), 2);
}
}
-
-
+
+
// display face mask image.
- if (faceMaskTexture != null && faceMaskMat != null) {
- if (displayFaceRects) {
- OpenCVForUnityUtils.DrawFaceRect (faceMaskMat, faceRectInMask, new Scalar (255, 0, 0, 255), 2);
+ if (faceMaskTexture != null && faceMaskMat != null)
+ {
+
+ if (displayFaceRects)
+ {
+ OpenCVForUnityUtils.DrawFaceRect(faceMaskMat, faceRectInMask, new Scalar(255, 0, 0, 255), 2);
}
- if (displayDebugFacePoints) {
- OpenCVForUnityUtils.DrawFaceLandmark (faceMaskMat, faceLandmarkPointsInMask, new Scalar (0, 255, 0, 255), 2);
+ if (displayDebugFacePoints)
+ {
+ OpenCVForUnityUtils.DrawFaceLandmark(faceMaskMat, faceLandmarkPointsInMask, new Scalar(0, 255, 0, 255), 2);
}
-
- float scale = (rgbMat.width () / 4f) / faceMaskMat.width ();
- float tx = rgbMat.width () - faceMaskMat.width () * scale;
+
+ float scale = (rgbMat.width() / 4f) / faceMaskMat.width();
+ float tx = rgbMat.width() - faceMaskMat.width() * scale;
float ty = 0.0f;
- Mat trans = new Mat (2, 3, CvType.CV_32F);//1.0, 0.0, tx, 0.0, 1.0, ty);
- trans.put (0, 0, scale);
- trans.put (0, 1, 0.0f);
- trans.put (0, 2, tx);
- trans.put (1, 0, 0.0f);
- trans.put (1, 1, scale);
- trans.put (1, 2, ty);
-
- Imgproc.warpAffine (faceMaskMat, rgbMat, trans, rgbMat.size (), Imgproc.INTER_LINEAR, Core.BORDER_TRANSPARENT, new Scalar (0));
+ Mat trans = new Mat(2, 3, CvType.CV_32F);//1.0, 0.0, tx, 0.0, 1.0, ty);
+ trans.put(0, 0, scale);
+ trans.put(0, 1, 0.0f);
+ trans.put(0, 2, tx);
+ trans.put(1, 0, 0.0f);
+ trans.put(1, 1, scale);
+ trans.put(1, 2, ty);
+
+ Imgproc.warpAffine(faceMaskMat, rgbMat, trans, rgbMat.size(), Imgproc.INTER_LINEAR, Core.BORDER_TRANSPARENT, new Scalar(0));
if (displayFaceRects || displayDebugFacePointsToggle)
- OpenCVForUnity.UnityUtils.Utils.texture2DToMat (faceMaskTexture, faceMaskMat);
+ OpenCVForUnity.UnityUtils.Utils.texture2DToMat(faceMaskTexture, faceMaskMat);
}
-
-// Imgproc.putText (rgbMat, "W:" + rgbMat.width () + " H:" + rgbMat.height () + " SO:" + Screen.orientation, new Point (5, rgbMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255), 1, Imgproc.LINE_AA, false);
- OpenCVForUnity.UnityUtils.Utils.fastMatToTexture2D (rgbMat, texture);
+ //Imgproc.putText (rgbMat, "W:" + rgbMat.width () + " H:" + rgbMat.height () + " SO:" + Screen.orientation, new Point (5, rgbMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
+
+ OpenCVForUnity.UnityUtils.Utils.fastMatToTexture2D(rgbMat, texture);
}
}
- private void MaskFace (TrackedMeshOverlay meshOverlay, TrackedRect tr, List landmarkPoints, List landmarkPointsInMaskImage, float maskImageWidth = 0, float maskImageHeight = 0)
+ private void MaskFace(TrackedMeshOverlay meshOverlay, TrackedRect tr, List landmarkPoints, List landmarkPointsInMaskImage, float maskImageWidth = 0, float maskImageHeight = 0)
{
float imageWidth = meshOverlay.width;
- float imageHeight = meshOverlay.height;
+ float imageHeight = meshOverlay.height;
if (maskImageWidth == 0)
maskImageWidth = imageWidth;
@@ -549,108 +634,139 @@ namespace FaceMaskExample
if (maskImageHeight == 0)
maskImageHeight = imageHeight;
- TrackedMesh tm = meshOverlay.GetObjectById (tr.id);
+ TrackedMesh tm = meshOverlay.GetObjectById(tr.id);
Vector3[] vertices = tm.meshFilter.mesh.vertices;
- if (vertices.Length == landmarkPoints.Count) {
- for (int j = 0; j < vertices.Length; j++) {
- vertices [j].x = landmarkPoints [j].x / imageWidth - 0.5f;
- vertices [j].y = 0.5f - landmarkPoints [j].y / imageHeight;
+ if (vertices.Length == landmarkPoints.Count)
+ {
+ for (int j = 0; j < vertices.Length; j++)
+ {
+ vertices[j].x = landmarkPoints[j].x / imageWidth - 0.5f;
+ vertices[j].y = 0.5f - landmarkPoints[j].y / imageHeight;
}
}
Vector2[] uv = tm.meshFilter.mesh.uv;
- if (uv.Length == landmarkPointsInMaskImage.Count) {
- for (int jj = 0; jj < uv.Length; jj++) {
- uv [jj].x = landmarkPointsInMaskImage [jj].x / maskImageWidth;
- uv [jj].y = (maskImageHeight - landmarkPointsInMaskImage [jj].y) / maskImageHeight;
+ if (uv.Length == landmarkPointsInMaskImage.Count)
+ {
+ for (int jj = 0; jj < uv.Length; jj++)
+ {
+ uv[jj].x = landmarkPointsInMaskImage[jj].x / maskImageWidth;
+ uv[jj].y = (maskImageHeight - landmarkPointsInMaskImage[jj].y) / maskImageHeight;
}
}
- meshOverlay.UpdateObject (tr.id, vertices, null, uv);
+ meshOverlay.UpdateObject(tr.id, vertices, null, uv);
- if (tr.numFramesNotDetected > 3) {
- tm.sharedMaterial.SetFloat (shader_FadeID, 1f);
- } else if (tr.numFramesNotDetected > 0 && tr.numFramesNotDetected <= 3) {
- tm.sharedMaterial.SetFloat (shader_FadeID, 0.3f + (0.7f / 4f) * tr.numFramesNotDetected);
- } else {
- tm.sharedMaterial.SetFloat (shader_FadeID, 0.3f);
+ if (tr.numFramesNotDetected > 3)
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 1f);
+ }
+ else if (tr.numFramesNotDetected > 0 && tr.numFramesNotDetected <= 3)
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 0.3f + (0.7f / 4f) * tr.numFramesNotDetected);
+ }
+ else
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 0.3f);
}
- if (enableColorCorrection) {
- tm.sharedMaterial.SetFloat (shader_ColorCorrectionID, 1f);
- } else {
- tm.sharedMaterial.SetFloat (shader_ColorCorrectionID, 0f);
+ if (enableColorCorrection)
+ {
+ tm.sharedMaterial.SetFloat(shader_ColorCorrectionID, 1f);
+ }
+ else
+ {
+ tm.sharedMaterial.SetFloat(shader_ColorCorrectionID, 0f);
}
// filter non frontal faces.
- if (filterNonFrontalFaces && frontalFaceChecker.GetFrontalFaceRate (landmarkPoints) < frontalFaceRateLowerLimit) {
- tm.sharedMaterial.SetFloat (shader_FadeID, 1f);
+ if (filterNonFrontalFaces && frontalFaceChecker.GetFrontalFaceRate(landmarkPoints) < frontalFaceRateLowerLimit)
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 1f);
}
}
- private void CorrectFaceMaskColor (int id, Mat src, Mat dst, List src_landmarkPoints, List dst_landmarkPoints)
+ private void CorrectFaceMaskColor(int id, Mat src, Mat dst, List src_landmarkPoints, List dst_landmarkPoints)
{
- Texture2D LUTTex = faceMaskColorCorrector.UpdateLUTTex (id, src, dst, src_landmarkPoints, dst_landmarkPoints);
- TrackedMesh tm = meshOverlay.GetObjectById (id);
- tm.sharedMaterial.SetTexture (shader_LUTTexID, LUTTex);
+ Texture2D LUTTex = faceMaskColorCorrector.UpdateLUTTex(id, src, dst, src_landmarkPoints, dst_landmarkPoints);
+ TrackedMesh tm = meshOverlay.GetObjectById(id);
+ tm.sharedMaterial.SetTexture(shader_LUTTexID, LUTTex);
}
///
- /// Raises the disable event.
+ /// Raises the destroy event.
///
- void OnDestroy ()
+ void OnDestroy()
{
- capture.release ();
+ if (sourceToMatHelper != null)
+ sourceToMatHelper.Dispose();
- if (rgbMat != null)
- rgbMat.Dispose ();
- if (grayMat != null)
- grayMat.Dispose ();
+ if (cascade != null)
+ cascade.Dispose();
if (rectangleTracker != null)
- rectangleTracker.Dispose ();
+ rectangleTracker.Dispose();
if (faceLandmarkDetector != null)
- faceLandmarkDetector.Dispose ();
+ faceLandmarkDetector.Dispose();
- foreach (var key in lowPassFilterDict.Keys) {
- lowPassFilterDict [key].Dispose ();
+ foreach (var key in lowPassFilterDict.Keys)
+ {
+ lowPassFilterDict[key].Dispose();
}
- lowPassFilterDict.Clear ();
- foreach (var key in opticalFlowFilterDict.Keys) {
- opticalFlowFilterDict [key].Dispose ();
+ lowPassFilterDict.Clear();
+ foreach (var key in opticalFlowFilterDict.Keys)
+ {
+ opticalFlowFilterDict[key].Dispose();
}
- opticalFlowFilterDict.Clear ();
+ opticalFlowFilterDict.Clear();
if (faceMaskColorCorrector != null)
- faceMaskColorCorrector.Dispose ();
+ faceMaskColorCorrector.Dispose();
- if (frontalFaceChecker != null)
- frontalFaceChecker.Dispose ();
-
- #if UNITY_WEBGL && !UNITY_EDITOR
- if (getFilePath_Coroutine != null) {
- StopCoroutine (getFilePath_Coroutine);
- ((IDisposable)getFilePath_Coroutine).Dispose ();
+#if UNITY_WEBGL
+ if (getFilePath_Coroutine != null)
+ {
+ StopCoroutine(getFilePath_Coroutine);
+ ((IDisposable)getFilePath_Coroutine).Dispose();
}
- #endif
+#endif
}
///
/// Raises the back button click event.
///
- public void OnBackButtonClick ()
+ public void OnBackButtonClick()
{
- SceneManager.LoadScene ("FaceMaskExample");
+ SceneManager.LoadScene("FaceMaskExample");
+ }
+
+ ///
+ /// Raises the play button click event.
+ ///
+ public void OnPlayButtonClick()
+ {
+ sourceToMatHelper.Play();
+ }
+
+ ///
+ /// Raises the pause button click event.
+ ///
+ public void OnPauseButtonClick()
+ {
+ sourceToMatHelper.Pause();
}
///
/// Raises the use Dlib face detector toggle value changed event.
///
- public void OnUseDlibFaceDetecterToggleValueChanged ()
+ public void OnUseDlibFaceDetecterToggleValueChanged()
{
- if (useDlibFaceDetecterToggle.isOn) {
+ if (useDlibFaceDetecterToggle.isOn)
+ {
useDlibFaceDetecter = true;
- } else {
+ }
+ else
+ {
useDlibFaceDetecter = false;
}
}
@@ -658,17 +774,22 @@ namespace FaceMaskExample
///
/// Raises the enable noise filter toggle value changed event.
///
- public void OnEnableNoiseFilterToggleValueChanged ()
+ public void OnEnableNoiseFilterToggleValueChanged()
{
- if (enableNoiseFilterToggle.isOn) {
+ if (enableNoiseFilterToggle.isOn)
+ {
enableNoiseFilter = true;
- foreach (var key in lowPassFilterDict.Keys) {
- lowPassFilterDict [key].Reset ();
+ foreach (var key in lowPassFilterDict.Keys)
+ {
+ lowPassFilterDict[key].Reset();
}
- foreach (var key in opticalFlowFilterDict.Keys) {
- opticalFlowFilterDict [key].Reset ();
+ foreach (var key in opticalFlowFilterDict.Keys)
+ {
+ opticalFlowFilterDict[key].Reset();
}
- } else {
+ }
+ else
+ {
enableNoiseFilter = false;
}
}
@@ -676,11 +797,14 @@ namespace FaceMaskExample
///
/// Raises the enable color correction toggle value changed event.
///
- public void OnEnableColorCorrectionToggleValueChanged ()
+ public void OnEnableColorCorrectionToggleValueChanged()
{
- if (enableColorCorrectionToggle.isOn) {
+ if (enableColorCorrectionToggle.isOn)
+ {
enableColorCorrection = true;
- } else {
+ }
+ else
+ {
enableColorCorrection = false;
}
}
@@ -688,11 +812,14 @@ namespace FaceMaskExample
///
/// Raises the filter non frontal faces toggle value changed event.
///
- public void OnFilterNonFrontalFacesToggleValueChanged ()
+ public void OnFilterNonFrontalFacesToggleValueChanged()
{
- if (filterNonFrontalFacesToggle.isOn) {
+ if (filterNonFrontalFacesToggle.isOn)
+ {
filterNonFrontalFaces = true;
- } else {
+ }
+ else
+ {
filterNonFrontalFaces = false;
}
}
@@ -700,11 +827,14 @@ namespace FaceMaskExample
///
/// Raises the display face rects toggle value changed event.
///
- public void OnDisplayFaceRectsToggleValueChanged ()
+ public void OnDisplayFaceRectsToggleValueChanged()
{
- if (displayFaceRectsToggle.isOn) {
+ if (displayFaceRectsToggle.isOn)
+ {
displayFaceRects = true;
- } else {
+ }
+ else
+ {
displayFaceRects = false;
}
}
@@ -712,11 +842,14 @@ namespace FaceMaskExample
///
/// Raises the display debug face points toggle value changed event.
///
- public void OnDisplayDebugFacePointsToggleValueChanged ()
+ public void OnDisplayDebugFacePointsToggleValueChanged()
{
- if (displayDebugFacePointsToggle.isOn) {
+ if (displayDebugFacePointsToggle.isOn)
+ {
displayDebugFacePoints = true;
- } else {
+ }
+ else
+ {
displayDebugFacePoints = false;
}
}
@@ -724,49 +857,56 @@ namespace FaceMaskExample
///
/// Raises the change face mask button click event.
///
- public void OnChangeFaceMaskButtonClick ()
+ public void OnChangeFaceMaskButtonClick()
{
- RemoveFaceMask ();
+ RemoveFaceMask();
if (faceMaskDatas.Count == 0)
return;
- FaceMaskData maskData = faceMaskDatas [faceMaskDataIndex];
+ FaceMaskData maskData = faceMaskDatas[faceMaskDataIndex];
faceMaskDataIndex = (faceMaskDataIndex < faceMaskDatas.Count - 1) ? faceMaskDataIndex + 1 : 0;
- if (maskData == null) {
- Debug.LogError ("maskData == null");
+ if (maskData == null)
+ {
+ Debug.LogError("maskData == null");
return;
}
- if (maskData.image == null) {
- Debug.LogError ("image == null");
+ if (maskData.image == null)
+ {
+ Debug.LogError("image == null");
return;
}
- if (maskData.landmarkPoints.Count != 68) {
- Debug.LogError ("landmarkPoints.Count != 68");
+ if (maskData.landmarkPoints.Count != 68)
+ {
+ Debug.LogError("landmarkPoints.Count != 68");
return;
}
faceMaskTexture = maskData.image;
- faceMaskMat = new Mat (faceMaskTexture.height, faceMaskTexture.width, CvType.CV_8UC3);
- OpenCVForUnity.UnityUtils.Utils.texture2DToMat (faceMaskTexture, faceMaskMat);
+ faceMaskMat = new Mat(faceMaskTexture.height, faceMaskTexture.width, CvType.CV_8UC3);
+ OpenCVForUnity.UnityUtils.Utils.texture2DToMat(faceMaskTexture, faceMaskMat);
- if (maskData.isDynamicMode) {
- faceRectInMask = DetectFace (faceMaskMat);
- faceLandmarkPointsInMask = DetectFaceLandmarkPoints (faceMaskMat, faceRectInMask);
+ if (maskData.isDynamicMode)
+ {
+ faceRectInMask = DetectFace(faceMaskMat);
+ faceLandmarkPointsInMask = DetectFaceLandmarkPoints(faceMaskMat, faceRectInMask);
maskData.faceRect = faceRectInMask;
maskData.landmarkPoints = faceLandmarkPointsInMask;
- } else {
+ }
+ else
+ {
faceRectInMask = maskData.faceRect;
faceLandmarkPointsInMask = maskData.landmarkPoints;
}
- if (faceRectInMask.width == 0 && faceRectInMask.height == 0) {
- RemoveFaceMask ();
- Debug.LogError ("A face could not be detected from the input image.");
+ if (faceRectInMask.width == 0 && faceRectInMask.height == 0)
+ {
+ RemoveFaceMask();
+ Debug.LogError("A face could not be detected from the input image.");
}
enableColorCorrectionToggle.isOn = maskData.enableColorCorrection;
@@ -777,16 +917,19 @@ namespace FaceMaskExample
*/
/*
- if (maskData.name == "Panda") {
+ if (maskData.name == "Panda")
+ {
UnityEngine.Rect faceRect;
List landmarkPoints;
- CreatePandaMaskData (out faceRect, out landmarkPoints);
- SetFaceMaskData (maskData, faceRect, landmarkPoints);
- }else if (maskData.name == "Anime") {
+ CreatePandaMaskData(out faceRect, out landmarkPoints);
+ SetFaceMaskData(maskData, faceRect, landmarkPoints);
+ }
+ else if (maskData.name == "Anime")
+ {
UnityEngine.Rect faceRect;
List landmarkPoints;
- CreateAnimeMaskData (out faceRect, out landmarkPoints);
- SetFaceMaskData (maskData, faceRect, landmarkPoints);
+ CreateAnimeMaskData(out faceRect, out landmarkPoints);
+ SetFaceMaskData(maskData, faceRect, landmarkPoints);
}
*/
}
@@ -794,249 +937,257 @@ namespace FaceMaskExample
///
/// Raises the remove face mask button click event.
///
- public void OnRemoveFaceMaskButtonClick ()
+ public void OnRemoveFaceMaskButtonClick()
{
- RemoveFaceMask ();
+ RemoveFaceMask();
}
- private void RemoveFaceMask ()
- {
+ private void RemoveFaceMask()
+ {
faceMaskTexture = null;
- if (faceMaskMat != null) {
- faceMaskMat.Dispose ();
+ if (faceMaskMat != null)
+ {
+ faceMaskMat.Dispose();
faceMaskMat = null;
}
- rectangleTracker.Reset ();
- meshOverlay.Reset ();
+ rectangleTracker.Reset();
+ meshOverlay.Reset();
}
- private UnityEngine.Rect DetectFace (Mat mat)
+ private UnityEngine.Rect DetectFace(Mat mat)
{
- if (useDlibFaceDetecter) {
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, mat);
- List result = faceLandmarkDetector.Detect ();
+ if (useDlibFaceDetecter)
+ {
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, mat);
+ List result = faceLandmarkDetector.Detect();
if (result.Count >= 1)
- return result [0];
- } else {
-
- using (Mat grayMat = new Mat ())
- using (Mat equalizeHistMat = new Mat ())
- using (MatOfRect faces = new MatOfRect ()) {
- // convert image to greyscale.
- Imgproc.cvtColor (mat, grayMat, Imgproc.COLOR_RGB2GRAY);
- Imgproc.equalizeHist (grayMat, equalizeHistMat);
-
- cascade.detectMultiScale (equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size (equalizeHistMat.cols () * 0.15, equalizeHistMat.cols () * 0.15), new Size ());
+ return result[0];
+ }
+ else
+ {
- List faceList = faces.toList ();
- if (faceList.Count >= 1) {
- UnityEngine.Rect r = new UnityEngine.Rect (faceList [0].x, faceList [0].y, faceList [0].width, faceList [0].height);
+ using (Mat grayMat = new Mat())
+ using (Mat equalizeHistMat = new Mat())
+ using (MatOfRect faces = new MatOfRect())
+ {
+ // convert image to greyscale.
+ Imgproc.cvtColor(mat, grayMat, Imgproc.COLOR_RGB2GRAY);
+ Imgproc.equalizeHist(grayMat, equalizeHistMat);
+
+ cascade.detectMultiScale(equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size(equalizeHistMat.cols() * 0.15, equalizeHistMat.cols() * 0.15), new Size());
+
+ List faceList = faces.toList();
+ if (faceList.Count >= 1)
+ {
+ UnityEngine.Rect r = new UnityEngine.Rect(faceList[0].x, faceList[0].y, faceList[0].width, faceList[0].height);
// corrects the deviation of a detection result between OpenCV and Dlib.
r.y += (int)(r.height * 0.1f);
return r;
}
}
}
- return new UnityEngine.Rect ();
+ return new UnityEngine.Rect();
}
- private List DetectFaceLandmarkPoints (Mat mat, UnityEngine.Rect rect)
+ private List DetectFaceLandmarkPoints(Mat mat, UnityEngine.Rect rect)
{
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, mat);
- List points = faceLandmarkDetector.DetectLandmark (rect);
-
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, mat);
+ List points = faceLandmarkDetector.DetectLandmark(rect);
+
return points;
}
/*
- private void DumpFaceRect (UnityEngine.Rect faceRect)
+ private void DumpFaceRect(UnityEngine.Rect faceRect)
{
- Debug.Log ("== DumpFaceRect ==");
- Debug.Log ("new Rect(" + faceRect.x + ", " + faceRect.y + ", " + faceRect.width + ", " + faceRect.height + ");");
- Debug.Log ("==================");
+ Debug.Log("== DumpFaceRect ==");
+ Debug.Log("new Rect(" + faceRect.x + ", " + faceRect.y + ", " + faceRect.width + ", " + faceRect.height + ");");
+ Debug.Log("==================");
}
- private void DumpLandMarkPoints (List landmarkPoints)
+ private void DumpLandMarkPoints(List landmarkPoints)
{
- Debug.Log ("== DumpLandMarkPoints ==");
+ Debug.Log("== DumpLandMarkPoints ==");
string str = "";
- for (int i = 0; i < landmarkPoints.Count; i++) {
- str = str + "new Vector2(" + landmarkPoints[i].x + ", " + landmarkPoints[i].y + ")";
- if (i < landmarkPoints.Count - 1) {
+ for (int i = 0; i < landmarkPoints.Count; i++)
+ {
+ str = str + "new Vector2(" + landmarkPoints[i].x + ", " + landmarkPoints[i].y + ")";
+ if (i < landmarkPoints.Count - 1)
+ {
str = str + "," + "\n";
}
}
- Debug.Log (str);
- Debug.Log ("==================");
+ Debug.Log(str);
+ Debug.Log("==================");
}
- private void SetFaceMaskData (FaceMaskData data, UnityEngine.Rect faceRect, List landmarkPoints)
+ private void SetFaceMaskData(FaceMaskData data, UnityEngine.Rect faceRect, List landmarkPoints)
{
data.faceRect = faceRect;
data.landmarkPoints = landmarkPoints;
}
- private void CreatePandaMaskData (out UnityEngine.Rect faceRect, out List landmarkPoints)
+ private void CreatePandaMaskData(out UnityEngine.Rect faceRect, out List landmarkPoints)
{
- faceRect = new UnityEngine.Rect (17, 64, 261, 205);
-
- landmarkPoints = new List () {
- new Vector2 (31, 136),
- new Vector2 (23, 169),
- new Vector2 (26, 195),
- new Vector2 (35, 216),
- new Vector2 (53, 236),
- new Vector2 (71, 251),
- new Vector2 (96, 257),
- new Vector2 (132, 259),
- new Vector2 (143, 263),
- //9
- new Vector2 (165, 258),
- new Vector2 (198, 255),
- new Vector2 (222, 242),
- new Vector2 (235, 231),
- new Vector2 (248, 215),
- new Vector2 (260, 195),
- new Vector2 (272, 171),
- new Vector2 (264, 135),
- //17
- new Vector2 (45, 115),
- new Vector2 (70, 94),
- new Vector2 (97, 89),
- new Vector2 (116, 90),
- new Vector2 (135, 105),
- new Vector2 (157, 104),
- new Vector2 (176, 90),
- new Vector2 (198, 86),
- new Vector2 (223, 90),
- new Vector2 (248, 110),
- //27
- new Vector2 (148, 134),
- new Vector2 (147, 152),
- new Vector2 (145, 174),
- new Vector2 (144, 192),
- new Vector2 (117, 205),
- new Vector2 (128, 213),
- new Vector2 (143, 216),
- new Vector2 (160, 216),
- new Vector2 (174, 206),
- //36
- new Vector2 (96, 138),
- new Vector2 (101, 131),
- new Vector2 (111, 132),
- new Vector2 (114, 140),
- new Vector2 (109, 146),
- new Vector2 (100, 146),
- new Vector2 (180, 138),
- new Vector2 (186, 130),
- new Vector2 (195, 131),
- new Vector2 (199, 137),
- new Vector2 (195, 143),
- new Vector2 (185, 143),
- //48
- new Vector2 (109, 235),
- new Vector2 (118, 231),
- new Vector2 (129, 228),
- new Vector2 (143, 225),
- new Vector2 (156, 227),
- new Vector2 (174, 232),
- new Vector2 (181, 234),
- new Vector2 (173, 241),
- new Vector2 (156, 245),
- new Vector2 (143, 245),
- new Vector2 (130, 244),
- new Vector2 (117, 239),
- new Vector2 (114, 235),
- new Vector2 (130, 232),
- new Vector2 (142, 232),
- new Vector2 (157, 233),
- new Vector2 (175, 236),
- new Vector2 (155, 237),
- new Vector2 (143, 238),
- new Vector2 (130, 237)
+ faceRect = new UnityEngine.Rect(17, 64, 261, 205);
+
+ landmarkPoints = new List() {
+ new Vector2 (31, 136),
+ new Vector2 (23, 169),
+ new Vector2 (26, 195),
+ new Vector2 (35, 216),
+ new Vector2 (53, 236),
+ new Vector2 (71, 251),
+ new Vector2 (96, 257),
+ new Vector2 (132, 259),
+ new Vector2 (143, 263),
+ //9
+ new Vector2 (165, 258),
+ new Vector2 (198, 255),
+ new Vector2 (222, 242),
+ new Vector2 (235, 231),
+ new Vector2 (248, 215),
+ new Vector2 (260, 195),
+ new Vector2 (272, 171),
+ new Vector2 (264, 135),
+ //17
+ new Vector2 (45, 115),
+ new Vector2 (70, 94),
+ new Vector2 (97, 89),
+ new Vector2 (116, 90),
+ new Vector2 (135, 105),
+ new Vector2 (157, 104),
+ new Vector2 (176, 90),
+ new Vector2 (198, 86),
+ new Vector2 (223, 90),
+ new Vector2 (248, 110),
+ //27
+ new Vector2 (148, 134),
+ new Vector2 (147, 152),
+ new Vector2 (145, 174),
+ new Vector2 (144, 192),
+ new Vector2 (117, 205),
+ new Vector2 (128, 213),
+ new Vector2 (143, 216),
+ new Vector2 (160, 216),
+ new Vector2 (174, 206),
+ //36
+ new Vector2 (96, 138),
+ new Vector2 (101, 131),
+ new Vector2 (111, 132),
+ new Vector2 (114, 140),
+ new Vector2 (109, 146),
+ new Vector2 (100, 146),
+ new Vector2 (180, 138),
+ new Vector2 (186, 130),
+ new Vector2 (195, 131),
+ new Vector2 (199, 137),
+ new Vector2 (195, 143),
+ new Vector2 (185, 143),
+ //48
+ new Vector2 (109, 235),
+ new Vector2 (118, 231),
+ new Vector2 (129, 228),
+ new Vector2 (143, 225),
+ new Vector2 (156, 227),
+ new Vector2 (174, 232),
+ new Vector2 (181, 234),
+ new Vector2 (173, 241),
+ new Vector2 (156, 245),
+ new Vector2 (143, 245),
+ new Vector2 (130, 244),
+ new Vector2 (117, 239),
+ new Vector2 (114, 235),
+ new Vector2 (130, 232),
+ new Vector2 (142, 232),
+ new Vector2 (157, 233),
+ new Vector2 (175, 236),
+ new Vector2 (155, 237),
+ new Vector2 (143, 238),
+ new Vector2 (130, 237)
};
}
- private void CreateAnimeMaskData (out UnityEngine.Rect faceRect, out List landmarkPoints)
+ private void CreateAnimeMaskData(out UnityEngine.Rect faceRect, out List landmarkPoints)
{
- faceRect = new UnityEngine.Rect (56, 85, 190, 196);
-
- landmarkPoints = new List () {
- new Vector2(62, 179),
- new Vector2(72, 209),
- new Vector2(75, 223),
- new Vector2(81, 236),
- new Vector2(90, 244),
- new Vector2(101, 251),
- new Vector2(116, 258),
- new Vector2(129, 262),
- new Vector2(142, 268),
- new Vector2(160, 265),
- new Vector2(184, 260),
- new Vector2(202, 253),
- new Vector2(210, 247),
- new Vector2(217, 239),
- new Vector2(222, 229),
- new Vector2(225, 222),
- new Vector2(243, 191),
- //17
- new Vector2(68, 136),
- new Vector2(86, 128),
- new Vector2(104, 126),
- new Vector2(122, 131),
- new Vector2(134, 141),
- new Vector2(177, 143),
- new Vector2(191, 135),
- new Vector2(209, 132),
- new Vector2(227, 136),
- new Vector2(239, 143),
- //27
- new Vector2(153, 163),
- new Vector2(150, 190),
- new Vector2(149, 201),
- new Vector2(148, 212),
- new Vector2(138, 217),
- new Vector2(141, 219),
- new Vector2(149, 221),
- new Vector2(152, 220),
- new Vector2(155, 217),
- //36
- new Vector2(70, 182),
- new Vector2(85, 165),
- new Vector2(114, 168),
- new Vector2(122, 192),
- new Vector2(113, 211),
- new Vector2(82, 209),
- new Vector2(177, 196),
- new Vector2(189, 174),
- new Vector2(220, 175),
- new Vector2(234, 192),
- new Vector2(215, 220),
- new Vector2(184, 217),
- //48
- new Vector2(132, 249),
- new Vector2(134, 249),
- new Vector2(139, 250),
- new Vector2(144, 251),
- new Vector2(148, 251),
- new Vector2(153, 250),
- new Vector2(155, 251),
- new Vector2(154, 253),
- new Vector2(149, 257),
- new Vector2(144, 257),
- new Vector2(138, 256),
- new Vector2(133, 252),
- new Vector2(133, 250),
- new Vector2(139, 252),
- new Vector2(144, 254),
- new Vector2(148, 253),
- new Vector2(153, 251),
- new Vector2(148, 254),
- new Vector2(144, 254),
- new Vector2(139, 253)
+ faceRect = new UnityEngine.Rect(56, 85, 190, 196);
+
+ landmarkPoints = new List() {
+ new Vector2(62, 179),
+ new Vector2(72, 209),
+ new Vector2(75, 223),
+ new Vector2(81, 236),
+ new Vector2(90, 244),
+ new Vector2(101, 251),
+ new Vector2(116, 258),
+ new Vector2(129, 262),
+ new Vector2(142, 268),
+ new Vector2(160, 265),
+ new Vector2(184, 260),
+ new Vector2(202, 253),
+ new Vector2(210, 247),
+ new Vector2(217, 239),
+ new Vector2(222, 229),
+ new Vector2(225, 222),
+ new Vector2(243, 191),
+ //17
+ new Vector2(68, 136),
+ new Vector2(86, 128),
+ new Vector2(104, 126),
+ new Vector2(122, 131),
+ new Vector2(134, 141),
+ new Vector2(177, 143),
+ new Vector2(191, 135),
+ new Vector2(209, 132),
+ new Vector2(227, 136),
+ new Vector2(239, 143),
+ //27
+ new Vector2(153, 163),
+ new Vector2(150, 190),
+ new Vector2(149, 201),
+ new Vector2(148, 212),
+ new Vector2(138, 217),
+ new Vector2(141, 219),
+ new Vector2(149, 221),
+ new Vector2(152, 220),
+ new Vector2(155, 217),
+ //36
+ new Vector2(70, 182),
+ new Vector2(85, 165),
+ new Vector2(114, 168),
+ new Vector2(122, 192),
+ new Vector2(113, 211),
+ new Vector2(82, 209),
+ new Vector2(177, 196),
+ new Vector2(189, 174),
+ new Vector2(220, 175),
+ new Vector2(234, 192),
+ new Vector2(215, 220),
+ new Vector2(184, 217),
+ //48
+ new Vector2(132, 249),
+ new Vector2(134, 249),
+ new Vector2(139, 250),
+ new Vector2(144, 251),
+ new Vector2(148, 251),
+ new Vector2(153, 250),
+ new Vector2(155, 251),
+ new Vector2(154, 253),
+ new Vector2(149, 257),
+ new Vector2(144, 257),
+ new Vector2(138, 256),
+ new Vector2(133, 252),
+ new Vector2(133, 250),
+ new Vector2(139, 252),
+ new Vector2(144, 254),
+ new Vector2(148, 253),
+ new Vector2(153, 251),
+ new Vector2(148, 254),
+ new Vector2(144, 254),
+ new Vector2(139, 253)
};
}
*/
}
-}
\ No newline at end of file
+}
diff --git a/Assets/FaceMaskExample/VideoCaptureFaceMaskExample/VideoCaptureFaceMaskExample.unity b/Assets/FaceMaskExample/VideoCaptureFaceMaskExample/VideoCaptureFaceMaskExample.unity
index 11f4141..78eb1bf 100644
--- a/Assets/FaceMaskExample/VideoCaptureFaceMaskExample/VideoCaptureFaceMaskExample.unity
+++ b/Assets/FaceMaskExample/VideoCaptureFaceMaskExample/VideoCaptureFaceMaskExample.unity
@@ -13,7 +13,7 @@ OcclusionCullingSettings:
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
- serializedVersion: 8
+ serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
@@ -39,6 +39,7 @@ RenderSettings:
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.37311918, g: 0.3807398, b: 0.35872716, a: 1}
+ m_UseRadianceAmbientProbe: 0
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
@@ -49,16 +50,14 @@ LightmapSettings:
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
- m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
- serializedVersion: 9
+ serializedVersion: 10
m_Resolution: 2
m_BakeResolution: 40
- m_TextureWidth: 1024
- m_TextureHeight: 1024
+ m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 0
@@ -88,8 +87,9 @@ LightmapSettings:
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
- m_UseShadowmask: 1
+ m_UseShadowmask: 0
--- !u!196 &5
NavMeshSettings:
serializedVersion: 2
@@ -109,13 +109,17 @@ NavMeshSettings:
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
+ debug:
+ m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &8001311
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100010, guid: 4859e20a6237a7041959573320b6a033, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100010, guid: 4859e20a6237a7041959573320b6a033,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 8001312}
- component: {fileID: 8001316}
@@ -132,9 +136,10 @@ GameObject:
--- !u!224 &8001312
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400010, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 22400010, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8001311}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -142,7 +147,7 @@ RectTransform:
m_Children:
- {fileID: 1153116564}
m_Father: {fileID: 1812831685}
- m_RootOrder: 7
+ m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -152,9 +157,10 @@ RectTransform:
--- !u!114 &8001313
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400016, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 11400016, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8001311}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -172,9 +178,10 @@ MonoBehaviour:
--- !u!114 &8001314
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400018, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 11400018, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8001311}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -220,14 +227,13 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
--- !u!114 &8001315
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400020, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 11400020, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8001311}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -240,8 +246,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -250,19 +254,24 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &8001316
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22200006, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 22200006, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8001311}
+ m_CullTransparentMesh: 0
--- !u!1 &25249900
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 146046, guid: c21bd43bdbf533e4ca465fa4f2d29967, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 146046, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 25249901}
- component: {fileID: 25249902}
@@ -277,9 +286,10 @@ GameObject:
--- !u!224 &25249901
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22424484, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 22424484, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 25249900}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -288,7 +298,7 @@ RectTransform:
- {fileID: 808166794}
- {fileID: 1373151044}
m_Father: {fileID: 1812831685}
- m_RootOrder: 5
+ m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -298,9 +308,10 @@ RectTransform:
--- !u!114 &25249902
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11493928, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 11493928, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 25249900}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -349,15 +360,14 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
m_IsOn: 1
--- !u!114 &25249903
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11483578, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 11483578, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 25249900}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -375,9 +385,11 @@ MonoBehaviour:
--- !u!1 &187294639
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 193088, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 193088, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 187294640}
- component: {fileID: 187294642}
@@ -392,9 +404,10 @@ GameObject:
--- !u!224 &187294640
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22416726, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22416726, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 187294639}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -411,9 +424,10 @@ RectTransform:
--- !u!114 &187294641
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11490212, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11490212, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 187294639}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -426,8 +440,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
@@ -436,19 +448,24 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &187294642
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22214216, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22214216, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 187294639}
+ m_CullTransparentMesh: 0
--- !u!1 &207521930
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 164110, guid: 5e526cad15da56245be9483ddceef720, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 164110, guid: 5e526cad15da56245be9483ddceef720,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 207521934}
- component: {fileID: 207521933}
@@ -463,9 +480,10 @@ GameObject:
--- !u!114 &207521932
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11476814, guid: 5e526cad15da56245be9483ddceef720,
+ m_CorrespondingSourceObject: {fileID: 11476814, guid: 5e526cad15da56245be9483ddceef720,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 207521930}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -482,9 +500,10 @@ MonoBehaviour:
--- !u!114 &207521933
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11425146, guid: 5e526cad15da56245be9483ddceef720,
+ m_CorrespondingSourceObject: {fileID: 11425146, guid: 5e526cad15da56245be9483ddceef720,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 207521930}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -497,8 +516,10 @@ MonoBehaviour:
--- !u!4 &207521934
Transform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 441112, guid: 5e526cad15da56245be9483ddceef720, type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 441112, guid: 5e526cad15da56245be9483ddceef720,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 207521930}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -510,9 +531,10 @@ Transform:
--- !u!1 &269809359
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 269809360}
- component: {fileID: 269809362}
@@ -527,8 +549,9 @@ GameObject:
--- !u!224 &269809360
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 269809359}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -545,8 +568,9 @@ RectTransform:
--- !u!114 &269809361
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 269809359}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -559,8 +583,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
@@ -569,18 +591,23 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &269809362
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 269809359}
+ m_CullTransparentMesh: 0
--- !u!1 &351224343
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 148322, guid: 992a0fbffb00f854aaa75c133aa55357, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 148322, guid: 992a0fbffb00f854aaa75c133aa55357,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 351224344}
- component: {fileID: 351224346}
@@ -595,9 +622,10 @@ GameObject:
--- !u!224 &351224344
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22440504, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 22440504, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 351224343}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -614,9 +642,10 @@ RectTransform:
--- !u!114 &351224345
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11428074, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 11428074, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 351224343}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -629,8 +658,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@@ -648,68 +675,78 @@ MonoBehaviour:
--- !u!222 &351224346
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22230812, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 22230812, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 351224343}
+ m_CullTransparentMesh: 0
--- !u!1001 &390785789
-Prefab:
+PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 871443400}
m_Modifications:
- - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 2}
+ - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 2}
+ - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 2}
+ - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 2}
+ - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 2}
+ - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 2}
+ - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 2}
+ - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 2}
+ - target: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
m_RemovedComponents: []
- m_ParentPrefab: {fileID: 100100000, guid: 87cd6c3c5699198498930c4fc18182ba, type: 2}
- m_IsPrefabParent: 0
+ m_SourcePrefab: {fileID: 100100000, guid: 87cd6c3c5699198498930c4fc18182ba, type: 3}
--- !u!4 &390785790 stripped
Transform:
- m_PrefabParentObject: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba, type: 2}
- m_PrefabInternal: {fileID: 390785789}
+ m_CorrespondingSourceObject: {fileID: 406216, guid: 87cd6c3c5699198498930c4fc18182ba,
+ type: 3}
+ m_PrefabInstance: {fileID: 390785789}
+ m_PrefabAsset: {fileID: 0}
--- !u!114 &390785791 stripped
MonoBehaviour:
- m_PrefabParentObject: {fileID: 11454898, guid: 87cd6c3c5699198498930c4fc18182ba,
- type: 2}
- m_PrefabInternal: {fileID: 390785789}
+ m_CorrespondingSourceObject: {fileID: 11454898, guid: 87cd6c3c5699198498930c4fc18182ba,
+ type: 3}
+ m_PrefabInstance: {fileID: 390785789}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cea3acc41ae7e1498ab5b898cf0043c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1 &397849012
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 397849013}
- component: {fileID: 397849015}
@@ -724,8 +761,9 @@ GameObject:
--- !u!224 &397849013
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 397849012}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -743,8 +781,9 @@ RectTransform:
--- !u!114 &397849014
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 397849012}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -757,8 +796,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -767,18 +804,246 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &397849015
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 397849012}
+ m_CullTransparentMesh: 0
+--- !u!1 &422813483
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 422813484}
+ - component: {fileID: 422813488}
+ - component: {fileID: 422813487}
+ - component: {fileID: 422813486}
+ - component: {fileID: 422813485}
+ m_Layer: 5
+ m_Name: PauseButton
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &422813484
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 422813483}
+ 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: 535048342}
+ m_Father: {fileID: 1043854888}
+ 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: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &422813485
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 422813483}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: 75
+ m_PreferredHeight: 35
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &422813486
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 422813483}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 3
+ 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_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_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 422813487}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 1425214142}
+ m_MethodName: OnPauseButtonClick
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+--- !u!114 &422813487
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 422813483}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 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
+--- !u!222 &422813488
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 422813483}
+ m_CullTransparentMesh: 0
+--- !u!1 &535048341
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 535048342}
+ - component: {fileID: 535048344}
+ - component: {fileID: 535048343}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &535048342
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 535048341}
+ 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: 422813484}
+ 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}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &535048343
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 535048341}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.196, g: 0.196, b: 0.196, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_FontSize: 14
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Pause
+--- !u!222 &535048344
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 535048341}
+ m_CullTransparentMesh: 0
--- !u!1 &568267471
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 141532, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 141532, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 568267472}
- component: {fileID: 568267474}
@@ -793,9 +1058,10 @@ GameObject:
--- !u!224 &568267472
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22431514, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22431514, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 568267471}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -804,7 +1070,7 @@ RectTransform:
- {fileID: 1238226683}
- {fileID: 730251093}
m_Father: {fileID: 1812831685}
- m_RootOrder: 2
+ m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -814,9 +1080,10 @@ RectTransform:
--- !u!114 &568267473
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11496574, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11496574, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 568267471}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -834,9 +1101,10 @@ MonoBehaviour:
--- !u!114 &568267474
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11418090, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11418090, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 568267471}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -885,67 +1153,74 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
m_IsOn: 1
--- !u!1001 &612983666
-Prefab:
+PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 871443400}
m_Modifications:
- - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 2}
+ - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 2}
+ - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 2}
+ - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 2}
+ - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 2}
+ - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 2}
+ - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 2}
+ - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 2}
+ - target: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
- m_ParentPrefab: {fileID: 100100000, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 2}
- m_IsPrefabParent: 0
+ m_SourcePrefab: {fileID: 100100000, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 3}
--- !u!4 &612983667 stripped
Transform:
- m_PrefabParentObject: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e, type: 2}
- m_PrefabInternal: {fileID: 612983666}
+ m_CorrespondingSourceObject: {fileID: 458588, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e,
+ type: 3}
+ m_PrefabInstance: {fileID: 612983666}
+ m_PrefabAsset: {fileID: 0}
--- !u!114 &612983668 stripped
MonoBehaviour:
- m_PrefabParentObject: {fileID: 11428486, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e,
- type: 2}
- m_PrefabInternal: {fileID: 612983666}
+ m_CorrespondingSourceObject: {fileID: 11428486, guid: 5cbfc79db1c11e641bdf1ff74dd73c1e,
+ type: 3}
+ m_PrefabInstance: {fileID: 612983666}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cea3acc41ae7e1498ab5b898cf0043c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1 &679367627
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 171798, guid: c21bd43bdbf533e4ca465fa4f2d29967, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 171798, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 679367630}
- component: {fileID: 679367629}
@@ -960,9 +1235,10 @@ GameObject:
--- !u!114 &679367628
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11416598, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 11416598, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 679367627}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -975,8 +1251,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
@@ -985,19 +1259,23 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &679367629
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22218340, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 22218340, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 679367627}
+ m_CullTransparentMesh: 0
--- !u!224 &679367630
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22491216, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 22491216, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 679367627}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1011,12 +1289,91 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 40, y: 40}
m_Pivot: {x: 0.5, y: 0.5}
+--- !u!1 &716359491
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 716359492}
+ - component: {fileID: 716359494}
+ - component: {fileID: 716359493}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &716359492
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 716359491}
+ 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: 2004093156}
+ 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}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &716359493
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 716359491}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.196, g: 0.196, b: 0.196, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_FontSize: 14
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Play
+--- !u!222 &716359494
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 716359491}
+ m_CullTransparentMesh: 0
--- !u!1 &730251092
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 193076, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 193076, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 730251093}
- component: {fileID: 730251095}
@@ -1031,9 +1388,10 @@ GameObject:
--- !u!224 &730251093
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22458608, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22458608, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 730251092}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1050,9 +1408,10 @@ RectTransform:
--- !u!114 &730251094
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11454552, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11454552, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 730251092}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1065,8 +1424,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@@ -1084,16 +1441,20 @@ MonoBehaviour:
--- !u!222 &730251095
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22293586, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22293586, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 730251092}
+ m_CullTransparentMesh: 0
--- !u!1 &802717303
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 184550, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 184550, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 802717304}
- component: {fileID: 802717306}
@@ -1108,9 +1469,10 @@ GameObject:
--- !u!224 &802717304
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22434094, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22434094, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 802717303}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1128,9 +1490,10 @@ RectTransform:
--- !u!114 &802717305
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11461380, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11461380, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 802717303}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1143,8 +1506,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -1153,19 +1514,24 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &802717306
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22292806, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22292806, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 802717303}
+ m_CullTransparentMesh: 0
--- !u!1 &805668048
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 193088, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 193088, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 805668049}
- component: {fileID: 805668051}
@@ -1180,9 +1546,10 @@ GameObject:
--- !u!224 &805668049
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22416726, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22416726, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 805668048}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1199,9 +1566,10 @@ RectTransform:
--- !u!114 &805668050
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11490212, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11490212, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 805668048}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1214,8 +1582,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
@@ -1224,19 +1590,24 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &805668051
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22214216, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22214216, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 805668048}
+ m_CullTransparentMesh: 0
--- !u!1 &808166793
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 133568, guid: c21bd43bdbf533e4ca465fa4f2d29967, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 133568, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 808166794}
- component: {fileID: 808166796}
@@ -1251,9 +1622,10 @@ GameObject:
--- !u!224 &808166794
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22416560, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 22416560, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 808166793}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1271,9 +1643,10 @@ RectTransform:
--- !u!114 &808166795
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11469484, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 11469484, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 808166793}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1286,8 +1659,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -1296,19 +1667,23 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &808166796
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22256836, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 22256836, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 808166793}
+ m_CullTransparentMesh: 0
--- !u!1 &871443399
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 871443400}
m_Layer: 0
@@ -1321,8 +1696,9 @@ GameObject:
--- !u!4 &871443400
Transform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 871443399}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1339,9 +1715,11 @@ Transform:
--- !u!1 &925105389
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 141532, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 141532, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 925105390}
- component: {fileID: 925105392}
@@ -1356,9 +1734,10 @@ GameObject:
--- !u!224 &925105390
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22431514, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22431514, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 925105389}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1367,7 +1746,7 @@ RectTransform:
- {fileID: 1941661906}
- {fileID: 1543184813}
m_Father: {fileID: 1812831685}
- m_RootOrder: 4
+ m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -1377,9 +1756,10 @@ RectTransform:
--- !u!114 &925105391
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11496574, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11496574, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 925105389}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1397,9 +1777,10 @@ MonoBehaviour:
--- !u!114 &925105392
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11418090, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11418090, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 925105389}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1448,15 +1829,15 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
m_IsOn: 1
--- !u!1 &963740687
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 193076, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 193076, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 963740688}
- component: {fileID: 963740690}
@@ -1471,9 +1852,10 @@ GameObject:
--- !u!224 &963740688
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22458608, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22458608, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963740687}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1490,9 +1872,10 @@ RectTransform:
--- !u!114 &963740689
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11454552, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11454552, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963740687}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1505,8 +1888,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@@ -1524,16 +1905,81 @@ MonoBehaviour:
--- !u!222 &963740690
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22293586, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22293586, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963740687}
+ m_CullTransparentMesh: 0
+--- !u!1 &1043854887
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1043854888}
+ - component: {fileID: 1043854889}
+ m_Layer: 5
+ m_Name: Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1043854888
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1043854887}
+ 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: 2004093156}
+ - {fileID: 422813484}
+ m_Father: {fileID: 1812831685}
+ 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: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1043854889
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1043854887}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -405508275, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Padding:
+ m_Left: 0
+ m_Right: 0
+ m_Top: 0
+ m_Bottom: 0
+ m_ChildAlignment: 0
+ m_Spacing: 10
+ m_ChildForceExpandWidth: 0
+ m_ChildForceExpandHeight: 0
+ m_ChildControlWidth: 1
+ m_ChildControlHeight: 1
--- !u!1 &1056439571
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 193076, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 193076, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1056439572}
- component: {fileID: 1056439574}
@@ -1548,9 +1994,10 @@ GameObject:
--- !u!224 &1056439572
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22458608, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22458608, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1056439571}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1567,9 +2014,10 @@ RectTransform:
--- !u!114 &1056439573
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11454552, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11454552, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1056439571}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1582,8 +2030,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@@ -1601,16 +2047,19 @@ MonoBehaviour:
--- !u!222 &1056439574
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22293586, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22293586, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1056439571}
+ m_CullTransparentMesh: 0
--- !u!1 &1059995316
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1059995321}
- component: {fileID: 1059995320}
@@ -1626,27 +2075,35 @@ GameObject:
--- !u!81 &1059995317
AudioListener:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1059995316}
m_Enabled: 1
--- !u!124 &1059995318
Behaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1059995316}
m_Enabled: 1
--- !u!20 &1059995320
Camera:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1059995316}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
+ m_projectionMatrixMode: 1
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_GateFitMode: 2
+ m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
@@ -1668,16 +2125,17 @@ Camera:
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 1
+ m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
- m_StereoMirrorMode: 0
--- !u!4 &1059995321
Transform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1059995316}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
@@ -1689,9 +2147,10 @@ Transform:
--- !u!1 &1121483422
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1121483425}
- component: {fileID: 1121483424}
@@ -1706,8 +2165,9 @@ GameObject:
--- !u!114 &1121483423
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1121483422}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1720,8 +2180,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@@ -1739,14 +2197,17 @@ MonoBehaviour:
--- !u!222 &1121483424
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1121483422}
+ m_CullTransparentMesh: 0
--- !u!224 &1121483425
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1121483422}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1763,9 +2224,11 @@ RectTransform:
--- !u!1 &1153116563
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100000, guid: 4859e20a6237a7041959573320b6a033, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100000, guid: 4859e20a6237a7041959573320b6a033,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1153116564}
- component: {fileID: 1153116566}
@@ -1780,9 +2243,10 @@ GameObject:
--- !u!224 &1153116564
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400000, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 22400000, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1153116563}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1799,9 +2263,10 @@ RectTransform:
--- !u!114 &1153116565
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400000, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 11400000, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1153116563}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1814,8 +2279,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@@ -1833,16 +2296,20 @@ MonoBehaviour:
--- !u!222 &1153116566
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22200000, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 22200000, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1153116563}
+ m_CullTransparentMesh: 0
--- !u!1 &1189341744
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 141532, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 141532, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1189341745}
- component: {fileID: 1189341747}
@@ -1857,9 +2324,10 @@ GameObject:
--- !u!224 &1189341745
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22431514, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22431514, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1189341744}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1868,7 +2336,7 @@ RectTransform:
- {fileID: 1779281359}
- {fileID: 963740688}
m_Father: {fileID: 1812831685}
- m_RootOrder: 3
+ m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -1878,9 +2346,10 @@ RectTransform:
--- !u!114 &1189341746
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11496574, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11496574, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1189341744}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1898,9 +2367,10 @@ MonoBehaviour:
--- !u!114 &1189341747
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11418090, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11418090, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1189341744}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -1949,15 +2419,15 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
m_IsOn: 1
--- !u!1 &1235527999
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100000, guid: 4859e20a6237a7041959573320b6a033, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100000, guid: 4859e20a6237a7041959573320b6a033,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1235528000}
- component: {fileID: 1235528002}
@@ -1972,9 +2442,10 @@ GameObject:
--- !u!224 &1235528000
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400000, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 22400000, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1235527999}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -1991,9 +2462,10 @@ RectTransform:
--- !u!114 &1235528001
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400000, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 11400000, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1235527999}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2006,8 +2478,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@@ -2025,16 +2495,20 @@ MonoBehaviour:
--- !u!222 &1235528002
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22200000, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 22200000, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1235527999}
+ m_CullTransparentMesh: 0
--- !u!1 &1238226682
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 184550, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 184550, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1238226683}
- component: {fileID: 1238226685}
@@ -2049,9 +2523,10 @@ GameObject:
--- !u!224 &1238226683
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22434094, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22434094, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1238226682}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -2069,9 +2544,10 @@ RectTransform:
--- !u!114 &1238226684
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11461380, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11461380, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1238226682}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2084,8 +2560,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -2094,19 +2568,23 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &1238226685
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22292806, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22292806, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1238226682}
+ m_CullTransparentMesh: 0
--- !u!1 &1306690626
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1306690627}
- component: {fileID: 1306690629}
@@ -2121,8 +2599,9 @@ GameObject:
--- !u!224 &1306690627
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1306690626}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -2131,7 +2610,7 @@ RectTransform:
- {fileID: 397849013}
- {fileID: 1121483425}
m_Father: {fileID: 1812831685}
- m_RootOrder: 1
+ m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -2141,8 +2620,9 @@ RectTransform:
--- !u!114 &1306690628
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1306690626}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2160,8 +2640,9 @@ MonoBehaviour:
--- !u!114 &1306690629
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1306690626}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2210,15 +2691,15 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
m_IsOn: 1
--- !u!1 &1354623055
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 114874, guid: 992a0fbffb00f854aaa75c133aa55357, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 114874, guid: 992a0fbffb00f854aaa75c133aa55357,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1354623059}
- component: {fileID: 1354623058}
@@ -2234,9 +2715,10 @@ GameObject:
--- !u!114 &1354623056
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11405730, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 11405730, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1354623055}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2251,9 +2733,10 @@ MonoBehaviour:
--- !u!114 &1354623057
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11494356, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 11494356, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1354623055}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2273,9 +2756,10 @@ MonoBehaviour:
--- !u!223 &1354623058
Canvas:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22384472, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 22384472, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1354623055}
m_Enabled: 1
serializedVersion: 3
@@ -2294,9 +2778,10 @@ Canvas:
--- !u!224 &1354623059
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22453370, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 22453370, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1354623055}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -2314,9 +2799,11 @@ RectTransform:
--- !u!1 &1373151043
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 142850, guid: c21bd43bdbf533e4ca465fa4f2d29967, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 142850, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1373151044}
- component: {fileID: 1373151046}
@@ -2331,9 +2818,10 @@ GameObject:
--- !u!224 &1373151044
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22429412, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 22429412, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1373151043}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -2350,9 +2838,10 @@ RectTransform:
--- !u!114 &1373151045
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11411684, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 11411684, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1373151043}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2365,8 +2854,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@@ -2384,68 +2871,79 @@ MonoBehaviour:
--- !u!222 &1373151046
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22220250, guid: c21bd43bdbf533e4ca465fa4f2d29967,
+ m_CorrespondingSourceObject: {fileID: 22220250, guid: c21bd43bdbf533e4ca465fa4f2d29967,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1373151043}
+ m_CullTransparentMesh: 0
--- !u!1001 &1377949792
-Prefab:
+PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 871443400}
m_Modifications:
- - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 2}
+ - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 2}
+ - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 2}
+ - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 2}
+ - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 2}
+ - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 2}
+ - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 2}
+ - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 2}
+ - target: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
m_RemovedComponents: []
- m_ParentPrefab: {fileID: 100100000, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 2}
- m_IsPrefabParent: 0
+ m_SourcePrefab: {fileID: 100100000, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 3}
--- !u!4 &1377949793 stripped
Transform:
- m_PrefabParentObject: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30, type: 2}
- m_PrefabInternal: {fileID: 1377949792}
+ m_CorrespondingSourceObject: {fileID: 403126, guid: 7bce755f0fbe79948b5ce92abdd4db30,
+ type: 3}
+ m_PrefabInstance: {fileID: 1377949792}
+ m_PrefabAsset: {fileID: 0}
--- !u!114 &1377949794 stripped
MonoBehaviour:
- m_PrefabParentObject: {fileID: 11496078, guid: 7bce755f0fbe79948b5ce92abdd4db30,
- type: 2}
- m_PrefabInternal: {fileID: 1377949792}
+ m_CorrespondingSourceObject: {fileID: 11496078, guid: 7bce755f0fbe79948b5ce92abdd4db30,
+ type: 3}
+ m_PrefabInstance: {fileID: 1377949792}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cea3acc41ae7e1498ab5b898cf0043c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1 &1414456873
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 100010, guid: 4859e20a6237a7041959573320b6a033, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 100010, guid: 4859e20a6237a7041959573320b6a033,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1414456874}
- component: {fileID: 1414456878}
@@ -2462,9 +2960,10 @@ GameObject:
--- !u!224 &1414456874
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22400010, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 22400010, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1414456873}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -2472,7 +2971,7 @@ RectTransform:
m_Children:
- {fileID: 1235528000}
m_Father: {fileID: 1812831685}
- m_RootOrder: 8
+ m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -2482,9 +2981,10 @@ RectTransform:
--- !u!114 &1414456875
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400016, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 11400016, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1414456873}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2502,9 +3002,10 @@ MonoBehaviour:
--- !u!114 &1414456876
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400018, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 11400018, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1414456873}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2550,14 +3051,13 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
--- !u!114 &1414456877
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11400020, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 11400020, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1414456873}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2570,8 +3070,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -2580,25 +3078,30 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &1414456878
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22200006, guid: 4859e20a6237a7041959573320b6a033,
+ m_CorrespondingSourceObject: {fileID: 22200006, guid: 4859e20a6237a7041959573320b6a033,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1414456873}
+ m_CullTransparentMesh: 0
--- !u!1 &1425214141
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1425214146}
- component: {fileID: 1425214145}
- component: {fileID: 1425214144}
- component: {fileID: 1425214143}
- component: {fileID: 1425214147}
+ - component: {fileID: 1425214149}
- component: {fileID: 1425214142}
- component: {fileID: 1425214148}
m_Layer: 0
@@ -2611,8 +3114,9 @@ GameObject:
--- !u!114 &1425214142
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1425214141}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2641,15 +3145,19 @@ MonoBehaviour:
--- !u!23 &1425214143
MeshRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1425214141}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 15698121b1adac346859c37d6b52726c, type: 2}
m_StaticBatchInfo:
@@ -2662,6 +3170,7 @@ MeshRenderer:
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
@@ -2673,29 +3182,31 @@ MeshRenderer:
--- !u!64 &1425214144
MeshCollider:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1425214141}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
- serializedVersion: 2
+ serializedVersion: 3
m_Convex: 0
- m_InflateMesh: 0
- m_SkinWidth: 0.01
+ m_CookingOptions: 14
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &1425214145
MeshFilter:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1425214141}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1425214146
Transform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1425214141}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -2707,8 +3218,9 @@ Transform:
--- !u!114 &1425214147
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1425214141}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2718,12 +3230,13 @@ MonoBehaviour:
interval: 1
poolSize: 10
_baseObject: {fileID: 1615476950310458, guid: 8b9701cb9064eeb44b641983696a9e94,
- type: 2}
+ type: 3}
--- !u!114 &1425214148
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1425214141}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2738,12 +3251,72 @@ MonoBehaviour:
padding: {x: 8, y: 5}
consoleHeight: 50
consoleText:
+--- !u!114 &1425214149
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1425214141}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: d1cc502785bb1f542879d090531b53bf, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ _requestedVideoFilePath:
+ _outputColorFormat: 1
+ _timeoutFrameCount: 300
+ _loop: 1
+ onInitialized:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 1425214142}
+ m_MethodName: OnVideoCaptureToMatHelperInitialized
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+ onDisposed:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 1425214142}
+ m_MethodName: OnVideoCaptureToMatHelperDisposed
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+ onErrorOccurred:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 1425214142}
+ m_MethodName: OnVideoCaptureToMatHelperErrorOccurred
+ m_Mode: 0
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
--- !u!1 &1461704771
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 193088, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 193088, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1461704772}
- component: {fileID: 1461704774}
@@ -2758,9 +3331,10 @@ GameObject:
--- !u!224 &1461704772
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22416726, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22416726, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1461704771}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -2777,9 +3351,10 @@ RectTransform:
--- !u!114 &1461704773
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11490212, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11490212, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1461704771}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2792,8 +3367,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
@@ -2802,19 +3375,24 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &1461704774
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22214216, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22214216, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1461704771}
+ m_CullTransparentMesh: 0
--- !u!1 &1543184812
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 193076, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 193076, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1543184813}
- component: {fileID: 1543184815}
@@ -2829,9 +3407,10 @@ GameObject:
--- !u!224 &1543184813
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22458608, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22458608, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1543184812}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -2848,9 +3427,10 @@ RectTransform:
--- !u!114 &1543184814
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11454552, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11454552, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1543184812}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2863,8 +3443,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@@ -2882,16 +3460,20 @@ MonoBehaviour:
--- !u!222 &1543184815
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22293586, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22293586, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1543184812}
+ m_CullTransparentMesh: 0
--- !u!1 &1601291230
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 193088, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 193088, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1601291231}
- component: {fileID: 1601291233}
@@ -2906,9 +3488,10 @@ GameObject:
--- !u!224 &1601291231
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22416726, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22416726, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1601291230}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -2925,9 +3508,10 @@ RectTransform:
--- !u!114 &1601291232
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11490212, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11490212, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1601291230}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -2940,8 +3524,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
@@ -2950,71 +3532,83 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &1601291233
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22214216, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22214216, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1601291230}
+ m_CullTransparentMesh: 0
--- !u!1001 &1683251207
-Prefab:
+PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 871443400}
m_Modifications:
- - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 2}
+ - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 2}
+ - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 2}
+ - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 2}
+ - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 2}
+ - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 2}
+ - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 2}
+ - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 2}
+ - target: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
- m_ParentPrefab: {fileID: 100100000, guid: 559ab07359e66dd49b294369acce470b, type: 2}
- m_IsPrefabParent: 0
+ m_SourcePrefab: {fileID: 100100000, guid: 559ab07359e66dd49b294369acce470b, type: 3}
--- !u!4 &1683251208 stripped
Transform:
- m_PrefabParentObject: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b, type: 2}
- m_PrefabInternal: {fileID: 1683251207}
+ m_CorrespondingSourceObject: {fileID: 445690, guid: 559ab07359e66dd49b294369acce470b,
+ type: 3}
+ m_PrefabInstance: {fileID: 1683251207}
+ m_PrefabAsset: {fileID: 0}
--- !u!114 &1683251209 stripped
MonoBehaviour:
- m_PrefabParentObject: {fileID: 11482412, guid: 559ab07359e66dd49b294369acce470b,
- type: 2}
- m_PrefabInternal: {fileID: 1683251207}
+ m_CorrespondingSourceObject: {fileID: 11482412, guid: 559ab07359e66dd49b294369acce470b,
+ type: 3}
+ m_PrefabInstance: {fileID: 1683251207}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cea3acc41ae7e1498ab5b898cf0043c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1 &1779281358
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 184550, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 184550, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1779281359}
- component: {fileID: 1779281361}
@@ -3029,9 +3623,10 @@ GameObject:
--- !u!224 &1779281359
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22434094, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22434094, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1779281358}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -3049,9 +3644,10 @@ RectTransform:
--- !u!114 &1779281360
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11461380, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11461380, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1779281358}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -3064,8 +3660,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -3074,19 +3668,24 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &1779281361
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22292806, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22292806, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1779281358}
+ m_CullTransparentMesh: 0
--- !u!1 &1812831684
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 172042, guid: 992a0fbffb00f854aaa75c133aa55357, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 172042, guid: 992a0fbffb00f854aaa75c133aa55357,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1812831685}
- component: {fileID: 1812831686}
@@ -3100,15 +3699,17 @@ GameObject:
--- !u!224 &1812831685
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22460884, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 22460884, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1812831684}
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: 2136998517}
+ - {fileID: 1043854888}
- {fileID: 1306690627}
- {fileID: 568267472}
- {fileID: 1189341745}
@@ -3128,9 +3729,10 @@ RectTransform:
--- !u!114 &1812831686
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11442566, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 11442566, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1812831684}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -3151,9 +3753,11 @@ MonoBehaviour:
--- !u!1 &1876343103
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 141532, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 141532, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1876343104}
- component: {fileID: 1876343106}
@@ -3168,9 +3772,10 @@ GameObject:
--- !u!224 &1876343104
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22431514, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22431514, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1876343103}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -3179,7 +3784,7 @@ RectTransform:
- {fileID: 802717304}
- {fileID: 1056439572}
m_Father: {fileID: 1812831685}
- m_RootOrder: 6
+ m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -3189,9 +3794,10 @@ RectTransform:
--- !u!114 &1876343105
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11496574, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11496574, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1876343103}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -3209,9 +3815,10 @@ MonoBehaviour:
--- !u!114 &1876343106
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11418090, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11418090, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1876343103}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -3260,67 +3867,74 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
m_IsOn: 1
--- !u!1001 &1924100047
-Prefab:
+PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 871443400}
m_Modifications:
- - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 2}
+ - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 2}
+ - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 2}
+ - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 2}
+ - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 2}
+ - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 2}
+ - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 2}
+ - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 2}
+ - target: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
- m_ParentPrefab: {fileID: 100100000, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 2}
- m_IsPrefabParent: 0
+ m_SourcePrefab: {fileID: 100100000, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 3}
--- !u!4 &1924100048 stripped
Transform:
- m_PrefabParentObject: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d, type: 2}
- m_PrefabInternal: {fileID: 1924100047}
+ m_CorrespondingSourceObject: {fileID: 478316, guid: 56cec6161f5a7cf44a2014b7f955f26d,
+ type: 3}
+ m_PrefabInstance: {fileID: 1924100047}
+ m_PrefabAsset: {fileID: 0}
--- !u!114 &1924100049 stripped
MonoBehaviour:
- m_PrefabParentObject: {fileID: 11443002, guid: 56cec6161f5a7cf44a2014b7f955f26d,
- type: 2}
- m_PrefabInternal: {fileID: 1924100047}
+ m_CorrespondingSourceObject: {fileID: 11443002, guid: 56cec6161f5a7cf44a2014b7f955f26d,
+ type: 3}
+ m_PrefabInstance: {fileID: 1924100047}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cea3acc41ae7e1498ab5b898cf0043c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
--- !u!1 &1941661905
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 184550, guid: ac5655ca450699c45bc16e4a602d622e, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 184550, guid: ac5655ca450699c45bc16e4a602d622e,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 1941661906}
- component: {fileID: 1941661908}
@@ -3335,9 +3949,10 @@ GameObject:
--- !u!224 &1941661906
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22434094, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22434094, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1941661905}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -3355,9 +3970,10 @@ RectTransform:
--- !u!114 &1941661907
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11461380, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 11461380, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1941661905}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -3370,8 +3986,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -3380,19 +3994,170 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &1941661908
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22292806, guid: ac5655ca450699c45bc16e4a602d622e,
+ m_CorrespondingSourceObject: {fileID: 22292806, guid: ac5655ca450699c45bc16e4a602d622e,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1941661905}
+ m_CullTransparentMesh: 0
+--- !u!1 &2004093155
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2004093156}
+ - component: {fileID: 2004093160}
+ - component: {fileID: 2004093159}
+ - component: {fileID: 2004093158}
+ - component: {fileID: 2004093157}
+ m_Layer: 5
+ m_Name: PlayButton
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &2004093156
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2004093155}
+ 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: 716359492}
+ m_Father: {fileID: 1043854888}
+ 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: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &2004093157
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2004093155}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: 75
+ m_PreferredHeight: 35
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &2004093158
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2004093155}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 3
+ 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_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_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 2004093159}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 1425214142}
+ m_MethodName: OnPlayButtonClick
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+--- !u!114 &2004093159
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2004093155}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 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
+--- !u!222 &2004093160
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2004093155}
+ m_CullTransparentMesh: 0
--- !u!1 &2136998516
GameObject:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 148394, guid: 992a0fbffb00f854aaa75c133aa55357, type: 2}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
+ m_CorrespondingSourceObject: {fileID: 148394, guid: 992a0fbffb00f854aaa75c133aa55357,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
m_Component:
- component: {fileID: 2136998517}
- component: {fileID: 2136998521}
@@ -3409,9 +4174,10 @@ GameObject:
--- !u!224 &2136998517
RectTransform:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22486678, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 22486678, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2136998516}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@@ -3429,9 +4195,10 @@ RectTransform:
--- !u!114 &2136998518
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11437790, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 11437790, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2136998516}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -3449,9 +4216,10 @@ MonoBehaviour:
--- !u!114 &2136998519
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11432740, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 11432740, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2136998516}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -3497,14 +4265,13 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
- Culture=neutral, PublicKeyToken=null
--- !u!114 &2136998520
MonoBehaviour:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 11468844, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 11468844, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2136998516}
m_Enabled: 1
m_EditorHideFlags: 0
@@ -3517,8 +4284,6 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
- Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@@ -3527,10 +4292,13 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
+ m_UseSpriteMesh: 0
--- !u!222 &2136998521
CanvasRenderer:
m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 22215542, guid: 992a0fbffb00f854aaa75c133aa55357,
+ m_CorrespondingSourceObject: {fileID: 22215542, guid: 992a0fbffb00f854aaa75c133aa55357,
type: 2}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2136998516}
+ m_CullTransparentMesh: 0
diff --git a/Assets/FaceMaskExample/WebCamTextureFaceMaskAdditionalExample/WebCamTextureFaceMaskAdditionalExample.cs b/Assets/FaceMaskExample/WebCamTextureFaceMaskAdditionalExample/WebCamTextureFaceMaskAdditionalExample.cs
index c276ca7..a016c96 100644
--- a/Assets/FaceMaskExample/WebCamTextureFaceMaskAdditionalExample/WebCamTextureFaceMaskAdditionalExample.cs
+++ b/Assets/FaceMaskExample/WebCamTextureFaceMaskAdditionalExample/WebCamTextureFaceMaskAdditionalExample.cs
@@ -18,10 +18,10 @@ namespace FaceMaskExample
///
/// WebCamTexture FaceMask Additional Example
///
- [RequireComponent (typeof(WebCamTextureToMatHelper), typeof(TrackedMeshOverlay))]
+ [RequireComponent(typeof(WebCamTextureToMatHelper), typeof(TrackedMeshOverlay))]
public class WebCamTextureFaceMaskAdditionalExample : MonoBehaviour
{
- [HeaderAttribute ("Additional FaceMask Option")]
+ [HeaderAttribute("Additional FaceMask Option")]
///
/// Determines if make both eyes transparent.
@@ -38,16 +38,16 @@ namespace FaceMaskExample
///
public bool extendForehead = true;
- [Space (15)]
+ [Space(15)]
- [HeaderAttribute ("FaceMaskData")]
+ [HeaderAttribute("FaceMaskData")]
///
/// The face mask data list.
///
public List faceMaskDatas;
- [HeaderAttribute ("Option")]
+ [HeaderAttribute("Option")]
///
/// Determines if use dlib face detector.
@@ -92,14 +92,14 @@ namespace FaceMaskExample
///
/// The frontal face rate lower limit.
///
- [Range (0.0f, 1.0f)]
+ [Range(0.0f, 1.0f)]
public float frontalFaceRateLowerLimit = 0.85f;
-
+
///
/// Determines if displays face rects.
///
public bool displayFaceRects = false;
-
+
///
/// The toggle for switching face rects display state
///
@@ -114,17 +114,17 @@ namespace FaceMaskExample
/// The toggle for switching debug face points display state.
///
public Toggle displayDebugFacePointsToggle;
-
+
///
/// The gray mat.
///
Mat grayMat;
-
+
///
/// The texture.
///
Texture2D texture;
-
+
///
/// The cascade.
///
@@ -139,7 +139,7 @@ namespace FaceMaskExample
/// The web cam texture to mat helper.
///
WebCamTextureToMatHelper webCamTextureToMatHelper;
-
+
///
/// The face landmark detector.
///
@@ -159,12 +159,12 @@ namespace FaceMaskExample
/// The face mask color corrector.
///
FaceMaskColorCorrector faceMaskColorCorrector;
-
+
///
/// The frontal face checker.
///
FrontalFaceChecker frontalFaceChecker;
-
+
///
/// The mesh overlay.
///
@@ -184,12 +184,12 @@ namespace FaceMaskExample
/// The Shader.PropertyToID for "_LUTTex".
///
int shader_LUTTexID;
-
+
///
/// The face mask texture.
///
Texture2D faceMaskTexture;
-
+
///
/// The face mask mat.
///
@@ -225,28 +225,28 @@ namespace FaceMaskExample
///
FpsMonitor fpsMonitor;
- #if UNITY_WEBGL && !UNITY_EDITOR
+#if UNITY_WEBGL
IEnumerator getFilePath_Coroutine;
- #endif
+#endif
// Use this for initialization
- void Start ()
+ void Start()
{
- fpsMonitor = GetComponent ();
+ fpsMonitor = GetComponent();
- webCamTextureToMatHelper = gameObject.GetComponent ();
+ webCamTextureToMatHelper = gameObject.GetComponent();
- #if UNITY_WEBGL && !UNITY_EDITOR
+#if UNITY_WEBGL
getFilePath_Coroutine = GetFilePath ();
StartCoroutine (getFilePath_Coroutine);
- #else
- haarcascade_frontalface_alt_xml_filepath = OpenCVForUnity.UnityUtils.Utils.getFilePath ("haarcascade_frontalface_alt.xml");
- sp_human_face_68_dat_filepath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath ("sp_human_face_68.dat");
- Run ();
- #endif
+#else
+ haarcascade_frontalface_alt_xml_filepath = OpenCVForUnity.UnityUtils.Utils.getFilePath("haarcascade_frontalface_alt.xml");
+ sp_human_face_68_dat_filepath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("sp_human_face_68.dat");
+ Run();
+#endif
}
- #if UNITY_WEBGL && !UNITY_EDITOR
+#if UNITY_WEBGL
private IEnumerator GetFilePath ()
{
var getFilePathAsync_0_Coroutine = OpenCVForUnity.UnityUtils.Utils.getFilePathAsync ("haarcascade_frontalface_alt.xml", (result) => {
@@ -263,47 +263,44 @@ namespace FaceMaskExample
Run ();
}
- #endif
+#endif
- private void Run ()
+ private void Run()
{
- meshOverlay = this.GetComponent ();
+ meshOverlay = this.GetComponent();
// Customize face mask.
- GameObject newBaseObject = Instantiate (meshOverlay.baseObject);
+ GameObject newBaseObject = Instantiate(meshOverlay.baseObject);
newBaseObject.name = "CustomFaceMaskTrackedMesh";
- TrackedMesh tm = newBaseObject.GetComponent ();
+ TrackedMesh tm = newBaseObject.GetComponent();
- if (extendForehead) {
- ExtendForehead (tm.meshFilter.mesh);
+ if (extendForehead)
+ {
+ ExtendForehead(tm.meshFilter.mesh);
}
- Texture alphaMask = tm.material.GetTexture ("_MaskTex");
+ Texture alphaMask = tm.material.GetTexture("_MaskTex");
Vector2[] uv = tm.meshFilter.sharedMesh.uv2;
- Texture2D newAlphaMask = CreateFaceMaskAlphaMaskTexture (alphaMask.width, alphaMask.height, uv, makeBothEyesTransparent, makeMouthTransparent);
- tm.material.SetTexture ("_MaskTex", newAlphaMask);
+ Texture2D newAlphaMask = CreateFaceMaskAlphaMaskTexture(alphaMask.width, alphaMask.height, uv, makeBothEyesTransparent, makeMouthTransparent);
+ tm.material.SetTexture("_MaskTex", newAlphaMask);
meshOverlay.baseObject = newBaseObject;
- shader_FadeID = Shader.PropertyToID ("_Fade");
- shader_ColorCorrectionID = Shader.PropertyToID ("_ColorCorrection");
- shader_LUTTexID = Shader.PropertyToID ("_LUTTex");
+ shader_FadeID = Shader.PropertyToID("_Fade");
+ shader_ColorCorrectionID = Shader.PropertyToID("_ColorCorrection");
+ shader_LUTTexID = Shader.PropertyToID("_LUTTex");
- rectangleTracker = new RectangleTracker ();
+ rectangleTracker = new RectangleTracker();
- faceLandmarkDetector = new FaceLandmarkDetector (sp_human_face_68_dat_filepath);
+ faceLandmarkDetector = new FaceLandmarkDetector(sp_human_face_68_dat_filepath);
- lowPassFilterDict = new Dictionary ();
- opticalFlowFilterDict = new Dictionary ();
+ lowPassFilterDict = new Dictionary();
+ opticalFlowFilterDict = new Dictionary();
- faceMaskColorCorrector = new FaceMaskColorCorrector ();
+ faceMaskColorCorrector = new FaceMaskColorCorrector();
- #if UNITY_ANDROID && !UNITY_EDITOR
- // Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2).
- webCamTextureToMatHelper.avoidAndroidFrontCameraLowLightIssue = true;
- #endif
- webCamTextureToMatHelper.Initialize ();
+ webCamTextureToMatHelper.Initialize();
displayFaceRectsToggle.isOn = displayFaceRects;
useDlibFaceDetecterToggle.isOn = useDlibFaceDetecter;
@@ -316,22 +313,23 @@ namespace FaceMaskExample
///
/// Raises the web cam texture to mat helper initialized event.
///
- public void OnWebCamTextureToMatHelperInitialized ()
+ public void OnWebCamTextureToMatHelperInitialized()
{
- Debug.Log ("OnWebCamTextureToMatHelperInitialized");
+ Debug.Log("OnWebCamTextureToMatHelperInitialized");
- Mat webCamTextureMat = webCamTextureToMatHelper.GetMat ();
+ Mat webCamTextureMat = webCamTextureToMatHelper.GetMat();
- texture = new Texture2D (webCamTextureMat.cols (), webCamTextureMat.rows (), TextureFormat.RGBA32, false);
+ texture = new Texture2D(webCamTextureMat.cols(), webCamTextureMat.rows(), TextureFormat.RGBA32, false);
- gameObject.transform.localScale = new Vector3 (webCamTextureMat.cols (), webCamTextureMat.rows (), 1);
- Debug.Log ("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
+ gameObject.transform.localScale = new Vector3(webCamTextureMat.cols(), webCamTextureMat.rows(), 1);
+ Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
- if (fpsMonitor != null) {
- fpsMonitor.Add ("width", webCamTextureMat.width ().ToString ());
- fpsMonitor.Add ("height", webCamTextureMat.height ().ToString ());
- fpsMonitor.Add ("orientation", Screen.orientation.ToString ());
+ if (fpsMonitor != null)
+ {
+ fpsMonitor.Add("width", webCamTextureMat.width().ToString());
+ fpsMonitor.Add("height", webCamTextureMat.height().ToString());
+ fpsMonitor.Add("orientation", Screen.orientation.ToString());
}
@@ -340,268 +338,319 @@ namespace FaceMaskExample
float widthScale = (float)Screen.width / width;
float heightScale = (float)Screen.height / height;
- if (widthScale < heightScale) {
+ if (widthScale < heightScale)
+ {
Camera.main.orthographicSize = (width * (float)Screen.height / (float)Screen.width) / 2;
- } else {
+ }
+ else
+ {
Camera.main.orthographicSize = height / 2;
}
- gameObject.GetComponent ().material.mainTexture = texture;
+ gameObject.GetComponent().material.mainTexture = texture;
- grayMat = new Mat (webCamTextureMat.rows (), webCamTextureMat.cols (), CvType.CV_8UC1);
- cascade = new CascadeClassifier (haarcascade_frontalface_alt_xml_filepath);
-// if (cascade.empty ()) {
-// Debug.LogError ("cascade file is not loaded.Please copy from “FaceTrackerExample/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
-// }
+ grayMat = new Mat(webCamTextureMat.rows(), webCamTextureMat.cols(), CvType.CV_8UC1);
+ cascade = new CascadeClassifier(haarcascade_frontalface_alt_xml_filepath);
+ //if (cascade.empty())
+ //{
+ // Debug.LogError("cascade file is not loaded.Please copy from “FaceTrackerExample/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
+ //}
- frontalFaceChecker = new FrontalFaceChecker (width, height);
+ frontalFaceChecker = new FrontalFaceChecker(width, height);
- meshOverlay.UpdateOverlayTransform (gameObject.transform);
+ meshOverlay.UpdateOverlayTransform(gameObject.transform);
- OnChangeFaceMaskButtonClick ();
+ OnChangeFaceMaskButtonClick();
}
///
/// Raises the web cam texture to mat helper disposed event.
///
- public void OnWebCamTextureToMatHelperDisposed ()
+ public void OnWebCamTextureToMatHelperDisposed()
{
- Debug.Log ("OnWebCamTextureToMatHelperDisposed");
+ Debug.Log("OnWebCamTextureToMatHelperDisposed");
- grayMat.Dispose ();
+ grayMat.Dispose();
- if (texture != null) {
- Texture2D.Destroy (texture);
+ if (texture != null)
+ {
+ Texture2D.Destroy(texture);
texture = null;
}
- rectangleTracker.Reset ();
- meshOverlay.Reset ();
+ rectangleTracker.Reset();
+ meshOverlay.Reset();
- foreach (var key in lowPassFilterDict.Keys) {
- lowPassFilterDict [key].Dispose ();
+ foreach (var key in lowPassFilterDict.Keys)
+ {
+ lowPassFilterDict[key].Dispose();
}
- lowPassFilterDict.Clear ();
- foreach (var key in opticalFlowFilterDict.Keys) {
- opticalFlowFilterDict [key].Dispose ();
+ lowPassFilterDict.Clear();
+ foreach (var key in opticalFlowFilterDict.Keys)
+ {
+ opticalFlowFilterDict[key].Dispose();
}
- opticalFlowFilterDict.Clear ();
+ opticalFlowFilterDict.Clear();
- faceMaskColorCorrector.Reset ();
+ faceMaskColorCorrector.Reset();
- frontalFaceChecker.Dispose ();
+ frontalFaceChecker.Dispose();
}
///
/// Raises the web cam texture to mat helper error occurred event.
///
/// Error code.
- public void OnWebCamTextureToMatHelperErrorOccurred (WebCamTextureToMatHelper.ErrorCode errorCode)
+ public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode)
{
- Debug.Log ("OnWebCamTextureToMatHelperErrorOccurred " + errorCode);
+ Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode);
}
// Update is called once per frame
- void Update ()
+ void Update()
{
- if (webCamTextureToMatHelper.IsPlaying () && webCamTextureToMatHelper.DidUpdateThisFrame ()) {
+ if (webCamTextureToMatHelper.IsPlaying() && webCamTextureToMatHelper.DidUpdateThisFrame())
+ {
- Mat rgbaMat = webCamTextureToMatHelper.GetMat ();
+ Mat rgbaMat = webCamTextureToMatHelper.GetMat();
// detect faces.
- List detectResult = new List ();
- if (useDlibFaceDetecter) {
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, rgbaMat);
- List result = faceLandmarkDetector.Detect ();
+ List detectResult = new List();
+ if (useDlibFaceDetecter)
+ {
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, rgbaMat);
+ List result = faceLandmarkDetector.Detect();
- foreach (var unityRect in result) {
- detectResult.Add (new Rect ((int)unityRect.x, (int)unityRect.y, (int)unityRect.width, (int)unityRect.height));
+ foreach (var unityRect in result)
+ {
+ detectResult.Add(new Rect((int)unityRect.x, (int)unityRect.y, (int)unityRect.width, (int)unityRect.height));
}
- } else {
+ }
+ else
+ {
// convert image to greyscale.
- Imgproc.cvtColor (rgbaMat, grayMat, Imgproc.COLOR_RGBA2GRAY);
+ Imgproc.cvtColor(rgbaMat, grayMat, Imgproc.COLOR_RGBA2GRAY);
- using (Mat equalizeHistMat = new Mat ())
- using (MatOfRect faces = new MatOfRect ()) {
- Imgproc.equalizeHist (grayMat, equalizeHistMat);
+ using (Mat equalizeHistMat = new Mat())
+ using (MatOfRect faces = new MatOfRect())
+ {
+ Imgproc.equalizeHist(grayMat, equalizeHistMat);
- cascade.detectMultiScale (equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size (equalizeHistMat.cols () * 0.15, equalizeHistMat.cols () * 0.15), new Size ());
+ cascade.detectMultiScale(equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size(equalizeHistMat.cols() * 0.15, equalizeHistMat.cols() * 0.15), new Size());
- detectResult = faces.toList ();
+ detectResult = faces.toList();
}
// corrects the deviation of a detection result between OpenCV and Dlib.
- foreach (Rect r in detectResult) {
+ foreach (Rect r in detectResult)
+ {
r.y += (int)(r.height * 0.1f);
}
- }
+ }
// face tracking.
- rectangleTracker.UpdateTrackedObjects (detectResult);
- List trackedRects = new List ();
- rectangleTracker.GetObjects (trackedRects, true);
+ rectangleTracker.UpdateTrackedObjects(detectResult);
+ List trackedRects = new List();
+ rectangleTracker.GetObjects(trackedRects, true);
// create noise filter.
- foreach (var openCVRect in trackedRects) {
- if (openCVRect.state == TrackedState.NEW) {
- if (!lowPassFilterDict.ContainsKey (openCVRect.id))
- lowPassFilterDict.Add (openCVRect.id, new LowPassPointsFilter ((int)faceLandmarkDetector.GetShapePredictorNumParts ()));
- if (!opticalFlowFilterDict.ContainsKey (openCVRect.id))
- opticalFlowFilterDict.Add (openCVRect.id, new OFPointsFilter ((int)faceLandmarkDetector.GetShapePredictorNumParts ()));
- } else if (openCVRect.state == TrackedState.DELETED) {
- if (lowPassFilterDict.ContainsKey (openCVRect.id)) {
- lowPassFilterDict [openCVRect.id].Dispose ();
- lowPassFilterDict.Remove (openCVRect.id);
+ foreach (var openCVRect in trackedRects)
+ {
+ if (openCVRect.state == TrackedState.NEW)
+ {
+ if (!lowPassFilterDict.ContainsKey(openCVRect.id))
+ lowPassFilterDict.Add(openCVRect.id, new LowPassPointsFilter((int)faceLandmarkDetector.GetShapePredictorNumParts()));
+ if (!opticalFlowFilterDict.ContainsKey(openCVRect.id))
+ opticalFlowFilterDict.Add(openCVRect.id, new OFPointsFilter((int)faceLandmarkDetector.GetShapePredictorNumParts()));
+ }
+ else if (openCVRect.state == TrackedState.DELETED)
+ {
+ if (lowPassFilterDict.ContainsKey(openCVRect.id))
+ {
+ lowPassFilterDict[openCVRect.id].Dispose();
+ lowPassFilterDict.Remove(openCVRect.id);
}
- if (opticalFlowFilterDict.ContainsKey (openCVRect.id)) {
- opticalFlowFilterDict [openCVRect.id].Dispose ();
- opticalFlowFilterDict.Remove (openCVRect.id);
+ if (opticalFlowFilterDict.ContainsKey(openCVRect.id))
+ {
+ opticalFlowFilterDict[openCVRect.id].Dispose();
+ opticalFlowFilterDict.Remove(openCVRect.id);
}
}
}
// create LUT texture.
- foreach (var openCVRect in trackedRects) {
- if (openCVRect.state == TrackedState.NEW) {
- faceMaskColorCorrector.CreateLUTTex (openCVRect.id);
- } else if (openCVRect.state == TrackedState.DELETED) {
- faceMaskColorCorrector.DeleteLUTTex (openCVRect.id);
+ foreach (var openCVRect in trackedRects)
+ {
+ if (openCVRect.state == TrackedState.NEW)
+ {
+ faceMaskColorCorrector.CreateLUTTex(openCVRect.id);
+ }
+ else if (openCVRect.state == TrackedState.DELETED)
+ {
+ faceMaskColorCorrector.DeleteLUTTex(openCVRect.id);
}
}
// detect face landmark points.
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, rgbaMat);
- List> landmarkPoints = new List> ();
- for (int i = 0; i < trackedRects.Count; i++) {
- TrackedRect tr = trackedRects [i];
- UnityEngine.Rect rect = new UnityEngine.Rect (tr.x, tr.y, tr.width, tr.height);
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, rgbaMat);
+ List> landmarkPoints = new List>();
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ TrackedRect tr = trackedRects[i];
+ UnityEngine.Rect rect = new UnityEngine.Rect(tr.x, tr.y, tr.width, tr.height);
- List points = faceLandmarkDetector.DetectLandmark (rect);
+ List points = faceLandmarkDetector.DetectLandmark(rect);
// apply noise filter.
- if (enableNoiseFilter) {
- if (tr.state > TrackedState.NEW && tr.state < TrackedState.DELETED) {
- opticalFlowFilterDict [tr.id].Process (rgbaMat, points, points);
- lowPassFilterDict [tr.id].Process (rgbaMat, points, points);
+ if (enableNoiseFilter)
+ {
+ if (tr.state > TrackedState.NEW && tr.state < TrackedState.DELETED)
+ {
+ opticalFlowFilterDict[tr.id].Process(rgbaMat, points, points);
+ lowPassFilterDict[tr.id].Process(rgbaMat, points, points);
}
}
- if (extendForehead) {
- AddForeheadPoints (points);
+ if (extendForehead)
+ {
+ AddForeheadPoints(points);
}
- landmarkPoints.Add (points);
+ landmarkPoints.Add(points);
}
// face masking.
- if (faceMaskTexture != null && landmarkPoints.Count >= 1) { // Apply face masking between detected faces and a face mask image.
+ if (faceMaskTexture != null && landmarkPoints.Count >= 1)
+ { // Apply face masking between detected faces and a face mask image.
float maskImageWidth = faceMaskTexture.width;
float maskImageHeight = faceMaskTexture.height;
TrackedRect tr;
- for (int i = 0; i < trackedRects.Count; i++) {
- tr = trackedRects [i];
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ tr = trackedRects[i];
- if (tr.state == TrackedState.NEW) {
- meshOverlay.CreateObject (tr.id, faceMaskTexture);
+ if (tr.state == TrackedState.NEW)
+ {
+ meshOverlay.CreateObject(tr.id, faceMaskTexture);
}
- if (tr.state < TrackedState.DELETED) {
- MaskFace (meshOverlay, tr, landmarkPoints [i], faceLandmarkPointsInMask, maskImageWidth, maskImageHeight);
+ if (tr.state < TrackedState.DELETED)
+ {
+ MaskFace(meshOverlay, tr, landmarkPoints[i], faceLandmarkPointsInMask, maskImageWidth, maskImageHeight);
- if (enableColorCorrection) {
- CorrectFaceMaskColor (tr.id, faceMaskMat, rgbaMat, faceLandmarkPointsInMask, landmarkPoints [i]);
+ if (enableColorCorrection)
+ {
+ CorrectFaceMaskColor(tr.id, faceMaskMat, rgbaMat, faceLandmarkPointsInMask, landmarkPoints[i]);
}
- } else if (tr.state == TrackedState.DELETED) {
- meshOverlay.DeleteObject (tr.id);
+ }
+ else if (tr.state == TrackedState.DELETED)
+ {
+ meshOverlay.DeleteObject(tr.id);
}
}
- } else if (landmarkPoints.Count >= 1) { // Apply face masking between detected faces.
+ }
+ else if (landmarkPoints.Count >= 1)
+ { // Apply face masking between detected faces.
float maskImageWidth = texture.width;
float maskImageHeight = texture.height;
TrackedRect tr;
- for (int i = 0; i < trackedRects.Count; i++) {
- tr = trackedRects [i];
-
- if (tr.state == TrackedState.NEW) {
- meshOverlay.CreateObject (tr.id, texture);
- }
- if (tr.state < TrackedState.DELETED) {
- MaskFace (meshOverlay, tr, landmarkPoints [i], landmarkPoints [0], maskImageWidth, maskImageHeight);
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ tr = trackedRects[i];
- if (enableColorCorrection) {
- CorrectFaceMaskColor (tr.id, rgbaMat, rgbaMat, landmarkPoints [0], landmarkPoints [i]);
+ if (tr.state == TrackedState.NEW)
+ {
+ meshOverlay.CreateObject(tr.id, texture);
+ }
+ if (tr.state < TrackedState.DELETED)
+ {
+ MaskFace(meshOverlay, tr, landmarkPoints[i], landmarkPoints[0], maskImageWidth, maskImageHeight);
+
+ if (enableColorCorrection)
+ {
+ CorrectFaceMaskColor(tr.id, rgbaMat, rgbaMat, landmarkPoints[0], landmarkPoints[i]);
}
- } else if (tr.state == TrackedState.DELETED) {
- meshOverlay.DeleteObject (tr.id);
+ }
+ else if (tr.state == TrackedState.DELETED)
+ {
+ meshOverlay.DeleteObject(tr.id);
}
}
}
// draw face rects.
- if (displayFaceRects) {
- for (int i = 0; i < detectResult.Count; i++) {
- UnityEngine.Rect rect = new UnityEngine.Rect (detectResult [i].x, detectResult [i].y, detectResult [i].width, detectResult [i].height);
- OpenCVForUnityUtils.DrawFaceRect (rgbaMat, rect, new Scalar (255, 0, 0, 255), 2);
+ if (displayFaceRects)
+ {
+ for (int i = 0; i < detectResult.Count; i++)
+ {
+ UnityEngine.Rect rect = new UnityEngine.Rect(detectResult[i].x, detectResult[i].y, detectResult[i].width, detectResult[i].height);
+ OpenCVForUnityUtils.DrawFaceRect(rgbaMat, rect, new Scalar(255, 0, 0, 255), 2);
}
- for (int i = 0; i < trackedRects.Count; i++) {
- UnityEngine.Rect rect = new UnityEngine.Rect (trackedRects [i].x, trackedRects [i].y, trackedRects [i].width, trackedRects [i].height);
- OpenCVForUnityUtils.DrawFaceRect (rgbaMat, rect, new Scalar (255, 255, 0, 255), 2);
-// Imgproc.putText (rgbaMat, " " + frontalFaceChecker.GetFrontalFaceAngles (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
-// Imgproc.putText (rgbaMat, " " + frontalFaceChecker.GetFrontalFaceRate (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ UnityEngine.Rect rect = new UnityEngine.Rect(trackedRects[i].x, trackedRects[i].y, trackedRects[i].width, trackedRects[i].height);
+ OpenCVForUnityUtils.DrawFaceRect(rgbaMat, rect, new Scalar(255, 255, 0, 255), 2);
+ //Imgproc.putText (rgbaMat, " " + frontalFaceChecker.GetFrontalFaceAngles (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
+ //Imgproc.putText (rgbaMat, " " + frontalFaceChecker.GetFrontalFaceRate (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
}
}
// draw face points.
- if (displayDebugFacePoints) {
- for (int i = 0; i < landmarkPoints.Count; i++) {
- DrawFaceLandmark (rgbaMat, landmarkPoints [i], new Scalar (0, 255, 0, 255), 2);
+ if (displayDebugFacePoints)
+ {
+ for (int i = 0; i < landmarkPoints.Count; i++)
+ {
+ DrawFaceLandmark(rgbaMat, landmarkPoints[i], new Scalar(0, 255, 0, 255), 2);
}
}
// display face mask image.
- if (faceMaskTexture != null && faceMaskMat != null) {
+ if (faceMaskTexture != null && faceMaskMat != null)
+ {
- if (displayFaceRects) {
- OpenCVForUnityUtils.DrawFaceRect (faceMaskMat, faceRectInMask, new Scalar (255, 0, 0, 255), 2);
+ if (displayFaceRects)
+ {
+ OpenCVForUnityUtils.DrawFaceRect(faceMaskMat, faceRectInMask, new Scalar(255, 0, 0, 255), 2);
}
- if (displayDebugFacePoints) {
- DrawFaceLandmark (faceMaskMat, faceLandmarkPointsInMask, new Scalar (0, 255, 0, 255), 2);
+ if (displayDebugFacePoints)
+ {
+ DrawFaceLandmark(faceMaskMat, faceLandmarkPointsInMask, new Scalar(0, 255, 0, 255), 2);
}
- float scale = (rgbaMat.width () / 4f) / faceMaskMat.width ();
- float tx = rgbaMat.width () - faceMaskMat.width () * scale;
+ float scale = (rgbaMat.width() / 4f) / faceMaskMat.width();
+ float tx = rgbaMat.width() - faceMaskMat.width() * scale;
float ty = 0.0f;
- Mat trans = new Mat (2, 3, CvType.CV_32F);//1.0, 0.0, tx, 0.0, 1.0, ty);
- trans.put (0, 0, scale);
- trans.put (0, 1, 0.0f);
- trans.put (0, 2, tx);
- trans.put (1, 0, 0.0f);
- trans.put (1, 1, scale);
- trans.put (1, 2, ty);
-
- Imgproc.warpAffine (faceMaskMat, rgbaMat, trans, rgbaMat.size (), Imgproc.INTER_LINEAR, Core.BORDER_TRANSPARENT, new Scalar (0));
+ Mat trans = new Mat(2, 3, CvType.CV_32F);//1.0, 0.0, tx, 0.0, 1.0, ty);
+ trans.put(0, 0, scale);
+ trans.put(0, 1, 0.0f);
+ trans.put(0, 2, tx);
+ trans.put(1, 0, 0.0f);
+ trans.put(1, 1, scale);
+ trans.put(1, 2, ty);
+
+ Imgproc.warpAffine(faceMaskMat, rgbaMat, trans, rgbaMat.size(), Imgproc.INTER_LINEAR, Core.BORDER_TRANSPARENT, new Scalar(0));
if (displayFaceRects || displayDebugFacePointsToggle)
- OpenCVForUnity.UnityUtils.Utils.texture2DToMat (faceMaskTexture, faceMaskMat);
+ OpenCVForUnity.UnityUtils.Utils.texture2DToMat(faceMaskTexture, faceMaskMat);
}
-// Imgproc.putText (rgbaMat, "W:" + rgbaMat.width () + " H:" + rgbaMat.height () + " SO:" + Screen.orientation, new Point (5, rgbaMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
+ //Imgproc.putText (rgbaMat, "W:" + rgbaMat.width () + " H:" + rgbaMat.height () + " SO:" + Screen.orientation, new Point (5, rgbaMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
- OpenCVForUnity.UnityUtils.Utils.fastMatToTexture2D (rgbaMat, texture);
+ OpenCVForUnity.UnityUtils.Utils.fastMatToTexture2D(rgbaMat, texture);
}
}
- private void MaskFace (TrackedMeshOverlay meshOverlay, TrackedRect tr, List landmarkPoints, List landmarkPointsInMaskImage, float maskImageWidth = 0, float maskImageHeight = 0)
+ private void MaskFace(TrackedMeshOverlay meshOverlay, TrackedRect tr, List landmarkPoints, List landmarkPointsInMaskImage, float maskImageWidth = 0, float maskImageHeight = 0)
{
float imageWidth = meshOverlay.width;
- float imageHeight = meshOverlay.height;
+ float imageHeight = meshOverlay.height;
if (maskImageWidth == 0)
maskImageWidth = imageWidth;
@@ -609,127 +658,146 @@ namespace FaceMaskExample
if (maskImageHeight == 0)
maskImageHeight = imageHeight;
- TrackedMesh tm = meshOverlay.GetObjectById (tr.id);
+ TrackedMesh tm = meshOverlay.GetObjectById(tr.id);
Vector3[] vertices = tm.meshFilter.mesh.vertices;
- if (vertices.Length == landmarkPoints.Count) {
- for (int j = 0; j < vertices.Length; j++) {
- vertices [j].x = landmarkPoints [j].x / imageWidth - 0.5f;
- vertices [j].y = 0.5f - landmarkPoints [j].y / imageHeight;
+ if (vertices.Length == landmarkPoints.Count)
+ {
+ for (int j = 0; j < vertices.Length; j++)
+ {
+ vertices[j].x = landmarkPoints[j].x / imageWidth - 0.5f;
+ vertices[j].y = 0.5f - landmarkPoints[j].y / imageHeight;
}
}
Vector2[] uv = tm.meshFilter.mesh.uv;
- if (uv.Length == landmarkPointsInMaskImage.Count) {
- for (int jj = 0; jj < uv.Length; jj++) {
- uv [jj].x = landmarkPointsInMaskImage [jj].x / maskImageWidth;
- uv [jj].y = (maskImageHeight - landmarkPointsInMaskImage [jj].y) / maskImageHeight;
+ if (uv.Length == landmarkPointsInMaskImage.Count)
+ {
+ for (int jj = 0; jj < uv.Length; jj++)
+ {
+ uv[jj].x = landmarkPointsInMaskImage[jj].x / maskImageWidth;
+ uv[jj].y = (maskImageHeight - landmarkPointsInMaskImage[jj].y) / maskImageHeight;
}
}
- meshOverlay.UpdateObject (tr.id, vertices, null, uv);
+ meshOverlay.UpdateObject(tr.id, vertices, null, uv);
- if (tr.numFramesNotDetected > 3) {
- tm.sharedMaterial.SetFloat (shader_FadeID, 1f);
- } else if (tr.numFramesNotDetected > 0 && tr.numFramesNotDetected <= 3) {
- tm.sharedMaterial.SetFloat (shader_FadeID, 0.3f + (0.7f / 4f) * tr.numFramesNotDetected);
- } else {
- tm.sharedMaterial.SetFloat (shader_FadeID, 0.3f);
+ if (tr.numFramesNotDetected > 3)
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 1f);
+ }
+ else if (tr.numFramesNotDetected > 0 && tr.numFramesNotDetected <= 3)
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 0.3f + (0.7f / 4f) * tr.numFramesNotDetected);
+ }
+ else
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 0.3f);
}
- if (enableColorCorrection) {
- tm.sharedMaterial.SetFloat (shader_ColorCorrectionID, 1f);
- } else {
- tm.sharedMaterial.SetFloat (shader_ColorCorrectionID, 0f);
+ if (enableColorCorrection)
+ {
+ tm.sharedMaterial.SetFloat(shader_ColorCorrectionID, 1f);
}
-
+ else
+ {
+ tm.sharedMaterial.SetFloat(shader_ColorCorrectionID, 0f);
+ }
+
// filter non frontal faces.
- if (filterNonFrontalFaces && frontalFaceChecker.GetFrontalFaceRate (landmarkPoints) < frontalFaceRateLowerLimit) {
- tm.sharedMaterial.SetFloat (shader_FadeID, 1f);
+ if (filterNonFrontalFaces && frontalFaceChecker.GetFrontalFaceRate(landmarkPoints) < frontalFaceRateLowerLimit)
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 1f);
}
}
- private void CorrectFaceMaskColor (int id, Mat src, Mat dst, List src_landmarkPoints, List dst_landmarkPoints)
+ private void CorrectFaceMaskColor(int id, Mat src, Mat dst, List src_landmarkPoints, List dst_landmarkPoints)
{
- Texture2D LUTTex = faceMaskColorCorrector.UpdateLUTTex (id, src, dst, src_landmarkPoints, dst_landmarkPoints);
- TrackedMesh tm = meshOverlay.GetObjectById (id);
- tm.sharedMaterial.SetTexture (shader_LUTTexID, LUTTex);
+ Texture2D LUTTex = faceMaskColorCorrector.UpdateLUTTex(id, src, dst, src_landmarkPoints, dst_landmarkPoints);
+ TrackedMesh tm = meshOverlay.GetObjectById(id);
+ tm.sharedMaterial.SetTexture(shader_LUTTexID, LUTTex);
}
///
/// Raises the destroy event.
///
- void OnDestroy ()
+ void OnDestroy()
{
- webCamTextureToMatHelper.Dispose ();
+ if (webCamTextureToMatHelper != null)
+ webCamTextureToMatHelper.Dispose();
if (cascade != null)
- cascade.Dispose ();
+ cascade.Dispose();
if (rectangleTracker != null)
- rectangleTracker.Dispose ();
+ rectangleTracker.Dispose();
if (faceLandmarkDetector != null)
- faceLandmarkDetector.Dispose ();
+ faceLandmarkDetector.Dispose();
- foreach (var key in lowPassFilterDict.Keys) {
- lowPassFilterDict [key].Dispose ();
+ foreach (var key in lowPassFilterDict.Keys)
+ {
+ lowPassFilterDict[key].Dispose();
}
- lowPassFilterDict.Clear ();
- foreach (var key in opticalFlowFilterDict.Keys) {
- opticalFlowFilterDict [key].Dispose ();
+ lowPassFilterDict.Clear();
+ foreach (var key in opticalFlowFilterDict.Keys)
+ {
+ opticalFlowFilterDict[key].Dispose();
}
- opticalFlowFilterDict.Clear ();
+ opticalFlowFilterDict.Clear();
if (faceMaskColorCorrector != null)
- faceMaskColorCorrector.Dispose ();
+ faceMaskColorCorrector.Dispose();
- #if UNITY_WEBGL && !UNITY_EDITOR
+#if UNITY_WEBGL
if (getFilePath_Coroutine != null) {
StopCoroutine (getFilePath_Coroutine);
((IDisposable)getFilePath_Coroutine).Dispose ();
}
- #endif
+#endif
}
///
/// Raises the back button click event.
///
- public void OnBackButtonClick ()
+ public void OnBackButtonClick()
{
- SceneManager.LoadScene ("FaceMaskExample");
+ SceneManager.LoadScene("FaceMaskExample");
}
///
/// Raises the play button click event.
///
- public void OnPlayButtonClick ()
+ public void OnPlayButtonClick()
{
- webCamTextureToMatHelper.Play ();
+ webCamTextureToMatHelper.Play();
}
///
/// Raises the pause button click event.
///
- public void OnPauseButtonClick ()
+ public void OnPauseButtonClick()
{
- webCamTextureToMatHelper.Pause ();
+ webCamTextureToMatHelper.Pause();
}
///
/// Raises the change camera button click event.
///
- public void OnChangeCameraButtonClick ()
+ public void OnChangeCameraButtonClick()
{
- webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.IsFrontFacing ();
+ webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.IsFrontFacing();
}
///
/// Raises the use Dlib face detector toggle value changed event.
///
- public void OnUseDlibFaceDetecterToggleValueChanged ()
+ public void OnUseDlibFaceDetecterToggleValueChanged()
{
- if (useDlibFaceDetecterToggle.isOn) {
+ if (useDlibFaceDetecterToggle.isOn)
+ {
useDlibFaceDetecter = true;
- } else {
+ }
+ else
+ {
useDlibFaceDetecter = false;
}
}
@@ -737,17 +805,22 @@ namespace FaceMaskExample
///
/// Raises the enable noise filter toggle value changed event.
///
- public void OnEnableNoiseFilterToggleValueChanged ()
+ public void OnEnableNoiseFilterToggleValueChanged()
{
- if (enableNoiseFilterToggle.isOn) {
+ if (enableNoiseFilterToggle.isOn)
+ {
enableNoiseFilter = true;
- foreach (var key in lowPassFilterDict.Keys) {
- lowPassFilterDict [key].Reset ();
+ foreach (var key in lowPassFilterDict.Keys)
+ {
+ lowPassFilterDict[key].Reset();
}
- foreach (var key in opticalFlowFilterDict.Keys) {
- opticalFlowFilterDict [key].Reset ();
+ foreach (var key in opticalFlowFilterDict.Keys)
+ {
+ opticalFlowFilterDict[key].Reset();
}
- } else {
+ }
+ else
+ {
enableNoiseFilter = false;
}
}
@@ -755,11 +828,14 @@ namespace FaceMaskExample
///
/// Raises the enable color correction toggle value changed event.
///
- public void OnEnableColorCorrectionToggleValueChanged ()
+ public void OnEnableColorCorrectionToggleValueChanged()
{
- if (enableColorCorrectionToggle.isOn) {
+ if (enableColorCorrectionToggle.isOn)
+ {
enableColorCorrection = true;
- } else {
+ }
+ else
+ {
enableColorCorrection = false;
}
}
@@ -767,11 +843,14 @@ namespace FaceMaskExample
///
/// Raises the filter non frontal faces toggle value changed event.
///
- public void OnFilterNonFrontalFacesToggleValueChanged ()
+ public void OnFilterNonFrontalFacesToggleValueChanged()
{
- if (filterNonFrontalFacesToggle.isOn) {
+ if (filterNonFrontalFacesToggle.isOn)
+ {
filterNonFrontalFaces = true;
- } else {
+ }
+ else
+ {
filterNonFrontalFaces = false;
}
}
@@ -779,11 +858,14 @@ namespace FaceMaskExample
///
/// Raises the display face rects toggle value changed event.
///
- public void OnDisplayFaceRectsToggleValueChanged ()
+ public void OnDisplayFaceRectsToggleValueChanged()
{
- if (displayFaceRectsToggle.isOn) {
+ if (displayFaceRectsToggle.isOn)
+ {
displayFaceRects = true;
- } else {
+ }
+ else
+ {
displayFaceRects = false;
}
}
@@ -791,11 +873,14 @@ namespace FaceMaskExample
///
/// Raises the display debug face points toggle value changed event.
///
- public void OnDisplayDebugFacePointsToggleValueChanged ()
+ public void OnDisplayDebugFacePointsToggleValueChanged()
{
- if (displayDebugFacePointsToggle.isOn) {
+ if (displayDebugFacePointsToggle.isOn)
+ {
displayDebugFacePoints = true;
- } else {
+ }
+ else
+ {
displayDebugFacePoints = false;
}
}
@@ -803,55 +888,63 @@ namespace FaceMaskExample
///
/// Raises the change face mask button click event.
///
- public void OnChangeFaceMaskButtonClick ()
+ public void OnChangeFaceMaskButtonClick()
{
- RemoveFaceMask ();
+ RemoveFaceMask();
if (faceMaskDatas.Count == 0)
return;
- FaceMaskData maskData = faceMaskDatas [faceMaskDataIndex];
+ FaceMaskData maskData = faceMaskDatas[faceMaskDataIndex];
faceMaskDataIndex = (faceMaskDataIndex < faceMaskDatas.Count - 1) ? faceMaskDataIndex + 1 : 0;
- if (maskData == null) {
- Debug.LogError ("maskData == null");
+ if (maskData == null)
+ {
+ Debug.LogError("maskData == null");
return;
}
- if (maskData.image == null) {
- Debug.LogError ("image == null");
+ if (maskData.image == null)
+ {
+ Debug.LogError("image == null");
return;
}
- if (maskData.landmarkPoints.Count != 68) {
- Debug.LogError ("landmarkPoints.Count != 68");
+ if (maskData.landmarkPoints.Count != 68)
+ {
+ Debug.LogError("landmarkPoints.Count != 68");
return;
}
faceMaskTexture = maskData.image;
- faceMaskMat = new Mat (faceMaskTexture.height, faceMaskTexture.width, CvType.CV_8UC4);
- OpenCVForUnity.UnityUtils.Utils.texture2DToMat (faceMaskTexture, faceMaskMat);
+ faceMaskMat = new Mat(faceMaskTexture.height, faceMaskTexture.width, CvType.CV_8UC4);
+ OpenCVForUnity.UnityUtils.Utils.texture2DToMat(faceMaskTexture, faceMaskMat);
- if (maskData.isDynamicMode) {
- faceRectInMask = DetectFace (faceMaskMat);
- faceLandmarkPointsInMask = DetectFaceLandmarkPoints (faceMaskMat, faceRectInMask);
+ if (maskData.isDynamicMode)
+ {
+ faceRectInMask = DetectFace(faceMaskMat);
+ faceLandmarkPointsInMask = DetectFaceLandmarkPoints(faceMaskMat, faceRectInMask);
maskData.faceRect = faceRectInMask;
maskData.landmarkPoints = faceLandmarkPointsInMask;
- } else {
+ }
+ else
+ {
faceRectInMask = maskData.faceRect;
faceLandmarkPointsInMask = maskData.landmarkPoints;
}
- if (extendForehead) {
- List newLandmarkPointsInMask = new List (faceLandmarkPointsInMask);
- AddForeheadPoints (newLandmarkPointsInMask);
+ if (extendForehead)
+ {
+ List newLandmarkPointsInMask = new List(faceLandmarkPointsInMask);
+ AddForeheadPoints(newLandmarkPointsInMask);
faceLandmarkPointsInMask = newLandmarkPointsInMask;
}
- if (faceRectInMask.width == 0 && faceRectInMask.height == 0) {
- RemoveFaceMask ();
- Debug.LogError ("A face could not be detected from the input image.");
+ if (faceRectInMask.width == 0 && faceRectInMask.height == 0)
+ {
+ RemoveFaceMask();
+ Debug.LogError("A face could not be detected from the input image.");
}
enableColorCorrectionToggle.isOn = maskData.enableColorCorrection;
@@ -860,40 +953,44 @@ namespace FaceMaskExample
///
/// Raises the scan face mask button click event.
///
- public void OnScanFaceMaskButtonClick ()
+ public void OnScanFaceMaskButtonClick()
{
- RemoveFaceMask ();
+ RemoveFaceMask();
// Capture webcam frame.
- if (webCamTextureToMatHelper.IsPlaying ()) {
+ if (webCamTextureToMatHelper.IsPlaying())
+ {
- Mat rgbaMat = webCamTextureToMatHelper.GetMat ();
+ Mat rgbaMat = webCamTextureToMatHelper.GetMat();
- faceRectInMask = DetectFace (rgbaMat);
- if (faceRectInMask.width == 0 && faceRectInMask.height == 0) {
- Debug.Log ("A face could not be detected from the input image.");
+ faceRectInMask = DetectFace(rgbaMat);
+ if (faceRectInMask.width == 0 && faceRectInMask.height == 0)
+ {
+ Debug.Log("A face could not be detected from the input image.");
return;
}
- Rect rect = new Rect ((int)faceRectInMask.x, (int)faceRectInMask.y, (int)faceRectInMask.width, (int)faceRectInMask.height);
- rect.inflate (rect.x / 5, rect.y / 5);
- rect = rect.intersect (new Rect (0, 0, rgbaMat.width (), rgbaMat.height ()));
+ Rect rect = new Rect((int)faceRectInMask.x, (int)faceRectInMask.y, (int)faceRectInMask.width, (int)faceRectInMask.height);
+ rect.inflate(rect.x / 5, rect.y / 5);
+ rect = rect.intersect(new Rect(0, 0, rgbaMat.width(), rgbaMat.height()));
- faceMaskTexture = new Texture2D (rect.width, rect.height, TextureFormat.RGBA32, false);
- faceMaskMat = new Mat (rgbaMat, rect).clone ();
- OpenCVForUnity.UnityUtils.Utils.matToTexture2D (faceMaskMat, faceMaskTexture);
- Debug.Log ("faceMaskMat ToString " + faceMaskMat.ToString ());
+ faceMaskTexture = new Texture2D(rect.width, rect.height, TextureFormat.RGBA32, false);
+ faceMaskMat = new Mat(rgbaMat, rect).clone();
+ OpenCVForUnity.UnityUtils.Utils.matToTexture2D(faceMaskMat, faceMaskTexture);
+ Debug.Log("faceMaskMat ToString " + faceMaskMat.ToString());
- faceRectInMask = DetectFace (faceMaskMat);
- faceLandmarkPointsInMask = DetectFaceLandmarkPoints (faceMaskMat, faceRectInMask);
+ faceRectInMask = DetectFace(faceMaskMat);
+ faceLandmarkPointsInMask = DetectFaceLandmarkPoints(faceMaskMat, faceRectInMask);
- if (extendForehead) {
- AddForeheadPoints (faceLandmarkPointsInMask);
+ if (extendForehead)
+ {
+ AddForeheadPoints(faceLandmarkPointsInMask);
}
- if (faceRectInMask.width == 0 && faceRectInMask.height == 0) {
- RemoveFaceMask ();
- Debug.Log ("A face could not be detected from the input image.");
+ if (faceRectInMask.width == 0 && faceRectInMask.height == 0)
+ {
+ RemoveFaceMask();
+ Debug.Log("A face could not be detected from the input image.");
}
}
}
@@ -901,76 +998,84 @@ namespace FaceMaskExample
///
/// Raises the remove face mask button click event.
///
- public void OnRemoveFaceMaskButtonClick ()
+ public void OnRemoveFaceMaskButtonClick()
{
- RemoveFaceMask ();
+ RemoveFaceMask();
}
- private void RemoveFaceMask ()
+ private void RemoveFaceMask()
{
faceMaskTexture = null;
- if (faceMaskMat != null) {
- faceMaskMat.Dispose ();
+ if (faceMaskMat != null)
+ {
+ faceMaskMat.Dispose();
faceMaskMat = null;
}
- rectangleTracker.Reset ();
- meshOverlay.Reset ();
+ rectangleTracker.Reset();
+ meshOverlay.Reset();
}
- private UnityEngine.Rect DetectFace (Mat mat)
+ private UnityEngine.Rect DetectFace(Mat mat)
{
- if (useDlibFaceDetecter) {
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, mat);
- List result = faceLandmarkDetector.Detect ();
+ if (useDlibFaceDetecter)
+ {
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, mat);
+ List result = faceLandmarkDetector.Detect();
if (result.Count >= 1)
- return result [0];
- } else {
-
- using (Mat grayMat = new Mat ())
- using (Mat equalizeHistMat = new Mat ())
- using (MatOfRect faces = new MatOfRect ()) {
- // convert image to greyscale.
- Imgproc.cvtColor (mat, grayMat, Imgproc.COLOR_RGBA2GRAY);
- Imgproc.equalizeHist (grayMat, equalizeHistMat);
-
- cascade.detectMultiScale (equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size (equalizeHistMat.cols () * 0.15, equalizeHistMat.cols () * 0.15), new Size ());
+ return result[0];
+ }
+ else
+ {
- List faceList = faces.toList ();
- if (faceList.Count >= 1) {
- UnityEngine.Rect r = new UnityEngine.Rect (faceList [0].x, faceList [0].y, faceList [0].width, faceList [0].height);
+ using (Mat grayMat = new Mat())
+ using (Mat equalizeHistMat = new Mat())
+ using (MatOfRect faces = new MatOfRect())
+ {
+ // convert image to greyscale.
+ Imgproc.cvtColor(mat, grayMat, Imgproc.COLOR_RGBA2GRAY);
+ Imgproc.equalizeHist(grayMat, equalizeHistMat);
+
+ cascade.detectMultiScale(equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size(equalizeHistMat.cols() * 0.15, equalizeHistMat.cols() * 0.15), new Size());
+
+ List faceList = faces.toList();
+ if (faceList.Count >= 1)
+ {
+ UnityEngine.Rect r = new UnityEngine.Rect(faceList[0].x, faceList[0].y, faceList[0].width, faceList[0].height);
// corrects the deviation of a detection result between OpenCV and Dlib.
r.y += (int)(r.height * 0.1f);
return r;
}
}
}
- return new UnityEngine.Rect ();
+ return new UnityEngine.Rect();
}
- private List DetectFaceLandmarkPoints (Mat mat, UnityEngine.Rect rect)
+ private List DetectFaceLandmarkPoints(Mat mat, UnityEngine.Rect rect)
{
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, mat);
- List points = faceLandmarkDetector.DetectLandmark (rect);
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, mat);
+ List points = faceLandmarkDetector.DetectLandmark(rect);
return points;
}
- private void ExtendForehead (Mesh mesh)
+ private void ExtendForehead(Mesh mesh)
{
if (mesh.vertices.Length != 68)
- throw new ArgumentException ("Invalid face mask mesh", "mesh");
+ throw new ArgumentException("Invalid face mask mesh", "mesh");
- List verticesList = new List (mesh.vertices.Length);
- foreach (Vector3 v in mesh.vertices) {
- verticesList.Add (new Vector2 (v.x, v.y));
+ List verticesList = new List(mesh.vertices.Length);
+ foreach (Vector3 v in mesh.vertices)
+ {
+ verticesList.Add(new Vector2(v.x, v.y));
}
- AddForeheadPoints (verticesList);
+ AddForeheadPoints(verticesList);
Vector3[] vertices = new Vector3[verticesList.Count];
- for (int i = 0; i < vertices.Length; i++) {
- vertices [i] = new Vector3 (verticesList [i].x, verticesList [i].y);
+ for (int i = 0; i < vertices.Length; i++)
+ {
+ vertices[i] = new Vector3(verticesList[i].x, verticesList[i].y);
}
mesh.vertices = vertices;
@@ -992,83 +1097,88 @@ namespace FaceMaskExample
72, 17, 0
};
int[] triangles = new int[mesh.triangles.Length + foreheadTriangles.Length];
- mesh.triangles.CopyTo (triangles, 0);
- foreheadTriangles.CopyTo (triangles, mesh.triangles.Length);
+ mesh.triangles.CopyTo(triangles, 0);
+ foreheadTriangles.CopyTo(triangles, mesh.triangles.Length);
mesh.triangles = triangles;
Vector2[] uv = new Vector2[mesh.uv.Length];
- for (int j = 0; j < uv.Length; j++) {
- uv [j].x = vertices [j].x + 0.5f;
- uv [j].y = vertices [j].y + 0.5f;
+ for (int j = 0; j < uv.Length; j++)
+ {
+ uv[j].x = vertices[j].x + 0.5f;
+ uv[j].y = vertices[j].y + 0.5f;
}
mesh.uv = uv;
- mesh.uv2 = (Vector2[])uv.Clone ();
-
- mesh.RecalculateNormals ();
+ mesh.uv2 = (Vector2[])uv.Clone();
+
+ mesh.RecalculateNormals();
}
- private void AddForeheadPoints (List points)
+ private void AddForeheadPoints(List points)
{
if (points.Count != 68)
- throw new ArgumentException ("Invalid face landmark points", "points");
+ throw new ArgumentException("Invalid face landmark points", "points");
- Vector2 noseLength = new Vector2 (points [27].x - points [30].x, points [27].y - points [30].y);
- Vector2 glabellaPoint = new Vector2 ((points [19].x + points [24].x) / 2f, (points [19].y + points [24].y) / 2f);
+ Vector2 noseLength = new Vector2(points[27].x - points[30].x, points[27].y - points[30].y);
+ Vector2 glabellaPoint = new Vector2((points[19].x + points[24].x) / 2f, (points[19].y + points[24].y) / 2f);
- points.Add (new Vector2 (points [26].x + noseLength.x * 0.8f, points [26].y + noseLength.y * 0.8f));
- points.Add (new Vector2 (points [24].x + noseLength.x, points [24].y + noseLength.y));
- points.Add (new Vector2 (glabellaPoint.x + noseLength.x * 1.1f, glabellaPoint.y + noseLength.y * 1.1f));
- points.Add (new Vector2 (points [19].x + noseLength.x, points [19].y + noseLength.y));
- points.Add (new Vector2 (points [17].x + noseLength.x * 0.8f, points [17].y + noseLength.y * 0.8f));
+ points.Add(new Vector2(points[26].x + noseLength.x * 0.8f, points[26].y + noseLength.y * 0.8f));
+ points.Add(new Vector2(points[24].x + noseLength.x, points[24].y + noseLength.y));
+ points.Add(new Vector2(glabellaPoint.x + noseLength.x * 1.1f, glabellaPoint.y + noseLength.y * 1.1f));
+ points.Add(new Vector2(points[19].x + noseLength.x, points[19].y + noseLength.y));
+ points.Add(new Vector2(points[17].x + noseLength.x * 0.8f, points[17].y + noseLength.y * 0.8f));
}
- private static void DrawFaceLandmark (Mat imgMat, List points, Scalar color, int thickness)
+ private static void DrawFaceLandmark(Mat imgMat, List points, Scalar color, int thickness)
{
- if (points.Count == 73) { // If landmark points of forehead exists.
+ if (points.Count == 73)
+ { // If landmark points of forehead exists.
for (int i = 1; i <= 16; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+
for (int i = 28; i <= 30; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+
for (int i = 18; i <= 21; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
for (int i = 23; i <= 26; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
for (int i = 31; i <= 35; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [30].x, points [30].y), new Point (points [35].x, points [35].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[30].x, points[30].y), new Point(points[35].x, points[35].y), color, thickness);
+
for (int i = 37; i <= 41; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [36].x, points [36].y), new Point (points [41].x, points [41].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[36].x, points[36].y), new Point(points[41].x, points[41].y), color, thickness);
+
for (int i = 43; i <= 47; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [42].x, points [42].y), new Point (points [47].x, points [47].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[42].x, points[42].y), new Point(points[47].x, points[47].y), color, thickness);
+
for (int i = 49; i <= 59; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [48].x, points [48].y), new Point (points [59].x, points [59].y), color, thickness);
-
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[48].x, points[48].y), new Point(points[59].x, points[59].y), color, thickness);
+
for (int i = 61; i <= 67; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), color, thickness);
- Imgproc.line (imgMat, new Point (points [60].x, points [60].y), new Point (points [67].x, points [67].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), color, thickness);
+ Imgproc.line(imgMat, new Point(points[60].x, points[60].y), new Point(points[67].x, points[67].y), color, thickness);
for (int i = 69; i <= 72; ++i)
- Imgproc.line (imgMat, new Point (points [i].x, points [i].y), new Point (points [i - 1].x, points [i - 1].y), new Scalar (0, 255, 0, 255), thickness);
- } else {
- OpenCVForUnityUtils.DrawFaceLandmark (imgMat, points, color, thickness);
+ Imgproc.line(imgMat, new Point(points[i].x, points[i].y), new Point(points[i - 1].x, points[i - 1].y), new Scalar(0, 255, 0, 255), thickness);
+ }
+ else
+ {
+ OpenCVForUnityUtils.DrawFaceLandmark(imgMat, points, color, thickness);
}
}
- private Texture2D CreateFaceMaskAlphaMaskTexture (float width, float height, Vector2[] uv, bool makeBothEyesTransparent = true, bool makeMouthTransparent = true)
+ private Texture2D CreateFaceMaskAlphaMaskTexture(float width, float height, Vector2[] uv, bool makeBothEyesTransparent = true, bool makeMouthTransparent = true)
{
if (uv.Length != 68 && uv.Length != 73)
- throw new ArgumentException ("Invalid face landmark points", "uv");
+ throw new ArgumentException("Invalid face landmark points", "uv");
Vector2[] facialContourUVPoints = new Vector2[0];
- if (uv.Length == 68) {
+ if (uv.Length == 68)
+ {
facialContourUVPoints = new Vector2[] {
uv [0],
uv [1],
@@ -1096,7 +1206,9 @@ namespace FaceMaskExample
uv [18],
uv [17]
};
- } else if (uv.Length == 73) { // If landmark points of forehead exists.
+ }
+ else if (uv.Length == 73)
+ { // If landmark points of forehead exists.
facialContourUVPoints = new Vector2[] {
uv [0],
uv [1],
@@ -1140,7 +1252,7 @@ namespace FaceMaskExample
uv [46],
uv [47]
};
-
+
Vector2[] mouthContourUVPoints = new Vector2[] {
uv [60],
uv [61],
@@ -1153,21 +1265,28 @@ namespace FaceMaskExample
};
Vector2[][] exclusionAreas;
- if (makeBothEyesTransparent == true && makeMouthTransparent == false) {
- exclusionAreas = new Vector2[][]{ rightEyeContourUVPoints, leftEyeContourUVPoints };
- } else if (makeBothEyesTransparent == false && makeMouthTransparent == true) {
- exclusionAreas = new Vector2[][]{ mouthContourUVPoints };
- } else if (makeBothEyesTransparent == true && makeMouthTransparent == true) {
+ if (makeBothEyesTransparent == true && makeMouthTransparent == false)
+ {
+ exclusionAreas = new Vector2[][] { rightEyeContourUVPoints, leftEyeContourUVPoints };
+ }
+ else if (makeBothEyesTransparent == false && makeMouthTransparent == true)
+ {
+ exclusionAreas = new Vector2[][] { mouthContourUVPoints };
+ }
+ else if (makeBothEyesTransparent == true && makeMouthTransparent == true)
+ {
exclusionAreas = new Vector2[][] {
rightEyeContourUVPoints,
leftEyeContourUVPoints,
mouthContourUVPoints
};
- } else {
- exclusionAreas = new Vector2[][]{ };
+ }
+ else
+ {
+ exclusionAreas = new Vector2[][] { };
}
- return AlphaMaskTextureCreater.CreateAlphaMaskTexture (width, height, facialContourUVPoints, exclusionAreas);
+ return AlphaMaskTextureCreater.CreateAlphaMaskTexture(width, height, facialContourUVPoints, exclusionAreas);
}
}
}
\ No newline at end of file
diff --git a/Assets/FaceMaskExample/WebCamTextureFaceMaskExample/WebCamTextureFaceMaskExample.cs b/Assets/FaceMaskExample/WebCamTextureFaceMaskExample/WebCamTextureFaceMaskExample.cs
index 7811467..4309744 100644
--- a/Assets/FaceMaskExample/WebCamTextureFaceMaskExample/WebCamTextureFaceMaskExample.cs
+++ b/Assets/FaceMaskExample/WebCamTextureFaceMaskExample/WebCamTextureFaceMaskExample.cs
@@ -1,16 +1,15 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using UnityEngine;
-using UnityEngine.UI;
-using UnityEngine.SceneManagement;
-using DlibFaceLandmarkDetector;
+using DlibFaceLandmarkDetector;
+using OpenCVForUnity.CoreModule;
+using OpenCVForUnity.ImgprocModule;
+using OpenCVForUnity.ObjdetectModule;
using OpenCVForUnity.RectangleTrack;
using OpenCVForUnity.UnityUtils.Helper;
-using OpenCVForUnity.CoreModule;
-using OpenCVForUnity.ObjdetectModule;
-using OpenCVForUnity.ImgprocModule;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.SceneManagement;
+using UnityEngine.UI;
using Rect = OpenCVForUnity.CoreModule.Rect;
namespace FaceMaskExample
@@ -18,17 +17,17 @@ namespace FaceMaskExample
///
/// WebCamTexture FaceMask Example
///
- [RequireComponent (typeof(WebCamTextureToMatHelper), typeof(TrackedMeshOverlay))]
+ [RequireComponent(typeof(WebCamTextureToMatHelper), typeof(TrackedMeshOverlay))]
public class WebCamTextureFaceMaskExample : MonoBehaviour
{
- [HeaderAttribute ("FaceMaskData")]
+ [HeaderAttribute("FaceMaskData")]
///
/// The face mask data list.
///
public List faceMaskDatas;
- [HeaderAttribute ("Option")]
+ [HeaderAttribute("Option")]
///
/// Determines if use dlib face detector.
@@ -73,14 +72,14 @@ namespace FaceMaskExample
///
/// The frontal face rate lower limit.
///
- [Range (0.0f, 1.0f)]
+ [Range(0.0f, 1.0f)]
public float frontalFaceRateLowerLimit = 0.85f;
-
+
///
/// Determines if displays face rects.
///
public bool displayFaceRects = false;
-
+
///
/// The toggle for switching face rects display state
///
@@ -95,17 +94,17 @@ namespace FaceMaskExample
/// The toggle for switching debug face points display state.
///
public Toggle displayDebugFacePointsToggle;
-
+
///
/// The gray mat.
///
Mat grayMat;
-
+
///
/// The texture.
///
Texture2D texture;
-
+
///
/// The cascade.
///
@@ -120,7 +119,7 @@ namespace FaceMaskExample
/// The web cam texture to mat helper.
///
WebCamTextureToMatHelper webCamTextureToMatHelper;
-
+
///
/// The face landmark detector.
///
@@ -140,12 +139,12 @@ namespace FaceMaskExample
/// The face mask color corrector.
///
FaceMaskColorCorrector faceMaskColorCorrector;
-
+
///
/// The frontal face checker.
///
FrontalFaceChecker frontalFaceChecker;
-
+
///
/// The mesh overlay.
///
@@ -170,7 +169,7 @@ namespace FaceMaskExample
/// The face mask texture.
///
Texture2D faceMaskTexture;
-
+
///
/// The face mask mat.
///
@@ -206,68 +205,66 @@ namespace FaceMaskExample
///
FpsMonitor fpsMonitor;
- #if UNITY_WEBGL && !UNITY_EDITOR
+#if UNITY_WEBGL
IEnumerator getFilePath_Coroutine;
- #endif
+#endif
// Use this for initialization
- void Start ()
+ void Start()
{
- fpsMonitor = GetComponent ();
+ fpsMonitor = GetComponent();
- webCamTextureToMatHelper = gameObject.GetComponent ();
+ webCamTextureToMatHelper = gameObject.GetComponent();
- #if UNITY_WEBGL && !UNITY_EDITOR
- getFilePath_Coroutine = GetFilePath ();
- StartCoroutine (getFilePath_Coroutine);
- #else
- haarcascade_frontalface_alt_xml_filepath = OpenCVForUnity.UnityUtils.Utils.getFilePath ("haarcascade_frontalface_alt.xml");
- sp_human_face_68_dat_filepath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath ("sp_human_face_68.dat");
- Run ();
- #endif
+#if UNITY_WEBGL
+ getFilePath_Coroutine = GetFilePath();
+ StartCoroutine(getFilePath_Coroutine);
+#else
+ haarcascade_frontalface_alt_xml_filepath = OpenCVForUnity.UnityUtils.Utils.getFilePath("haarcascade_frontalface_alt.xml");
+ sp_human_face_68_dat_filepath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath("sp_human_face_68.dat");
+ Run();
+#endif
}
- #if UNITY_WEBGL && !UNITY_EDITOR
- private IEnumerator GetFilePath ()
+#if UNITY_WEBGL
+ private IEnumerator GetFilePath()
{
- var getFilePathAsync_0_Coroutine = OpenCVForUnity.UnityUtils.Utils.getFilePathAsync ("haarcascade_frontalface_alt.xml", (result) => {
+ var getFilePathAsync_0_Coroutine = OpenCVForUnity.UnityUtils.Utils.getFilePathAsync("haarcascade_frontalface_alt.xml", (result) =>
+ {
haarcascade_frontalface_alt_xml_filepath = result;
});
yield return getFilePathAsync_0_Coroutine;
- var getFilePathAsync_1_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync ("sp_human_face_68.dat", (result) => {
+ var getFilePathAsync_1_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync("sp_human_face_68.dat", (result) =>
+ {
sp_human_face_68_dat_filepath = result;
});
yield return getFilePathAsync_1_Coroutine;
getFilePath_Coroutine = null;
- Run ();
+ Run();
}
- #endif
+#endif
- private void Run ()
+ private void Run()
{
- meshOverlay = this.GetComponent ();
+ meshOverlay = this.GetComponent();
- shader_FadeID = Shader.PropertyToID ("_Fade");
- shader_ColorCorrectionID = Shader.PropertyToID ("_ColorCorrection");
- shader_LUTTexID = Shader.PropertyToID ("_LUTTex");
+ shader_FadeID = Shader.PropertyToID("_Fade");
+ shader_ColorCorrectionID = Shader.PropertyToID("_ColorCorrection");
+ shader_LUTTexID = Shader.PropertyToID("_LUTTex");
- rectangleTracker = new RectangleTracker ();
+ rectangleTracker = new RectangleTracker();
- faceLandmarkDetector = new FaceLandmarkDetector (sp_human_face_68_dat_filepath);
+ faceLandmarkDetector = new FaceLandmarkDetector(sp_human_face_68_dat_filepath);
- lowPassFilterDict = new Dictionary ();
- opticalFlowFilterDict = new Dictionary ();
+ lowPassFilterDict = new Dictionary();
+ opticalFlowFilterDict = new Dictionary();
- faceMaskColorCorrector = new FaceMaskColorCorrector ();
+ faceMaskColorCorrector = new FaceMaskColorCorrector();
- #if UNITY_ANDROID && !UNITY_EDITOR
- // Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2).
- webCamTextureToMatHelper.avoidAndroidFrontCameraLowLightIssue = true;
- #endif
- webCamTextureToMatHelper.Initialize ();
+ webCamTextureToMatHelper.Initialize();
displayFaceRectsToggle.isOn = displayFaceRects;
useDlibFaceDetecterToggle.isOn = useDlibFaceDetecter;
@@ -280,22 +277,23 @@ namespace FaceMaskExample
///
/// Raises the web cam texture to mat helper initialized event.
///
- public void OnWebCamTextureToMatHelperInitialized ()
+ public void OnWebCamTextureToMatHelperInitialized()
{
- Debug.Log ("OnWebCamTextureToMatHelperInitialized");
+ Debug.Log("OnWebCamTextureToMatHelperInitialized");
- Mat webCamTextureMat = webCamTextureToMatHelper.GetMat ();
+ Mat webCamTextureMat = webCamTextureToMatHelper.GetMat();
- texture = new Texture2D (webCamTextureMat.cols (), webCamTextureMat.rows (), TextureFormat.RGBA32, false);
+ texture = new Texture2D(webCamTextureMat.cols(), webCamTextureMat.rows(), TextureFormat.RGBA32, false);
- gameObject.transform.localScale = new Vector3 (webCamTextureMat.cols (), webCamTextureMat.rows (), 1);
- Debug.Log ("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
+ gameObject.transform.localScale = new Vector3(webCamTextureMat.cols(), webCamTextureMat.rows(), 1);
+ Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation);
- if (fpsMonitor != null) {
- fpsMonitor.Add ("width", webCamTextureMat.width ().ToString ());
- fpsMonitor.Add ("height", webCamTextureMat.height ().ToString ());
- fpsMonitor.Add ("orientation", Screen.orientation.ToString ());
+ if (fpsMonitor != null)
+ {
+ fpsMonitor.Add("width", webCamTextureMat.width().ToString());
+ fpsMonitor.Add("height", webCamTextureMat.height().ToString());
+ fpsMonitor.Add("orientation", Screen.orientation.ToString());
}
@@ -304,266 +302,316 @@ namespace FaceMaskExample
float widthScale = (float)Screen.width / width;
float heightScale = (float)Screen.height / height;
- if (widthScale < heightScale) {
+ if (widthScale < heightScale)
+ {
Camera.main.orthographicSize = (width * (float)Screen.height / (float)Screen.width) / 2;
- } else {
+ }
+ else
+ {
Camera.main.orthographicSize = height / 2;
}
- gameObject.GetComponent ().material.mainTexture = texture;
+ gameObject.GetComponent().material.mainTexture = texture;
- grayMat = new Mat (webCamTextureMat.rows (), webCamTextureMat.cols (), CvType.CV_8UC1);
- cascade = new CascadeClassifier (haarcascade_frontalface_alt_xml_filepath);
-// if (cascade.empty ()) {
-// Debug.LogError ("cascade file is not loaded.Please copy from “FaceTrackerExample/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
-// }
+ grayMat = new Mat(webCamTextureMat.rows(), webCamTextureMat.cols(), CvType.CV_8UC1);
+ cascade = new CascadeClassifier(haarcascade_frontalface_alt_xml_filepath);
+ //if (cascade.empty())
+ //{
+ // Debug.LogError("cascade file is not loaded.Please copy from “FaceTrackerExample/StreamingAssets/” to “Assets/StreamingAssets/” folder. ");
+ //}
- frontalFaceChecker = new FrontalFaceChecker (width, height);
+ frontalFaceChecker = new FrontalFaceChecker(width, height);
- meshOverlay.UpdateOverlayTransform (gameObject.transform);
+ meshOverlay.UpdateOverlayTransform(gameObject.transform);
- OnChangeFaceMaskButtonClick ();
+ OnChangeFaceMaskButtonClick();
}
///
/// Raises the web cam texture to mat helper disposed event.
///
- public void OnWebCamTextureToMatHelperDisposed ()
+ public void OnWebCamTextureToMatHelperDisposed()
{
- Debug.Log ("OnWebCamTextureToMatHelperDisposed");
+ Debug.Log("OnWebCamTextureToMatHelperDisposed");
- grayMat.Dispose ();
+ grayMat.Dispose();
- if (texture != null) {
- Texture2D.Destroy (texture);
+ if (texture != null)
+ {
+ Texture2D.Destroy(texture);
texture = null;
}
- rectangleTracker.Reset ();
- meshOverlay.Reset ();
+ rectangleTracker.Reset();
+ meshOverlay.Reset();
- foreach (var key in lowPassFilterDict.Keys) {
- lowPassFilterDict [key].Dispose ();
+ foreach (var key in lowPassFilterDict.Keys)
+ {
+ lowPassFilterDict[key].Dispose();
}
- lowPassFilterDict.Clear ();
- foreach (var key in opticalFlowFilterDict.Keys) {
- opticalFlowFilterDict [key].Dispose ();
+ lowPassFilterDict.Clear();
+ foreach (var key in opticalFlowFilterDict.Keys)
+ {
+ opticalFlowFilterDict[key].Dispose();
}
- opticalFlowFilterDict.Clear ();
+ opticalFlowFilterDict.Clear();
- faceMaskColorCorrector.Reset ();
+ faceMaskColorCorrector.Reset();
- frontalFaceChecker.Dispose ();
+ frontalFaceChecker.Dispose();
}
///
/// Raises the web cam texture to mat helper error occurred event.
///
/// Error code.
- public void OnWebCamTextureToMatHelperErrorOccurred (WebCamTextureToMatHelper.ErrorCode errorCode)
+ public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode)
{
- Debug.Log ("OnWebCamTextureToMatHelperErrorOccurred " + errorCode);
+ Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode);
}
// Update is called once per frame
- void Update ()
+ void Update()
{
- if (webCamTextureToMatHelper.IsPlaying () && webCamTextureToMatHelper.DidUpdateThisFrame ()) {
+ if (webCamTextureToMatHelper.IsPlaying() && webCamTextureToMatHelper.DidUpdateThisFrame())
+ {
- Mat rgbaMat = webCamTextureToMatHelper.GetMat ();
+ Mat rgbaMat = webCamTextureToMatHelper.GetMat();
// detect faces.
- List detectResult = new List ();
- if (useDlibFaceDetecter) {
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, rgbaMat);
- List result = faceLandmarkDetector.Detect ();
+ List detectResult = new List();
+ if (useDlibFaceDetecter)
+ {
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, rgbaMat);
+ List result = faceLandmarkDetector.Detect();
- foreach (var unityRect in result) {
- detectResult.Add (new Rect ((int)unityRect.x, (int)unityRect.y, (int)unityRect.width, (int)unityRect.height));
+ foreach (var unityRect in result)
+ {
+ detectResult.Add(new Rect((int)unityRect.x, (int)unityRect.y, (int)unityRect.width, (int)unityRect.height));
}
- } else {
+ }
+ else
+ {
// convert image to greyscale.
- Imgproc.cvtColor (rgbaMat, grayMat, Imgproc.COLOR_RGBA2GRAY);
+ Imgproc.cvtColor(rgbaMat, grayMat, Imgproc.COLOR_RGBA2GRAY);
- using (Mat equalizeHistMat = new Mat ())
- using (MatOfRect faces = new MatOfRect ()) {
- Imgproc.equalizeHist (grayMat, equalizeHistMat);
+ using (Mat equalizeHistMat = new Mat())
+ using (MatOfRect faces = new MatOfRect())
+ {
+ Imgproc.equalizeHist(grayMat, equalizeHistMat);
- cascade.detectMultiScale (equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size (equalizeHistMat.cols () * 0.15, equalizeHistMat.cols () * 0.15), new Size ());
+ cascade.detectMultiScale(equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size(equalizeHistMat.cols() * 0.15, equalizeHistMat.cols() * 0.15), new Size());
- detectResult = faces.toList ();
+ detectResult = faces.toList();
}
// corrects the deviation of a detection result between OpenCV and Dlib.
- foreach (Rect r in detectResult) {
+ foreach (Rect r in detectResult)
+ {
r.y += (int)(r.height * 0.1f);
}
}
// face tracking.
- rectangleTracker.UpdateTrackedObjects (detectResult);
- List trackedRects = new List ();
- rectangleTracker.GetObjects (trackedRects, true);
+ rectangleTracker.UpdateTrackedObjects(detectResult);
+ List trackedRects = new List();
+ rectangleTracker.GetObjects(trackedRects, true);
// create noise filter.
- foreach (var openCVRect in trackedRects) {
- if (openCVRect.state == TrackedState.NEW) {
- if (!lowPassFilterDict.ContainsKey (openCVRect.id))
- lowPassFilterDict.Add (openCVRect.id, new LowPassPointsFilter ((int)faceLandmarkDetector.GetShapePredictorNumParts ()));
- if (!opticalFlowFilterDict.ContainsKey (openCVRect.id))
- opticalFlowFilterDict.Add (openCVRect.id, new OFPointsFilter ((int)faceLandmarkDetector.GetShapePredictorNumParts ()));
- } else if (openCVRect.state == TrackedState.DELETED) {
- if (lowPassFilterDict.ContainsKey (openCVRect.id)) {
- lowPassFilterDict [openCVRect.id].Dispose ();
- lowPassFilterDict.Remove (openCVRect.id);
+ foreach (var openCVRect in trackedRects)
+ {
+ if (openCVRect.state == TrackedState.NEW)
+ {
+ if (!lowPassFilterDict.ContainsKey(openCVRect.id))
+ lowPassFilterDict.Add(openCVRect.id, new LowPassPointsFilter((int)faceLandmarkDetector.GetShapePredictorNumParts()));
+ if (!opticalFlowFilterDict.ContainsKey(openCVRect.id))
+ opticalFlowFilterDict.Add(openCVRect.id, new OFPointsFilter((int)faceLandmarkDetector.GetShapePredictorNumParts()));
+ }
+ else if (openCVRect.state == TrackedState.DELETED)
+ {
+ if (lowPassFilterDict.ContainsKey(openCVRect.id))
+ {
+ lowPassFilterDict[openCVRect.id].Dispose();
+ lowPassFilterDict.Remove(openCVRect.id);
}
- if (opticalFlowFilterDict.ContainsKey (openCVRect.id)) {
- opticalFlowFilterDict [openCVRect.id].Dispose ();
- opticalFlowFilterDict.Remove (openCVRect.id);
+ if (opticalFlowFilterDict.ContainsKey(openCVRect.id))
+ {
+ opticalFlowFilterDict[openCVRect.id].Dispose();
+ opticalFlowFilterDict.Remove(openCVRect.id);
}
}
}
// create LUT texture.
- foreach (var openCVRect in trackedRects) {
- if (openCVRect.state == TrackedState.NEW) {
- faceMaskColorCorrector.CreateLUTTex (openCVRect.id);
- } else if (openCVRect.state == TrackedState.DELETED) {
- faceMaskColorCorrector.DeleteLUTTex (openCVRect.id);
+ foreach (var openCVRect in trackedRects)
+ {
+ if (openCVRect.state == TrackedState.NEW)
+ {
+ faceMaskColorCorrector.CreateLUTTex(openCVRect.id);
+ }
+ else if (openCVRect.state == TrackedState.DELETED)
+ {
+ faceMaskColorCorrector.DeleteLUTTex(openCVRect.id);
}
}
// detect face landmark points.
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, rgbaMat);
- List> landmarkPoints = new List> ();
- for (int i = 0; i < trackedRects.Count; i++) {
- TrackedRect tr = trackedRects [i];
- UnityEngine.Rect rect = new UnityEngine.Rect (tr.x, tr.y, tr.width, tr.height);
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, rgbaMat);
+ List> landmarkPoints = new List>();
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ TrackedRect tr = trackedRects[i];
+ UnityEngine.Rect rect = new UnityEngine.Rect(tr.x, tr.y, tr.width, tr.height);
- List points = faceLandmarkDetector.DetectLandmark (rect);
+ List points = faceLandmarkDetector.DetectLandmark(rect);
// apply noise filter.
- if (enableNoiseFilter) {
- if (tr.state > TrackedState.NEW && tr.state < TrackedState.DELETED) {
- opticalFlowFilterDict [tr.id].Process (rgbaMat, points, points);
- lowPassFilterDict [tr.id].Process (rgbaMat, points, points);
+ if (enableNoiseFilter)
+ {
+ if (tr.state > TrackedState.NEW && tr.state < TrackedState.DELETED)
+ {
+ opticalFlowFilterDict[tr.id].Process(rgbaMat, points, points);
+ lowPassFilterDict[tr.id].Process(rgbaMat, points, points);
}
}
- landmarkPoints.Add (points);
+ landmarkPoints.Add(points);
}
// face masking.
- if (faceMaskTexture != null && landmarkPoints.Count >= 1) { // Apply face masking between detected faces and a face mask image.
+ if (faceMaskTexture != null && landmarkPoints.Count >= 1)
+ { // Apply face masking between detected faces and a face mask image.
float maskImageWidth = faceMaskTexture.width;
float maskImageHeight = faceMaskTexture.height;
TrackedRect tr;
- for (int i = 0; i < trackedRects.Count; i++) {
- tr = trackedRects [i];
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ tr = trackedRects[i];
- if (tr.state == TrackedState.NEW) {
- meshOverlay.CreateObject (tr.id, faceMaskTexture);
+ if (tr.state == TrackedState.NEW)
+ {
+ meshOverlay.CreateObject(tr.id, faceMaskTexture);
}
- if (tr.state < TrackedState.DELETED) {
- MaskFace (meshOverlay, tr, landmarkPoints [i], faceLandmarkPointsInMask, maskImageWidth, maskImageHeight);
+ if (tr.state < TrackedState.DELETED)
+ {
+ MaskFace(meshOverlay, tr, landmarkPoints[i], faceLandmarkPointsInMask, maskImageWidth, maskImageHeight);
- if (enableColorCorrection) {
- CorrectFaceMaskColor (tr.id, faceMaskMat, rgbaMat, faceLandmarkPointsInMask, landmarkPoints [i]);
+ if (enableColorCorrection)
+ {
+ CorrectFaceMaskColor(tr.id, faceMaskMat, rgbaMat, faceLandmarkPointsInMask, landmarkPoints[i]);
}
- } else if (tr.state == TrackedState.DELETED) {
- meshOverlay.DeleteObject (tr.id);
+ }
+ else if (tr.state == TrackedState.DELETED)
+ {
+ meshOverlay.DeleteObject(tr.id);
}
}
- } else if (landmarkPoints.Count >= 1) { // Apply face masking between detected faces.
-
+ }
+ else if (landmarkPoints.Count >= 1)
+ { // Apply face masking between detected faces.
+
float maskImageWidth = texture.width;
float maskImageHeight = texture.height;
TrackedRect tr;
- for (int i = 0; i < trackedRects.Count; i++) {
- tr = trackedRects [i];
-
- if (tr.state == TrackedState.NEW) {
- meshOverlay.CreateObject (tr.id, texture);
- }
- if (tr.state < TrackedState.DELETED) {
- MaskFace (meshOverlay, tr, landmarkPoints [i], landmarkPoints [0], maskImageWidth, maskImageHeight);
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ tr = trackedRects[i];
- if (enableColorCorrection) {
- CorrectFaceMaskColor (tr.id, rgbaMat, rgbaMat, landmarkPoints [0], landmarkPoints [i]);
+ if (tr.state == TrackedState.NEW)
+ {
+ meshOverlay.CreateObject(tr.id, texture);
+ }
+ if (tr.state < TrackedState.DELETED)
+ {
+ MaskFace(meshOverlay, tr, landmarkPoints[i], landmarkPoints[0], maskImageWidth, maskImageHeight);
+
+ if (enableColorCorrection)
+ {
+ CorrectFaceMaskColor(tr.id, rgbaMat, rgbaMat, landmarkPoints[0], landmarkPoints[i]);
}
- } else if (tr.state == TrackedState.DELETED) {
- meshOverlay.DeleteObject (tr.id);
+ }
+ else if (tr.state == TrackedState.DELETED)
+ {
+ meshOverlay.DeleteObject(tr.id);
}
}
}
// draw face rects.
- if (displayFaceRects) {
- for (int i = 0; i < detectResult.Count; i++) {
- UnityEngine.Rect rect = new UnityEngine.Rect (detectResult [i].x, detectResult [i].y, detectResult [i].width, detectResult [i].height);
- OpenCVForUnityUtils.DrawFaceRect (rgbaMat, rect, new Scalar (255, 0, 0, 255), 2);
+ if (displayFaceRects)
+ {
+ for (int i = 0; i < detectResult.Count; i++)
+ {
+ UnityEngine.Rect rect = new UnityEngine.Rect(detectResult[i].x, detectResult[i].y, detectResult[i].width, detectResult[i].height);
+ OpenCVForUnityUtils.DrawFaceRect(rgbaMat, rect, new Scalar(255, 0, 0, 255), 2);
}
- for (int i = 0; i < trackedRects.Count; i++) {
- UnityEngine.Rect rect = new UnityEngine.Rect (trackedRects [i].x, trackedRects [i].y, trackedRects [i].width, trackedRects [i].height);
- OpenCVForUnityUtils.DrawFaceRect (rgbaMat, rect, new Scalar (255, 255, 0, 255), 2);
-// Imgproc.putText (rgbaMat, " " + frontalFaceChecker.GetFrontalFaceAngles (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
-// Imgproc.putText (rgbaMat, " " + frontalFaceChecker.GetFrontalFaceRate (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
+ for (int i = 0; i < trackedRects.Count; i++)
+ {
+ UnityEngine.Rect rect = new UnityEngine.Rect(trackedRects[i].x, trackedRects[i].y, trackedRects[i].width, trackedRects[i].height);
+ OpenCVForUnityUtils.DrawFaceRect(rgbaMat, rect, new Scalar(255, 255, 0, 255), 2);
+ //Imgproc.putText (rgbaMat, " " + frontalFaceChecker.GetFrontalFaceAngles (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
+ //Imgproc.putText (rgbaMat, " " + frontalFaceChecker.GetFrontalFaceRate (landmarkPoints [i]), new Point (rect.xMin, rect.yMin - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false);
}
}
// draw face points.
- if (displayDebugFacePoints) {
- for (int i = 0; i < landmarkPoints.Count; i++) {
- OpenCVForUnityUtils.DrawFaceLandmark (rgbaMat, landmarkPoints [i], new Scalar (0, 255, 0, 255), 2);
+ if (displayDebugFacePoints)
+ {
+ for (int i = 0; i < landmarkPoints.Count; i++)
+ {
+ OpenCVForUnityUtils.DrawFaceLandmark(rgbaMat, landmarkPoints[i], new Scalar(0, 255, 0, 255), 2);
}
}
// display face mask image.
- if (faceMaskTexture != null && faceMaskMat != null) {
+ if (faceMaskTexture != null && faceMaskMat != null)
+ {
- if (displayFaceRects) {
- OpenCVForUnityUtils.DrawFaceRect (faceMaskMat, faceRectInMask, new Scalar (255, 0, 0, 255), 2);
+ if (displayFaceRects)
+ {
+ OpenCVForUnityUtils.DrawFaceRect(faceMaskMat, faceRectInMask, new Scalar(255, 0, 0, 255), 2);
}
- if (displayDebugFacePoints) {
- OpenCVForUnityUtils.DrawFaceLandmark (faceMaskMat, faceLandmarkPointsInMask, new Scalar (0, 255, 0, 255), 2);
+ if (displayDebugFacePoints)
+ {
+ OpenCVForUnityUtils.DrawFaceLandmark(faceMaskMat, faceLandmarkPointsInMask, new Scalar(0, 255, 0, 255), 2);
}
- float scale = (rgbaMat.width () / 4f) / faceMaskMat.width ();
- float tx = rgbaMat.width () - faceMaskMat.width () * scale;
+ float scale = (rgbaMat.width() / 4f) / faceMaskMat.width();
+ float tx = rgbaMat.width() - faceMaskMat.width() * scale;
float ty = 0.0f;
- Mat trans = new Mat (2, 3, CvType.CV_32F);//1.0, 0.0, tx, 0.0, 1.0, ty);
- trans.put (0, 0, scale);
- trans.put (0, 1, 0.0f);
- trans.put (0, 2, tx);
- trans.put (1, 0, 0.0f);
- trans.put (1, 1, scale);
- trans.put (1, 2, ty);
-
- Imgproc.warpAffine (faceMaskMat, rgbaMat, trans, rgbaMat.size (), Imgproc.INTER_LINEAR, Core.BORDER_TRANSPARENT, new Scalar (0));
+ Mat trans = new Mat(2, 3, CvType.CV_32F);//1.0, 0.0, tx, 0.0, 1.0, ty);
+ trans.put(0, 0, scale);
+ trans.put(0, 1, 0.0f);
+ trans.put(0, 2, tx);
+ trans.put(1, 0, 0.0f);
+ trans.put(1, 1, scale);
+ trans.put(1, 2, ty);
+
+ Imgproc.warpAffine(faceMaskMat, rgbaMat, trans, rgbaMat.size(), Imgproc.INTER_LINEAR, Core.BORDER_TRANSPARENT, new Scalar(0));
if (displayFaceRects || displayDebugFacePointsToggle)
- OpenCVForUnity.UnityUtils.Utils.texture2DToMat (faceMaskTexture, faceMaskMat);
+ OpenCVForUnity.UnityUtils.Utils.texture2DToMat(faceMaskTexture, faceMaskMat);
}
-// Imgproc.putText (rgbaMat, "W:" + rgbaMat.width () + " H:" + rgbaMat.height () + " SO:" + Screen.orientation, new Point (5, rgbaMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
+ //Imgproc.putText (rgbaMat, "W:" + rgbaMat.width () + " H:" + rgbaMat.height () + " SO:" + Screen.orientation, new Point (5, rgbaMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 0.5, new Scalar (255, 255, 255, 255), 1, Imgproc.LINE_AA, false);
- OpenCVForUnity.UnityUtils.Utils.fastMatToTexture2D (rgbaMat, texture);
+ OpenCVForUnity.UnityUtils.Utils.fastMatToTexture2D(rgbaMat, texture);
}
}
- private void MaskFace (TrackedMeshOverlay meshOverlay, TrackedRect tr, List landmarkPoints, List landmarkPointsInMaskImage, float maskImageWidth = 0, float maskImageHeight = 0)
+ private void MaskFace(TrackedMeshOverlay meshOverlay, TrackedRect tr, List landmarkPoints, List landmarkPointsInMaskImage, float maskImageWidth = 0, float maskImageHeight = 0)
{
float imageWidth = meshOverlay.width;
- float imageHeight = meshOverlay.height;
+ float imageHeight = meshOverlay.height;
if (maskImageWidth == 0)
maskImageWidth = imageWidth;
@@ -571,127 +619,147 @@ namespace FaceMaskExample
if (maskImageHeight == 0)
maskImageHeight = imageHeight;
- TrackedMesh tm = meshOverlay.GetObjectById (tr.id);
+ TrackedMesh tm = meshOverlay.GetObjectById(tr.id);
Vector3[] vertices = tm.meshFilter.mesh.vertices;
- if (vertices.Length == landmarkPoints.Count) {
- for (int j = 0; j < vertices.Length; j++) {
- vertices [j].x = landmarkPoints [j].x / imageWidth - 0.5f;
- vertices [j].y = 0.5f - landmarkPoints [j].y / imageHeight;
+ if (vertices.Length == landmarkPoints.Count)
+ {
+ for (int j = 0; j < vertices.Length; j++)
+ {
+ vertices[j].x = landmarkPoints[j].x / imageWidth - 0.5f;
+ vertices[j].y = 0.5f - landmarkPoints[j].y / imageHeight;
}
}
Vector2[] uv = tm.meshFilter.mesh.uv;
- if (uv.Length == landmarkPointsInMaskImage.Count) {
- for (int jj = 0; jj < uv.Length; jj++) {
- uv [jj].x = landmarkPointsInMaskImage [jj].x / maskImageWidth;
- uv [jj].y = (maskImageHeight - landmarkPointsInMaskImage [jj].y) / maskImageHeight;
+ if (uv.Length == landmarkPointsInMaskImage.Count)
+ {
+ for (int jj = 0; jj < uv.Length; jj++)
+ {
+ uv[jj].x = landmarkPointsInMaskImage[jj].x / maskImageWidth;
+ uv[jj].y = (maskImageHeight - landmarkPointsInMaskImage[jj].y) / maskImageHeight;
}
}
- meshOverlay.UpdateObject (tr.id, vertices, null, uv);
+ meshOverlay.UpdateObject(tr.id, vertices, null, uv);
- if (tr.numFramesNotDetected > 3) {
- tm.sharedMaterial.SetFloat (shader_FadeID, 1f);
- } else if (tr.numFramesNotDetected > 0 && tr.numFramesNotDetected <= 3) {
- tm.sharedMaterial.SetFloat (shader_FadeID, 0.3f + (0.7f / 4f) * tr.numFramesNotDetected);
- } else {
- tm.sharedMaterial.SetFloat (shader_FadeID, 0.3f);
+ if (tr.numFramesNotDetected > 3)
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 1f);
+ }
+ else if (tr.numFramesNotDetected > 0 && tr.numFramesNotDetected <= 3)
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 0.3f + (0.7f / 4f) * tr.numFramesNotDetected);
+ }
+ else
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 0.3f);
}
- if (enableColorCorrection) {
- tm.sharedMaterial.SetFloat (shader_ColorCorrectionID, 1f);
- } else {
- tm.sharedMaterial.SetFloat (shader_ColorCorrectionID, 0f);
+ if (enableColorCorrection)
+ {
+ tm.sharedMaterial.SetFloat(shader_ColorCorrectionID, 1f);
+ }
+ else
+ {
+ tm.sharedMaterial.SetFloat(shader_ColorCorrectionID, 0f);
}
// filter non frontal faces.
- if (filterNonFrontalFaces && frontalFaceChecker.GetFrontalFaceRate (landmarkPoints) < frontalFaceRateLowerLimit) {
- tm.sharedMaterial.SetFloat (shader_FadeID, 1f);
+ if (filterNonFrontalFaces && frontalFaceChecker.GetFrontalFaceRate(landmarkPoints) < frontalFaceRateLowerLimit)
+ {
+ tm.sharedMaterial.SetFloat(shader_FadeID, 1f);
}
}
- private void CorrectFaceMaskColor (int id, Mat src, Mat dst, List src_landmarkPoints, List dst_landmarkPoints)
+ private void CorrectFaceMaskColor(int id, Mat src, Mat dst, List src_landmarkPoints, List dst_landmarkPoints)
{
- Texture2D LUTTex = faceMaskColorCorrector.UpdateLUTTex (id, src, dst, src_landmarkPoints, dst_landmarkPoints);
- TrackedMesh tm = meshOverlay.GetObjectById (id);
- tm.sharedMaterial.SetTexture (shader_LUTTexID, LUTTex);
+ Texture2D LUTTex = faceMaskColorCorrector.UpdateLUTTex(id, src, dst, src_landmarkPoints, dst_landmarkPoints);
+ TrackedMesh tm = meshOverlay.GetObjectById(id);
+ tm.sharedMaterial.SetTexture(shader_LUTTexID, LUTTex);
}
///
/// Raises the destroy event.
///
- void OnDestroy ()
+ void OnDestroy()
{
- webCamTextureToMatHelper.Dispose ();
+ if (webCamTextureToMatHelper != null)
+ webCamTextureToMatHelper.Dispose();
if (cascade != null)
- cascade.Dispose ();
+ cascade.Dispose();
if (rectangleTracker != null)
- rectangleTracker.Dispose ();
+ rectangleTracker.Dispose();
if (faceLandmarkDetector != null)
- faceLandmarkDetector.Dispose ();
+ faceLandmarkDetector.Dispose();
- foreach (var key in lowPassFilterDict.Keys) {
- lowPassFilterDict [key].Dispose ();
+ foreach (var key in lowPassFilterDict.Keys)
+ {
+ lowPassFilterDict[key].Dispose();
}
- lowPassFilterDict.Clear ();
- foreach (var key in opticalFlowFilterDict.Keys) {
- opticalFlowFilterDict [key].Dispose ();
+ lowPassFilterDict.Clear();
+ foreach (var key in opticalFlowFilterDict.Keys)
+ {
+ opticalFlowFilterDict[key].Dispose();
}
- opticalFlowFilterDict.Clear ();
+ opticalFlowFilterDict.Clear();
if (faceMaskColorCorrector != null)
- faceMaskColorCorrector.Dispose ();
+ faceMaskColorCorrector.Dispose();
- #if UNITY_WEBGL && !UNITY_EDITOR
- if (getFilePath_Coroutine != null) {
- StopCoroutine (getFilePath_Coroutine);
- ((IDisposable)getFilePath_Coroutine).Dispose ();
+#if UNITY_WEBGL
+ if (getFilePath_Coroutine != null)
+ {
+ StopCoroutine(getFilePath_Coroutine);
+ ((IDisposable)getFilePath_Coroutine).Dispose();
}
- #endif
+#endif
}
///
/// Raises the back button click event.
///
- public void OnBackButtonClick ()
+ public void OnBackButtonClick()
{
- SceneManager.LoadScene ("FaceMaskExample");
+ SceneManager.LoadScene("FaceMaskExample");
}
///
/// Raises the play button click event.
///
- public void OnPlayButtonClick ()
+ public void OnPlayButtonClick()
{
- webCamTextureToMatHelper.Play ();
+ webCamTextureToMatHelper.Play();
}
///
/// Raises the pause button click event.
///
- public void OnPauseButtonClick ()
+ public void OnPauseButtonClick()
{
- webCamTextureToMatHelper.Pause ();
+ webCamTextureToMatHelper.Pause();
}
///
/// Raises the change camera button click event.
///
- public void OnChangeCameraButtonClick ()
+ public void OnChangeCameraButtonClick()
{
- webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.IsFrontFacing ();
+ webCamTextureToMatHelper.requestedIsFrontFacing = !webCamTextureToMatHelper.IsFrontFacing();
}
///
/// Raises the use Dlib face detector toggle value changed event.
///
- public void OnUseDlibFaceDetecterToggleValueChanged ()
+ public void OnUseDlibFaceDetecterToggleValueChanged()
{
- if (useDlibFaceDetecterToggle.isOn) {
+ if (useDlibFaceDetecterToggle.isOn)
+ {
useDlibFaceDetecter = true;
- } else {
+ }
+ else
+ {
useDlibFaceDetecter = false;
}
}
@@ -699,17 +767,22 @@ namespace FaceMaskExample
///
/// Raises the enable noise filter toggle value changed event.
///
- public void OnEnableNoiseFilterToggleValueChanged ()
+ public void OnEnableNoiseFilterToggleValueChanged()
{
- if (enableNoiseFilterToggle.isOn) {
+ if (enableNoiseFilterToggle.isOn)
+ {
enableNoiseFilter = true;
- foreach (var key in lowPassFilterDict.Keys) {
- lowPassFilterDict [key].Reset ();
+ foreach (var key in lowPassFilterDict.Keys)
+ {
+ lowPassFilterDict[key].Reset();
}
- foreach (var key in opticalFlowFilterDict.Keys) {
- opticalFlowFilterDict [key].Reset ();
+ foreach (var key in opticalFlowFilterDict.Keys)
+ {
+ opticalFlowFilterDict[key].Reset();
}
- } else {
+ }
+ else
+ {
enableNoiseFilter = false;
}
}
@@ -717,11 +790,14 @@ namespace FaceMaskExample
///
/// Raises the enable color correction toggle value changed event.
///
- public void OnEnableColorCorrectionToggleValueChanged ()
+ public void OnEnableColorCorrectionToggleValueChanged()
{
- if (enableColorCorrectionToggle.isOn) {
+ if (enableColorCorrectionToggle.isOn)
+ {
enableColorCorrection = true;
- } else {
+ }
+ else
+ {
enableColorCorrection = false;
}
}
@@ -729,11 +805,14 @@ namespace FaceMaskExample
///
/// Raises the filter non frontal faces toggle value changed event.
///
- public void OnFilterNonFrontalFacesToggleValueChanged ()
+ public void OnFilterNonFrontalFacesToggleValueChanged()
{
- if (filterNonFrontalFacesToggle.isOn) {
+ if (filterNonFrontalFacesToggle.isOn)
+ {
filterNonFrontalFaces = true;
- } else {
+ }
+ else
+ {
filterNonFrontalFaces = false;
}
}
@@ -741,11 +820,14 @@ namespace FaceMaskExample
///
/// Raises the display face rects toggle value changed event.
///
- public void OnDisplayFaceRectsToggleValueChanged ()
+ public void OnDisplayFaceRectsToggleValueChanged()
{
- if (displayFaceRectsToggle.isOn) {
+ if (displayFaceRectsToggle.isOn)
+ {
displayFaceRects = true;
- } else {
+ }
+ else
+ {
displayFaceRects = false;
}
}
@@ -753,11 +835,14 @@ namespace FaceMaskExample
///
/// Raises the display debug face points toggle value changed event.
///
- public void OnDisplayDebugFacePointsToggleValueChanged ()
+ public void OnDisplayDebugFacePointsToggleValueChanged()
{
- if (displayDebugFacePointsToggle.isOn) {
+ if (displayDebugFacePointsToggle.isOn)
+ {
displayDebugFacePoints = true;
- } else {
+ }
+ else
+ {
displayDebugFacePoints = false;
}
}
@@ -765,49 +850,56 @@ namespace FaceMaskExample
///
/// Raises the change face mask button click event.
///
- public void OnChangeFaceMaskButtonClick ()
+ public void OnChangeFaceMaskButtonClick()
{
- RemoveFaceMask ();
+ RemoveFaceMask();
if (faceMaskDatas.Count == 0)
return;
- FaceMaskData maskData = faceMaskDatas [faceMaskDataIndex];
+ FaceMaskData maskData = faceMaskDatas[faceMaskDataIndex];
faceMaskDataIndex = (faceMaskDataIndex < faceMaskDatas.Count - 1) ? faceMaskDataIndex + 1 : 0;
- if (maskData == null) {
- Debug.LogError ("maskData == null");
+ if (maskData == null)
+ {
+ Debug.LogError("maskData == null");
return;
}
- if (maskData.image == null) {
- Debug.LogError ("image == null");
+ if (maskData.image == null)
+ {
+ Debug.LogError("image == null");
return;
}
- if (maskData.landmarkPoints.Count != 68) {
- Debug.LogError ("landmarkPoints.Count != 68");
+ if (maskData.landmarkPoints.Count != 68)
+ {
+ Debug.LogError("landmarkPoints.Count != 68");
return;
}
faceMaskTexture = maskData.image;
- faceMaskMat = new Mat (faceMaskTexture.height, faceMaskTexture.width, CvType.CV_8UC4);
- OpenCVForUnity.UnityUtils.Utils.texture2DToMat (faceMaskTexture, faceMaskMat);
+ faceMaskMat = new Mat(faceMaskTexture.height, faceMaskTexture.width, CvType.CV_8UC4);
+ OpenCVForUnity.UnityUtils.Utils.texture2DToMat(faceMaskTexture, faceMaskMat);
- if (maskData.isDynamicMode) {
- faceRectInMask = DetectFace (faceMaskMat);
- faceLandmarkPointsInMask = DetectFaceLandmarkPoints (faceMaskMat, faceRectInMask);
+ if (maskData.isDynamicMode)
+ {
+ faceRectInMask = DetectFace(faceMaskMat);
+ faceLandmarkPointsInMask = DetectFaceLandmarkPoints(faceMaskMat, faceRectInMask);
maskData.faceRect = faceRectInMask;
maskData.landmarkPoints = faceLandmarkPointsInMask;
- } else {
+ }
+ else
+ {
faceRectInMask = maskData.faceRect;
faceLandmarkPointsInMask = maskData.landmarkPoints;
}
- if (faceRectInMask.width == 0 && faceRectInMask.height == 0) {
- RemoveFaceMask ();
- Debug.LogError ("A face could not be detected from the input image.");
+ if (faceRectInMask.width == 0 && faceRectInMask.height == 0)
+ {
+ RemoveFaceMask();
+ Debug.LogError("A face could not be detected from the input image.");
}
enableColorCorrectionToggle.isOn = maskData.enableColorCorrection;
@@ -816,36 +908,39 @@ namespace FaceMaskExample
///
/// Raises the scan face mask button click event.
///
- public void OnScanFaceMaskButtonClick ()
+ public void OnScanFaceMaskButtonClick()
{
- RemoveFaceMask ();
+ RemoveFaceMask();
// Capture webcam frame.
- if (webCamTextureToMatHelper.IsPlaying ()) {
+ if (webCamTextureToMatHelper.IsPlaying())
+ {
- Mat rgbaMat = webCamTextureToMatHelper.GetMat ();
+ Mat rgbaMat = webCamTextureToMatHelper.GetMat();
- faceRectInMask = DetectFace (rgbaMat);
- if (faceRectInMask.width == 0 && faceRectInMask.height == 0) {
- Debug.Log ("A face could not be detected from the input image.");
+ faceRectInMask = DetectFace(rgbaMat);
+ if (faceRectInMask.width == 0 && faceRectInMask.height == 0)
+ {
+ Debug.Log("A face could not be detected from the input image.");
return;
}
- Rect rect = new Rect ((int)faceRectInMask.x, (int)faceRectInMask.y, (int)faceRectInMask.width, (int)faceRectInMask.height);
- rect.inflate (rect.x / 5, rect.y / 5);
- rect = rect.intersect (new Rect (0, 0, rgbaMat.width (), rgbaMat.height ()));
+ Rect rect = new Rect((int)faceRectInMask.x, (int)faceRectInMask.y, (int)faceRectInMask.width, (int)faceRectInMask.height);
+ rect.inflate(rect.x / 5, rect.y / 5);
+ rect = rect.intersect(new Rect(0, 0, rgbaMat.width(), rgbaMat.height()));
- faceMaskTexture = new Texture2D (rect.width, rect.height, TextureFormat.RGBA32, false);
- faceMaskMat = new Mat (rgbaMat, rect).clone ();
- OpenCVForUnity.UnityUtils.Utils.matToTexture2D (faceMaskMat, faceMaskTexture);
- Debug.Log ("faceMaskMat ToString " + faceMaskMat.ToString ());
+ faceMaskTexture = new Texture2D(rect.width, rect.height, TextureFormat.RGBA32, false);
+ faceMaskMat = new Mat(rgbaMat, rect).clone();
+ OpenCVForUnity.UnityUtils.Utils.matToTexture2D(faceMaskMat, faceMaskTexture);
+ Debug.Log("faceMaskMat ToString " + faceMaskMat.ToString());
- faceRectInMask = DetectFace (faceMaskMat);
- faceLandmarkPointsInMask = DetectFaceLandmarkPoints (faceMaskMat, faceRectInMask);
+ faceRectInMask = DetectFace(faceMaskMat);
+ faceLandmarkPointsInMask = DetectFaceLandmarkPoints(faceMaskMat, faceRectInMask);
- if (faceRectInMask.width == 0 && faceRectInMask.height == 0) {
- RemoveFaceMask ();
- Debug.Log ("A face could not be detected from the input image.");
+ if (faceRectInMask.width == 0 && faceRectInMask.height == 0)
+ {
+ RemoveFaceMask();
+ Debug.Log("A face could not be detected from the input image.");
}
}
}
@@ -853,57 +948,63 @@ namespace FaceMaskExample
///
/// Raises the remove face mask button click event.
///
- public void OnRemoveFaceMaskButtonClick ()
+ public void OnRemoveFaceMaskButtonClick()
{
- RemoveFaceMask ();
+ RemoveFaceMask();
}
- private void RemoveFaceMask ()
+ private void RemoveFaceMask()
{
faceMaskTexture = null;
- if (faceMaskMat != null) {
- faceMaskMat.Dispose ();
+ if (faceMaskMat != null)
+ {
+ faceMaskMat.Dispose();
faceMaskMat = null;
}
- rectangleTracker.Reset ();
- meshOverlay.Reset ();
+ rectangleTracker.Reset();
+ meshOverlay.Reset();
}
- private UnityEngine.Rect DetectFace (Mat mat)
+ private UnityEngine.Rect DetectFace(Mat mat)
{
- if (useDlibFaceDetecter) {
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, mat);
- List result = faceLandmarkDetector.Detect ();
+ if (useDlibFaceDetecter)
+ {
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, mat);
+ List result = faceLandmarkDetector.Detect();
if (result.Count >= 1)
- return result [0];
- } else {
-
- using (Mat grayMat = new Mat ())
- using (Mat equalizeHistMat = new Mat ())
- using (MatOfRect faces = new MatOfRect ()) {
- // convert image to greyscale.
- Imgproc.cvtColor (mat, grayMat, Imgproc.COLOR_RGBA2GRAY);
- Imgproc.equalizeHist (grayMat, equalizeHistMat);
-
- cascade.detectMultiScale (equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size (equalizeHistMat.cols () * 0.15, equalizeHistMat.cols () * 0.15), new Size ());
+ return result[0];
+ }
+ else
+ {
- List faceList = faces.toList ();
- if (faceList.Count >= 1) {
- UnityEngine.Rect r = new UnityEngine.Rect (faceList [0].x, faceList [0].y, faceList [0].width, faceList [0].height);
+ using (Mat grayMat = new Mat())
+ using (Mat equalizeHistMat = new Mat())
+ using (MatOfRect faces = new MatOfRect())
+ {
+ // convert image to greyscale.
+ Imgproc.cvtColor(mat, grayMat, Imgproc.COLOR_RGBA2GRAY);
+ Imgproc.equalizeHist(grayMat, equalizeHistMat);
+
+ cascade.detectMultiScale(equalizeHistMat, faces, 1.1f, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size(equalizeHistMat.cols() * 0.15, equalizeHistMat.cols() * 0.15), new Size());
+
+ List faceList = faces.toList();
+ if (faceList.Count >= 1)
+ {
+ UnityEngine.Rect r = new UnityEngine.Rect(faceList[0].x, faceList[0].y, faceList[0].width, faceList[0].height);
// corrects the deviation of a detection result between OpenCV and Dlib.
r.y += (int)(r.height * 0.1f);
return r;
}
}
}
- return new UnityEngine.Rect ();
+ return new UnityEngine.Rect();
}
- private List DetectFaceLandmarkPoints (Mat mat, UnityEngine.Rect rect)
+ private List DetectFaceLandmarkPoints(Mat mat, UnityEngine.Rect rect)
{
- OpenCVForUnityUtils.SetImage (faceLandmarkDetector, mat);
- List points = faceLandmarkDetector.DetectLandmark (rect);
+ OpenCVForUnityUtils.SetImage(faceLandmarkDetector, mat);
+ List points = faceLandmarkDetector.DetectLandmark(rect);
return points;
}
diff --git a/Assets/StreamingAssets/dance.avi.meta b/Assets/StreamingAssets/dance.avi.meta
deleted file mode 100644
index 8fa2299..0000000
--- a/Assets/StreamingAssets/dance.avi.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: b5b15518ef2238443905fff4839cfaec
-timeCreated: 1483051440
-licenseType: Free
-MovieImporter:
- serializedVersion: 1
- quality: .5
- linearTexture: 0
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/StreamingAssets/dance.avi b/Assets/StreamingAssets/dance_mjpeg.mjpeg
similarity index 100%
rename from Assets/StreamingAssets/dance.avi
rename to Assets/StreamingAssets/dance_mjpeg.mjpeg
diff --git a/Assets/StreamingAssets/dance_mjpeg.mjpeg.meta b/Assets/StreamingAssets/dance_mjpeg.mjpeg.meta
new file mode 100644
index 0000000..24dedbe
--- /dev/null
+++ b/Assets/StreamingAssets/dance_mjpeg.mjpeg.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 0855c0873096fe74a830babe059e61ed
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant: