Example #1
0
        /// <summary>
        /// Handler for when a fingerprint is captured.
        /// </summary>
        /// <param name="captureResult">contains info and data on the fingerprint capture</param>
        private void OnCaptured(CaptureResult captureResult)
        {
            try
            {
                // Check capture quality and throw an error if bad.
                if (!_sender.CheckCaptureResult(captureResult))
                {
                    return;
                }

                SendMessage(Action.SendMessage, "A finger was captured.");

                DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI);
                if (captureResult.ResultCode != Constants.ResultCode.DP_SUCCESS)
                {
                    _sender.Reset = true;
                    throw new Exception(captureResult.ResultCode.ToString());
                }

                if (count == 0)
                {
                    rightIndex = resultConversion.Data;
                    count     += 1;
                    SendMessage(Action.SendMessage, "Now place your right thumb on the reader.");
                }
                else if (count == 1)
                {
                    rightThumb = resultConversion.Data;
                    count     += 1;
                    SendMessage(Action.SendMessage, "Now place any finger on the reader.");
                }
                else if (count == 2)
                {
                    anyFinger = resultConversion.Data;
                    Fmd[] fmds = new Fmd[2];
                    fmds[0] = rightIndex;
                    fmds[1] = rightThumb;

                    // See the SDK documentation for an explanation on threshold scores.
                    int thresholdScore = DPFJ_PROBABILITY_ONE * 1 / 100000;

                    IdentifyResult identifyResult = Comparison.Identify(anyFinger, 0, fmds, thresholdScore, 2);
                    if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS)
                    {
                        _sender.Reset = true;
                        throw new Exception(identifyResult.ResultCode.ToString());
                    }

                    SendMessage(Action.SendMessage, "Identification resulted in the following number of matches: " + identifyResult.Indexes.Length.ToString());
                    SendMessage(Action.SendMessage, "Place your right index finger on the reader.");
                    count = 0;
                }
            }
            catch (Exception ex)
            {
                // Send error message, then close form
                SendMessage(Action.SendMessage, "Error:  " + ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// Handler for when a fingerprint is captured.
        /// </summary>
        /// <param name="captureResult">contains info and data on the fingerprint capture</param>
        private void OnCaptured(CaptureResult captureResult)
        {
            try
            {
                // Check capture quality and throw an error if bad.
                if (!_sender.CheckCaptureResult(captureResult))
                {
                    return;
                }

                SendMessage(Action.SendMessage, oHelper.Mensaje2);

                DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI);
                if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS)
                {
                    _sender.Reset = true;
                    throw new Exception(resultConversion.ResultCode.ToString());
                }

                if (count == 0)
                {
                    firstFinger = resultConversion.Data;

                    OperadorEncontrado = funciones.CompararHuella(firstFinger, secondFinger);

                    if (OperadorEncontrado.IdOperador != 0)
                    {
                        SendMessage(Action.SendMessage, "Huella coincide con operador " + OperadorEncontrado.Nombre + " y su status es " + OperadorEncontrado.Status);
                        SendMessage(Action.SendMessage, oHelper.Mensaje1);
                    }

                    else
                    {
                        SendMessage(Action.SendMessage, oHelper.Mensaje5);
                        SendMessage(Action.SendMessage, oHelper.Mensaje1);
                    }

                    count = 0;
                }
            }
            catch (Exception ex)
            {
                // Send error message, then close form
                SendMessage(Action.SendMessage, oHelper.Error + ex.Message);
            }

            ///si el lector es desconectado con la ventana de verification abierta, mandamos a cerrarla automaticamente
            ///para llamar al evento Verification_Closed y que se cargue el load del main para que salga el mensajeBox de lector
            ///desconectado (Reintentar/Salir)
            if (captureResult.ResultCode == Constants.ResultCode.DP_DEVICE_FAILURE)
            {
                Thread t = new Thread(cerrar);
                t.Start();
            }
        }
Example #3
0
        /// <summary>
        /// Handler for when a fingerprint is captured.
        /// </summary>
        /// <param name="captureResult">contains info and data on the fingerprint capture</param>
        private void OnCaptured(CaptureResult captureResult)
        {
            try
            {
                // Check capture quality and throw an error if bad.
                if (!_sender.CheckCaptureResult(captureResult))
                {
                    return;
                }

                count++;

                DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI);

                SendMessage(Action.SendMessage, "A finger was captured.  \r\nCount:  " + (count));

                if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS)
                {
                    _sender.Reset = true;
                    throw new Exception(resultConversion.ResultCode.ToString());
                }

                preenrollmentFmds.Add(resultConversion.Data);

                if (count >= 4)
                {
                    DataResult <Fmd> resultEnrollment = DPUruNet.Enrollment.CreateEnrollmentFmd(Constants.Formats.Fmd.ANSI, preenrollmentFmds);

                    if (resultEnrollment.ResultCode == Constants.ResultCode.DP_SUCCESS)
                    {
                        SendMessage(Action.SendMessage, "An enrollment FMD was successfully created.");
                        SendMessage(Action.SendMessage, "Place a finger on the reader.");
                        preenrollmentFmds.Clear();
                        count = 0;
                        return;
                    }
                    else if (resultEnrollment.ResultCode == Constants.ResultCode.DP_ENROLLMENT_INVALID_SET)
                    {
                        SendMessage(Action.SendMessage, "Enrollment was unsuccessful.  Please try again.");
                        SendMessage(Action.SendMessage, "Place a finger on the reader.");
                        preenrollmentFmds.Clear();
                        count = 0;
                        return;
                    }
                }

                SendMessage(Action.SendMessage, "Now place the same finger on the reader.");
            }
            catch (Exception ex)
            {
                // Send error message, then close form
                SendMessage(Action.SendMessage, "Error:  " + ex.Message);
            }
        }
