public void DataMatchesCorrectly()
        {
            var brady = this.ReadResult("brady.fmb");
            var matt = this.ReadResult("matt.fmb");
            var rosack = this.ReadResult("rosack.fmb");
            var rosackTest = this.ReadResult("rosack_test.fmb");

            var processor = new FaceModelRecognitionProcessor(new List<IFaceModelTargetFace> { brady, matt, rosack });
            var result = new FaceModelRecognitionProcessorResult();
            result.Deformations = rosackTest.Deformations;
            result.HairColor = rosackTest.HairColor;
            result.SkinColor = rosackTest.SkinColor;

            processor.Process(result);

            Assert.AreEqual("Rosack", result.Key);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Processes the subject data (contained in result) against the target faces
        /// </summary>
        public void Process(FaceModelRecognitionProcessorResult result)
        {
            lock (this.processingMutex)
            {
                result.Score = double.MaxValue;

                foreach (var targetFace in this.faces)
                {
                    var score = this.ScoreFaceDifferences(result, targetFace);

                    if (score < this.Threshold && score < result.Score)
                    {
                        result.Score = score;
                        result.Key   = targetFace.Key;
                    }
                }
            }
        }
        /// <summary>
        /// Attempt to find a trained face
        /// </summary>
        public IRecognitionProcessorResult Process(Bitmap colorSpaceBitmap, KinectFaceTrackingResult trackingResults)
        {
            lock (this.processingMutex)
            {
                var result = new FaceModelRecognitionProcessorResult();

                if (trackingResults.ConstructedFaceModel != null)
                {
                    result.Deformations = trackingResults.ConstructedFaceModel.FaceShapeDeformations;
                    result.HairColor = this.UIntToColor(trackingResults.ConstructedFaceModel.HairColor);
                    result.SkinColor = this.UIntToColor(trackingResults.ConstructedFaceModel.SkinColor);

                    this.Process(result);
                }

                return result;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Attempt to find a trained face
        /// </summary>
        public IRecognitionProcessorResult Process(Bitmap colorSpaceBitmap, KinectFaceTrackingResult trackingResults)
        {
            lock (this.processingMutex)
            {
                var result = new FaceModelRecognitionProcessorResult();

                if (trackingResults.ConstructedFaceModel != null)
                {
                    result.Deformations = trackingResults.ConstructedFaceModel.FaceShapeDeformations;
                    result.HairColor    = this.UIntToColor(trackingResults.ConstructedFaceModel.HairColor);
                    result.SkinColor    = this.UIntToColor(trackingResults.ConstructedFaceModel.SkinColor);

                    this.Process(result);
                }

                return(result);
            }
        }
        /// <summary>
        /// Processes the subject data (contained in result) against the target faces
        /// </summary>
        public void Process(FaceModelRecognitionProcessorResult result)
        {
            lock (this.processingMutex)
            {
                result.Score = double.MaxValue;

                foreach (var targetFace in this.faces)
                {
                    var score = this.ScoreFaceDifferences(result, targetFace);

                    if (score < this.Threshold && score < result.Score)
                    {
                        result.Score = score;
                        result.Key = targetFace.Key;
                    }
                }
            }
        }