Smartphone accelerometer gestures algorightms

I am developing a simple mobile application for the iPhone and Android platforms, and I am looking for algorithms that will allow me to trigger certain events (functions) when we detect a specific gesture using an internal accelerometer. I work with Phonegap, which uses HTML5 and javascript, which reads the three coordinates (x, y, and z) from the accelerometer to a preset interval (for example, every 0.04 sec.).

I wrote a simple function that detects jittery movement, and it works pretty well, but it is primitive (it only determines jitter, not direction) - and I want to detect some other gestures, such as: - tilt (left / right) - shake up / down - shake left / right - circular motion - flip upside down - etc.

Does anyone have algorithms (or at least mathematical formulas / functions) that can calculate (detect) this kind of gestures based on the input values ​​i (x, y, z and the time interval for each call)?

I am looking for any code in any programming language (I will rewrite it directly in javascript. Thanks in advance!

+6
source share
3 answers

Dynamic Time Warping (DTW) does a good job, however I would recommend using Fast Dynamic Time Warping (Fast DTW). Especially for mobile scenarios, FastDTW is really applicable! For a detailed version, see this article: http://cs.fit.edu/~pkc/papers/tdm04.pdf

Edit:. Some time ago, I wrote my thesis on 3D gestures for controlling devices in setting up a smart home. See here in action here (there is a link to PDF). I used FastDTW to recognize gestures on the iPhone.

+4
source

You might want to try dynamically changing the time . An illustrative example is here .

+1
source

If I can be so bold, Fast DTW (and related, but another FTW Sakurai and Faloutsos) are not good solutions.

If you limit deformation (a):

  • Then using the lower bound of DTW is as fast as the Euclidean distance [b] [c]
  • Accuracy will improve. (a, b)

For limited deformation, FTW and Fast DTW are slower than brute force due to overhead (e.g. Ira Assent).

a) Ratanamahatana, CA and Keogh. E. (2004). Everything you know about dynamic timing is wrong

b) Xiaoyue Wang, Hui Ding, Goce Trajcevski, Peter Scheuermann, Eamonn J. Keogh: Experimental comparison of presentation methods and distance measurements for time series data CoRR abs / 1012.2789: (2010)

c) http://www.cs.ucr.edu/~eamonn/LB_Keogh.htm

0
source

Source: https://habr.com/ru/post/907344/


All Articles