智能手机加速度计手势算法
我正在为 iPhone 和 Android 平台开发简单的移动应用程序,我正在寻找算法,当我们使用内部加速度计检测到某个手势时,该算法允许我触发某些事件(功能)。我使用 Phonegap,它利用 HTML5 和 javascript,以预设的时间间隔(例如每 0.04 秒)从加速度计读取三个坐标(x、y 和 z)。
我编写了一个简单的函数来检测摇动运动,它工作得很好,但它很原始(它只检测摇动,而不是方向) - 我想检测其他一些手势,例如: - 倾斜(向左/向右) - 上/下摇动 - 向左/向右摇动 - 圆周运动 - 翻转过来 - 等等......
是否有人有算法(或至少是数学公式/函数)可以根据我拥有的输入值(x,y,z 和每次调用的时间间隔)计算(检测)这种手势?
我正在寻找任何编程语言的任何代码(我自己将其重写为javascript。提前致谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
动态时间扭曲 (DTW) 效果很好,但我建议使用快速动态时间扭曲 (Fast DTW)。尤其是对于移动场景,FastDTW真的很适用!
有关详细版本,请查看此研究论文:http://cs.fit .edu/~pkc/papers/tdm04.pdf
编辑: 不久前,我写了一篇关于在智能家居环境中控制设备的 3D 手势的论文。 此处查看实际情况(也有 PDF 链接)。我使用 FastDTW 来识别 iPhone 上的手势。
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.
如果我这么大胆的话,Fast DTW(以及 Sakurai 和 Faloutsos 的相关但不同的 FTW)并不是很好的解决方案。
如果约束扭曲 (a):
对于约束扭曲,FTW 和快速 DTW 比强力慢,因为到头顶(Ira Assent 等人已经证明了这一点)。
a) Ratanamahatana,CA 和 Keogh。 E.(2004)。你所知道的关于动态时间扭曲的一切都是错误的
b) Xiaoyue Wang, Hui Ding, Goce Trajcevski, Peter Scheuermann, Eamonn J. Keogh:时间序列数据表示方法和距离测量的实验比较 CoRR abs/1012.2789: (2010)
c) http://www.cs.ucr.edu/~eamonn/LB_Keogh.htm
If I may be so bold, Fast DTW (and the related, but different FTW of Sakurai and Faloutsos) are not good solutions.
If you constrain the warping (a):
For constrained warping FTW and Fast DTW are slower than brute force due to overhead (Ira Assent among others have shown this).
a) Ratanamahatana, C. A. and Keogh. E. (2004). Everything you know about Dynamic Time Warping is Wrong
b) Xiaoyue Wang, Hui Ding, Goce Trajcevski, Peter Scheuermann, Eamonn J. Keogh: Experimental Comparison of Representation Methods and Distance Measures for Time Series Data CoRR abs/1012.2789: (2010)
c) http://www.cs.ucr.edu/~eamonn/LB_Keogh.htm