错误集成指纹 U.are.U SDK 与 java web 应用程序 [英] Error integration fingerprint U.are.U SDK with java web application

查看:28
本文介绍了错误集成指纹 U.are.U SDK 与 java web 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在后端使用 Java 和 play 框架开发了一个 Web 应用程序,在前端使用 AngularJS.

I developed a web application using Java and play framework in the BackEnd, and AngularJS in the FrontEnd.

我集成了 U.are.U SDK 以进行指纹扫描,但是在尝试比较两个相等的指纹时出现错误.

I did an integration with the U.are.U SDK for fingerprint scanning, however I'm getting an error while trying to compare two equal fingerprints.

这是我在 Angular 部分的代码:

This is my code in the Angular part:

if(currentFormat == Fingerprint.SampleFormat.PngImage){
        localStorage.setItem("imageSrc", "");
        var samples = JSON.parse(s.samples); //parse json
        var finger = Fingerprint.b64UrlTo64(samples[0]); // convertion to Base64

        localStorage.setItem("imageSrc", "data:image/png;base64," + finger);

        var vDiv = document.getElementById('imagediv');
        vDiv.innerHTML = "";
        var image = document.createElement("img");
        image.id = "image";
        image.src = localStorage.getItem("imageSrc");
        vDiv.appendChild(image);

        AuthService.fingerValidation(finger, vm.username, function(response){
          showMessage("Login biométrico", response);
        });
    }

我使用此 SDK 的 javascript API 捕获指纹的地方.

Where I captured the fingerprint with the javascript API of this SDK.

然后他向 Web 服务发送了一个 Base64 字符串并执行了以下过程:

He then sent a Base64 String to the web service and performed the following procedure:

UserFingerPrint print = fingerprintService.getFinderByUser(data.getUsername()); //Db data
if (print != null) {
    String equals = "";
    //'finger' is the base64 String from JavaScript
    //Convert finger to byte[]
    byte[] bytesImage = fingerprintService.getFMD(Base64.decodeBase64(finger), "first"); 

    //Convert byte[] to FMD format from SDK with parameters of image example
    Fmd fmd = UareUGlobal.GetEngine().CreateFmd(bytesImage, 320, 350, 500, 1, 3407615, Fmd.Format.ANSI_378_2004);

    //Image from DB
    byte[] imageDB = fingerprintService.resizeImage(print.getImage());
    Fmd fmd2 = UareUGlobal.GetEngine().CreateFmd(imageDB, 320, 350, 500, 1, 3407615, Fmd.Format.ANSI_378_2004);

    //The error is when comparing with the following method.
    //The fingerprint is always different, even if it is the same image.
    int falsematch_rate = UareUGlobal.GetEngine().Compare(fmd, 0, fmd2, 0);
    int target_falsematch_rate = Engine.PROBABILITY_ONE / 100000;
    if (falsematch_rate < target_falsematch_rate) {
        equals = "match success";
    } else {
        equals = "No match"
    }
}

有没有人将图像转换为 FMD 可以帮助我?谢谢!

Has anyone converted an image to FMD that can help me? Thanks!

推荐答案

  1. 将您的 PNG 图像转换为灰度的原始字节数组:

  1. Convert your PNG image to raw bytearray in grayscale:

     // read an image from the disk
     BufferedImage image = ImageIO.read(new File("kittens.jpg"));

     setPreferredSize(new Dimension(
         image.getWidth(),image.getHeight()));

     // create a grayscale image the same size
     gray = new BufferedImage(image.getWidth(),image.getHeight(),
         BufferedImage.TYPE_BYTE_GRAY);

     // convert the original colored image to grayscale
     ColorConvertOp op = new ColorConvertOp(
         image.getColorModel().getColorSpace(),
         gray.getColorModel().getColorSpace(),null);
     op.filter(image,gray);

     //convert BuffuredImage to raw byte array
     WritableRaster raster = gray.getRaster();
     DataBufferByte data = (DataBufferByte) raster.getDataBuffer();    
     byte[] rawPixels = data.getData();

  • 将您的字节数组转换为 FID

  • convert your bytearray to FID

         Fid fid = UareUGlobal.getImporter().ImportRaw(rawPixels, 
             width, height, inDpi, fingerPosition, cbeffId, 
             Fid.Format.ANSI_381_2004, outDpi, rotate180);
    

  • 将您的 FID 转换为 FMD

  • convert your FID to FMD

         Fmd fmd = UareUGlobal.GetEngine().CreateFmd(fid, 
             Fid.Format.ANSI_381_2004);
    

  • 现在您可以将此 Fmd 与当前捕获进行比较

  • Now you could compare this Fmd with current capture

    这篇关于错误集成指纹 U.are.U SDK 与 java web 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