我正在尝试使用DigitalPersona SDK v 3.0.0比较java中的两个指纹,但我认为FMD是无效错误,或者有时我得到传递给API调用的一个或多个参数无效。
我有一个从Javascript API获得的png图像,我尝试创建一个FID,然后在这篇文章中创建一个FDM example
但我不知道如何获得方法参数:inDpi,fingerPosition,cbeffId,outDpi和rotate180来获得de Fid
Fid fid = UareUGlobal.getImporter()。ImportRaw(rawPixels, width,height,inDpi,fingerPosition,cbeffId, Fid.Format.ANSI_381_2004,outDpi,rotate180);
我也尝试过使用中间格式的ImportFmd而没有成功
任何帮助都将是apreciated
答案 0 :(得分:2)
嗯,我目前也在研究那个。 UareU SDK V3.0.0,
但是我对“验证和比较”功能有疑问。
但是,要回答您的问题,如果您有指纹图像,
您可以直接将图像导入Fmd
。我的意思是(我使用ISO标准):
Fmd fmd = UareUGlobal.GetEngine().CreateFmd(bInput, 500, 550, 700, 0, 0, Fmd.Format.ISO_19794_2_2005)
然后,您可以直接与此compare
进行verify
或fmd
。
注意:必须根据您的图像和阅读器更改高度,分辨率。
cbeffid
参数,我尝试了0和1。
如果有人找到了该参数的正确答案,也请提出建议。
CBEFF
错误
API调用无效
通常,我发现分辨率,指纹格式和手指位置参数正确。指纹参数,我通常设置为0(第一指或第一视图)
更新
如果您使用的是javascript
。我建议您首先将base64字符串从javascript转换为bufferedImage
。
public static Fmd importImageString(String image) throws UnsupportedEncodingException, IOException, UareUException {
byte[] bytes = Base64.getDecoder().decode(image.getBytes("UTF-8"));
if (null != bytes && bytes.length > 0) {
ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
BufferedImage buf = ImageIO.read(stream);
if (null != buf) {
return UareUGlobal.GetEngine().CreateFmd(
TestDPuareU.toBytes(buf),
buf.getWidth(),
buf.getHeight(),
500, 0, 1, Fmd.Format.ISO_19794_2_2005
);
}
}
return null;
}
public static byte[] toBytes(BufferedImage image) throws IOException {
WritableRaster raster = image.getRaster();
DataBufferByte data = (DataBufferByte) raster.getDataBuffer();
return (data.getData());
}
我从javascript(image
)var finger
那里获得的sdk.onSamplesAcquired = function (s)
如下所示
var samples = JSON.parse(s.samples);
var finger = Fingerprint.b64UrlTo64(samples[0])
答案 1 :(得分:2)
此代码对我来说就像在Digital Persona 4500模型上一样。
private boolean ProcessCaptureResult(CaptureThread.CaptureEvent evt) throws IOException{
boolean bCanceled = false;
// CaptureThread.CaptureEvent evt = evt;
if(null != evt.capture_result){
System.out.println("This is Processing Capture");
if(null != evt.capture_result.image && Reader.CaptureQuality.GOOD == evt.capture_result.quality){
//extract features
Engine engine = UareUGlobal.GetEngine();
try{
Fmd fmd = engine.CreateFmd(evt.capture_result.image,
Fmd.Format.ISO_19794_2_2005;
BufferedImage img=ImageIO.read(new File("C:\\Users\\User\\Documents\\NetBeansProjects\\FingerPrintApp\\MembersImages","imag6.jpg"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write( img, "jpg", baos );
baos.flush();
byte[] imageInByte = baos.toByteArray();
baos.close();
// Fmd fmd1 = engine.CreateFmd(img, 0xa, 0xa, 0x14, Fmd.Format.ANSI_378_2004);
Fmd fmd2=UareUGlobal.GetEngine().CreateFmd(
toBytes(img),
img.getWidth(),
img.getHeight(),
500, 0, 3407615, Fmd.Format.ISO_19794_2_2005
);
System.out.println("Resulotion: "+evt.capture_result.image.getImageResolution()); ;
System.out.println("ID : "+evt.capture_result.image.getCbeffId()); ;
System.out.println(evt.capture_result.image.getData());
// if(null == m_fmds[0])
m_fmds[0] = fmd;
// else if(null == m_fmds[1])
m_fmds[1] = fmd2;
}
catch(UareUException e){ System.out.println("Engine.CreateFmd() "+e.getMessage()); }
// if(null != m_fmds[0] && null != m_fmds[1]){
//perform comparison
try{
System.out.println(m_fmds[0].getFormat().name());
int falsematch_rate = engine.Compare(m_fmds[0], 0, m_fmds[1], 0);
int target_falsematch_rate = Engine.PROBABILITY_ONE / 100000; //target rate is 0.00001
if(falsematch_rate < target_falsematch_rate){
System.out.println("Fingerprints matched.\n");
String str = String.format("dissimilarity score: 0x%x.\n", falsematch_rate);
System.out.println(str);
str = String.format("false match rate: %e.\n\n\n", (double)(falsematch_rate / Engine.PROBABILITY_ONE));
System.out.println(str);
}
else{
System.out.println("Fingerprints did not match.\n\n\n");
}
}
catch(UareUException e){ System.out.println("Engine.CreateFmd()"+ e.getMessage()); }
//discard FMDs
m_fmds[0] = null;
m_fmds[1] = null;
//the new loop starts
System.out.println(m_strPrompt1);
// }
// else{
// //the loop continues
// System.out.println(m_strPrompt2);
// }
}
else if(Reader.CaptureQuality.CANCELED == evt.capture_result.quality){
//capture or streaming was canceled, just quit
bCanceled = true;
}
else{
//bad quality
MessageBox.BadQuality(evt.capture_result.quality);
}
}
else if(null != evt.exception){
//exception during capture
MessageBox.DpError("Capture", evt.exception);
bCanceled = true;
}
else if(null != evt.reader_status){
//reader failure
MessageBox.BadStatus(evt.reader_status);
bCanceled = true;
}
return !bCanceled;
}
public static byte[] toBytes(BufferedImage image) {
WritableRaster raster = image.getRaster();
DataBufferByte data = (DataBufferByte) raster.getDataBuffer();
return (data.getData());
}
Code working in digital persona 4500
答案 2 :(得分:1)
这样的事情就是你如何获得这些价值,但是我得到了同样的错误PID IS INVALID,祝你好运,无论你有答案我希望你能分享它,问候。
m_fmd = m_engine.CreateFmd(cap_result.image, Fmd.Format.ANSI_378_2004);
data = m_fmd.getData();
width = m_fmd.getWidth();
height = m_fmd.getHeight();
resolution = m_fmd.getResolution();
finger_position = m_fmd.getCaptureEquipmentCompliance();
cbeff_id = m_fmd.getCbeffId();
format = m_fmd.getFormat();