public void Draw3D(Transform screenTransform, NormalizedLandmarkList landmarkList, bool isFlipped = false)
        {
            if (isEmpty(landmarkList))
            {
                Clear();
                return;
            }

            for (var i = 0; i < NodeSize; i++)
            {
                var landmark = landmarkList.Landmark[i];
                var node     = Nodes[i];

                node.GetComponent <NodeAnnotationController>().Draw3D(screenTransform, landmark, isFlipped, NodeScale);
            }

            for (var i = 0; i < EdgeSize; i++)
            {
                var connection = Connections[i];
                var edge       = Edges[i];

                var a = Nodes[connection.Item1];
                var b = Nodes[connection.Item2];

                edge.GetComponent <EdgeAnnotationController>().Draw(screenTransform, a, b);
            }
        }
Beispiel #2
0
 public void Draw(Transform screenTransform, ClassificationList handedness, NormalizedLandmarkList handLandmarkList,
                  NormalizedRect handRect, List <Detection> palmDetections, bool isFlipped = false)
 {
     handednessAnnotation.GetComponent <ClassificationAnnotationController>().Draw(screenTransform, handedness);
     handLandmarkListAnnotation.GetComponent <HandLandmarkListAnnotationController>().Draw(screenTransform, handLandmarkList, isFlipped);
     handRectAnnotation.GetComponent <RectAnnotationController>().Draw(screenTransform, handRect, isFlipped);
     palmDetectionsAnnotation.GetComponent <DetectionListAnnotationController>().Draw(screenTransform, palmDetections, isFlipped);
 }
Beispiel #3
0
        private IList <NormalizedLandmark> GetIrisLandmarks(NormalizedLandmarkList landmarkList, Side side)
        {
            var irisLandmarks = new List <NormalizedLandmark>(5);
            var offset        = 468 + (side == Side.Left ? 0 : 5);

            for (var i = 0; i < 5; i++)
            {
                irisLandmarks.Add(landmarkList.Landmark[offset + i]);
            }

            return(irisLandmarks);
        }
 private int meshScale = -5; // サイズ調整用の変数
 private void UpdateFaceMesh(NormalizedLandmarkList landmarkList)
 {
     // 顔の頂点分だけ実行(478 - 10 = 468)
     for (var i = 0; i < landmarkList.Landmark.Count - 10; i++)
     {
         var landmark = landmarkList.Landmark[i];
         // 検出したLandmarkをMeshの頂点座標にセット
         vertextList[i] = new Vector3(meshScale * landmark.X, meshScale * landmark.Y, meshScale * landmark.Z);
     }
     // 座標リストをMeshに適用
     faceMesh.SetVertices(vertextList);
 }
Beispiel #5
0
        public void Draw(Transform screenTransform, NormalizedLandmarkList landmarkList,
                         NormalizedRect faceRect, List <Detection> faceDetections, bool isFlipped = false)
        {
            if (landmarkList == null)
            {
                Clear();
                return;
            }

            var leftIrisLandmarks = GetIrisLandmarks(landmarkList, Side.Left);

            leftIrisAnnotation.GetComponent <IrisAnnotationController>().Draw(screenTransform, leftIrisLandmarks, isFlipped);

            var rightIrisLandmarks = GetIrisLandmarks(landmarkList, Side.Right);

            rightIrisAnnotation.GetComponent <IrisAnnotationController>().Draw(screenTransform, rightIrisLandmarks, isFlipped);

            faceLandmarkListAnnotation.GetComponent <FaceLandmarkListAnnotationController>().Draw(screenTransform, landmarkList, isFlipped);
            faceRectAnnotation.GetComponent <RectAnnotationController>().Draw(screenTransform, faceRect, isFlipped);
            faceDetectionsAnnotation.GetComponent <DetectionListAnnotationController>().Draw(screenTransform, faceDetections, isFlipped);
        }
 private bool isEmpty(NormalizedLandmarkList landmarkList)
 {
     return(landmarkList.Landmark.All(landmark => {
         return landmark.X == 0 && landmark.Y == 0 && landmark.Z == 0;
     }));
 }