使用手势比较用户签名

时间:2012-06-13 08:34:41

标签: android gesture

在我的应用程序中,用户将输入签名,并在下次比较时进行身份验证。

我在SO上看到了问题,但我无法找到我们的比较方式。如果我们使用手势和存储文件作为图像,则不正确,因为下次用户可能会以很小的变化进行签名。

我尝试过使用Gestures进行自我比较,但首先,多击不正常,第二次预测并不完美。

向库添加手势:     public void addGesture(){             if(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();
            }
        }
    }

任何人都可以提出有关此事的建议。

1 个答案:

答案 0 :(得分:0)

你可以做的一件事就是将预测分数从0.7降低。

if (prediction.score > 0.7) {                 // Show the spell                 Toast.makeText(this, prediction.name, Toast.LENGTH_SHORT).show();             } 

我认为这可以解决您的问题。