Esempio n. 1
0
        public EnrollView(string subjectId)
        {
            InitializeComponent();
            openFileDialog.Filter = NImages.GetOpenFileFilterString(true, true);
            string component = "Biometrics.FingerExtraction,Biometrics.FingerMatching,Devices.FingerScanners,Images.WSQ,Biometrics.FingerSegmentation,Biometrics.FingerQualityAssessmentBase";

            ControllerUtils.ObtainLicense(component);
        }
        public IdentificationFromImage(string subjectID, string templateFile)
        {
            string components = "Biometrics.FingerMatching";

            //obtain license

            ControllerUtils.ObtainLicense(components);
            using (var biometricClient = new NBiometricClient())
                // Read template


                using (NSubject subject = CreateSubject(templateFile, subjectID))
                {
                    //Identification done from IdentificationFromDatabase constructor
                    IdentificationFromDatabase identify = new IdentificationFromDatabase(subject);
                }
        }
Esempio n. 3
0
        public EnrollmentFromImage(string subjectID, string imageFile)
        {
            string components = "Biometrics.FingerExtraction";

            //call Obtain License to obtain license
            ControllerUtils.ObtainLicense(components);

            try {
                using (var biometricClient = new NBiometricClient {
                    UseDeviceManager = true
                })
                    // using (var deviceManager = biometricClient.DeviceManager)
                    using (var subject = new NSubject())
                        using (var finger = new NFinger())
                        {
                            finger.FileName = imageFile;
                            subject.Fingers.Add(finger);
                            subject.Id = subjectID; //ID number in the database

                            //Set finger template size (recommended, for enroll to database, is large)
                            biometricClient.FingersTemplateSize = NTemplateSize.Large;

                            NBiometricStatus status = NBiometricStatus.InternalError;

                            //creates template using the image
                            status = biometricClient.CreateTemplate(subject);
                            if (status == NBiometricStatus.Ok)
                            {
                                ControllerUtils.SaveTemplate(subject);

                                //enroll into database using EnrollToDatabase Constructor
                                EnrollToDatabase enrollToDatabase = new EnrollToDatabase(status, subject);
                            }
                            else
                            {
                                Console.WriteLine("Extraction failed! Status: {0}", status);
                            }
                        }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            // return 0;
        }
        public IdentificationFromScanner(string subjectID, NSubject subject)
        {
            const string components = "Biometrics.FingerExtraction,Biometrics.FingerMatching";

            //Obtain license
            ControllerUtils.ObtainLicense(components);

            using (var biometricClient = new NBiometricClient {
                UseDeviceManager = true
            })
                using (var deviceManager = biometricClient.DeviceManager)
                    // using (var subject = new NSubject())
                    using (var finger = new NFinger())
                    {
                        ////set type of the device used
                        //deviceManager.DeviceTypes = NDeviceType.FingerScanner;
                        ////initialize the NDeviceManager
                        //deviceManager.Initialize();

                        //int i;
                        ////get count of connected devices
                        //int count = deviceManager.Devices.Count;

                        //if (count > 0)
                        //    MessageBox.Show("found " + count + "finger scanners");
                        //else
                        //{
                        //    MessageBox.Show("no finger scanners found, exiting ...\n");
                        //    // return -1;
                        //}
                        ////list detected scanners
                        //if (count > 1)
                        //    MessageBox.Show("Please select finger scanner from the list: ");
                        //for (i = 0; i < count; i++)
                        //{
                        //    NDevice device = deviceManager.Devices[i];
                        //    MessageBox.Show(i + 1 + " " + device.DisplayName);
                        //}
                        ////finger scanner selection by user
                        //if (count > 1)
                        //{
                        //    MessageBox.Show("Please enter finger scanner index: ");
                        //    string line = Console.ReadLine();
                        //    if (line == null) throw new ApplicationException("Nothing read from standard input");
                        //    i = int.Parse(line);
                        //    if (i > count || i < 1)
                        //    {
                        //        MessageBox.Show("Incorrect index provided, exiting ...");
                        //        //return -1;
                        //    }
                        //}
                        //i--;

                        ////set the selected finger scanner as NBiometricClient Finger Scanner
                        //biometricClient.FingerScanner = (NFScanner)deviceManager.Devices[i];

                        ////add NFinger to NSubject
                        //subject.Fingers.Add(finger);
                        //MessageBox.Show("Place your finger on the scanner");
                        ////start capturing
                        //NBiometricStatus status = biometricClient.Capture(subject);
                        //if (status != NBiometricStatus.Ok)
                        //{
                        //    MessageBox.Show("Failed to capture: " + status);
                        //    // return -1;
                        //}
                        //MessageBox.Show("Captured ");
                        //Set finger template size (recommended, for enroll to database, is large) (optional)
                        biometricClient.FingersTemplateSize = NTemplateSize.Large;
                        subject.Id = subjectID;
                        //Create template from added finger image
                        NBiometricStatus status = biometricClient.CreateTemplate(subject);
                        //identification from IdentificationFromDatabase from model class
                        IdentificationFromDatabase idm = new IdentificationFromDatabase(subject);
                    }
        }