Hola grupo,
Estoy tratando de guardar y luego comparar huellas para identificar a los usuarios. Hasta el momento he logrado observar los eventos, configurar el lector, capturar las huellas y almacenarlas en la base de datos pero no logro comparar una captura contra otra que esta guardada.
Les resumo la forma en como guardo en la base de datos:
Código:
public Fmd template;
...
//al capturar la cantidad de muestras que necesito, seteo el template:
template = evt.enrollment_fmd;
...
ByteArrayInputStream fingerprintInfo = new ByteArrayInputStream(template.getData());
Integer fingerprintSize = template.getData().length;
...
PreparedStatement sqlInsertStmt = c.prepareStatement("INSERT INTO fingers (rut, fingerprint) values(?,?)");
sqlInsertStmt.setString(1, txtRut.getText());
sqlInsertStmt.setBinaryStream(2, fingerprintInfo, fingerprintSize);
Y para comparar estoy tratando así:
Código:
//Captura desde el lector:
Fmd fmd = engine.CreateFmd(evt.capture_result.image, Fmd.Format.ANSI_378_2004);
...
//Comparar con una de la base de datos
//Es aquí donde tengo el problema; sé que debo usar el método engine.Compare() pero para ello necesito recrear la captura que tengo almacenada en la BD. Estoy intentando con engine.CreateFmd() pero no logró realizarlo.
Fmd fmdDb = engine.CreateFmd(rs.getBytes("fingerprint"), fmd.getWidth(), fmd.getHeight(), fmd.getResolution(), 1, fmd.getCbeffId(), Fmd.Format.ANSI_378_2004);
int falsematch_rate = engine.Compare(fmd, 0, fmdDb, 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");
System.out.println(String.format("dissimilarity score: 0x%x", falsematch_rate));
System.out.println(String.format("false match rate: %e", (double)(falsematch_rate / Engine.PROBABILITY_ONE)));
success = true;
rut = rs.getString("rut");
break;
}
else{
System.out.println("Fingerprints did not match");
}
Al comprar recibo el mensaje de error:
Código:
Operation not allowed after ResultSet closed
La documentación del método CreateFmd() son:
Código:
Fmd CreateFmd(byte[] data,
int width,
int height,
int resolution,
int finger_position,
int cbeff_id,
Fmd.Format format)
throws UareUException
Extracts features and creates an FMD from a raw image.
When you do a fingerprint capture, you can receive a raw image or a FID. If you specify a raw image, you can then extract features into an FMD using this function. The raw image is just a buffer of pixels. This function works with raw images that have - 8 bits per pixel - no padding - square pixels (dpi is the same for horizontal and vertical) The size of the resulting FMD will vary depending on the minutiae in a specific fingerprint.
Parameters:
data - Image data.
width - Width of the image.
height - Height of the image.
resolution - Resolution of the finger in dpi.
finger_position - Position of the finger.
cbeff_id - CBEFF product ID, from IBIA registry.
format - Format of the FMD.
Returns:
FMD
Throws:
UareUException - if failed to create FMD
No me queda claro como usar este método y si es la forma correcta. Quizás debo guardar mas información de la captura para poder pasar todos los parámetros que me indica el método createFmd()
Estoy usando la versión 2 del sdk en ubuntu 64 bits.
Saludos y gracias por la ayuda,