Exemplo n.º 1
0
 protected DPFP.FeatureSet ExtractFeatures(DPFP.Sample Sample, DPFP.Processing.DataPurpose Purpose)
 {
     DPFP.Processing.FeatureExtraction Extractor = new DPFP.Processing.FeatureExtraction();      // Create a feature extractor
     DPFP.Capture.CaptureFeedback      feedback  = DPFP.Capture.CaptureFeedback.None;
     DPFP.FeatureSet features = new DPFP.FeatureSet();
     Extractor.CreateFeatureSet(Sample, Purpose, ref feedback, ref features);                    // TODO: return features as a result?
     debugFeedback = feedback;
     if (feedback == DPFP.Capture.CaptureFeedback.Good)
     {
         notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_CaptureGood, "Capture is Good");
         if (NotifyEvent != null)
         {
             NotifyEvent(this, notifyEvent);
         }
         return(features);
     }
     else
     {
         notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_CaptureBad, feedback.ToString());
         if (NotifyEvent != null)
         {
             NotifyEvent(this, notifyEvent);
         }
         return(null);
     }
 }
Exemplo n.º 2
0
 protected void Stop()
 {
     SetTextBox("Request Stop", DateTime.Now);
     if (null != Capturer)
     {
         try
         {
             Capturer.StopCapture();
             notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerSucceedToStopCapture, "Fingerprint Stopped");
             if (NotifyEvent != null)
             {
                 SetTextBox("Fingerprint Stopped", DateTime.Now);
                 NotifyEvent(this, notifyEvent);
             }
         }
         catch
         {
             notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerFailedToStopCapture, "Fingerprint fails to stop");
             if (NotifyEvent != null)
             {
                 SetTextBox("Can't terminate capture!", DateTime.Now);
                 NotifyEvent(this, notifyEvent);
             }
         }
     }
 }
Exemplo n.º 3
0
 protected void Start()
 {
     SetTextBox("Request Start", DateTime.Now);
     if (null != Capturer)
     {
         try
         {
             Capturer.StartCapture();
             if (Mode == FingerprintMode.Verify)
             {
                 notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerSucceedToStartCapture, "Fingerprint wait Capture");
                 if (NotifyEvent != null)
                 {
                     SetTextBox("Capture Process", DateTime.Now);
                     NotifyEvent(this, notifyEvent);
                 }
             }
         }
         catch
         {
             notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerFailedToStartCapture, "Can't initiate capture!");
             if (NotifyEvent != null)
             {
                 SetTextBox("Can't initiate capture!", DateTime.Now);
                 NotifyEvent(this, notifyEvent);
             }
         }
     }
 }
Exemplo n.º 4
0
        protected virtual void Init(string serialFinger)
        {
            try
            {
                SetTextBox("Request Init", DateTime.Now);
                Stop();
                if (serialFinger != null)
                {
                    Capturer = new DPFP.Capture.Capture(serialFinger, DPFP.Capture.Priority.Low);                        // Create a capture operation.
                }
                else
                {
                    Capturer = new DPFP.Capture.Capture(DPFP.Capture.Priority.Low);
                }

                if (null != Capturer)
                {
                    Capturer.EventHandler = this;
                    notifyEvent           = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerSucceedToInit, "Finger Initialized");
                    if (NotifyEvent != null)
                    {
                        SetTextBox("Finger Initialized", DateTime.Now);// Subscribe for capturing events.
                        NotifyEvent(this, notifyEvent);
                    }
                }
                else
                {
                    notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerFailedToInit, "Finger failed to Initialize");
                    if (NotifyEvent != null)
                    {
                        SetTextBox("Can't initiate capture operation!", DateTime.Now);
                        NotifyEvent(this, notifyEvent);
                    }
                }
            }
            catch
            {
                notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerFailedToInit, "Finger failed to Initialize");
                if (NotifyEvent != null)
                {
                    SetTextBox("Finger failed to Initialize", DateTime.Now);
                    NotifyEvent(this, notifyEvent);
                }
            }
            if (Mode == FingerprintMode.Verify)
            {
                Verificator = new DPFP.Verification.Verification(FarThreshold);         // Create a fingerprint template verificator FAR 0.01% > 214748
                SetTextBox("Init Verificator with FAR : " + Verificator.FARRequested.ToString(), DateTime.Now);
                if (bUseEmbedDB)
                {
                    #if UseSQLITE
                    DBClassUser dbJob = new DBClassUser(UserList);
                    dbJob.RecoverUser();
                    #endif
                }
            }
        }
