Пример #1
0
        public string inscribirHuella(Sockets socket)
        {
            try
            {
                DataResult<Fmd> enrollmentResult = Enrollment.CreateEnrollmentFmd(
                    Constants.Formats.Fmd.ANSI,
                    CaptureAndExtractFmd(5, socket)
                );

                socket.mandarMensaje(5, base64String);
                Fmd fmd = enrollmentResult.Data;

                return Fmd.SerializeXml(fmd).Replace("\"", "\\\"");
            }
            catch (NullReferenceException)
            {
                // Dedo leido mal
                return "0";
            }
            catch (SDKException)
            {
                // Dedos diferentes / No se puede obtener un FMD
                return "0";
            }
        }
Пример #2
0
        IEnumerable<Fmd> CaptureAndExtractFmd(int lecturas, Sockets socket)
        {
            int no_lecturas = 0;
            while (no_lecturas < lecturas)
            {
                if (lector.Status.Status.Equals(Constants.ReaderStatuses.DP_STATUS_READY))
                {
                    // Capture a fingerprint.
                    CaptureResult captureResult = lector.Capture(
                        Constants.Formats.Fid.ANSI,
                        Constants.CaptureProcessing.DP_IMG_PROC_DEFAULT,
                        -1,
                        lector.Capabilities.Resolutions[0]
                    );

                    if(no_lecturas == 0)
                    {
                        Bitmap bmp = new Bitmap(150, 150);
                        foreach (Fid.Fiv fiv in captureResult.Data.Views)
                        {
                            bmp = CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height);
                        }

                        System.IO.MemoryStream stream = new System.IO.MemoryStream();
                        bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
                        byte[] imageBytes = stream.ToArray();

                        base64String = Convert.ToBase64String(imageBytes);
                    }

                    no_lecturas++;
                    socket.mandarMensaje(3, "Lectura capturada");

                    // !!! Check for errors, use ‘yield return null; or break;’ to stop.
                    yield return FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI).Data;
                }
            }
        }
Пример #3
0
 void IniciarWebSockets()
 {
     socket = new Sockets(this);
 }