在我的应用程序中,用户将输入签名,下次它会比较并进行身份验证。
我看到了关于 SO 的问题,但我找不到我们如何比较。如果我们使用手势并将文件存储为图像,则它是不正确的,因为下次用户可能会以很小的变化签名。
我已经尝试使用自己的手势进行比较,但是,首先,多笔画不能正常工作,其次预测也不完美。
将手势添加到库中: public void addGesture() { 如果(mGesture != null){
final GestureLibrary store = getStore();
store.addGesture("ges", mGesture);
store.save();
setResult(RESULT_OK);
final String path = new File(Environment.getExternalStorageDirectory(),
"gestures").getAbsolutePath();
Toast.makeText(this,"success", Toast.LENGTH_LONG).show();
} else {
setResult(RESULT_CANCELED);
}
}
比较:
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
ArrayList<Prediction> predictions = mLibrary.recognize(gesture);
Log.e("predictions","predictions----"+predictions.size());
// We want at least one prediction
if (predictions.size() > 0) {
Prediction prediction = predictions.get(0);
// We want at least some confidence in the result
Log.e("SCORE","SCORE----"+prediction.score);
if (prediction.score > 1.0) {
// Show the spell
Toast.makeText(this, prediction.name, Toast.LENGTH_SHORT).show();
}
}
}
任何人都可以对此提出建议。
最佳答案
您可以做的一件事是将预测分数从 0.7 降低到 0.7。
if (prediction.score > 0.7) { // Show the spell Toast.makeText(this, prediction.name, Toast.LENGTH_SHORT).show(); }
我认为这应该可以解决您的问题。
关于android - 使用手势比较用户签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11011036/