繁体   English   中英

如何将拇指印象扫描到我的 JAVA Web 应用程序中

[英]How do I scan thumb impression into my JAVA web application

我想将生物识别拇指印象扫描到我的 Web 应用程序中。我有 SecuGen Hamster 的生物识别模型,但我不知道如何访问 Web 应用程序。 或如何将拇指印象发送到网络浏览器。

由于我以前没有使用过这样的设备,我不知道如何准备代码来实现这一点。 对此主题的任何帮助将不胜感激。

我目前在 jsp/servlet 中工作。

谢谢

您需要三样东西 1. Java 拇指扫描仪设备驱动程序 2. 拇指扫描仪设备 Sdk 3. 创建自己的小程序。小程序可以与某些浏览器对话

Secugen 提供了包含 Java 代码的 SDK。 使用该 java 代码,您可以测试您的设备。

它以一维字节数组捕获指纹。 您可以将其转换为 2D 字节数组并构建图像。

尽管如此,如果您需要代码来完成这里的所有工作:根据您的需要清理代码。


import java.awt.image.BufferedImage;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;

import SecuGen.FDxSDKPro.jni.JSGFPLib;
import SecuGen.FDxSDKPro.jni.SGDeviceInfoParam;
import SecuGen.FDxSDKPro.jni.SGFDxDeviceName;
import SecuGen.FDxSDKPro.jni.SGFDxErrorCode;
import SecuGen.FDxSDKPro.jni.SGFingerInfo;
import SecuGen.FDxSDKPro.jni.SGFingerPosition;
import SecuGen.FDxSDKPro.jni.SGImpressionType;
import SecuGen.FDxSDKPro.jni.SGPPPortAddr;

public class RecordFingerPrint {

    private static javax.swing.JLabel jLabelImage;

    public static JSGFPLib sgfplib = null;
    public static long err;
    public static SGDeviceInfoParam deviceInfo;

    public static byte[] SG400minutiaeBuffer1=null;
    public static byte[] SG400minutiaeBuffer2=null;

    public static void writeImage(byte[][] img) {
        //write your realtime image for testing
        String path = "D:\\testimg1.png";
        BufferedImage image = new BufferedImage(img.length, img[0].length, BufferedImage.TYPE_BYTE_GRAY);
        for (int x = 0; x < img.length; x++) {
            for (int y = 0; y <img[0].length; y++) {
                image.setRGB(x, y, img[x][y]);
            }
        }

        File ImageFile = new File(path);
        try {
            ImageIO.write(image, "png", ImageFile);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    public static byte[] returnCapturedFingerImage() {
        byte[] imageBuffer1 = null;

        /* initialize the secugen bluetooth device */
        try
        {
             sgfplib = new JSGFPLib();


             if ((sgfplib != null) && (sgfplib.jniLoadStatus != SGFDxErrorCode.SGFDX_ERROR_JNI_DLLLOAD_FAILED))
                {
                    System.out.println(sgfplib);
                }
                else
                {
                    System.out.println("An error occurred while loading JSGFPLIB.DLL JNI Wrapper");
                 //   return false;
                }       


                // Init()
                System.out.println("Call Init(SGFDxDeviceName.SG_DEV_AUTO)");
                err = sgfplib.Init(SGFDxDeviceName.SG_DEV_AUTO);
                System.out.println("Init returned : [" + err + "]");




                // **************OpenDevice()
                System.out.println("Call OpenDevice(SGPPPortAddr.AUTO_DETECT)");
                err = sgfplib.OpenDevice(SGPPPortAddr.AUTO_DETECT);
                System.out.println("OpenDevice returned : [" + err + "]");

             // GetError()
                System.out.println("Call GetLastError()");
                err = sgfplib.GetLastError();
                System.out.println("GetLastError returned : [" + err + "]");

                // GetDeviceInfo()
                //System.out.println("Call GetDeviceInfo()");
                deviceInfo = new SGDeviceInfoParam();
                err = sgfplib.GetDeviceInfo(deviceInfo);
                //System.out.println( "GetDeviceInfo returned : [" + err + "]");

                System.out.println("\tdeviceInfo.DeviceSN:    [" + new String(deviceInfo.deviceSN()) + "]");
                System.out.println("\tdeviceInfo.Brightness:  [" + deviceInfo.brightness + "]");
                System.out.println("\tdeviceInfo.ComPort:     [" + deviceInfo.comPort + "]");
                System.out.println("\tdeviceInfo.ComSpeed:    [" + deviceInfo.comSpeed + "]");
                System.out.println("\tdeviceInfo.Contrast:    [" + deviceInfo.contrast + "]");
                System.out.println("\tdeviceInfo.DeviceID:    [" + deviceInfo.deviceID + "]");
                System.out.println("\tdeviceInfo.FWVersion:   [" + deviceInfo.FWVersion + "]");
                System.out.println("\tdeviceInfo.Gain:        [" + deviceInfo.gain + "]");
                System.out.println("\tdeviceInfo.ImageDPI:    [" + deviceInfo.imageDPI + "]");
                System.out.println("\tdeviceInfo.ImageHeight: [" + deviceInfo.imageHeight + "]");
                System.out.println("\tdeviceInfo.ImageWidth:  [" + deviceInfo.imageWidth + "]"); 
        }
        catch (Exception e)
        {
            System.out.println("Exception reading FP reader : " + e);
        }

        //get finger print data captured 
        /*****************************************************************************/

        byte[] buffer = new byte[deviceInfo.imageWidth*deviceInfo.imageHeight];
        long timeout = 10000;
        long quality = 80;
        if(sgfplib.GetImageEx(buffer, timeout, 1, quality) ==SGFDxErrorCode.SGFDX_ERROR_NONE)
        {

            /*image code*/
             javax.swing.JLabel jLabelRegisterImage1 = new javax.swing.JLabel();


            /*image code test end*/

            PrintStream fp = null;
            int[] img_qlty = new int[1];;
            err = sgfplib.GetImageQuality(deviceInfo.imageHeight, deviceInfo.imageWidth, buffer, img_qlty);


            byte[][] buffer2D = new byte[deviceInfo.imageHeight][deviceInfo.imageWidth];


            System.out.println("********************");
            for(int i=0;i<deviceInfo.imageHeight;i++) {
                for(int j=0;j<deviceInfo.imageWidth;j++) {
                    buffer2D[i][j]=buffer[i*deviceInfo.imageWidth+j];
                    System.out.print(buffer2D[i][j]+" ,");
                    //System.out.println(i+" ,"+j+" "+(i*deviceInfo.imageWidth+j));
                }
                System.out.println();
            }

            System.out.println("********************");
            writeImage(buffer2D);




            System.out.println("Buffer Length:"+buffer.length);
            //System.out.println("Buffer array:"+Arrays.toString(buffer));

            System.out.println("GetImageQuality returned : [" + err + "]");
            System.out.println("Image Quality is : [" + img_qlty[0] + "]");
            FileOutputStream fout = null;
            try {
                //fout = new FileOutputStream("D:\\sample\\fp_image\\fp.raw");
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            fp = new PrintStream(fout);
            fp.write(buffer,0, buffer.length);
            fp.close();
            try {
                fout.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            fp = null;
            fout = null;

        }

        return null;

    }


}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM