Reputation: 11
Hi I am working with Finger print application and the facing problem in converting bytes information into desire DPFP template comes with the Fingerprint SDK (One Touch)...
Please help me out
Upvotes: 1
Views: 3031
Reputation: 62
This question is six years ago. But id still post my answer to help those who still doesn't know how to do this.
Id assume that you've properly saved your .fpt template/enroller template in the longblob column of your database.
You can simple convert byte to DPFP template like this:
byte[] bytes = (byte[])reader["column_name_where_your_.fpt_is_saved"];
MemoryStream ms = new MemoryStream(bytes);
Template = new DPFP.Template(ms);
Upvotes: 0
Reputation: 11
You need to make things before get the array of bytes...
You need to know that if you want make a template you extract the feature of the sample 4 times and this make a template.
You need to implement a DPFPDataListener,
Create a capture
public DPFPCapture CAPTURA = DPFPGlobal.getCaptureFactory().createCapture();
Variables that you will need
private DPFPEnrollment HUELLA;
public DPFPFeatureSet EXTRACTION;
public DPFPTemplate TEMPLATE;
Add listeners
CAPTURA.addDataListener(this);
When to put the finger in the hardware, you dispache the event
@Override
public void dataAcquired(DPFPDataEvent dpfpde) {
EXTRACTION = extractFeatures(dpfpde.getSample(), DPFPDataPurpose.DATA_PURPOSE_ENROLLMENT);
TEMPLATE = enrollment_huella(EXTRACTION); **//this line add in the finally part
}
You need to get the feature
protected DPFPFeatureSet extractFeatures(DPFPSample sample, DPFPDataPurpose purpose){
DPFPFeatureExtraction extractor = DPFPGlobal.getFeatureExtractionFactory().createFeatureExtraction();
try {
return extractor.createFeatureSet(sample, purpose);
} catch (DPFPImageQualityException e) {
return null;
}
}
Finally Part
protected DPFPTemplate enrollment_huella(DPFPFeatureSet featureSet) throws DPFPImageQualityException{
if(HUELLA == null) HUELLA = DPFPGlobal.getEnrollmentFactory().createEnrollment();
HUELLA.addFeatures(featureSet);
//here you can see if the template is ready...
if( HUELLA.getTemplateStatus() == DPFPTemplateStatus.TEMPLATE_STATUS_READY){
return HUELLA.getTemplate();
}
else return null;
}
In the function dataAcquired you can get the template.
I hope you understand!
Upvotes: 1