Kinect V2开发(6)骨骼数据平滑处理

Kinect获取到的关节坐标数据包含了许多噪声。
影响噪声特性和大小的因素有很多(room lighting; a person’s body size; the person’s distance from the sensor array; the person’s pose (for example, for hand data, if the person’s hand is open or fisted); location of the sensor array; quantization noise; rounding effects introduced by computations; and so on)。误差从来源看可分为系统误差和偶然误差,如下图b所示为系统误差(由于仪器本身不精确,或实验方法粗略,或实验原理不完善而产生的),要减小系统误差,必须校准测量仪器,改进实验方法,设计在原理上更为完善的实验。图d为偶然误差(由各种偶然因素而产生的),偶然误差总是有时偏大,有时偏小,并且偏大偏小的概率相同。因此,可以多进行几次测量,求出几次测得的数值的平均值,这个平均值比一次测得的数值更接近于真实值。由于噪声的性质各不相同,适用的滤波方法也不一样。
这里写图片描述

滤波会带来一定的延迟
这里写图片描述
A useful technique to reduce latency is to tweak the joint filter to predict the future joint positions. That is, the filter output would be a smoothed estimate of joint position in subsequent frames. If forecasting is used, then joint filtering would reduce the overall latency. However, since the forecasted outputs are estimated from previous data, the forecasted data may not always be accurate, especially when a movement is suddenly started or stopped. Forecasting may propagate and magnify the noise in previous data to future data, and hence, may increase the noise.
减少延迟的一种有效方法是调整关节滤波器,以预测未来的关节位置。意思是说滤波器输出将是对后续帧中联合位置的平滑估计。

Accordingly, one should understand how latency and smoothness affect the user experience, and identify which one is more important to create a good experience. Then, carefully choose a filtering method and fine-tune its parameters to match the specific needs of the application. In most Kinect applications, data output from the ST system is used for a variety of purposes—such as gesture detection, avatar retargeting, interacting with UI items and virtual objects, and so on—where all are different in terms of how smoothness and latency affect them. Similarly, joints have different characteristics from one another in terms of how fast they can move, or how they are used to create the overall experience. For example, in some applications, a person’s hands can move much faster than the spine joint, and therefore, one needs to use different filtering techniques for hands than the spine and other joints.
没有哪种滤波器适用所有情况下的所有骨骼数据平滑处理。

滤波器的阶跃信号和正弦信号的时间响应:
这里写图片描述

上升时间显示过滤器对输入的突然变化有多快,而超调、振铃和稳定时间则表明过滤器在对输入的突然变化作出反应后能够很好地稳定下来。 过滤器对STEP函数的响应并不能显示过滤技术的所有有用特性,因为它只显示过滤器对突然变化的响应。研究滤波器对正弦波输入的时域和频域响应也是非常有用的。

这里写图片描述

时域响应可以显示滤波器输出的滞后,这在大多数情况下取决于输入频率(即非线性相位滤波器)。注意,由于滤波器衰减了输入频率,输出可能达不到输入的最大或最小水平。

骨骼数据滤波有很多种方法

  • Auto Regressive Moving Average (ARMA) Filters自回归滑动平均(ARMA)滤波器 Simple
  • Averaging Filter 简单平均滤波器 Double Moving Averaging Filter 双动平均滤波器
  • Savitzky–Golay Smoothing Filter Savitzky-Golay平滑滤波器
  • Exponential Smoothing Filter 指数平滑滤波器
  • Double Exponential Smoothing Filter 双指数平滑滤波器
  • Adaptive Double Exponential Smoothing Filter 自适应双指数平滑滤波器
  • Taylor Series Filter Taylor级数滤波器
  • Median Filter 中值滤波器
  • Jitter Removal Filter 抖动消除滤波器

在Kinect V1SDK中用的是Holt双指数平滑法
这里写图片描述

  • Smoothing:平滑参数,设置处理骨骼数据帧时的平滑量。值越大,平滑的越多,0表示不进行平滑;
  • Correction:修正参数,值越小,修正越多;
  • Prediction : 预测超前期数,增大该值能减小滤波的延迟,但是会对突然的运动更敏感,容易造成过冲(可以设置合理的最大偏离半径减轻该问题);
  • JitterRadius:抖动半径参数,设置修正的半径。如果关节点“抖动”超过了设置的这个半径,将会被纠正到这个半径之内。(Jitter removal limits changes of each frame in order to dampen the spikes);
  • MaxDeviationRadius:最大偏离半径参数,用来和抖动半径一起来设置抖动半径的最大边界。

    Kinect SDK2.0中不再包含现成的平滑方法,需要自己去实现。


参考
Skeletal Joint Smoothing White Paper
Joint Flitering
如何平滑处理Kinect采集的骨骼数据 | KinectAPI编程