Exemplo n.º 5
0
        public void OnReaderDisconnect(object Capture, string ReaderSerialNumber)
        {
            // Stop();

            notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerprintDisconnect, "The fingerprint reader was disconnected.");
            if (NotifyEvent != null)
            {
                SetTextBox("The fingerprint reader was disconnected.", DateTime.Now);
                NotifyEvent(this, notifyEvent);
            }
        }
Exemplo n.º 6
0
 public void OnReaderConnect(object Capture, string ReaderSerialNumber)
 {
     /*Init(FingerSerialNumber);
      * Start();   */
     TimeFingerTouch = DateTime.Now;
     notifyEvent     = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerprintConnect, "The fingerprint reader was connected.");
     if (NotifyEvent != null)
     {
         SetTextBox("The fingerprint reader was connected.", DateTime.Now);
         NotifyEvent(this, notifyEvent);
     }
 }
Exemplo n.º 7
0
        public void OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample)
        {
            bIsProcessed = true;

            notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_CaptureGood, "The finger was successively capture by the fingerprint reader.");
            if (NotifyEvent != null)
            {
                SetTextBox("The finger was successively capture by the fingerprint reader.", DateTime.Now);
                NotifyEvent(this, notifyEvent);
            }

            saveBitmap(new Bitmap(ConvertSampleToBitmap(Sample)));
            BmpFP = new Bitmap(ConvertSampleToBitmap(Sample));
            Process(Sample);
        }
Exemplo n.º 8
0
        public void OnFingerTouch(object Capture, string ReaderSerialNumber)
        {
            bIsProcessed        = false;
            serialFingerTouched = ReaderSerialNumber;
            notifyEvent         = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerTouch, "The fingerprint reader was touched.");
            if (NotifyEvent != null)
            {
                SetTextBox("The fingerprint reader was touched.", DateTime.Now);
                NotifyEvent(this, notifyEvent);
            }


            TimeFingerTouch = DateTime.Now;
            CloseFarFinger  = int.MaxValue;
            debugFeedback   = DPFP.Capture.CaptureFeedback.None;
            BmpFP           = null;
            TimeFingerGone  = TimeFingerTouch;
            debugFirstName  = string.Empty;
            debugLastName   = string.Empty;
            debugFinger     = FingerIndexValue.Unknown_Finger;
            pathImage       = string.Empty;

            errorCaptFP = true;
        }