Example #4
0
        /// <summary>
        /// Handler for when a fingerprint is captured.
        /// </summary>
        /// <param name="captureResult">contains info and data on the fingerprint capture</param>
        private void OnCaptured(CaptureResult captureResult)
        {
            try
            {
                // Check capture quality and throw an error if bad.
                if (!_sender.CheckCaptureResult(captureResult))
                {
                    return;
                }

                SendMessage(Action.SendMessage, "A finger was captured.");

                IDs.Clear();

                DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI);
                if (captureResult.ResultCode != Constants.ResultCode.DP_SUCCESS)
                {
                    _sender.Reset = true;
                    throw new Exception(captureResult.ResultCode.ToString());
                }

                SendMessage(Action.SendMessage, "Please wait while searching is done in background.");

                anyFinger = resultConversion.Data;
                Fmd[] fmdsArray = fmds.ToArray();

                foreach (Fmd fmd in fmdsArray)
                {
                    CompareResult compareResult = Comparison.Compare(anyFinger, 0, fmd, 0);
                    if (compareResult.Score < (PROBABILITY_ONE / 100000))
                    {
                        IDs.Add(fmdsDic[fmd]);
                    }
                }
                SendMessage(Action.SendMessage, IDs.Count.ToString() + " Finger Print(s) Matched.");
                SendMessage(Action.SendMessage, "Click the button below to show results or place thumb to search again.");

                if (IDs.Count > 0)
                {
                    SendMessage(Action.ShowMatchedEntry, "");
                }
                else
                {
                    SendMessage(Action.HideMatchedEntry, "");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error in Identification: " + ex.Message);
            }
        }
Example #5
0
        /// <summary>
        /// Handler for when a fingerprint is captured.
        /// </summary>
        /// <param name="captureResult">contains info and data on the fingerprint capture</param>
        private void OnCaptured(CaptureResult captureResult)
        {
            try
            {
                // Check capture quality and throw an error if bad.
                if (!_sender.CheckCaptureResult(captureResult))
                {
                    return;
                }

                SendMessage(Action.SendMessage, "A finger was captured.");

                DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI);
                if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS)
                {
                    _sender.Reset = true;
                    throw new Exception(resultConversion.ResultCode.ToString());
                }

                if (count == 0)
                {
                    firstFinger = resultConversion.Data;
                    count      += 1;
                    SendMessage(Action.SendMessage, "Now place the same or a different finger on the reader.");
                }
                else if (count == 1)
                {
                    secondFinger = resultConversion.Data;
                    CompareResult compareResult = Comparison.Compare(firstFinger, 0, secondFinger, 0);
                    if (compareResult.ResultCode != Constants.ResultCode.DP_SUCCESS)
                    {
                        _sender.Reset = true;
                        throw new Exception(compareResult.ResultCode.ToString());
                    }

                    SendMessage(Action.SendMessage, "Comparison resulted in a dissimilarity score of " + compareResult.Score.ToString() + (compareResult.Score < (PROBABILITY_ONE / 100000) ? " (fingerprints matched)" : " (fingerprints did not match)"));
                    SendMessage(Action.SendMessage, "Place a finger on the reader.");
                    count = 0;
                }
            }
            catch (Exception ex)
            {
                // Send error message, then close form
                SendMessage(Action.SendMessage, "Error:  " + ex.Message);
            }
        }
Example #6
0
        /// <summary>
        /// Handler for when a fingerprint is captured.
        /// </summary>
        /// <param name="captureResult">contains info and data on the fingerprint capture</param>
        public void OnCaptured(CaptureResult captureResult)
        {
            try
            {
                // Check capture quality and throw an error if bad.
                if (!_sender.CheckCaptureResult(captureResult))
                {
                    return;
                }

                // Create bitmap
                foreach (Fid.Fiv fiv in captureResult.Data.Views)
                {
                    SendMessage(Action.SendBitmap, _sender.CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height));
                }
            }
            catch (Exception ex)
            {
                // Send error message, then close form
                SendMessage(Action.SendMessage, "Error:  " + ex.Message);
            }
        }