protected override void RecognizeFace(Image <Bgr, byte> face)
        {
            if (students.Length != 0)
            {
                //RESIZE THE FACE TO BE RECOGNIZED SO ITS EQUAL TO THE FACES ALREADY IN THE TRAINING SET
                int width  = 120;
                int height = 120;

                face = FramesManager.ResizeColoredImage(face, new Size(width, height));

                //ATTEMPT TO RECOGNIZE THE PERPETRATOR
                face_recognition_result = faces_manager.MatchFace(face);

                //IF A VALID ID IS RETURMED
                if (face_recognition_result.match_was_found)
                {
                    //GET STUDENT ASSOCIATED WITH ID
                    foreach (var student in students)
                    {
                        if (student.id == face_recognition_result.id)
                        {
                            face_recognition_result.identified_student = student;
                            break;
                        }
                    }
                }

                return;
            }
        }
Пример #2
0
        protected override void RecognizeFace(Image <Bgr, byte> face)
        {
            if (active_perpetrators.Length != 0)
            {
                //RESIZE THE FACE TO RECOGNIZE SO ITS EQUAL TO THE FACES ALREADY IN THE TRAINING SET
                int width  = 120;
                int height = 120;

                face = FramesManager.ResizeColoredImage(face, new Size(width, height));

                //GET ID OF MOST SIMILAR PERPETRATOR
                FaceRecognitionResult result = faces_manager.MatchFace(face);

                //IF A VALID RESULT IS RETURNED
                if (result != null)
                {
                    //IF A VALID ID IS RETURMED
                    if (result.match_was_found)
                    {
                        //GET PERPETRATOR ASSOCIATED WITH ID
                        foreach (var perp in active_perpetrators)
                        {
                            if (perp.id == result.id)
                            {
                                result.identified_perpetrator = perp;
                                break;
                            }
                        }
                    }
                    Singleton.FACE_RECOGNITION_RESULTS.Enqueue(result);
                }
                return;
            }
        }