Exemplo n.º 9
0
        public void OnFingerGone(object Capture, string ReaderSerialNumber)
        {
            TimeSpan ts = TimeSpan.MinValue;

            notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerGone, "The finger was removed from the fingerprint reader.");
            if (NotifyEvent != null)
            {
                SetTextBox("The finger was removed from the fingerprint reader.", DateTime.Now);
                NotifyEvent(this, notifyEvent);
            }

            try
            {
                TimeFingerGone = DateTime.Now;
                ts             = TimeFingerGone - TimeFingerTouch;
                if ((debugFP) && (ts.TotalSeconds < 10.0) && (errorCaptFP))
                {
                    DebugFP wf = new DebugFP(debugFPFormVisible,
                                             debugWindowTimeout,
                                             sendDebugMail,
                                             BmpFP,
                                             this.ReaderSerialNumber,
                                             TimeFingerTouch,
                                             TimeFingerGone,
                                             debugFirstName,
                                             debugLastName,
                                             debugFinger,
                                             CloseFarFinger,
                                             FarThreshold,
                                             debugFeedback,
                                             pathImage,
                                             bIsProcessed,
                                             SenderAdress,
                                             LoginName,
                                             Password,
                                             SMTPServer,
                                             SMTPPort);
                    wf.Show();

                    errorCaptFP = false;
                }
            }
            catch (Exception exp)
            {
                SetTextBox("FP exception : " + exp.Message, DateTime.Now);
                //MessageBox.Show("FP exception : " + exp.Message);
            }


            if (!bIsProcessed)
            {
                //renewFP();
                //Stop();
                //Init(FingerSerialNumber);
                //Start();
                //System.Threading.Thread.Sleep(500);
                notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_CaptureBad, "The finger was not successively capture by the fingerprint reader.");
                if (NotifyEvent != null)
                {
                    SetTextBox("The finger was not successively capture by the fingerprint reader.", DateTime.Now);
                    NotifyEvent(this, notifyEvent);
                }
            }
        }
Exemplo n.º 10
0
        protected virtual void Process(DPFP.Sample Sample)
        {
            if (Mode == FingerprintMode.Verify)
            {
                bool      bVerified    = false;
                int       fingerFind   = -1;
                UserClass VerifiedUser = new UserClass();

                // Process the sample and create a feature set for the enrollment purpose.
                DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

                if (features != null)
                {
                    foreach (UserClass TheUser in UserList)
                    {
                        FingerData fingdata = new FingerData();
                        fingdata.CopyUserToFinger(TheUser);

                        //foreach (DPFP.Template Template in fingdata.Templates)
                        for (int index = 0; index < 10; index++)
                        {
                            DPFP.Template Template = fingdata.Templates[index];
                            if (Template != null)
                            {
                                FingerIndexValue fiv = (FingerIndexValue)index;
                                // Compare the feature set with our template
                                DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                                Verificator.Verify(features, Template, ref result);

                                SetTextBox("Verify : " + TheUser.firstName + " " + TheUser.lastName + " : " + fiv.ToString() +
                                           " - FAR :" + result.FARAchieved.ToString() + " / " + Verificator.FARRequested.ToString()
                                           + " - Verified : " + result.Verified.ToString(), DateTime.Now);

                                if (CloseFarFinger > result.FARAchieved)
                                {
                                    CloseFarFinger = result.FARAchieved;
                                }

                                if ((result.Verified) || (result.FARAchieved < Verificator.FARRequested))
                                {
                                    bVerified    = true;
                                    VerifiedUser = TheUser;
                                    fingerFind   = index;
                                    break;
                                }
                            }
                        }
                        if (bVerified)
                        {
                            break;
                        }
                    }
                    if (bVerified)
                    {
                        string strUser = VerifiedUser.firstName + ";" + VerifiedUser.lastName + ";" + fingerFind.ToString();
                        debugFirstName = VerifiedUser.firstName;
                        debugLastName  = VerifiedUser.lastName;
                        debugFinger    = (FingerIndexValue)fingerFind;

                        if (debugOnFailedOnly)
                        {
                            errorCaptFP = false;
                        }

                        notifyEvent = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_AuthentificationCompleted, strUser);
                        if (NotifyEvent != null)
                        {
                            SetTextBox("User verify : " + strUser, DateTime.Now);
                            NotifyEvent(this, notifyEvent);
                        }
                    }
                    else
                    {
                        debugFirstName = "Unknown User";
                        debugLastName  = "Unknown User";
                        debugFinger    = FingerIndexValue.Unknown_Finger;
                        notifyEvent    = new FingerArgs(ReaderSerialNumber, FingerArgs.FingerNotify.RN_FingerUserUnknown, "Unknown User");
                        if (NotifyEvent != null)
                        {
                            SetTextBox("Unknown User", DateTime.Now);
                            NotifyEvent(this, notifyEvent);
                        }
                    }
                }
            }
        }