Tiefpassfilter Dies sind in erster Linie Hinweise Es wird in keinem Sinne abgeschlossen sein. Es besteht darin, Fragmente nützlicher Informationen zu enthalten. Pseudocode Der exponentiell gewogene gleitende Mittelwert (EWMA) ist der Name für die wahrscheinlich einfachste digitale Zeitbereichs-Realisierung des (ersten) Tiefpasses auf diskreten Daten. Dieser Filter glättet mit einem sich bewegenden lokalen Durchschnitt, was ihn zu einem trägen Folger des Eingangssignals macht. Intuitiv reagiert sie langsam auf die schnellen Änderungen (den hochfrequenten Anteil), während sie immer noch der Gesamttendenz des Signals (dem niederfrequenten Anteil) folgen. Er wird durch eine Variable (siehe x3b1) gewogen, um seine Empfindlichkeit variieren zu können. In Anwendungen, die in einem regelmäßigen Intervall (z. B. Sound) abtasten, können Sie x3b1 auf den Frequenzinhalt beziehen. In diesen Fällen wollen Sie oft eine gefilterte Ausgangsserie für eine Eingangsserie berechnen, indem Sie eine Liste durchlaufen, die so etwas wie: oder das Äquivalent macht: Die letztere Form kann sich intuitiveinformulieren: Die Änderung des gefilterten Outputs ist proportional zur Menge von Geändert und mit der Filterstärke x3b1 gewogen. Beide können helfen, zu prüfen, wie die Verwendung der zuletzt gefilterten Ausgabe die Trägheit des Systems hervorruft: Ein kleineres x3b1 (größeres 1-x3b1 in dem ehemaligen) (macht auch für größere RC) bedeutet, dass der Ausgang träger anliegt und weniger Rauschen zeigen sollte Cutoff-Frequenz ist niedriger (überprüfen)). Ein größeres x3b1 (kleineres 1-x3b1) (kleineres RC) bedeutet, dass sich der Ausgang schneller einstellen wird (weniger Trägheit), aber empfindlicher auf Rauschen (da die Grenzfrequenz höher ist) Wo Sie nur möchten, dass der letzte Wert die Speicherung eines großen Arrays vermeiden kann, indem Sie für jedes neue Sample (oft eine Reihe von Zeiten in einer Reihe, um sicherzustellen, dass wir genug einstellen) folgendes tun. In Fällen von nicht-so-regelmäßiger Probenahme ist x3b1 mehr mit der Geschwindigkeit der Adaption als mit dem Häufigkeitsgehalt verbunden. Sein noch relevantes, aber die Anmerkungen über Frequenzinhalt gelten weniger streng. In der Regel möchten Sie das Arraymemory als Float implementieren - auch wenn Sie Ints zurückgeben - um Probleme durch Rundungsfehler zu vermeiden. Das meiste Problem: Wenn Alphadifferenz (selbst eine schwebende Multiplikation) kleiner als 1 ist, wird sie in einer (truncatng) Form zu einer ganzen Zahl 0. Wenn zum Beispiel Alpha 0,01 ist, werden Signalunterschiede kleiner als 100 für eine Einstellung von 0 (über eine Ganzzahl-Trunkierung) sorgen, so daß sich der Filter niemals auf den tatsächlichen ADC-Wert einstellen würde. EWMA hat das Wort exponentiell in ihr, weil jede neue gefilterte Ausgabe effektiv alle Werte vor ihr und effektiv mit exponentiell abklingende Gewichte verwendet. Siehe die Wikipedia Links für weitere Diskussion. Ein grafisches Beispiel: Ein Screenshot aus arduinoscope - ein bewegter Graph mit den neuesten Proben auf der linken Seite. Das rohe Signal an der Spitze ist ein paar Sekunden wert eines ADC-Sampling von einem schwimmenden Pin, mit einem Finger berührt es hin und wieder. Die anderen sind Lowpassed Versionen davon, mit zunehmender Stärke. Einige Dinge zu beachten: die langsame exponentielle Anpassung an Schritt-ähnliche Antworten (ähnlich wie ein Ladekondensator - schnell intially, dann langsamer und langsamer) die Unterdrückung der einzelnen großen Spikesdeviations. Dass es sicher möglich ist, zu hart zu filtern (obwohl diese Beurteilung stark von der Abtastgeschwindigkeit und den Anpassungsinhaltsfrequenzen abhängt, die Ihr Zielzweck benötigt). Im zweiten Bild kommt die Vollbereichsschwingung auf halbem Weg nicht so sehr wegen der Filterung, sondern auch vor allem, weil die meisten Rohproben um sie herum an beiden Enden des ADCs-Bereichs gesättigt sind. Auf x3b1, x3c4, und die Cutoff-Frequenz Dieser Artikel ist ein Stub x2014 wahrscheinlich ein Stapel von halb-sortierten Notizen, ist nicht gut überprüft, so haben möglicherweise falsche Bits. (Fühlen Sie sich frei zu ignorieren, zu fixieren, oder sagen Sie mir) x3b1 ist der Glättungsfaktor, theoretisch zwischen 0,0 und 1,0, in der Praxis meist lt0,2 und oft lt0.1 oder kleiner, weil über, dass Sie kaum noch Filterung. In DSP basiert es oft auf: x394 t. Regelmäßig schriftlich dt. Das Zeitintervall zwischen den Abtastwerten (Reziprokwert der Abtastrate), eine Wahl der Zeitkonstante x3c4 (tau), alias RC (letzteres scheint ein Hinweis auf einen Widerstand-plus-Kondensator-Schaltkreis, der ebenfalls Tiefpaß erzeugt Die der Kondensator lädt Wenn Sie eine RC in der Nähe von dt youll erhalten Alphas höher als 0,5, und auch eine Cutoff-Frequenz, die in der Nähe der Nyquist-Frequenz ist (passiert bei 0.666 (überprüfen)), die herausfiltert so wenig, dass es den Filter macht In der Praxis youll oft wählen Sie eine RC, die mindestens ein paar Vielfache von dt, was bedeutet, dass x3b1 ist in der Größenordnung von 0,1 oder weniger. Wenn die Probenahme erfolgt streng regelmäßig, wie es für Sound und viele andere DSP-Anwendungen , Ist die Cutoff-Frequenz, auch bekannt als Knie-Frequenz, gut definiert, zum Beispiel: Wenn RC0.002sec, ist die Cutoff bei 200Hz, 2000Hz und 20000Hz Abtastung, die für Alpha von 0,7, 0,2 und 0,024 macht (Bei gleicher Abtastgeschwindigkeit: je niedriger Alpha, desto geringer die Anpassung an neue Werte und desto geringer die effektive Cutoff-Frequenz) (verifizieren) Für einen Tiefpass erster Ordnung: Bei niedrigeren Frequenzen ist das Ansprechverhalten nahezu vollständig flach Diese Frequenz beträgt -3dB (hat begonnen, in einem weichen Bendknee abzunehmen) bei höheren Frequenzen, die es bei 6dboctave (20dBdecade) abfällt. Höherwertige Variationen fallen schneller ab und haben ein härteres Knie. Beachten Sie, dass es auch eine Phasenverschiebung gibt, die hinter dem Eingang zurückbleibt. Es hängt von der Frequenz, die es beginnt früher als die Amplitude fallen, und wird -45 Grad bei der Knie-Frequenz (überprüfen). Arduino Beispiel Dieser Artikel ist ein Stub x2014 wahrscheinlich ein Haufen von halb-sortierten Notizen, ist nicht gut überprüft, so kann falsche Bits haben. (Fühlen Sie sich frei zu ignorieren, zu fixieren, oder sagen Sie mir) Dies ist eine Single-Stück-Speicher-Version, denn wenn Sie interessiert sind nur in den (neuesten) Ausgangswert. Semi-sortedUpdated 12. März 2013 Was sind RC Filtering und Exponential Averaging und wie unterscheiden sie sich Die Antwort auf den zweiten Teil der Frage ist, dass sie der gleiche Prozess sind Wenn man aus einem Elektronik-Hintergrund dann RC Filtering (oder RC Glättung) kommt Der übliche Ausdruck. Auf der anderen Seite hat ein Ansatz, der auf Zeitreihenstatistik basiert, den Namen Exponential Averaging oder den vollen Namen Exponential Weighted Moving Average. Dies wird auch als EWMA oder EMA bezeichnet. Ein wesentlicher Vorteil des Verfahrens ist die Einfachheit der Formel für die Berechnung der nächsten Ausgabe. Es benötigt einen Bruchteil der vorherigen Ausgabe und einen Minus dieser Fraktion mal der Stromeingabe. Algebraisch zum Zeitpunkt k ist die geglättete Ausgabe y k gegeben durch Wie später gezeigt, hebt diese einfache Formel die jüngsten Ereignisse hervor, glättet Hochfrequenzschwankungen und zeigt langfristige Trends. Es gibt zwei Formen der exponentiellen Mittelungsgleichung, die eine oben und eine Variante Both sind richtig. Siehe die Hinweise am Ende des Artikels für weitere Details. In dieser Diskussion werden wir nur die Gleichung (1) verwenden. Die obige Formel wird manchmal in der begrenzten Weise geschrieben. Wie ist diese Formel abgeleitet und was ist ihre Interpretation Ein wichtiger Punkt ist, wie wir wählen. Um dies zu untersuchen, ist ein RC-Tiefpassfilter zu betrachten. Jetzt ist ein RC-Tiefpassfilter einfach ein Serienwiderstand R und ein Parallelkondensator C, wie unten dargestellt. Die Zeitreihengleichung für diese Schaltung ist Das Produkt RC hat Zeiteinheiten und wird als Zeitkonstante T bezeichnet. Für die Schaltung. Angenommen wir repräsentieren die obige Gleichung in ihrer digitalen Form für eine Zeitreihe, die alle h Sekunden dauert. Wir haben Dies ist genau die gleiche Form wie die vorherige Gleichung. Vergleicht man die beiden Beziehungen für a, die sich auf die sehr einfache Beziehung verringert, ergibt sich die Wahl von N, um welche Zeitkonstante wir uns entschieden haben. Nun kann Gleichung (1) als Tiefpassfilter erkannt werden, und die Zeitkonstante bezeichnet das Verhalten des Filters. Um die Bedeutung der Zeitkonstanten zu sehen, müssen wir die Frequenzcharakteristik dieses Tiefpass-RC-Filters betrachten. In seiner allgemeinen Form ist dies in E-Modul und Phase-Form haben wir, wo der Phasenwinkel ist. Die Frequenz wird als nominale Grenzfrequenz bezeichnet. Physikalisch kann gezeigt werden, daß bei dieser Frequenz die Leistung im Signal um die Hälfte reduziert wurde und die Amplitude um den Faktor verringert ist. In dB ist diese Frequenz, wo die Amplitude um 3dB reduziert wurde. Wenn die Zeitkonstante T zunimmt, nimmt die Grenzfrequenz ab, und wir wenden den Daten mehr Glättung zu, dh wir eliminieren die höheren Frequenzen. Es ist wichtig anzumerken, dass der Frequenzgang in Bogenmaß angegeben ist. Das ist es ist ein Faktor der beteiligt. Wenn beispielsweise eine Zeitkonstante von 5 Sekunden gewählt wird, ergibt sich eine effektive Grenzfrequenz von. Eine beliebte Verwendung von RC-Glättung ist die Simulation der Wirkung eines Meters, wie er in einem Schallpegelmesser verwendet wird. Diese werden typischerweise durch ihre Zeitkonstante wie beispielsweise 1 Sekunde für S-Typen und 0,125 Sekunden für F-Typen typisiert. Für diese beiden Fälle liegen die effektiven Grenzfrequenzen bei 0,16 Hz bzw. 1,27 Hz. Eigentlich ist es nicht die Zeitkonstante, die wir normalerweise wählen wollen, sondern jene Perioden, die wir einschließen möchten. Angenommen, wir haben ein Signal, wo wir Merkmale mit einer P zweiten Periode einschließen möchten. Nun ist eine Periode P eine Frequenz. Dann können wir eine Zeitkonstante T wählen. Allerdings wissen wir, dass wir etwa 30 der Ausgabe (-3dB) verloren haben. Die Wahl einer Zeitkonstante, die genau den Periodizitäten entspricht, die wir beibehalten wollen, ist nicht das beste Schema. Es ist normalerweise besser, eine etwas höhere Grenzfrequenz zu wählen, sagen wir. Die Zeitkonstante ist dann die in der Praxis ähnelt. Dies verringert den Verlust auf etwa 15 bei dieser Periodizität. In der Praxis also, um Ereignisse mit einer Periodizität von oder größer zu halten, dann wählen Sie eine Zeitkonstante von. Dies beinhaltet die Auswirkungen der Periodizität von bis zu etwa. Zum Beispiel, wenn wir die Auswirkungen der Ereignisse, die mit sagen, eine 8-Sekunden-Periode (0,125 Hz), dann wählen Sie eine Zeitkonstante von 0,8 Sekunden. Dies ergibt eine Grenzfrequenz von ungefähr 0,2 Hz, so daß unsere 8-Sekunden-Periode im Hauptdurchlaßband des Filters gut ist. Wenn wir die Daten mit 20 timessecond (h 0,05) abtasten, dann ist der Wert von N (0,80,05) 16 und. Dies gibt einen Einblick in die Einstellung. Grundsätzlich für eine bekannte Abtastrate bezeichnet er die Mittelungsperiode und wählt aus, welche Hochfrequenzschwankungen ignoriert werden. Mit Blick auf die Erweiterung des Algorithmus können wir sehen, dass es die neuesten Werte begünstigt, und auch, warum es als exponentielle Gewichtung bezeichnet wird. Wir haben Ersatz für y k-1 gibt Wiederholen dieses Prozesses mehrmals führt zu, weil im Bereich dann deutlich die Begriffe nach rechts kleiner werden und sich wie eine abklingende Exponential verhalten. Das ist die aktuelle Ausgabe ist auf die jüngeren Ereignisse voreingenommen, aber je größer wir wählen, desto weniger Bias. Zusammenfassend lässt sich feststellen, dass die einfache Formel die jüngsten Ereignisse hervorhebt, die die Ereignisse mit hoher Frequenz (kurzzeitig) glätten, zeigt langfristige Trends Anhang 1 8211 Alternative Formen der Gleichung Achtung Es gibt zwei Formen der exponentiellen Mittelungsgleichung, die in der Literatur vorkommen. Beide sind richtig und gleichwertig. Die erste Form, wie oben gezeigt, ist (A1) Die alternative Form ist 8230 (A2) Beachten Sie die Verwendung von in der ersten Gleichung und in der zweiten Gleichung. In beiden Gleichungen sind Werte zwischen Null und Eins. Früher wurde definiert als Jetzt wählen, um zu definieren Also die alternative Form der exponentiellen Mittelung Gleichung ist In physikalischen Begriffen bedeutet es, dass die Wahl der Form verwendet wird, hängt davon ab, wie man denken, entweder nehmen als die Rückkopplung Fraktion Gleichung (A1) oder Als den Bruchteil der Eingangsgleichung (A2). Die erste Form ist etwas weniger umständlich, wenn sie die RC-Filterbeziehung zeigt, und führt zu einem einfacheren Verständnis in Filterausdrücken. Chief Signal Processing Analyst bei Prosig Dr. Colin Mercer war früher am Institut für Schall - und Schwingungsforschung (ISVR) der University of Southampton, wo er das Data Analysis Center gründete. Er ging dann zu Prosig im Jahr 1977 gefunden. Colin zog sich als Chief Signal Processing Analyst bei Prosig im Dezember 2016. Er ist ein Chartered Ingenieur und ein Fellow der British Computer Society. Ich denke, dass Sie den 8216p8217 zum Symbol für pi ändern möchten. Marco, danke für das Zeigen. Ich denke, dies ist einer unserer älteren Artikel, die von einem alten Textverarbeitungsdokument übertragen wurde. Offensichtlich, der Herausgeber (mir) nicht zu erkennen, dass die pi nicht korrekt transkribiert wurde. Sie wird in Kürze behoben. Es ist ein sehr guter Artikel Erklärung über die exponentielle Mittelung Ich glaube, es gibt einen Fehler in der Formel für T. Es sollte T h (N-1), nicht T (N-1) h sein. Mike, danke für das Spotting. Ich habe gerade zurück zu Dr Mercer8217s ursprünglichen technischen Hinweis in unserem Archiv und es scheint, dass es Fehler bei der Übertragung der Gleichungen auf den Blog. Wir korrigieren die Post. Danke, dass Sie uns wissen Danke Danke danken Ihnen. Sie können 100 DSP-Texte lesen, ohne etwas zu sagen, dass ein exponentieller Mittelungsfilter das Äquivalent eines R-C-Filters ist. Hmm, haben Sie die Gleichung für einen EMA-Filter richtig ist es nicht Yk aXk (1-a) Yk-1 anstatt Yk aYk-1 (1-a) Xk Alan, Beide Formen der Gleichung erscheinen in der Literatur, und Beide Formen sind korrekt, wie ich unten zeigen werde. Der Punkt, den Sie machen, ist wichtig, weil die Verwendung der alternativen Form bedeutet, dass die physikalische Beziehung mit einem RC-Filter weniger offensichtlich ist, darüber hinaus ist die Interpretation der Bedeutung eines in dem Artikel gezeigt nicht geeignet für die alternative Form. Zuerst zeigen wir, dass beide Formen korrekt sind. Die Form der Gleichung, die ich verwendet habe und die alternative Form, die in vielen Texten erscheint, ist Anmerkung in der oben Ich habe Latex 1latex in der ersten Gleichung und Latex 2latex in der zweiten Gleichung verwendet. Die Gleichheit beider Formen der Gleichung wird mathematisch unterhalb der einfachen Schritte auf einmal gezeigt. Was ist nicht das gleiche ist der Wert für Latex-Latex in jeder Gleichung verwendet. In beiden Formen ist Latex-Latex ein Wert zwischen Null und Eins. Zuerst wird die Gleichung (1) beschrieben, die Latexlatex durch Latexlatex ersetzt. Dies ergibt Latexyk y (1 - beta) xklatex 8230 (1A) Jetzt definieren wir Latexbeta (1 - 2) Latex und so haben wir auch Latex 2 (1 - beta) Latex. Setzt man diese in die Gleichung (1A) ein, so erhält man die Latexyk (1 - 2) y 2xklatex 8230 (1B) und schließlich die Reorganisation. Diese Gleichung ist identisch mit der in Gleichung (2) angegebenen alternativen Form. Setzen Sie einfacher Latex 2 (1 - 1) Latex. In physikalischer Hinsicht bedeutet das, dass die Wahl der verwendeten Form davon abhängt, wie man annehmen will, ob man Latexalphalatex als Rückkopplungsfraktionsgleichung (1) oder als Bruchteil der Eingangsgleichung (2) annimmt. Wie oben erwähnt, habe ich die erste Form verwendet, da sie etwas weniger mühsam ist, die RC-Filterbeziehung zu zeigen, und führt zu einem einfacheren Verständnis in Filtertermen. Allerdings Auslassung der oben ist, meiner Meinung nach, ein Mangel in dem Artikel als andere Menschen könnten eine falsche Schlussfolgerung, so dass eine überarbeitete Version wird bald erscheinen. Ich habe immer darüber nachgedacht, danke für die Beschreibung so klar. Ich denke, ein anderer Grund die erste Formulierung ist schön ist Alpha-Maps zu 8216smoothness8217: eine höhere Auswahl an Alpha bedeutet eine 8216more smooth8217 Ausgabe. Michael Vielen Dank für die Beobachtung 8211 Ich werde den Artikel etwas auf diese Zeilen hinzufügen, da es immer besser in meiner Sicht auf physische Aspekte beziehen. Dr Mercer, Ausgezeichneter Artikel, danke. Ich habe eine Frage bezüglich der Zeitkonstante, wenn sie mit einem RMS-Detektor wie in einem Schallpegelmesser verwendet wird, auf den Sie in dem Artikel verweisen. Wenn ich Ihre Gleichungen verwenden, um einen exponentiellen Filter mit Zeitkonstanten 125ms zu modellieren und ein Eingangsschrittsignal zu verwenden, bekomme ich tatsächlich einen Ausgang, der nach 125ms 63,2 des Endwerts ist. Jedoch wenn ich das Eingangssignal quadriere und dieses durch den Filter stelle, sehe ich, daß ich die Zeitkonstante verdoppeln muß, damit das Signal 63.2 seines Endwertes in 125ms erreicht. Können Sie mir mitteilen, ob dies erwartet wird. Danke vielmals. Ian Ian, Wenn Sie ein Signal wie ein Sinus-Welle dann im Grunde Sie verdoppeln die Häufigkeit ihrer grundlegenden sowie die Einführung von vielen anderen Frequenzen. Da die Frequenz in Wirklichkeit verdoppelt worden ist, wird sie um 8216 um einen grßeren Betrag durch das Tiefpaßfilter verringert. Infolgedessen dauert es länger, die gleiche Amplitude zu erreichen. Die Quadrierung Operation ist eine nicht lineare Operation, so glaube ich nicht, dass es immer doppelt genau in allen Fällen, aber es wird dazu neigen, zu verdoppeln, wenn wir eine dominante niedrige Frequenz haben. Beachten Sie auch, dass die Differenz eines quadrierten Signals das Doppelte des Differentials des 8220un-squared8221 Signals ist. Ich vermute, Sie könnten versuchen, eine Form der mittleren quadratischen Glättung, die vollkommen in Ordnung und gültig ist zu bekommen. Es könnte besser sein, den Filter und dann quadratisch anzuwenden, wie Sie die effektive Cutoff kennen. Aber wenn alles, was Sie haben, ist das quadrierte Signal dann mit einem Faktor von 2, um Ihre Filter-Alpha-Wert ändern wird etwa erhalten Sie zurück auf die ursprüngliche Cut Off-Frequenz, oder setzen Sie es ein wenig einfacher definieren Sie Ihre Cutoff-Frequenz auf das Doppelte des Originals. Vielen Dank für Ihre Antwort Dr. Mercer. Meine Frage war wirklich versuchen, zu bekommen, was tatsächlich in einem rms Detektor eines Schallpegelmessgerät getan. Wenn die Zeitkonstante für 8216fast8217 (125ms) eingestellt ist, hätte ich gedacht, dass Sie intuitiv erwarten würden, dass ein sinusförmiges Eingangssignal einen Ausgang von 63.2 seines Endwertes nach 125ms erzeugt, aber da das Signal quadriert wird, bevor es an die 8216mean8217 gelangt Erkennung, es dauert doppelt so lange wie Sie erklärt haben. Das Hauptziel des Artikels ist es, die Äquivalenz der RC-Filterung und exponentielle Mittelung zu zeigen. Wenn wir die Integrationszeit äquivalent zu einem echten rechteckigen Integrator diskutieren, dann sind Sie richtig, dass es einen Faktor von zwei beteiligt ist. Grundsätzlich, wenn wir einen echten rechtwinkligen Integrator haben, der für Ti Sekunden integriert, ist die äquivalente RC-Integatorzeit, um dasselbe Ergebnis zu erzielen, 2RC Sekunden. Ti unterscheidet sich von der RC 8216zeit constant8217 T, die RC ist. Also, wenn wir eine 8216Fast8217 Zeitkonstante von 125 ms haben, das ist RC 125 msec, dann ist das äquivalent zu einer wahren Integrationszeit von 250 msec Vielen Dank für den Artikel, es war sehr hilfreich. Es gibt einige neuere Arbeiten in der Neurowissenschaften, die eine Kombination von EMA-Filtern (kurzfensternde EMA 8211 langfächerige EMA) als Bandpassfilter für die Echtzeit-Signalanalyse verwenden. Ich möchte sie anwenden, aber ich kämpfe mit den Fenstergrößen, die verschiedene Arbeitsgruppen verwendet haben, und ihre Entsprechung mit der Grenzfrequenz. Let8217s sagen, ich möchte alle Frequenzen unter 0,5 Hz (aprox) zu halten, und dass ich 10 Proben zweiten zu erwerben. Das bedeutet, dass fp 0.5Hz P 2s T P100.2 h 1fs0.1 Die Fenstergröße I sollte mit N3 verwendet werden. Ist diese Argumentation richtig Vor der Beantwortung Ihrer Frage muss ich kommentieren die Verwendung von zwei Hochpass-Filter, um ein Bandpassfilter zu bilden. Vermutlich arbeiten sie als zwei getrennte Ströme, so ist ein Ergebnis der Inhalt von sagen, latexf Latex zu halben Sample-Rate und der andere ist der Inhalt von sagen, latexf Latex auf halbe Sample-Rate. Wenn alles, was getan wird, die Differenz der mittleren quadratischen Ebenen als Angabe der Leistung in der Band aus latexf Latex zu latexf Latex dann kann es sinnvoll sein, wenn die beiden abgeschnittenen Frequenzen sind ausreichend weit auseinander, aber ich erwarte, dass die Menschen mit dieser Technik Versuchen, ein schmaleres Bandfilter zu simulieren. Aus meiner Sicht wäre das für eine ernsthafte Arbeit unzuverlässig und würde eine Quelle der Besorgnis sein. Nur als Referenz ist ein Bandpassfilter eine Kombination eines Niederfrequenz-Hochpassfilters, um die niedrigen Frequenzen zu entfernen, und ein Hochfrequenz-Tiefpaßfilter, um die hohen Frequenzen zu entfernen. Es gibt natürlich eine Tiefpaßform eines RC-Filters und damit eine entsprechende EMA. Vielleicht aber mein Urteil ist überkritisch, ohne zu wissen, alle Fakten So könnten Sie bitte senden Sie mir einige Verweise auf die Studien, die Sie erwähnt, so kann ich Kritik als angemessen. Vielleicht verwenden sie einen Tiefpass sowie ein Hochpassfilter. Ich denke, es ist am besten, die grundlegende Gleichung T (N-1) h verwenden, um Ihre tatsächliche Frage, wie zu bestimmen N für eine bestimmte Ziel-Cut-off-Frequenz. Die Diskussion über Zeiträume zielte darauf ab, den Menschen ein Gefühl dafür zu geben, was vor sich ging. Also bitte die Ableitung unten. Wir haben die Beziehungen latexT (N-1) hlatex und latexT12 Latex, wobei latexfclatex die nominale Grenzfrequenz ist und h die Zeit zwischen den Proben ist, klar latexh 1 Latex, wobei latexfslatex die Abtastrate in samplessec ist. Nachfolgend wird die Umlagerung von T (N-1) h in einer geeigneten Form, um die Grenzfrequenz, Latexfclatex und die Probenrate, Latexfslatex, zuzuordnen. Also mit latexfc 0.5Hzlatex und latexfs 10latex samplessec so dass Latex (fcfs) 0.05latex gibt Also der nächste Integer-Wert ist 4. Re-Arrangieren der oben haben wir Also mit N4 haben wir latexfc 0.5307 Hzlatex. Unter Verwendung von N3 ergibt sich ein Latexfclatex von 0,318 Hz. Kinect für Windows 1.5, 1.6, 1.7, 1.8 von Mehran Azimi, Software Development Engineer 1. Einführung Das Skeletal Tracking (ST) System der Natural User Interface ( NUI) bietet gemeinsame Positionen von Skeletten. Diese gemeinsamen Positionen sind die Daten als Position und Pose verbraucht, und sie werden für viele Zwecke, wie Gestenerkennung, navigieren Benutzeroberflächen, und so weiter verwendet. In der Praxis ist in den vom ST-System zurückgelegten gemeinsamen Positionen ein Rauschen vorhanden. Ein wichtiger Schritt, bevor ST-Daten verbraucht werden, besteht darin, ein Rauschverminderungsfilter zu verwenden, um so viel Rauschen wie möglich von den gemeinsamen Daten zu entfernen. Solche Filter werden Glättungsfilter genannt, weil sie zu einer glatteren Position über der Zeit führen. Dieses Whitepaper beschreibt die Filtertechniken und Best Practices für die Verwendung von Skeletthaftdaten für eine Kinect-fähige Anwendung. Ihr Ziel ist es, Entwicklern dabei zu helfen, eine geeignete Filtertechnik auszuwählen und die Filterparameter entsprechend ihren Anwendungsanforderungen zu optimieren. Das Papier umfasst verschiedene Bereiche, die sich auf die gemeinsame Filterung beziehen, wie etwa die Art des Rauschens, die man in ST-Daten erwarten sollte, wie die Filterung die Latenz beeinflusst und wie die Prognose verwendet werden kann, um die Eigenschaften eines idealen gemeinsamen Filters in Bezug auf Reaktionsfähigkeit, Latenzzeit, Und Glättungseffekt und die Verfolgung von Zustandsdaten, die von ST zurückgegeben werden, können verwendet werden, um die Filterung zu verbessern. Dann werden die spezifischen Eigenschaften einiger nützlicher Filtertechniken im Detail beschrieben. Das Papier schließt mit einer Zusammenfassung der besten Praktiken und praktische Tipps für die Filterung. 2. Warum brauchen wir gemeinsame Filterung Messfehler und Rauschen sind Nebenprodukte von nahezu jedem System, das eine physikalische Größe über einen Sensor misst. Die Eigenschaften dieses Fehlers werden gewöhnlich durch Genauigkeit und Präzision des Systems beschrieben, wobei Genauigkeit als der Grad der Nähe der gemessenen Größe auf ihren tatsächlichen Wert definiert ist, und die Genauigkeit ist definiert als der Grad, zu dem wiederholte Messungen nahe beieinander sind. Ein genaues System hat keinen systematischen Fehler in Messungen und fügt daher keine systematische Vorspannung hinzu. Ein präzises System führt zu Messungen nahe bei einander, wenn die Messung 1, 4 wiederholt wird. Die Genauigkeits - und Präzisionskonzepte sind in Tabelle 1 für ein System dargestellt, das eine Handposition in der realen Welt misst. Tabelle 1. Genauigkeit vs. Präzision: Das schwarze X repräsentiert die Handposition in der realen Welt, und rote Punkte repräsentieren einige Messungen der Handposition durch ein Messsystem. (A) Ein ungenaues und ungenaues System erzeugt zufällige Messungen, die in der Praxis praktisch unbrauchbar sind. (B) Ein ungenaues, aber präzises Messsystem erzeugt Messungen, die nahe beieinander liegen, aber einen systematischen Fehler oder Vorspannung aufweisen. (C) Ein genaues und präzises System erzeugt identische Messungen, die in der realen Welt nahe liegen. Leider gibt es in der realen Welt nicht 100 präzise und genaue Systeme, da es in der Praxis immer einen Fehler gibt. (D) Ein genaues und bescheiden genaues System erzeugt Messungen, die nahe beieinander liegen und nicht systematisch in Bezug auf die Daten in der realen Welt vorgespannt sind. Das sollte man in einem gut durchdachten System in der Praxis erwarten. Genau wie jedes Messsystem haben die vom NUI ST-System zurückgegebenen gemeinsamen Positionsdaten etwas Rauschen. Es gibt viele Parameter, die sich auf die Eigenschaften und das Niveau des Lärms, die Raumbeleuchtung eine Person Körpergröße der Personen Abstand von der Sensor - Array die Personen stellen (z. B. für Hand - Daten, wenn die Person Hand geöffnet ist oder fisted) Ort Die durch Berechnungen und so weiter eingeführt werden. Beachten Sie, dass die von ST zurückgegebenen gemeinsamen Positionen korrekt sind. Dh es gibt keine Vorspannung in den gemeinsamen Positionsdaten zu den tatsächlichen Positionen in der realen Welt. Dies bedeutet, dass, wenn eine Person steht still, dann ist der Durchschnitt der gemeinsamen Positionen Daten, im Laufe der Zeit, in der Nähe der Positionen in der realen Welt. Die Gelenkpositionsdaten sind jedoch nicht unbedingt vollkommen präzise, dh sie sind um die korrekten Positionen in jedem Rahmen gestreut. In der Praxis sind die Gelenkpositionen in einem Zentimeterbereich, nicht in Millimetern, genau. Es gibt Fälle, in denen das ST-System nicht über ausreichende Informationen in einem erfassten Rahmen verfügt, um eine bestimmte gemeinsame Position zu bestimmen. Beispiele für diese Fälle sind Okklusion durch Möbel oder andere Personen, Selbstverschluss eines Gelenkes durch andere Körperteile der Person und Bewegen eines Gelenks aus dem Sensorfeld. In den meisten dieser Fälle ist das ST-System noch in der Lage, auf die gemeinsame Position zu schließen, und der Parameter NUISKELETONPOSITIONTRACKINGSTATE, der als Teil einer NUISKELETONDATA-Struktur zurückgegeben wird, wird für diese Verbindung auf NUISKELETONPOSITIONINFERRED gesetzt. Dieser Parameter kann als Vertrauensniveau des ST-Systems bezüglich der Gelenkposition behandelt werden. Obwohl die abgeleiteten Gelenkpositionen eine sehr raffinierte Schätzung der Gelenkposition sind, können sie in einigen Fällen ungenau werden, abhängig von einer Person. Daher sollte man erwarten, dass abgeleitete Verbindungen höhere Rauschwerte aufweisen, zusammen mit einer Möglichkeit einer Vorspannung. Diese Vorspannung wird gewöhnlich als vorübergehende Spikes in den gemeinsamen Positionsdaten beobachtet, die weggehen, wenn die gemeinsame Tracking-Zustandsniveau auf NUISKELETONPOSITIONTRACKED zurückgeht. Daher gibt es zwei Arten von Rauschen in Gelenkstellungen. Eines ist das relativ kleine weiße Rauschen, das für alle Gelenke immer vorhanden ist und durch Ungenauigkeit verursacht wird, das andere ist vorübergehende Spikes, die durch Ungenauigkeit verursacht werden, die auftreten, wenn das Gelenk einen abgeleiteten Verfolgungszustand hat. Da diese Geräusche unterschiedliche Charakteristiken haben, sollten für jeden Filter unterschiedliche Filtertechniken verwendet werden. Das heißt, Entwickler müssen eine Kombination aus zwei oder drei Filtertechniken verwenden, um gute Ergebnisse in einer Kinect-fähigen Anwendung zu erzielen. 3. Gemeinsame Filterung Grundlagen Vor der Beschreibung eines bestimmten Filter-Technik, gibt es ein paar wichtige Konzepte zu decken, die im Zusammenhang mit der Filterung gehören Latenz und wie es sich um Filter-Verzögerungen, wie Vorhersage kann Latenz, die Kompromiss zwischen Latenz und Glättungseffekte in Filter-Design, und was macht einen idealen Filter. 3.1. Latenzzeit und wie sie sich auf die Filterung bezieht Latenzzeit kann als die Zeit definiert werden, die benötigt wird, wenn eine Person einen Zug macht, bis zu dem Zeitpunkt, an dem die Person die Reaktion auf seine Körperbewegung auf dem Bildschirm sieht. Latenz verschlechtert die Erfahrung, sobald die Menschen anfangen zu bemerken, dass es eine Verzögerung in Reaktion auf ihre Bewegungen gibt. Die Nutzerforschung zeigt, dass 72 Personen diese Verzögerung bemerken, wenn die Latenzzeit mehr als 100 ms beträgt, und daher wird vorgeschlagen, dass Entwickler eine Gesamtlatenz von 100 ms 15 anstreben. Für eine detaillierte Diskussion über Latenz, siehe 14 in Referenzen. Die gemeinsame Filterlatenz ist, wie lange es dauert, bis die Filterleistung bei einer Bewegung in einem Gelenk auf die tatsächliche Gelenkposition aufholt. Dies ist in Fig. 1 gezeigt, was zeigt, daß das Filterausgangssignal hinter dem Eingang zurückbleibt, wenn Änderungen am Eingang auftreten. Es ist wichtig zu beachten, dass die Latenz, die durch die gemeinsame Filterung eingeführt wird, nicht die CPU-Zeit ist, die es braucht, bis die Filterroutine ausgeführt wird. Abbildung 1. Ausgang eines typischen Gelenkfilters als Reaktion auf eine NUI-Gelenkbewegung. Beachten Sie, dass Latenz durch gemeinsame Filterung ist die Verzögerung zwischen Ausgang und Eingabe, wenn es Bewegung in den Eingabedaten, und die Höhe hängt davon ab, wie schnell die gemeinsame Bewegung ist. Im allgemeinen hängt die Filterverzögerung davon ab, wie schnell sich die Eingabe ändert, und daher kann man einem bestimmten Filter für alle Fälle keinen bestimmten Verzögerungswert zuordnen. Dies wird in der Signalverarbeitung 6, 7 als Phasenverzerrung bezeichnet. Eine spezielle Klasse von Filtern, die als lineare Phasenfilter bezeichnet werden, haben dieselbe Verzögerung für alle Eingangsfrequenzen, und eine solche spezifische Verzögerungszeit kann dem Filter für alle Eingänge zugerechnet werden. Eine Verringerung der Phasenverzerrung ist bei einigen Signalverarbeitungsanwendungen wichtig, insbesondere bei der Audioverarbeitung, sie ist jedoch nicht notwendigerweise bei der NUI-Verbindungsfilterung so wichtig, weshalb ein lineares Phasenfilter kein Designkriterium bei der NUI-gemeinsamen Filterung ist. Eine nützliche Technik, um die Latenz zu reduzieren, besteht darin, den gemeinsamen Filter zu optimieren, um die zukünftigen gemeinsamen Positionen vorherzusagen. Das heißt, die Filterausgabe wäre eine geglättete Schätzung der Gelenkposition in nachfolgenden Rahmen. Wenn eine Prognose verwendet wird, würde die gemeinsame Filterung die Gesamtlatenz verringern. Da jedoch die prognostizierten Ergebnisse aus früheren Daten abgeschätzt werden, sind die prognostizierten Daten nicht immer genau, insbesondere wenn eine Bewegung plötzlich gestartet oder gestoppt wird. Die Prognose kann das Rauschen in früheren Daten auf zukünftige Daten übertragen und vergrßern und kann daher das Rauschen erhöhen. Fast alle gemeinsamen Filtertechniken können prognostiziert oder optimiert werden, um zukünftige Ergebnisse vorherzusagen. Die Genauigkeit der vorhergesagten Ausgänge hängt von dem zugrunde liegenden Datenmodell ab, das der Filter verwendet und wie die Filterparameter ausgewählt werden. Man beachte, daß es üblicherweise praktisch ist, eine gemeinsame Position für etwa zwei Rahmen zu prognostizieren, was die Filterlatenz im Idealfall um etwa 66 ms verringern könnte. In der Praxis würde jedoch die Glättungseffekt des Filters zusammen mit den Vorhersagefehlern in prognostizierten Daten zu kleineren Latenzreduktionen führen. 3.2. Filter Glättungseffekt vs. Filterverzögerung Ein idealer Gelenkfilter würde alle unerwünschten Geräusche und Jitters aus den Gelenkdaten entfernen, was zu glatten Gelenkpositionsdaten über die Zeit führt. Es würde auch die Bewegungen des Gelenkes ohne Verzögerung oder Verzögerung folgen. Leider gibt es einen Kompromiß zwischen diesen beiden Zielen in der Praxis, und das Auswählen einer Filtertechnik, die aggressiv die Daten glatt macht, würde zu einer höheren Filterverzögerung führen, was die wahrgenommene Latenz erhöhen würde. As an intuitive explanation for this concept, consider a case where a person is standing still and therefore the input to the joint filter is mostly a constant position along with some noise. In order to produce a smooth output, the filter should not be sensitive to the changes in input due to noise. Now suppose the person starts moving hisher hand. In order to be responsive to these movements, the filter should be designed to be sensitive to changes due to movement, which is an opposite of the requirement for noise removal. In practice, most filters take some time to see enough movement before they start following these changes in output, and therefore their output lags behind the changes in input. 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 purposessuch as gesture detection, avatar retargeting, interacting with UI items and virtual objects, and so onwhere 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 persons 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. Alternately, consider an application that uses hand movements to score how well a person is doing a particular exercise (that is, gesture scoring), and to animate the persons avatar on screen at the same time. Latency is usually less important in gesture scoring, since the whole gesture should be done before computing the score consequently, the application should use a high-latency filtering technique with more aggressive smoothing for gesture scoring, while also using a different low-latency filtering technique for animating a persons avatar. So, there is no filtering solution that fits the needs of all use cases for all joints. Depending on which joint data is to be used and how the filter output is consumed, one should apply different filtering techniques or fine-tune the parameters per joint and per application . 3.3. Error Propagation to Variables Calculated from Skeletal Tracking Data One can apply the filtering techniques discussed in this paper to the variables calculated from joint positions. For example, an application may need to use the elbow angle formed between the persons hand, elbow, and shoulder. Then the same filtering techniques discussed here can be applied to the calculated angle to smooth it out over time. Another example is using spherical coordinate systems local to a joints parents, where each point in space is represented by a ( , , ) triplet, instead of a Cartesian system of ( x , y , z ) coordinates. For example, one can use the right shoulder as the origin and represent the elbow position by using this local spherical coordinate system. In this case, the Cartesian coordinates returned by ST are transformed to local spherical coordinates ( , , ), and filtering is done on each component separately. The radius . which represents the bone length, can be filtered more aggressively than the angles ( , ), which represent the joint movements. It is important to note that applying mathematical operations to noisy joint data would propagate noise and may amplify the noise level. The underlying concept of noise propagation is similar in essence to propagation of rounding or precisions errors of floating-point variables in math operations, though rounding errors on floating-point values are small and are ignored in most practical cases, while measurement noise is relatively much larger. Operations to calculate body part sizes, such as addition, subtraction, and multiplication, amplify the noise 1-4 . For example, calculating bone length or calculating relative joint coordinates, such as elbow position relative to shoulder or hand position relative to head, all require subtracting two joint positions. In all these cases, the noise in resulting data is amplified. Trigonometric functions (such as sine, cosine, or inverse tangent), which are typically used for calculating or manipulating joint angles, affect the noise in different ways. The effect of any function on noise depends on the local slope of that function, that is, the local derivative of the function around the data point used. For example, suppose is a joint angle calculated from noisy ST data, and hence is noisy as well. Now consider function tan . which is sensitive around 90 o. because ( d d )tan converges to around 90 o. Hence, calculating the tan function would amplify the noise drastically if is close to 90 o. However, since ( d d )tan 1 around 0 o. then noise is neither amplified or decreased if is close to zero. A more thorough discussion of this topic can be found in References under Error analysis and error propagation in noisy data see 1-4 for more details. 3.4. Filter Notations The joint filter implementation in a typical application receives joint positions from ST as input in each frame, and returns the filtered joint positions as output. The filter treats each joints x . y . and z coordinates independently from other joints or other dimensions. That is, a filter is independently applied to the x . y . and z coordinate of each joint separatelyand potentially each with different filtering parameters. Note that, though it is typical to directly filter the Cartesian position data returned by ST, one can apply the same filtering techniques to any data calculated from joint positions. This means the input of each joint filter is a one-dimensional time series that represents a single joint position in a given dimension at frame n (for example, y coordinates of the right hand position). The filter input at frame n is denoted by X n and the filter output generated from applying the filter by n . Figure 2. Filter notations used in this white paper 3.5. Filter Response to Step Function and Sinus Waveform Inputs In order to understand a filtering technique and how filtering parameters affect the filter characteristics, it is useful to study the filter output in response to some predefined inputs, specifically step function and sine wave inputs. Step function input models a sudden jump in input data, and is defined as: That is, input X n is zero for up to a given time and then jumps and stays at 1 at time N . Though one does not expect to see such input in practice, a step function is helpful because it shows how quickly and how accurately the filter tracks sudden changes in input. Figure 4 shows the typical output of a filter to a step function input, as well as definitions for some of the filter characteristics of our interest. Figure 3. Typical response of a filter to step function input Rise time is the time required for the filter output to reach 90 of it asymptotic final value, which is 0.90 in case of a unit step function input. In some fields, a similar parameter called time constant is used, which is the time required for the filter output to reach (1e 1 )63 of its final asymptotic value. A small rise time is an indication of a filter with low latency. Overshoot is when the output of the filter reaches a higher maximum value than input, and this is usually represented as a percentage of the final asymptotic value. Note that not all filters have overshoot in their output. Overshoot is undesirable, and it is usually present in low-latency filters that are sensitive to changes in input. Ringing is the effect where filter output oscillates before it settles down to its final value. Settling time is applicable to filters that have overshoot or ringing, and it is the time it takes for the filter output to reach and remain within a given error margin of its final asymptotic value. The range of the error margin is usually 10 percent. Rise time shows how quickly the filter catches up with sudden changes in input, while overshoot, ringing, and settling time are indications of how well a filter can settle down after it has responded to a sudden change in input. A filters response to a step function does not reveal all of the useful characteristics of a filtering technique, because it only shows the filters response to sudden changes. It is also useful to study a filters response to sine waveform input, both in time and frequency domains. As shown in Figure 4, the response in the time domain can show the lag in filter output, which depends on input frequency in most cases (that is, in nonlinear phase filters). Note that the output may not reach the maximum or minimum level of the input due to the filter attenuating that frequency. This is sometimes referred to as dampening the peaks and valleys in input by aggressive smoothing. As an example, Figure 5 shows the hand position x of a person who has opened and closed his arm quickly two times, resulting in a sinusoidal peak in input. As noted, aggressive smoothing of data has resulted in filter output not reaching the same maximum and minimum level of the input. Also, it is interesting to note in Figures 4 and 5 that, in some frames, the input is increasing while the output is decreasing this can be attributed to the filtering latency. This filter would not be a good choice for drawing a cursor on the screen based on the persons current hand position, because it would produce an undesirable effect when the persons hand changes direction the cursor would catch up and change direction after a while, which would create an awkward experience for the person. Figure 4. Typical response of a filter to sine waveform input Figure 5. Aggressive smoothing would reduce the minimum and maximum in sinusoidal input data. The data is from actual hand movement where a person has opened and closed his arms rapidly two times. The filters response in the frequency domain shows how a filter responds to all ranges of frequency inputs. All smoothing filters used for NUI joint filtering are low pass filters, where an ideal low pass filter would let through the input frequency components that are lower than a cut-off frequency, but remove the frequency components that are higher than the cut-off frequency. The low-pass characteristics of NUI joint filters is based on the assumption that joint movements have relatively lower frequency than the noise, though this is not necessarily a correct assumption for all casesspecifically, when a person makes rapid movements, such as quick hand movements or sudden jumps. Note there are powerful methods of filter design available in signal processing textbooks that realize a desired frequency response, such as a low pass filter of given order N and with a given cutoff frequency 6 . Since the frequency range of NUI joint data overlaps with the noise, low-pass filters with a design based only on the frequency response criteria do not necessarily provide good results in Kinect applications. Design methods of frequency domain filters are not within the scope of this white paper. However, you can still become familiar with the underlying concepts used in filter design in the frequency domain to better understand filtering characteristics in general, and items 6 ,7 in References are good starting points. 3.6. Using Joint Tracking State in Filtering Joints that are inferred are more likely to have temporary spike noises due to being less accurate. Also, the random noise levels are usually higher for inferred joints. In practice, for Kinect applications, developers should consider a joints tracking state to be valuable information about the quality of the joint data, and apply a more aggressive smoothing filter when a joints state is inferred. This can easily be done by checking the joints tracking state in the filters implementation and adaptively update the filter parameters based on the joints tracking state. Also, filters that are specifically more powerful in removing spike noise should be applied when a joints state is inferred. 3.7. Using Body Kinematics to Correct the Filter Output Data The anatomy and kinematics of a person provide valuable information that can be used to enhance the ST joint data. For example, some joints move or bend only in a certain direction, or some joints, such as hands, can move faster than other joints. How this data can be applied depends on the joint and the contexts the joint data are used. As a practical example, suppose that a persons right hand joint is filtered with a low latency filter that forecast one frame in future. This type of filter usually results in overshoots in response to sudden movements. Therefore, due to overshoot, the filter may calculate the hand position to be too far from the persons body. This overshoot can be corrected by using an estimate of hand bone length, and correcting the filtered hand position such that the hand is positioned an acceptable distance from the persons body. Another useful kinematic property is the limitations of hinge joint. A hinge joint is a joint that can bend along only one axis (that is, it has only one degree of freedom). For example, elbows and knees are hinge joints, because they can bend in only one direction and within a limited range. These kinematic limitations of elbow or knee can be used to correct the filtered joint positions. 4. Smoothing Filters This section discusses details of a few smoothing filtering techniques that are useful for NUI joint filters. First are the Auto Regressive Moving Average (ARMA) filters, which are a general class of filters. Specific smoothing filters for noise removal are also covered, including Moving Average, Double Moving Average, Exponential Filter, Double Exponential Filter, and Savitzky-Golay filters. All these smoothing filters are special cases of ARMA filters. Finally, the section discusses a filter based on the Taylor series that is useful for forecasting. Also covered are Median and Jitter Removal filters, which although they have some smoothing effect, are specifically useful for removing spike noise from data. 4.1. Auto Regressive Moving Average (ARMA) Filters Auto regressive moving average (ARMA) filters are a general class of linear filters. All the smoothing filters we discuss in this paper are a special case of ARMA filters. The output of an ARMA filter is a weighted average of current and N previous inputs, and M previous filter outputs: Where the a i and b i coefficients are the filtering parameters. The first term is known as the moving average (MA) term, and the second term is known as the auto-regressive (AR) term. Moving average (MA) filters are a special case of ARMA filters where all b i parameters are zero: The coefficients a i are the weight factors and are selected such that a i 1 in all NUI joint filter applications. This property is a result of using low-pass filtering and allowing DC components through without attenuation. As an intuitive explanation, suppose the input to be filtered is the constant 1 for all frames n . Then, one intuitively expects the filter output to be 1 as well for all n . which would result in a i 1. This can be used as a quick sanity check that the derived a i coefficients are correct. The moving average filter can be extended to a central moving average filter, where filter output is the weighted average of N past and M future inputs: Since the output of this filter depends on M future inputs after X n . then any implementation of this filter will add a latency of at least M frames. Therefore, this filter is only practical in offline cases in which all data is available in advance, or in cases in which increasing the latency by an order of a few frames is tolerable. For example, in some Kinect-enabled applications, it may make sense to score how well the person has done an exercise after the whole performance is finished. The central MA filters usually perform better in terms of noise removal than simple MA filters. ARMA filters are usually designed by assuming an underlying data model for data and using this model to calculate the filter orders N and M . and the a i and b i coefficients. The data model should be chosen based on the actual data characteristics. In some approaches the underlying data models are chosen based on a statistical approach that would preserve the higher order moments of data. The details of these methods are outside the scope of this paper see 5 for a detailed discussion. This paper mentions the order of statistical moments up to which input data are preserved by the filter. In general, filters that preserve higher-order moments perform better. 4.2. Simple Averaging Filter The simple averaging filter is the simplest joint filter, where the filter output is the average of N recent inputs, which is an MA filter of order N with a i 1( N 1) for all i : From a statistical point of view, the averaging filter is a naive filter that fits a horizontal line (that is, a constant) to N recent inputs and uses it as the filter output. Therefore, an averaging filter is not taking advantage of joint data characteristics or noise statistical distribution, and it preserves only the first-order moment of data, which is the average. A simple averaging filter doesnt provide satisfactory results in most cases of filtering NUI joints. An averaging filter using a large N would result in more smoothing than a smaller N . but it would introduce more filtering delay. The filtering delay can be noted in the output from an averaging filter in response to inputs from step functions and sinusoidal waveforms. where filtering delay is directly proportional to N . --gtFor example, the step function rise time for N 5 and N 10 are about 4.5 frames (148 msec) and 9 frames (297 msec), respectively. The simple averaging is a linear phase filter, which means that all frequency components in input are delayed by the same amount 6 . To experience this, try different frequencies for sinusoidal input in the spreadsheet, and notice that the output delay is the same for all filters. The smoothing effect of the filter can be more easily noticed when noise is added to step function or sinusoidal inputs. Also note that output from the averaging filter cannot reach the peaks and valleys of most sinusoidal waveform inputs. Since an averaging filter fits a horizontal line of data, it forecasts the future outputs as a constant as well, which is the average of last N inputs up to time n: The simple averaging filter performs well in terms of forecasting only if the input data is stationary and there is no trend in data. In NUI joint filtering, stationary input data means that a joint has little movement. If there is movement in the joint, then the filters input data will have a slope, and hence, averaging filters performs poorly, especially in terms of forecasting. For NUI joint data with movement at a constant speed, it can be shown that the averaging filter has a constant bias in its output 8 ,9 . A method to eliminate this error is to use a filtering method called double moving average . which is discussed in the next section. 4.3. Double Moving Averaging Filter Double moving averages are used in many applications, such as stock market forecasting, and they are useful when data has a linear trend . The trend in NUI joint data is equivalent to a joint movement at a constant velocity. The underlying data model used by double moving averaging filter is to fit a linear line to local input data, and hence it is more adaptable to track changes in input data than simple averaging filter 8 ,9 . Let and be the first and second order moving averages of input data at time n : Therefore is a moving average of a moving average of input data (hence the name double moving average). If we assume that the underlying data follow a linear model, it can be shown that systematically lags behind the actual data, and it can also be shown that a second moving average lags average by approximately the same amount. To account for the systematic lag, the difference of second and first order averages ( ) is added to the filter output. Then filter output is given as the first order of moving average plus the trend adjustment term: A similar approach is used for adjusting trends in forecasting, and future data are estimated as: The double moving averaging filter has the advantage of being more responsive to changes in input data as compared to a moving averaging filter. Note that for a given window N . the filtering equations can be combined and the filter output equation can be rewritten in terms of a weighted moving average of past inputs, which would result in easier implementation. For example, for N 2, the second moving average and filter output are given by: which would result in: It is interesting to note that this filter uses larger weights for recent inputs, which is generally true for any filtering window N . 4.4. SavitzkyGolay Smoothing Filter A Savitzky-Golay smoothing filter (also known as a smoothing polynomial filter or a least squares smoothing filter ) fits a polynomial to neighbor input data for each input X n in a least-square sense and uses the value of the polynomial at time n as the filter output. A polynomial of order K is defined as: If we use N previous and M future samples as the neighbor samples, then a Savitzky-Golay filter finds c i coefficients such that minimize the term: and uses the polynomial value at time n as the filter outputthat is, n f K ( n ). Though it may first seem that this filter results in a complicated implementation, it turns out to be easy. It has been shown that the output of a Savitzky-Golay filter can be expressed as a weighted moving average filter that is: where the filtering coefficients a i are all constant for all X n values and do not change for different n . or even different inputs. Thus, to implement a Savitzky-Golay filter requires only choosing the appropriate filter order K . and determining how many samples before and after should be used (that is, choose N and M ). Then, the coefficients a i can be calculated offline by using available off-the-shelf algorithms, and filter output is easily calculated using these coefficients 11 ,12 . Savitzky-Golay filters are optimal in two different senses firstly, they minimize the least-squares error in fitting a polynomial to each windowed frame of input data, and secondly, in preserving the K first statistical moments of the input signal. In general, Savitzky-Golay filters are useful for cases in which the frequency span of input data without noise is large, and therefore, Savitzky-Golay filters are good candidates for NUI joint filtering. A Savitzky-Golay filter of order K preserves the first K 1 moments of the data 11 . For K 0, the Savitzky-Golay filter fits f K ( x ) c 0. or a constant value, to neighbors of each input, which would turn to a simple averaging filter with equal weight coefficients a i . For K 1, a straight line is fitted to local input data, which is usually referred to as linear regression in statistics text books. For K 2 and K 3, a parabola and a cubic curve are fitted, respectively. The choice of n affects the filter smoothing effect, where a cubic curve using K 3 seems to be a good choice for NUI joint filtering, since it is the lowest-degree polynomial that supports inflection and is still smooth. Using a higher-order polynomial yields jumpy curves with too many local minima and maxima, which would result in a lessened smoothing effect. The Savitzky-Golay filter can also be used for estimating the derivatives of input 11 , which is easily calculated from the coefficients c i . Thus, a Savitzky-Golay filter can produce the joint speed and acceleration along the smoothed position for NUI joint data. 4.5. Exponential Smoothing Filter An exponential smoothing filter, also known as an exponentially weighted moving average (EWMA), is a popular filter in many different fields. The exponential filter output is given by: Where is called the dampening factor and 01. By substituting ( n 1) this can be expanded to obtain: Therefore, filter output at time n is a weighted average of all past inputs, where weights a i (1) i decrease exponentially with time (more precisely, with geometric progression, which is the discrete version of an exponential function). Also, all previous inputs contribute to the smoothed filter output, but their contribution is dampened by increasing power of parameter 1. Since n depends on all past inputs, an exponential filter is said to have an infinite memory of all past inputs. Similar to a simple averaging filter, the exponential filter fits a straight horizontal line to the input data. The difference is that an exponential filter places relatively more weight on recent input data, and is correspondingly more responsive to recent changes in input than a simple averaging filter. The dampening factor affects the filtering delay and smoothing effect. A larger corresponds to larger weight on recent inputs, and results in faster dampening of older inputs. This results in less latency and less smoothing of the data. A small gives larger weight to older input samples, and hence, the effect of older inputs is larger. This results in a more aggressive smoothing effect and more latency, as shown in Figure 6. Figure 6. Effect of on filtering delay of an exponential smoothing filter Since an exponential filter fits a horizontal line to data, it forecasts the future data as a constant value similar to an averaging filter: A variant of exponential filter, called a double exponential filter, addresses this limitation of exponential filters and is described in the next section. One can incorporate state data for a joint into the implementation of an exponential filter by adaptively using a smaller for joints for which tracking state indicates inferred positions. This results in more aggressive filtering of inferred joints. 4.6. Double Exponential Smoothing Filter The double exponential smoothing filter is a popular smoothing filter used in many applications. Similar to a double moving averaging filter, the double exponential smoothing filter smoothes the smoothed output by applying a second exponential filter (hence the name double exponential), and it uses this to account for trends in input data. There are various formulations of double exponential smoothing filters, with minor differences between them, but the most popular formulation is defined by the following set of equations: As can be noted, the trend b n is calculated as an exponential filter of the difference between a filters last two outputs. Then the sum of the current trend and the previous filter outputthat is, ( n 1) b ( n 1) are used in calculating the filter output. Including the trend helps to reduce the delay as the filter fits a line to local input data, where the trend b n is the slope of this fitted line. The parameter controls the weights on the input data that was used for calculating the trend, and hence, controls how sensitive the trends is to recent changes in input. A large results in less latency in trend that is, the trend element follows the recent changes in input faster, while a small gives larger weight to older input samples and, hence, results in longer delay in trend elements catching up with changes in input. Note that a trend is the smoothed difference between the last two estimated joint positions (that is, a trend is the smoothed value of n ( n1 ) ) so a trend can be thought of as the estimated velocity of the joint in the case of NUI joint filtering. Therefore, we can think of as the dampening factor used in exponential filtering of joint velocity and that the smoothed joint velocity is accounted for when joint position is calculated as the filter output. The trend factor b n can easily result in overshooting in filter outputs when there are sudden joint movements or stops. For example, suppose a person suddenly moves his or her hand and then stops, which results in a filter input similar to a step function (that is, a sudden jump in filter input). This is shown in Figure 7. In this case, the trend term b n helps the filter output to catch up more quickly with this change in input however, since b n itself is smoothed out, b n will need some time to settle back to zero, which will result in overshoot and ringing in output. Note that there is a delay between b n maximum and overshoot. Figure 7. Output and trend of a double exponential smoothing filter in response to step function input 0.35 and 0.70 The double exponential smoothing filter fits a line to data and, therefore, forecasts the future data as a straight line with a slope equal to trend term b n . In general, this filter performs better than a single smoothing filter in terms of forecasting. However, as shown in Figure 8, the filter overshoot is larger in forecasted outputs. Figure 8. Output and trend of a double exponential smoothing filter in response to step function input 0.50 and 0.40 There are numerical techniques that adaptively update the and parameters such that the error in filter predictions for a given k are minimized in a least-square sense. For example, when predicting one sample ahead (that is, k 1), the prediction error at time n considering the past N forecasts is given by: Then and are updated at time n in a direction that this prediction error is minimized (for details, see the Levenberg-Marquardt algorithm in 10 ,12 ). This criterion is useful if precise forecasting is the only concern however, it does not take into account the smoothing effect of the filter, and so the and parameters calculated by this approach do not necessarily result in smooth output. 4.7. Adaptive Double Exponential Smoothing Filter A simple but useful improvement to a double exponential smoothing filter for NUI joints is to adjust the and parameters adaptively based on the joint velocity, such that when the joint is not moving quickly more aggressive filtering is applied by using smaller and parameters. This adaptation results in smoothed output when a joint is not moving quickly. Alternately, larger and parameters are used when the joint is moving quickly, which results in better responsiveness to input changes and, hence, a lower latency. This idea can be implemented in different ways. For example, an adaptive double exponential smoothing filter could be implemented by using two preset and parameters: one for low-velocity cases, say low and low . and one for high-velocity cases, say high and high . There could also be two velocity thresholds used, say v low and v high . Then for each input X n . the velocity is estimated as v n X n X ( n 1) , and filtering parameters and are set as a linear interpolation between their low and high values based on the current velocity. For example, the parameter used at time n . denoted by n . is set to be: 4.8. Taylor Series Filter The Taylor series expansion is a well-known representation of a function in mathematics, where a continuous function f ( x ) is expressed as an infinite sum of terms, calculated from its derivatives at a given point a 13 : f ( i ) ( a ) is the i th derivative of function f ( x ) at point a . This series is used in many applications for approximating a function as a polynomial of order N at points close to expansion point a . where N is the number of terms in the expansion that are included in this approximation. The Taylor series can be used for forecasting NUI joint data. The underlying assumption is that joint movement is approximated with a polynomial of order N over time. In other terms, we fit a polynomial of size N to past N inputs, and then use this polynomial approximation to forecast next joint data. Note that the NUI joint data are in discrete time therefore, the derivatives used in Taylor series coefficients are approximated numerically as higher order backward differences of input data. For example, the first, second and third degree derivatives are approximated as: As said, the next input is estimated by using the fitted polynomialthat is, X ( n 1 n ) f ( n 1). Substituting the preceding terms for f ( i ) ( n ) in a Taylor series polynomial expansion of size N and choosing a n results in an estimate for next inputs in term of past inputs: For example, for N 3, by using the preceding equations, one obtains: which is, again, a weighted moving average of past N inputs. The Taylor series expansion is helpful, because it can forecast the future positions of joints. Note that the Taylor series does not smooth the data or attempt to remove any noise by itself, though this can be compensated for by applying a smoothing filter, such as exponential smoothing filter, to the output of a Taylor series filter. One approach for tweaking the Taylor series filter is to smooth the data that the Taylor series uses to forecast the current input from previous inputs (that is, X ( n n 1) ) and then calculate the smoothed output as a linear interpolation between X n and X ( n n 1). That is, the filter output is given by: Also note that the approximation of derivatives using only the backward differences is a naive approximation of the derivatives 13 . This is imposed on us, because we do not have any future input data to use in difference equations to estimate the derivatives. The Savitzky-Golay filter is known to create good estimates for the derivatives. So, instead of the difference equations presented in the preceding text, one can use the Savitzky-Golay filter to calculate the derivatives and use them in a Taylor series filter to forecast future outputs. Also remember that the approximation by a Taylor series is accurate when the expansion is around a near point (that is, when x a is small), which means it is not practical to forecast more than one input into the future by using the Taylor series. Note that the Taylor series filter may, at first, seem identical to the Savitzky-Golay filter, because both are fitting a local polynomial to input data. However, they are different, because a Savitzky-Golay filter is over-fitting a local polynomial to input samples, which means that the number of input data used to calculate the model parameters is greater than the model parameters. Since there is more than one potential solution, the least-square error approach is used to find the model parameters that minimize the error in a least-square sense. This allows the Savitzky-Golay filter to handle noise in the input data better, and the results are much smoother. However, in a Taylor series filter, there is no over-fitting of data, and the underlying polynomial is simply approximated by approximating the derivatives of input. This can be noted as exactly N 1 samples ( N previous samples along current sample) are used in calculating the N 1 polynomial coefficients in a Taylor series approach. 4.9. Median Filter In a median filter (also known as moving median filter ), the filters output is the median of the last N inputs. Median filters are useful in removing impulsive spike noises, as shown in Figure 9. Ideally, the filter size N should be selected to be larger than the duration of the spike noise peaks. However, the filters latency directly depends on N . and hence, a larger N adds more latency. Figure 9. Median filter applied to actual NUI data. Ideally, the filter order N should be larger than the duration of the spike noises. Median filters do not take advantage of the statistical distribution of data or noise, and though they have some smoothing effect, they are not suitable for removing random noise from joint data. 4.10. Jitter Removal Filter A jitter removal filter attempts to dampen the spikes in input by limiting the changes allowed in output in each frame. That is, filter output is the same as input if the difference between the current input data and the previous filter output is less than a threshold. Otherwise, the filter limits the changes in output, which can be done by using different methods. For example, the following variant of a jitter removal filter uses an exponential filter to dampen large changes seen in input: Alternately, one can use a simple averaging filter instead of the exponential filter. Since median filters usually perform better in terms of removing spikes, changes in input can be limited by the median: Where X med denotes the median of the last N inputs. Jitter removal filters basically bypass the filtering for cases in which a jump has not been detected that is as large as the threshold in input data. Ideally, the threshold should be selected to be less than the impulsive jumps in the input that are due to spike noise, but larger than normal changes that are due to actual joint movements in practice, these two criteria may overlap with each other. In a Kinect-enabled application, the joint tracking state can be used to adaptively select this thresholdthat is, to use a smaller threshold when the joint data is inferred. 5. Practical Tips and Takeaways Following is a summary of the tips described in this white paper: No filtering solution fits all cases: There is no filtering technique that can be universally used in all Kinect-enabled applications. You must choose and fine-tune the filtering techniques that are right for your application. Latency vs. Smoothing Tradeoff: Be aware of the tradeoff between latency and smoothing in joint filtering. Understand how latency affects your application, and become familiar with different filtering techniques so you can choose and fine-tune the right filter for your application. Filter per-joint and per-application: Joints have a variety of characteristics, and depending on how the filter output is to be used, different filtering techniques should be used per joint. Remember you can filter any data: We usually apply filtering to the Cartesian coordinates ( x , y , z ) of joints however, filtering can be applied to any data calculated from joint positions. For example, one can directly filter the bone length, relative coordinates of a joint with reference to another joint, spherical coordinates of a joint, and so on. Applying mathematical calculations to noisy data or calculating relative joints usually amplifies the noise, so be careful. It may take more than one filter to get good results: A good filtering solution is usually a combination of various filtering techniques, which may include applying a jitter removal filter to remove spike noise, a smoothing filter, and a forecasting filter to reduce latency, and then adjusting the outputs based on person kinematics and anatomy to avoid awkward cases caused by overshoot. Use the joint tracking state: Take advantage of the joint tracking state data, and use it in your filter implementations to apply more aggressive smoothing and jitter removal when a joint position is inferred. Include future frame data in filtering, if possible: In offline cases, or in cases when its acceptable to increase latency by a few frames, include the future joint data in filtering (for example, use ARMA filters, such as central moving average or Savitzky-Golay with M 0), which will result in better noise removal. Account for the actual time elapsed between two NUI frames: In some cases, the call to get the joint positions from the ST system may fail, which would result in a dropped frame. Therefore, the input data to the filter would be missing for that dropped frame, which means that the joint positions are no longer 33 msec apart from each other. Make sure that your filtering implementation uses the time stamp of the NUI frames and that it estimates the missing data points with an interpolation of data before and after the missing data. Reset the filter when a skeleton is lost: When a person moves outside of the cameras field of view, its skeleton is lost and is no longer tracked. The ST system may use a different tracking ID for the same person later, or it may reuse that tracking ID for other persons. So make sure you reset the filter after a person skeleton is lost. Use debug visualization to see how filter parameters affect your application: Visualizing the filtered joint positions on top of the depth map is useful to see how your filtered data is different from the actual depth data. It is useful to visualize only one joint, like the right hand, and render a history of previous positions on screen. This joint path will show you how smooth the filter output was over the past frames. Use Kinect Studio to export joint data and analyze them offline: You can use Kinect Studio to export joint data and analyze them offline. Use Note that the SDK includes the NuiTransformSmooth method, which is an implementation of a joint filter that is based on double exponential smoothing combined with jitter removal and some overshoot control. 6. References Error Analysis and Error Propagation in Noisy Data 1. John Robert Taylor, An Introduction to Error Analysis: The Study of Uncertainties in Physical Measurements . University Science Books, 1999. 2. Manfred Drosg, Dealing with Uncertainties: A Guide to Error Analysis . Springer, 2009. 3. Bevington, Philip, and D. Keith Robinson, Data Reduction and Error Analysis for the Physical Sciences . McGraw-Hill Science, 3rd edition, 2003. 4. Hughes, Ifan, and Thomas Hase, Measurements and their Uncertainties: A practical guide to modern error analysis . Oxford University Press, 2010. ARMA Filters 5. Brockwell, Peter J. and Richard A. Davis, Time Series: Theory and Methods . 2nd edition. Springer, 2009. Digital Filter Design in Frequency Domain 6. Oppenheim, Alan V. Ronald W. Schafer, and John R. Buck, Discrete-Time Signal Processing . Prentice Hall, 1999. 7. A. Antoniou, Digital Filters: Analysis, Design, and Applications . McGraw-Hill, 2000. Moving Average and Exponential Filters 8. Robert Goodell Brown, Smoothing, Forecasting and Prediction of Discrete Time Series . Dover Publications, 2004. 9. Hoang Pham, Springer handbook of engineering statistics . Springer, 2006. 10. Nocedal, Jorger, and Stephen J. Wright, Numerical Optimization . 2nd edition. Springer, 2006. Savitzky-Golay Filter 11. Vijay Madisetti, The digital signal processing handbook . CRC Press, 2009. 12. William H. Press, Numerical Recipes: the art of scientific computing . Cambridge University Press, 2007. Taylor Series and Derivative Estimation Using Difference Equations 13. Joe D. Hoffman, Numerical Methods for Engineers and Scientists . 2nd edition. CRC Press, 2001.
Comments
Post a Comment