Ask Your Question

Aladdin's profile - activity

2014-11-07 06:56:26 -0600 asked a question Use kalman in Java

Hi! I'm trying to use the Kalman filter in openCV in java but it I can't get it to work. I have made a simple example with some 2D-points moving.

Both the output from predict() and correct() and empty for this example.

    double[][] samplesArr = {{0,0},{1,0},{1,1},{2,1},{2,2}};

    Mat meas = new Mat(2,1,CvType.CV_32F);
    KalmanFilter kf = new KalmanFilter(4, 2);
    for(int i = 0; i < samplesArr.length; i++)
    {
        meas.put(0, 0, samplesArr[i]);
        Mat corr = kf.correct(meas);
        Mat pre = kf.predict();
        System.out.println(pre.dump());
    }