Ask Your Question
0

Assertion Error in Kalman Filter python OpenCV 2.4.0

asked Jul 9 '12

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 ?

Preview: (hide)

1 answer

Sort by » oldest newest most voted
2

answered Jul 16 '12

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.

Preview: (hide)

Question Tools

Stats

Asked: Jul 9 '12

Seen: 3,302 times

Last updated: Jul 16 '12