コード例 #1
0
        private double[] doFaceRecognitionTask(Image image)
        {
            //retrieve from the Config-file if the student image shell should be used (if not set, use default)
            FaceRecognitionTask.setImageImplementation(("false".Equals(ConfigManager.GetSetting("shellUsesDefault")) ? true : false));
            FaceRecognitionTask task = new FaceRecognitionTask(new Bitmap(image));


            try {
                doPreProcessing(task);

                doLocalization(task);

                doExtraction(task);

                if (!task.executePostProcessing())
                {
                    throw new FaceRecognitionTask.FaceRecognitionException("Post-processing: failed!");
                }

                if (!task.executeRepresentation())
                {
                    throw new FaceRecognitionTask.FaceRecognitionException("Representation: failed!");
                }
                else
                {
                    return(task.getFacialParameters());
                }
            } catch (FaceRecognitionTask.FaceRecognitionException e) {
                log("Exception during face recognition:");
                log(e.Message);
            } finally {
                task.dispose();
            }
            return(null);
        }
コード例 #2
0
        private void doLocalization(FaceRecognitionTask task)
        {
            task.prepareLocalization();
            //retrieve from the Config-file if the student algorithms should be used (if not set, use default)

            task.executeLocalizationStep1(("false".Equals(ConfigManager.GetSetting("step2_1UsesDefault")) ? true : false));
            log("Localization step 1: successful!");
            pictureBox4.Image = task.localizationDebug;

            task.executeLocalizationStep2(("false".Equals(ConfigManager.GetSetting("step2_2UsesDefault")) ? true : false));
            log("Localization step 2: successful!");
            pictureBox4.Image = task.localizationDebug;

            task.executeLocalizationStep3(("false".Equals(ConfigManager.GetSetting("step2_3UsesDefault")) ? true : false));
            log("Localization step 3: successful!");
            pictureBox4.Image = task.localizationDebug;


            task.executeLocalizationStep4(("false".Equals(ConfigManager.GetSetting("step2_4UsesDefault")) ? true : false));
            log("Localization step 4: successful!");
            pictureBox4.Image = task.localizationDebug;

            task.executeLocalizationStep5(("false".Equals(ConfigManager.GetSetting("step2_5UsesDefault")) ? true : false));
            log("Localization step 5: successful!");
            pictureBox4.Image = task.localizationDebug;
        }
コード例 #3
0
        private void doPreProcessing(FaceRecognitionTask task)
        {
            //retrieve from the Config-file if the student algorithms should be used (if not set, use default)

            task.executePreProcessingStep1(("false".Equals(ConfigManager.GetSetting("step1_1UsesDefault")) ? true : false));
            log("PreProcessing step 1: successful!");

            task.executePreProcessingStep2(("false".Equals(ConfigManager.GetSetting("step1_2UsesDefault")) ? true : false));
            log("PreProcessing step 2: successful!");
            pictureBox2.Image = task.preProcessing2;

            task.executePreProcessingStep3(("false".Equals(ConfigManager.GetSetting("step1_3UsesDefault")) ? true : false));
            log("PreProcessing step 3: successful!");

            task.executePreProcessingStep4(("false".Equals(ConfigManager.GetSetting("step1_4UsesDefault")) ? true : false));
            log("PreProcessing step 4: successful!");
            pictureBox3.Image = task.preProcessing4;
        }