android - 使用手势比较用户签名

标签 android gesture

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

我看到了关于 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/

相关文章:

android - videoview的onpreparedlistener()出错

android - 如何在 Android Studio 的运行/调试配置中将参数传递给 Java 代码

图像上的 Android 手势

apache-flex - Flex移动手势事件: how to slide between 2 views like Google+ Mobile?

javascript - 当用户在屏幕上拖动/平移时 Canvas 清晰

ios - UILongPressGestureRecognizer iOS 用于连续 Action

android - 如何使用 Parse 避免安装重复?

java - 使用 AsyncTask 显示进度时下载文件时出错

android - 如何从android中的电影文件中读取每一帧?

android - 让手势落入 Android 上的不同 View