I am developing simple mobile app for iPhone and Android platform and I am looking for algorithms that would allow me to trigger certain events (functions) when we detect a certain gesture using internal accelerometer. I work with Phonegap that utilizes HTML5 and javascript which reads three coordinates (x,y and z) from accelerometer on pre-set interval (e.g. every 0.04 sec.).
I wrote a simple function that detects a shaking motion and it works quite fine but it is primitive (it only detects shaking, not the direction) - and I want to detect some other gestures such as: - tilt (to the left/right) - shake up/down - shake left/right - circular motion - turn upside down - etc....
Does anybody have algorithms (or at least mathematical formulas/functions) that can calculate (detect) this kind of gestures based on input values I have (x,y,z and time interval for each call)?
I am looking for any code in any programming language (I will rewrite it to javascript myself. Thanks in advance!
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, take a look at this research paper: http://cs.fit.edu/~pkc/papers/tdm04.pdf
Edit: Some time ago, I wrote my thesis about 3D gestures for controlling devices in a smart-home setting. See it in action here (there is a link to the PDF, too). I used FastDTW for recognizing gestures on an iPhone.
You might want to try dynamic time warping. An illustrative example is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With