Handwriting gesture recognition for multiple characters android

扶醉桌前 提交于 2019-12-12 09:23:41

问题


I have implemented handwriting gestures for android character recognition for a single character as shown here.

But i want to read multiple characters at a single time, .i.e Android. I am able to read a single character by the following implementation. But, I need help to recognize a complete word like Android at the same time.

My implementation so far is shown below. GestureLibrary mLibrary;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
    if (!mLibrary.load()) {
        finish();
    }

    GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures);
    gestures.addOnGesturePerformedListener(this);
}
@Override
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
    ArrayList<Prediction> predictions = mLibrary.recognize(gesture);

    if (predictions.size() > 0 && predictions.get(0).score > 1.0) {
        String result = predictions.get(0).name;

        if ("a".equalsIgnoreCase(result))
        {
            ////Toast.makText(this, "a", Toast.LENGTH_LONG).show();
            textView.setText(textView.getText().toString()+"a");
        }
   }
}

Before putting my question, I want everyone there to know that I have checked and read all the questions and answers on stackoverflow regarding this question.

来源:https://stackoverflow.com/questions/41039943/handwriting-gesture-recognition-for-multiple-characters-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!