Handwriting gesture recognition for multiple chara

2019-04-16 10: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.

0条回答
登录 后发表回答