以前書いたPointの平滑化をさらに拡張、
一度インスタンスを作れば各JointType全てに平滑処理が走るように実装してみた。 でもコレの違いってやってる人じゃないと分かんないかもしれない。 個人的にはかなりヌルヌル動いてて結果に満足だけど・・・。 以下ソース using System; using System.Windows; using System.Collections.Generic; using Microsoft.Kinect; namespace Microsoft.Samples.Kinect.BodyBasics { class SmoothingPoint { private static Dictionary<JointType, Queue<Point>> pointBufferS = new Dictionary<JointType, Queue<Point>>(); private static Dictionary<JointType, Queue<Point>> pointBufferE = new Dictionary<JointType, Queue<Point>>(); public SmoothingPoint() { foreach (JointType jt in Enum.GetValues(typeof(JointType))) { pointBufferS.Add(jt, new Queue<Point>()); } } public Point Smoothing(JointType jType, Point p) { return DoubleMovingAverage(jType, p); } private Point SimpleAverageFilter(JointType jt, Point newPoint, int parameter) private Point DoubleMovingAverage(JointType jt, Point newPoint, int parameter = 5) Point newSimpleAverage = SimpleAverageFilter(jt, newPoint, parameter); if (pointBufferE[jt].Count <= parameter) pointBufferE[jt].Dequeue(); int n = pointBufferE[jt].Count; for (int i = 0; i < pointBufferE[jt].Count; i++) point.X = x / n; return point; } }}
by onigirism
| 2015-12-10 18:26
| C#
|
Comments(0)
|
カテゴリ
全体 Kinect Unity C# ノンジャンル Blender Music プログラミング アプリ スマホ まーくあっぷ PC Windows Android VisualStudio サモンズボード 未分類 以前の記事
2017年 06月 2017年 03月 2016年 12月 2016年 11月 2016年 08月 2016年 06月 2016年 02月 2016年 01月 2015年 12月 2015年 11月 2015年 10月 2015年 09月 2015年 08月 2015年 07月 2015年 06月 フォロー中のブログ
タグ
その他のジャンル
最新の記事
外部リンク
|
ファン申請 |
||