kalman filter plugin (Composition by dust)

Author: dust
License: (unknown)
Date: 2011.04.27
Compatibility: 10.5, 10.6
Categories:
Required plugins:
(none)

kalman vector filter.

a kalman filter is used heavily in computer vision as it is an included filter. you can use it to predict things like musical notes or something its arbitrary the data. normally it is used to smooth out values that have some sort of noise in them.

http://kalman.sourceforge.net/

PreviewAttachmentSize
kalman filter.zip59.78 KB

franz's picture
Re: kalman filter plugin (Composition by dust)

Can't you build 32/64 universal plugins in one go ?

Btw, what's the purpose of this plugin ? It seems to queue the positions, but what ? It is not predicting where my mouse cursor will be next frame ... (that would be awesome !) (and I don't want to sound harsh).

dust's picture
Re: kalman filter plugin (Composition by dust)

actually i think these may both be 64/32 bit universal. i built them separately just in case.

there are many purposes for a kalman filter. like with a hidden markov chain or veterbi algorithm you can predict an output based on various states.

Quote:
The Kalman filter produces estimates of the true values of measurements and their associated calculated values by predicting a value, estimating the uncertainty of the predicted value, and computing a weighted average of the predicted value and the measured value.

...wikipedia

it seems to be of particular interest in open cv applications. in this case you would use it to smooth out optical flow points from open cv blobs for tracking. it can also be uses to restore signal degradations based on referential input like with most electronic communication devices FM radios phased locked loop being an example. basically it should smooth any structure of numbers that has jittery or noise in it.

franz i used the mouse in the example which may be of poor choice because the pointer is actually a very accurate device and you would want to use something jittery to see how well it smooths. in my mind theoretically if you queue up 5 or 10 mouse positions and run it through kalman you get a predicted mouse position. ;)

first use i have in mind for this is smooth out kinect and cv things. once i see this working then i will move onto trying to predict musical notes maybe.

i have only tried this with the mouse but thought maybe someone might find it useful. i'm back from class now going to see how well this works with an audio stream. try and break it etc..

hope someone finds it useful.

can post source if it interests anyone.

franz's picture
Re: kalman filter plugin (Composition by dust)

I find this pretty interesting and would love to see a more advanced example.

dust's picture
Re: kalman filter plugin (Composition by dust)

here is a smoother linear approach. i'm working on integrating newtons laws to turn this plugin from vector to an adaptive kalman filter.

im testing right now with augmented reality.

you can see the above example is much smoother than previous jittery test below.

should have an adaptive filter with some inputs and various outputs like

predicted state vector (a priori state estimate). predicted measurement vector. corrected state (a posteriori state estimate).

will have a more advanced example soon @franz with source...

thanks for trying it out.

here is an audio test with the new approximation.

PreviewAttachmentSize
kalman.plugin.zip23.73 KB
kAudioFilter.qtz144.22 KB

benoitlahoz's picture
Re: kalman filter plugin (Composition by dust)

Thanks a lot for this Dust, but the examples make QC crash for me. :-( The messages in the console don't seem really interesting, so I can't tell you more. May be someone has the same issue ?

dust's picture
Re: kalman filter plugin (Composition by dust)

if its crashing it is because you need to set the path to your audio track. maybe thats it. i'm going to work on this plugin some more. re compile the libs and stuff. maybe use some cl to incorporate euler or verlets into the prediction process ? if it still crashes don't worry. i will have a new version soon.

benoitlahoz's picture
Re: kalman filter plugin (Composition by dust)

Thanks Dust. Will you make it available for 2D structures ? :-)