java 如何从指纹读取器读取数据并在java中转换为图像文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12917422/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to read data from finger print reader and convert into image file in java
提问by Manpreet
i have to read data from finger print reader and convert into image file. I am using Digital Persona 's device U and U 4500 with Platinum SDK . I am new biometric field. Till now I am only able to detect the device means whether it is connected to system or not.Please guide me what should i do to accomplish this task
我必须从指纹阅读器读取数据并转换为图像文件。我正在使用带有 Platinum SDK 的 Digital Persona 的设备 U 和 U 4500。我是新的生物识别领域。直到现在我只能检测到设备是否连接到系统。请指导我我该怎么做才能完成此任务
i have used this Code(only to check whether device is working )
我使用过此代码(仅用于检查设备是否正常工作)
import com.digitalpersona.onetouch.DPFPGlobal;
import com.digitalpersona.onetouch.DPFPSample;
import com.digitalpersona.onetouch.capture.DPFPCapture;
import com.digitalpersona.onetouch.capture.event.DPFPDataEvent;
import com.digitalpersona.onetouch.capture.event.DPFPDataListener;
import com.digitalpersona.onetouch.capture.event.DPFPErrorEvent;
import com.digitalpersona.onetouch.capture.event.DPFPErrorListener;
import com.digitalpersona.onetouch.capture.event.DPFPReaderStatusAdapter;
import com.digitalpersona.onetouch.capture.event.DPFPReaderStatusEvent;
import com.digitalpersona.onetouch.capture.event.DPFPReaderStatusListener;
import com.digitalpersona.onetouch.capture.event.DPFPSensorEvent;
import com.digitalpersona.onetouch.capture.event.DPFPSensorListener;
public class Demo {
public static void main(String args[]){
//byte[] a=null;
DPFPCapture capture=DPFPGlobal.getCaptureFactory().createCapture();
capture.addReaderStatusListener(new DPFPReaderStatusListener() {
@Override
public void readerDisconnected(DPFPReaderStatusEvent arg0) {
//TODO Auto-generated method stub
System.out.println("I m Dis-connected");
}
@Override
public void readerConnected(DPFPReaderStatusEvent arg0) {
// TODO Auto-generated method stub
System.out.println("I m connected");
}
});
capture.addSensorListener(new DPFPSensorListener() {
@Override
public void imageAcquired(DPFPSensorEvent arg0) {
// TODO Auto-generated method stub
System.out.print("acquired");
}
@Override
public void fingerTouched(DPFPSensorEvent arg0) {
// TODO Auto-generated method stub
System.out.print("s");
}
@Override
public void fingerGone(DPFPSensorEvent arg0) {
// TODO Auto-generated method stub
System.out.print("gone");
}
});
capture.startCapture();
capture.addDataListener(new DPFPDataListener() {
@Override
public void dataAcquired(DPFPDataEvent arg0) {
// TODO Auto-generated method stub
DPFPSample sample=DPFPGlobal.getSampleFactory().createSample();
sample=arg0.getSample();
byte a[]=sample.serialize();
for(byte i:a){
System.out.print(i);
}
}
});
capture.addErrorListener(new DPFPErrorListener() {
@Override
public void exceptionCaught(DPFPErrorEvent arg0) {
// TODO Auto-generated method stub
System.out.println("error");
}
@Override
public void errorOccured(DPFPErrorEvent arg0) {
// TODO Auto-generated method stub
System.out.println("error");
}
});
}
}
回答by JohnTheBeloved
I am also currently working on a Digital Persona Finger Print Reader, I actually had the same Problem but now i have overcome it, I think the code to add the Listeners should be in the init() method and also start the init method in the constructor of the class The main method should only instantiate the Class.
我目前也在研究 Digital Persona Finger Print Reader,我实际上遇到了同样的问题,但现在我已经克服了它,我认为添加监听器的代码应该在 init() 方法中,并且在类的构造函数 main 方法应该只实例化类。