1. What causes skeleton jitters?
Though the skeleton jitters could be caused by the application performance due to both software and hardware, there are several internal possible reasons for skeleton joints jittering. One of the main reasons is processing large amounts of data over a period of time during skeleton tracking. Because of the processing of large data, it's very difficult to calculate the accuracy of the joint movements.
2. Making skeleton movement softer
The Kinect for Windows SDK exposes some APIs for smoothing and filtering out the skeleton data. We can set smoothing parameters while setting up the skeleton stream data. The smoothing parameters solve the jittering problem by filtering the skeleton data and applying a smoothing algorithm to it. We have already seen that the SkeletonStream class has an overloaded Enable() method. This method accepts SmoothParameters as a parameter, which is a type of TransformSmoothParameters structure.
For example, the following code enables a skeleton stream using TransformSmoothParameters.
// create the smooth parameters
var smoothParameters = new TransformSmoothParameters
{
Correction = 0.1f,
JitterRadius = 0.05f,
MaxDeviationRadius = 0.05f,
Prediction = 0.1f,
Smoothing = 1.0f
};
// Enable the skeleton stream with smooth parameters
this.sensor.SkeletonStream.Enable(smoothParameters);
应用实例1:《Kinect应用开发实践 》 Page182
var parameters = new TransformSmoothParameters
{
Smoothing = 0.5f,
Correction = 0.5f,
Prediction = 0.5f,
JitterRadius = 0.05f,
MaxDeviationRadius = 0.04f
};
kinect.SkeletonStream.Enable(parameters);
// kinect.SkeletonStream.Enable(); // 以上等同于该指令的作用
应用实例2:《Programming with the Kinect for Windows SDK 》 Page134
参数设置与应用实例1相同,代码略
3. Smoothing parameters
TransformSmoothParameters is a public structure defined in the Microsoft. Kinect assembly. It has five public properties that enable the overall smoothing of skeleton data. The following table lists out the properties:
4. How to check if skeleton smoothing is enabled?
The SkeletonStream has a read-only property IsSmoothingEnabled to check if the smoothing is enabled. For example, you can use the property as follows:
bool isSmoothingEnable = this.sensor.SkeletonStream.IsSmoothingEnabled;
The IsSmoothingEnabled property is automatically set to true when the stream is
enabled with TransformSmoothParameters and false when the default Enable()
method is used.
5. Exponential smoothing
The Kinect for Windows SDK exposes an API to apply the smoothing parameter while enabling the skeleton stream and once it's applied, all the joint positions returned by the skeleton tracking engine will be smooth. The smoothing parameters
are applied to the data returned by the skeleton engine over time. The overall smoothing process uses statistical analysis to generate a moving average of joints, which reduces the noise. The Kinect for Windows SDK uses the Holt double exponential smoothing procedure to reduce the jitters from skeletal joint data. The exponential smoothing is applied to a series of time-based data to make a forecast.
The skeleton engine returns the skeleton frame in a regular time interval. The smoothing algorithm applies to each set of data and calculates a moving average based on the previous set of data. During the calculation of moving average, it uses
the values passed by the smoothing parameter. For example, from the following sample chart you can see the difference between the raw skeleton and smoothed data. If you noticed, the trend of data movement always remains the same as the original data but the deviation is less.
Applying smoothing on skeleton data could be very expensive in terms of application performance. This is because the skeleton stream data itself is massive, and applying smoothing filtering on it makes data processing slow and this highly depends on the parameters you are using.
本文摘自《Kinect for Windows SDK Programming Guide》 Abhijit Jana 著 PACKT Publishing (First Published 2012.12) 第六章:Human Skeleton Tracking
以上转自:http://www.cnblogs.com/microcampus/archive/2013/05/06/3063625.html
其实,Kinect自带的平滑处理方法,对于要求不高的重现效果还是可以的(比如棒状图的人体动作重现);但是对于要求比较高的实时人体模型动作重,由于模型对动作要求比较高,同时还需考虑实时性,Kinect自带的平滑效果无法满足要求,常常会出现这样的效果图:
即,动作会出现模型会出现抖动、塌陷等效果,没法完成很好的重现效果,由于我见过一个应用OpenNI平台的例子提供了自身的平滑处理方法(非开源),所以考虑自己运用一些基本的平滑方法对数据进行处理,这样可能会起到一定的效果,目前尝试的方法是kalman滤波,将其对Kinect平滑后的数据进行二次滤波,这样的效果是上述错误有一些改善,但是不能达到理想的效果。还有很多方法有待尝试。希望对这方面研究比较深入的前辈,看到这篇文章时,能够给予指点!