Пример #1
0
        public void MakePrediction(ARFaceAnchor faceAnchor)
        {
            if (testingDot == null)
            {
                return;
            }

            var gaze = GazePredictionInput.FromAnchor(faceAnchor, motionManager.DeviceMotion.Attitude);

            try
            {
                var yPrediction = yModel.GetPrediction(gaze, out NSError yPredictionError);
                var yResult     = yPrediction.GetFeatureValue("yPoint").DoubleValue;

                var xPrediction = xModel.GetPrediction(gaze, out NSError xPredictionError);
                var xResult     = xPrediction.GetFeatureValue("xPoint").DoubleValue;

                System.Console.WriteLine($"Prediction is: ({xResult}, {yResult}");

                testingDot.Position = new CGPoint(xResult, yResult);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex);
            }
        }
Пример #2
0
        public static GazePredictionInput FromAnchor(ARFaceAnchor faceAnchor, CMAttitude attitude)
        {
            var snapshot = new GazePredictionInput();

            snapshot.SetAttitude(attitude);
            snapshot.SetTransform(faceAnchor.Transform);
            snapshot.SetBlendingShapes(faceAnchor.BlendShapes);

            return(snapshot);
        }