0
我目前正在從一個簡單的java項目中掃描用戶的指紋,將其轉換爲字符串,使用文本將其存儲在數據庫(MySQL)中,從數據庫中檢索它們並將其與新指紋執行匹配操作。問題出在同一個人身上,它不識別指紋數據。 爲了捕捉手指數據,我使用Mantra的MFS100指紋設備! 下面是代碼卡:錯誤匹配手指數據
byte[] ISOTemplate = null;
/* Finger data contains
* byte[] ISOTemplate;
*/
FingerData data = new FingerData();
/*It will now scan fingerprints from device*/
int ret = mfs100.AutoCapture(data,timeout,false,false);
//Initializing local ISOTemplate
ISOTemplate = new byte[data.ISOTemplate().length];
System.arraycopy(data.ISOTemplate(), 0, ISOTemplate, 0, data.ISOTemplate().length);
//Storing it in database
String str = new String(ISOTemplate);
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/db","user","pass");
PreparedStatement ps = con.prepareStatement("update datatable set fingerscan = ? where empID like '123'");
ps.setString(1,str);
ps.executeUpdate();
直到這裏,一切工作正常。問題在這裏:
PreparedStatement ps = con.prepareStatement("select fingerscan from datatable where empID like '123'");
ResultSet rs = ps.executeQuery();
while(rs.next()){
String tmp = rs.getString("fingerscan");
ISOTemplate = tmp.getBytes();
}
//captures new data from user
int ret = mfs100.AutoCapture(data, timeout, false, false);
if(ret == 0){
int score = 0;
score = mfs100.MatchISO(data.ISOTemplate(), ISOTemplate);
System.out.println("Score:"+score);
if(score > 14000){
Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Success:"+score, ButtonType.OK);
alert.show();
}else if (score >= 0 && score < 14000) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Failure:"+score, ButtonType.OK);
alert.show();
}
}
根據設備規範匹配分數應該大於14000.但在我的情況下,得分只有1300左右。 我已經試過這樣:
How to save "Finger Print" in database
但還是得分低於14000
我知道問題是,當我存儲在手指數據的mysql數據庫中的數據變得無用。 所以請建議我將手指數據存儲到數據庫中的一些方法。 請幫我提高比賽得分。
@ShahidPeerzade請接受的答案,如果它是有用的 – LaurentY