Ask Your Question
0

Assertion Error in Kalman Filter python OpenCV 2.4.0

asked 2012-07-08 23:40:49 -0600

When I try to predict Kalman,

k = cv2.KalmanFilter(2,1,0)
c = np.array([(0.0),(0.0)]).reshape(2,1)
a = k.predict(c)

I am getting following Assertion Error.

error: /home/jay/Downloads/OpenCV-2.4.0/modules/core/src/matmul.cpp:711: error: (-215) type == B.type() && (type == CV32FC1 || type == CV64FC1 || type == CV32FC2 || type == CV64FC2) in function gemm

So, I added following line of code in OpenCV-2.4.0/modules/core/src/matmul.cpp and rebuilt it from the source.

printf("%d %d\n",type,B.type());

So, now it gives me output as,

5 5

0 6

Am I doing something wrong here ? What's the problem ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2012-07-16 15:38:53 -0600

blue gravatar image

The python wrapper for this class is incomplete. Nowhere in your example did you specify any of the system matrices or noise covariances, and indeed the python wrapper does not provide a method to do this.

If you look at the sample kalman.cpp, you can see that the C++ API requires the transition, measurement, control and noise covariance matrices to be initialized after the filter object is constructed.

You might want to write up a feature request on the bug tracker for this.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-07-08 23:40:49 -0600

Seen: 3,199 times

Last updated: Jul 16 '12