Пример #1
0
        private static void AddAcquisitionModeStrategy(ref AssociativeTuple <string, AcquisitionModeStrategy> io_x_AcquisitionModeStrategyMap, AcquisitionModeStrategy i_e_AcquisitionModeStrategy)
        {
            switch (i_e_AcquisitionModeStrategy)
            {
            case AcquisitionModeStrategy.EXPERT:
                io_x_AcquisitionModeStrategyMap["Expert"] = AcquisitionModeStrategy.EXPERT;
                break;

            case AcquisitionModeStrategy.UNIVERSAL_FAST:
                io_x_AcquisitionModeStrategyMap["Universal (fast)"] = AcquisitionModeStrategy.UNIVERSAL_FAST;
                break;

            case AcquisitionModeStrategy.UNIVERSAL_ACCURATE:
                io_x_AcquisitionModeStrategyMap["Universal (accurate)"] = AcquisitionModeStrategy.UNIVERSAL_ACCURATE;
                break;

            case AcquisitionModeStrategy.FULL_MULTIMODAL:
                io_x_AcquisitionModeStrategyMap["Full multimodal"] = AcquisitionModeStrategy.FULL_MULTIMODAL;
                break;

            case AcquisitionModeStrategy.ANTI_SPOOFING:
                io_x_AcquisitionModeStrategyMap["Anti-spoofing"] = AcquisitionModeStrategy.ANTI_SPOOFING;
                break;

            default:
                throw new InvalidParameterException("Unknown acquisition mode strategy value", ErrorCodes.IED_ERR_INTERNAL);
            }
        }
Пример #2
0
        private static void AddTemplateFormat(ref AssociativeTuple <string, TemplateFormat> io_x_TemplateFormatMap, TemplateFormat i_e_TemplateFormat)
        {
            switch (i_e_TemplateFormat)
            {
            case TemplateFormat.CFV:
                io_x_TemplateFormatMap["Morpho CFV Fingerprint Template"] = TemplateFormat.CFV;
                break;

            case TemplateFormat.PKMAT:
                io_x_TemplateFormatMap["Morpho PkMat Fingerprint Template"] = TemplateFormat.PKMAT;
                break;

            case TemplateFormat.PKCOMPV2:
                io_x_TemplateFormatMap["Morpho PkComp V2 Fingerprint Template"] = TemplateFormat.PKCOMPV2;
                break;

            case TemplateFormat.PKLITE:
                io_x_TemplateFormatMap["Morpho PkLite Fingerprint Template"] = TemplateFormat.PKLITE;
                break;

            case TemplateFormat.PK_FVP:
                io_x_TemplateFormatMap["Morpho PkFVP Finger Vein/Fingerprint Template"] = TemplateFormat.PK_FVP;
                break;

            case TemplateFormat.ANSI_378:
                io_x_TemplateFormatMap["ANSI INCITS 378-2004 Finger Minutiae Record"] = TemplateFormat.ANSI_378;
                break;

            case TemplateFormat.ISO_19794_2_FMR:
                io_x_TemplateFormatMap["ISO/IEC 19794-2:2005 Finger Minutiae Record"] = TemplateFormat.ISO_19794_2_FMR;
                break;

            case TemplateFormat.ISO_19794_2_Card_Format_Normal_Size:
                io_x_TemplateFormatMap["ISO/IEC 19794-2:2005 Finger Minutiae Card Format Normal Size"] = TemplateFormat.ISO_19794_2_Card_Format_Normal_Size;
                break;

            case TemplateFormat.ISO_19794_2_Card_Format_Compact_Size:
                io_x_TemplateFormatMap["ISO/IEC 19794-2:2005 Finger Minutiae Card Format Compact Size"] = TemplateFormat.ISO_19794_2_Card_Format_Compact_Size;
                break;

            case TemplateFormat.PKMAT_NORM:
                io_x_TemplateFormatMap["Morpho PkMat Norm Fingerprint Template"] = TemplateFormat.PKMAT_NORM;
                break;

            case TemplateFormat.PKCOMPV2_NORM:
                io_x_TemplateFormatMap["Morpho PkComp V2 Norm Fingerprint Template"] = TemplateFormat.PKCOMPV2_NORM;
                break;

            default:
                throw new InvalidParameterException("Unknown template format value", ErrorCodes.IED_ERR_INTERNAL);
            }
        }
