Ask Your Question
0

Assertion Error in Kalman Filter python OpenCV 2.4.0

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

jayrambhia gravatar image jayrambhia flag of India
152 1 4 10
http://jayrambhia.wordpre...

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 ?

delete close flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

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

blue gravatar image blue
171 3

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.

link delete flag offensive edit

Login/Signup to Answer

Question tools

Follow

subscribe to rss feed

Stats

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

Seen: 309 times

Last updated: Jul 16 '12