Ask Your Question
2

Using Kalman filter from Java, Is there a working example?

asked 2014-01-23 02:48:27 -0600

CAlbertson gravatar image

I read the Java API docs, other then the constructor there are only to methods and one of them takes no input. This should be easy because there is not much you CAN do but I don't get results.

A very minimal "hello world" type working example in Java would be great.

Here is what I think you do..

KalmanFilter kf  = new KalmanFilter(3, 4);
Mat state        = new MatOfDouble(3,1);    // (x, y, h)
Mat measurement  = new MatOfDouble(4,1);    // (odoX, odoY, odoH, compassH)    

while(1){
      //stuff new sensor data into "measurements"

      // call these to methods
      kf.correct(measurement);
      state = kf.predict();

      // pull predicted state from "state"
    }

correct() does produce a return value but it's not clear what and correct() take no input

edit retag flag offensive close merge delete

Comments

Did you already looked at this topic? It seems to do exactly what you want :)

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-23 03:26:16 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-01-23 03:30:34 -0600

And maybe this could also lead to a solution, the javacv wrappers seem to have a better working Kalman filtering than the openCV java bindings.

Hi everyone,

I recently released Java code, based on JNA, that wraps all functions and structures (that are useful in Java) of cxcore, cv, and highgui libraries, plus some additional helper classes for access, conversions, etc. It's part of this package here: http://www.ok.ctrl.titech.ac.jp/~saudet/procamcalib/javacv-src-20090811.ziphttp://www.ok.ctrl.titech.ac.jp/%7Esaudet/procamcalib/javacv-src-20090811.zip The wrappers are fully contained in cxcore.java, cv.java and highgui.java respectively. They are basically Java versions of the include files, so you may strip them out if interested in that part only :)

A word of warning though: They have not been fully tested.

(I think the licensing stuff is all right, but please let me know if there are any potential issues, or any requests at all about other things, thank you.)

Samuel

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-01-23 02:48:27 -0600

Seen: 3,849 times

Last updated: Jan 23 '14