1. 程式人生 > >Kinect V2開發(6)骨骼資料平滑處理

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中不再包含現成的平滑方法,需要自己去實現。