private void Awake()
    {
        // Debug.Log("GAME eventMANAGER Awake");

        //  FindObjectOfType<cursorkiller>().ShouldIkillCursor();
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
Esempio n. 2
0
        /// <summary>
        /// Marks detected objects on the texture
        /// </summary>
        public void MarkDetected(bool drawSubItems = true)
        {
            int facesdetected = 0;

            // mark each found eye
            foreach (DetectedFace face in Faces)
            {
                // face rect
                Cv2.Rectangle((InputOutputArray)Image, face.Region, Scalar.FromRgb(255, 0, 0), 2);

                if (facesdetected < 1)
                {
                    MasterEVNTmanager.CALL_RectReady(face.Region.X, face.Region.Y + face.Region.Height + 10, face.Region.Width - 10, face.Region.Height);
                }
                facesdetected++;
                // convex hull
                //Cv2.Polylines(Image, new IEnumerable<Point>[] { face.Info.ConvexHull }, true, Scalar.FromRgb(255, 0, 0), 2);

                // render face triangulation (should we have one)
                if (face.Info != null)
                {
                    foreach (DetectedFace.Triangle tr in face.Info.DelaunayTriangles)
                    {
                        Cv2.Polylines(Image, new IEnumerable <Point>[] { tr.ToArray() }, true, Scalar.FromRgb(0, 0, 255), 1);
                    }
                }

                // Sub-items
                if (drawSubItems)
                {
                    List <string> closedItems = new List <string>(new string[] { "Nose", "Eye", "Lip" });
                    foreach (DetectedObject sub in face.Elements)
                    {
                        if (sub.Marks != null)
                        {
                            Cv2.Polylines(Image, new IEnumerable <Point>[] { sub.Marks }, closedItems.Contains(sub.Name), Scalar.FromRgb(0, 255, 0), 1);
                        }
                    }
                }
            }
        }