Пример #3
0
        private static void AddSecurityLevel(ref AssociativeTuple <string, ExtendedSecurityLevel> io_x_SecurityLevelMap, ExtendedSecurityLevel i_e_SecurityLevel)
        {
            switch (i_e_SecurityLevel)
            {
            case ExtendedSecurityLevel.STANDARD:
                io_x_SecurityLevelMap["Standard"] = ExtendedSecurityLevel.STANDARD;
                break;

            case ExtendedSecurityLevel.MEDIUM:
                io_x_SecurityLevelMap["Medium"] = ExtendedSecurityLevel.MEDIUM;
                break;

            case ExtendedSecurityLevel.HIGH:
                io_x_SecurityLevelMap["High"] = ExtendedSecurityLevel.HIGH;
                break;

            case ExtendedSecurityLevel.CRITICAL:
                io_x_SecurityLevelMap["Critical"] = ExtendedSecurityLevel.CRITICAL;
                break;

            default:
                throw new InvalidParameterException("Unknown security level value", ErrorCodes.IED_ERR_INTERNAL);
            }
        }
Пример #4
0
        private static void AddCoderAlgorithm(ref AssociativeTuple <string, CoderAlgorithm> io_x_CoderAlgorithmMap, CoderAlgorithm i_e_CoderAlgorithm)
        {
            switch (i_e_CoderAlgorithm)
            {
            case CoderAlgorithm.EmbeddedCoder:
                io_x_CoderAlgorithmMap["Device Embedded Coder"] = CoderAlgorithm.EmbeddedCoder;
                break;

            case CoderAlgorithm.V6:
                io_x_CoderAlgorithmMap["Morpho V6 Coder"] = CoderAlgorithm.V6;
                break;

            case CoderAlgorithm.V9:
                io_x_CoderAlgorithmMap["Morpho V9 Coder"] = CoderAlgorithm.V9;
                break;

            case CoderAlgorithm.V10:
                io_x_CoderAlgorithmMap["Morpho V10 Coder"] = CoderAlgorithm.V10;
                break;

            default:
                throw new InvalidParameterException("Unknown coder algorithm value", ErrorCodes.IED_ERR_INTERNAL);
            }
        }
