I developed a web application using Java and play framework in the BackEnd, and AngularJS in the FrontEnd.
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.
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);
});
}
Where I captured the fingerprint with the javascript API of this SDK.
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"
}
}
Has anyone converted an image to FMD that can help me? Thanks!