コード例 #1
0
        void core_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
        {
            // button1.Enabled = false;
            try
            {
                huella = ie.RawImage;
                //template = null;

                core.Extract(huella, ref template); //try to use getbiometric data...

                pictureBox1.Image = huella.Image;

                switch (template.Quality)
                {
                case 0:
                    SetText("Bad Quality");
                    //MessageBox.Show("Huella de mala calidad favor de volver a poner el dedo", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;

                case 1:
                    SetText("Medium Quality");
                    // MessageBox.Show("Fingerprint has a medium quality, proceed anyway?", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;

                case 2:
                    SetText("Good Quality");
                    //MessageBox.Show("Fingerprint has a medium quality, proceed anyway?", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
コード例 #2
0
ファイル: MainLoginPage.cs プロジェクト: kwadoskii/evoting
        void core_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
        {
            try
            {
                huella = ie.RawImage;

                core.Extract(huella, ref template);
                mainLoginPgFPImageBox.Image = huella.Image;
            }
            catch (Exception)
            {}
        }
コード例 #3
0
        /// <summary>
        /// Convert System.Drawing.Image to FingerprintTemplate
        /// </summary>
        /// <param name="image">image to convert</param>
        /// <returns>raw image from image</returns>
        private FingerprintRawImage RawImageFromImage(Image image)
        {
            FingerprintRawImage retRawImage = new FingerprintRawImage();
            Bitmap bitmapTemp = image as Bitmap;

            #region paranoia section
            if (image.Height > Settings.Default.maxImageHeight)
                throw new ArgumentOutOfRangeException("image.Height");

            if (image.Width > Settings.Default.maxImageWidth)
                throw new ArgumentOutOfRangeException("image.Width");
            #endregion

            retRawImage.rawImage = new byte[bitmapTemp.Width * bitmapTemp.Height];

            for (int y = 0; y < bitmapTemp.Height; y++)
                for (int x = 0; x < bitmapTemp.Width; x++)
                {
                    retRawImage.rawImage[y * bitmapTemp.Width + x] = bitmapTemp.GetPixel(x, y).R;
                }

            retRawImage.width = bitmapTemp.Width;
            retRawImage.height = bitmapTemp.Height;

            // Oh, shi~  This f*cken SDK use resolution of scaner, but not image >_<
            retRawImage.res = Settings.Default.scanerResolution;

            return retRawImage;
        }
コード例 #4
0
        /// <summary>
        /// Extract template from rawImage
        /// </summary>
        /// <param name="rawImage">1-byte per pixel raw image</param>
        /// <returns>template if success, otherwise it throws exception</returns>
        private FingerprintTemplate ExtractTemplate(FingerprintRawImage rawImage)
        {
            FingerprintTemplate tmpTemplate;

            // if template already stored in cache
            if (templateCache.TryGetValue(rawImage, out tmpTemplate))
            {
                return tmpTemplate;
            }

            // otherwise extract template and store it
            try
            {
                tmpTemplate = null;
                fingerPrintCore.Extract(rawImage, ref tmpTemplate);
                templateCache.Add(rawImage, tmpTemplate);

                return tmpTemplate;
            }
            catch
            {
                throw new Exception("Unable to extract template!");
            }
        }
コード例 #5
0
        private void DisplayImage(FingerprintTemplate template, FingerprintRawImage rawImage)
        {
            IntPtr hdc = FingerprintCore.GetDC();

              IntPtr image = new IntPtr();

              FPCore.GetBiometricDisplay(template, rawImage, hdc, ref image, FingerprintConstants.GR_NO_CONTEXT);

              SetBMapImage(Bitmap.FromHbitmap(image));

              FingerprintCore.ReleaseDC(hdc);
        }
コード例 #6
0
 public void SaveRawImageToFile(FingerprintRawImage rawImage, string fileName, GrCaptureImageFormat imageFormat)
 {
     try
     {
         IntPtr destination = Marshal.AllocCoTaskMem(rawImage.Width * rawImage.Height);
         Marshal.Copy(rawImage.RawImage, 0, destination, rawImage.Width * rawImage.Height);
         this.SaveRawImageToFile(destination, rawImage.Width, rawImage.Height, fileName, imageFormat);
         Marshal.FreeCoTaskMem(destination);
     }
     catch (OutOfMemoryException exception)
     {
         FingerprintException exception2 = new FingerprintException(-7, exception);
         throw exception2;
     }
 }
コード例 #7
0
 public void GetHandlerFromRawImage(FingerprintRawImage rawImage, IntPtr hdc, ref IntPtr image)
 {
     try
     {
         IntPtr destination = Marshal.AllocCoTaskMem(rawImage.Width * rawImage.Height);
         Marshal.Copy(rawImage.RawImage, 0, destination, rawImage.Width * rawImage.Height);
         this.GetHandlerFromRawImage(destination, rawImage.Width, rawImage.Height, hdc, ref image);
         Marshal.FreeCoTaskMem(destination);
     }
     catch (OutOfMemoryException exception)
     {
         FingerprintException exception2 = new FingerprintException(-7, exception);
         throw exception2;
     }
 }
コード例 #8
0
 public void GetBiometricDisplay(FingerprintTemplate tptQuery, FingerprintRawImage rawImage, IntPtr hdc, ref IntPtr handle, int matchContext)
 {
     try
     {
         IntPtr destination = Marshal.AllocCoTaskMem(rawImage.Width * rawImage.Height);
         Marshal.Copy(rawImage.RawImage, 0, destination, rawImage.Width * rawImage.Height);
         this.GetBiometricDisplay(tptQuery, destination, rawImage.Width, rawImage.Height, rawImage.Resolution, hdc, ref handle, matchContext);
         Marshal.FreeCoTaskMem(destination);
     }
     catch (OutOfMemoryException exception)
     {
         FingerprintException exception2 = new FingerprintException(-7, exception);
         throw exception2;
     }
 }
コード例 #9
0
 public void ExtractEx(FingerprintRawImage fingerPrintRawImage, ref FingerprintTemplate fingerTemplate, int context, GrTemplateFormat tptFormat)
 {
     try
     {
         IntPtr destination = Marshal.AllocCoTaskMem(fingerPrintRawImage.Width * fingerPrintRawImage.Height);
         Marshal.Copy(fingerPrintRawImage.RawImage, 0, destination, fingerPrintRawImage.Width * fingerPrintRawImage.Height);
         this.ExtractEx(destination, fingerPrintRawImage.Width, fingerPrintRawImage.Height, fingerPrintRawImage.Resolution, ref fingerTemplate, context, (int) tptFormat);
         Marshal.FreeCoTaskMem(destination);
     }
     catch (OutOfMemoryException exception)
     {
         FingerprintException exception2 = new FingerprintException(-7, exception);
         throw exception2;
     }
 }
コード例 #10
0
 public void ExtractEx(FingerprintRawImage fingerPrintRawImage, ref FingerprintTemplate fingerTemplate, GrTemplateFormat tptFormat)
 {
     this.ExtractEx(fingerPrintRawImage, ref fingerTemplate, 0, tptFormat);
 }
コード例 #11
0
 public void Extract(FingerprintRawImage fingerPrintRawImage, ref FingerprintTemplate fingerTemplate)
 {
     this.Extract(fingerPrintRawImage, ref fingerTemplate, 0);
 }
コード例 #12
0
 public GrEnrollState Enroll(FingerprintRawImage rawImage, ref FingerprintTemplate tpt, GrTemplateFormat tptFormat, int context)
 {
     GrEnrollState state;
     IntPtr zero = IntPtr.Zero;
     try
     {
         int num = 0;
         int quality = -1;
         int cb = 0x2710 * Marshal.SizeOf(typeof(byte));
         zero = Marshal.AllocHGlobal(cb);
         IntPtr destination = Marshal.AllocCoTaskMem(rawImage.Width * rawImage.Height);
         Marshal.Copy(rawImage.RawImage, 0, destination, rawImage.Width * rawImage.Height);
         num = this.Enroll(destination, rawImage.Width, rawImage.Height, rawImage.Resolution, zero, ref cb, ref quality, (int) tptFormat, context);
         Marshal.FreeCoTaskMem(destination);
         zero = Marshal.ReAllocHGlobal(zero, (IntPtr) cb);
         tpt = new FingerprintTemplate(zero, cb, quality);
         state = (GrEnrollState) num;
     }
     catch (OutOfMemoryException exception)
     {
         throw new FingerprintException(-7, exception);
     }
     catch (AccessViolationException exception2)
     {
         throw new FingerprintException(-113, exception2);
     }
     finally
     {
         Marshal.FreeHGlobal(zero);
     }
     return state;
 }
コード例 #13
0
 public GrEnrollState Enroll(FingerprintRawImage rawImage, ref FingerprintTemplate tpt, GrTemplateFormat tptFormat)
 {
     return this.Enroll(rawImage, ref tpt, tptFormat, 0);
 }
コード例 #14
0
ファイル: FingerPrints.cs プロジェクト: BoschC/fplibrary
 /// <summary>
 /// Extract a fingerprint template from a raw fingerprint image
 /// </summary>
 /// <param name="image">The image to extract the template from</param>
 /// <returns></returns>
 public FingerprintTemplate ExtractTemplate(FingerprintRawImage image)
 {
     var template = new FingerprintTemplate();
       griauleLibrary.ExtractEx(image, ref template, (GrTemplateFormat)DefaultTemplateFormat);
       return template;
 }
コード例 #15
0
 public ImageEventArgs(string source, IntPtr rawImage, int width, int height, int res)
 {
     this.source = source;
     this.tRawImage = new FingerprintRawImage(rawImage, width, height, res);
 }