Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smartphone accelerometer gestures algorightms

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!

like image 688
j99 Avatar asked Jan 31 '12 19:01

j99


2 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, 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.

like image 59
tilo Avatar answered Sep 20 '22 23:09

tilo


You might want to try dynamic time warping. An illustrative example is here.

like image 35
Ali Avatar answered Sep 20 '22 23:09

Ali