问题描述
我正在基于设备运动在画布上绘画,我想基于移动运动在画布上绘制不同的字符。
I am drawing on canvas based on device movement, I want to draw different characters in canvas based on mobile movement.
当前其工作正常,但是我想找到时差,我想检测暂停,暂停表示当用户不尝试绘制且用户不移动手机时,因此Application ca假定现在用户要绘制下一个字符。
Currently its working, but I want to find time difference and i want to detect pause, pause means when user is not trying to draw and user is not moving mobile phone, so that Application ca assume that now user want to draw next character.
如何在加速度计值中查找暂停。有逻辑吗?还告诉我如何使加速度计值平滑,以便用户可以在没有噪声的情况下绘制线条。
How to find pause in accelerometer values. Any logic? Also tell me how i can smooth accelerometer values, so that user can draw lines without noise.
推荐答案
我无法使用加速器部分,但考虑到数据中的噪音,这是使用 产生相似的结果,但不会牺牲末端的任何点(移动平均值将向前或在结束)。
A different approach would be to use a Savitzky–Golay filter which gives a similar result, but not "sacrifice" any points at the end (moving average will push forward or crop at the end).
这篇关于使用Windows Phone 8.1中的加速度传感器数据在画布上绘制线条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!