Пример #5
0
        private void buttonVerify_Click(object sender, EventArgs e)
        {
            try
            {
                //Select File
                OpenFileDialog dlg = new OpenFileDialog();

                dlg.Multiselect = false;
                dlg.Title       = "Select reference template";

                Dictionary <TemplateFormat, string> l_x_TemplateFormatFilterMap = new Dictionary <TemplateFormat, string>();

                l_x_TemplateFormatFilterMap[TemplateFormat.CFV]             = "Morpho CFV Fingerprint Template (*.cfv)|*.cfv";
                l_x_TemplateFormatFilterMap[TemplateFormat.PKMAT]           = "Morpho PkMat Fingerprint Template (*.pkmat)|*.pkmat";
                l_x_TemplateFormatFilterMap[TemplateFormat.PKCOMPV2]        = "Morpho PkComp V2 Fingerprint Template (*.pkc)|*.pkc";
                l_x_TemplateFormatFilterMap[TemplateFormat.PKLITE]          = "Morpho PkLite Fingerprint Template (*.pklite)|*.pklite";
                l_x_TemplateFormatFilterMap[TemplateFormat.PK_FVP]          = "Morpho PkFVP Finger Vein/Fingerprint Template (*.fvp)|*.fvp";
                l_x_TemplateFormatFilterMap[TemplateFormat.ANSI_378]        = "ANSI INCITS 378-2004 Finger Minutiae Record (*.ansi-fmr)|*.ansi-fmr";
                l_x_TemplateFormatFilterMap[TemplateFormat.ISO_19794_2_FMR] = "ISO/IEC 19794-2:2005 Finger Minutiae Record (*.iso-fmr)|*.iso-fmr";
                l_x_TemplateFormatFilterMap[TemplateFormat.ISO_19794_2_Card_Format_Normal_Size]  = "ISO/IEC 19794-2:2005 Finger Minutiae Card Format Normal Size (*.iso-fmc-ns)|*.iso-fmc-ns";
                l_x_TemplateFormatFilterMap[TemplateFormat.ISO_19794_2_Card_Format_Compact_Size] = "ISO/IEC 19794-2:2005 Finger Minutiae Card Format Compact Size (*.iso-fmc-cs)|*.iso-fmc-cs";
                l_x_TemplateFormatFilterMap[TemplateFormat.PKMAT_NORM]    = "Morpho PkMat Norm Fingerprint Template (*.pkmn)|*.pkmn";
                l_x_TemplateFormatFilterMap[TemplateFormat.PKCOMPV2_NORM] = "Morpho PkComp V2 Norm Fingerprint Template (*.pkcn)|*.pkcn";


                AssociativeTuple <int, TemplateFormat> l_x_FilterTemplates = new AssociativeTuple <int, TemplateFormat>();
                string l_x_Filter      = string.Empty;
                int    l_i_FilterIndex = -1;
                int    l_i_FilterCount = 1;

                foreach (TemplateFormat l_x_TemplateFormat in CurrentDeviceLayoutConfig.VerifyTemplateFormats.Seconds)
                {
                    l_x_FilterTemplates[l_i_FilterCount] = l_x_TemplateFormat;
                    l_x_Filter += l_x_TemplateFormatFilterMap[l_x_TemplateFormat] + "|";

                    if (l_x_TemplateFormat == CurrentDeviceLayoutConfig.FPTemplateFormats[this.comboBoxFPFormat.SelectedItem.ToString()] ||
                        (CurrentDeviceLayoutConfig.FVPTemplatesSupported && (l_x_TemplateFormat == CurrentDeviceLayoutConfig.FVPTemplateFormats[this.comboBoxFVPFormat.SelectedItem.ToString()])))
                    {
                        l_i_FilterIndex = l_i_FilterCount;
                    }

                    l_i_FilterCount++;
                }

                if (CurrentDeviceLayoutConfig.FVPTemplatesSupported)
                {
                    l_x_FilterTemplates[l_i_FilterCount] = CurrentDeviceLayoutConfig.FVPTemplateFormats[CurrentDeviceLayoutConfig.FVPTemplateDefaultValue];

                    if (l_i_FilterIndex == -1)
                    {
                        l_i_FilterIndex = l_x_FilterTemplates[CurrentDeviceLayoutConfig.FVPTemplateFormats[CurrentDeviceLayoutConfig.FVPTemplateDefaultValue]];
                    }
                }
                else
                {
                    l_x_FilterTemplates[l_i_FilterCount] = CurrentDeviceLayoutConfig.FPTemplateFormats[CurrentDeviceLayoutConfig.FPTemplateDefaultValue];

                    if (l_i_FilterIndex == -1)
                    {
                        l_i_FilterIndex = l_x_FilterTemplates[CurrentDeviceLayoutConfig.FPTemplateFormats[CurrentDeviceLayoutConfig.FPTemplateDefaultValue]];
                    }
                }

                l_x_Filter += "All Files (*.*)|*.*";

                dlg.Filter      = l_x_Filter;
                dlg.FilterIndex = l_i_FilterIndex;

                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    //Cancel by User
                    return;
                }

                //Open Template
                FileStream fs = new FileStream(dlg.FileName, FileMode.Open, FileAccess.Read);
                Byte[]     reference_template = new Byte[(int)fs.Length];
                fs.Read(reference_template as Byte[], 0, (int)fs.Length);
                fs.Close();

                //Init Acquisition Component
                InitAcquisition(ref GenericAcqComponent);

                // Retrieve the template format selected by user for the reference template
                TemplateFormat l_e_ReferenceTemplateFormat = l_x_FilterTemplates[dlg.FilterIndex];

                // Backup the previous template format value
                TemplateFormat l_e_PreviousTemplateFormat = GenericAcqComponent.TemplateFormat;

                // Set MorphoAcquisition template format to the reference template format
                GenericAcqComponent.TemplateFormat = l_e_ReferenceTemplateFormat;

                //Run Acquisition
                VerifyResult result = GenericAcqComponent.RunCaptureVerify(reference_template);

                // Restore MorphoAcquisition previous template format
                GenericAcqComponent.TemplateFormat = l_e_PreviousTemplateFormat;

                if ((result.Status != ErrorCodes.IED_NO_ERROR) && (result.Status != ErrorCodes.IED_ERR_NO_HIT))
                {
                    // Error happened (matching not done)
                    MessageBox.Show(String.Format("Verification failed with error {0}.", result.Status), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (result.Status == ErrorCodes.IED_ERR_NO_HIT)
                {
                    // Sensor returned NO_HIT
                    MessageBox.Show("Authentication failed.", "Authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (this.CurrentComponentType == DeviceType.ACTIVE_MACI)
                {
                    // MorphoAccess does not indicate the matching score so it is not pertinent to check it
                    MessageBox.Show("Authentication succeeded.", "Authentication succeeded", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (result.AuthenticationScore >= Convert.ToInt16(textBoxAuthent.Text))
                {
                    // Other wise, we check the matching score
                    MessageBox.Show(String.Format("Authentication succeeded, score : {0}", result.AuthenticationScore),
                                    "Authentication succeeded", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    // This should never happen
                    MessageBox.Show(String.Format("Authentication failed, score : {0}", result.AuthenticationScore),
                                    "Authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, exc.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }