5

I'm working on a game for Android that uses gestures as input. I've got a working demo, but the gesture recognition seems a bit too liberal (e.g. there are many false positives), and as I'm considering a gesture library of 30 or so, this will be more of a problem as I add in new gestures.

The official documentation is here:

http://developer.android.com/resources/articles/gestures.html

It says:

In this example, the first prediction is taken into account only if it's score is greater than 1.0. The threshold you use is entirely up to you but know that scores lower than 1.0 are typically poor matches.

Okay, that's great, but what is the range of values for prediction.score? Neither this page nor the javadocs appears to provide a range of values. Does anyone here know? I will have to tweak the values anyway, but it would be nice to have some baseline for my guesses, and this seems like a weird oversight of the documentation.

polyclef
  • 1,281
  • 2
  • 16
  • 20
  • I don't know if this can help you but Cyanogenmod implements gestures in different places of the operating system (lockscreen, sms, etc) and it allow user to set a sensibility from 1 to 12. – rciovati Nov 02 '11 at 17:48

3 Answers3

4

There is no upper limit to the range of prediction.score. A good way to match a gesture is usually to sort the predictions by decreasing score, and if the first gesture has a score > 1, you have a good match.

Romain Guy
  • 97,993
  • 18
  • 219
  • 200
  • Thanks for the response. The problem is less finding a good match than the matches being applied too liberally. For example, I have a fairly distinct gesture that involves moving to the right, looping around and down, then back to the upper left diagonally. I'm getting prediction scores greater than 1.0 simply for squiggles, and sometimes for a simple swipe from left to right. What is the recommended procedure for making matches be applied more narrowly, rather than more widely? – polyclef Nov 03 '11 at 15:21
2

I ran into a similar challenge recently and wrote up my experience and conclusions in this question. For me, it boiled down to experimenting with SEQUENCE_SENSITIVE and ORIENTATION_INVARIANT. Hope it helps.

Community
  • 1
  • 1
Andy Dennie
  • 6,012
  • 2
  • 32
  • 51
0

As best I can tell, the more complicated the gesture, the higher score possible. For instance, a straight line directly left can never appear to get a matching gesture score of higher than 1.8 or so, however a gesture using a checkmark can get scores well into the upper teens if the proportionate parts are perfect, etc. My assumption would be that the more complicated the gesture, the higher confidence it can have in the prediction.

I would evaluate what scores are appropriate per gesture. If the gesture is a straight line you may only look for a score of ~1.2 or higher, but if you are drawing a star or a box or something, perhaps require a higher score to reduce false positives - either way, evaluate per gesture what score is appropriate for the cutoff point.

SmartyP
  • 1,329
  • 1
  • 8
  • 13