I would like to detect gestures on an iOS device using the accelerometer and perhaps the gyroscope. The Application should detect movements like drawing a circle or a rectangle in the air. I've found several papers on gesture recognition on iPhones but there is no actual code which I could use. I wonder if there is a library which could assist me in approaching this goal in any way? If not, I have to start building one on my own! :) Thanks in advance! Markus
3 Answers
You'll probably have to develop those functions on your own. The built in gesture recognition features are all for touch based events.

- 9,524
- 1
- 31
- 34
I related question is here, it may help little.
Beside the paper mentioned there, you might find interesting this paper too, page 363, 5. boundary conditions and page 364. I am curious how DTW works for your application. Good luck anyhow!
-
Somebody thought like me before me. :-p I was on the right track! :-) – Constantino Tsarouhas Jun 27 '11 at 23:11
-
Thank you very much, this seemes to be far much easier than the Hidden Markov Stuff I've found so far. I'm trying to evaluate this stuff a little and therefore dont want to put thaaat much effort into it. But I will definitely try the DTW! – blackforestcowboy Jun 28 '11 at 00:35
-
I am glad you liked the idea. Please post your experience with the DTW, I am curious! – Ali Jun 28 '11 at 00:54
-
1Soo, i have not implemented the DTW algorithm you described in your other post. But i have a little problem with understanding it. perhaps you can help me :) https://skitch.com/reinerspass/fg66p/iphone-store-orientation-to-an-array-and-compare-stack-overflow The number in the lower left corner is ok, 5-2 is 3 + min of three times 0 is 0, so the result is zero. But i get confused with the next one: 5-4 is 1 + min(0,0,3) is 1, you have 4 in your chart. It would be nice if you can give me e hint! :) Thanks in advance! – blackforestcowboy Jun 28 '11 at 02:17
-
My mistake, thanks for pointing that out. The matrices are correct, just the explanation how I got them was wrong. The `D(0,*)` and `D(*,0)` are not zero but left out. The **columns** are computed first. I fixed these in the answer. – Ali Jun 28 '11 at 08:40
-
Ahh thank you very much! Now its clear and my app is working. I currently use the algorithm in a little drawing app which allows to record and then match gestures. So far I further evaluate it. The results are not that marvelous :) I think i have to normalize the inputvalues in a certain way. – blackforestcowboy Jun 28 '11 at 16:22
-
Yes, I only gave a sketch of the algorithm. Please check the linked paper / google dwt, there are a number of ways to improve the basic algorithm. Good luck! – Ali Jun 28 '11 at 16:28
Use Core Motion and a lot of mathematical functions.
I'll take a guess (for which I'll be probably wrong): If you want to capture circular motions (drawing with the device a circle in the air in one plane), take regular samples (> 20 Hz) and save the maximum values of x, y and z in an array each (to recognize in all 3 planes). If you want the gesture to be 5 seconds long, keep 100 samples (at 20 Hz). Then analyze if any of the three arrays has values which change sinusoidally. If it does, you've got a gesture.
I guess it's a bit of trial and error, or drawing on paper a circle and guessing the accelerometer values in the progress of moving.
Hope you find the answer. I'm very interested already.

- 6,846
- 6
- 43
- 54
-
yes, you are on the right track, DTW (see the link at my answer) is better for gesture recognition. – Ali Jun 27 '11 at 23:20
-
thanks your idea! :) I'll try to implement @Ali's idea since it sounds very promising! – blackforestcowboy Jun 28 '11 at 00:36