ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Has anyone used the KalmanFilter Opencv libraries inside ROS?

asked 2015-07-16 17:26:10 -0500

erivera1802 gravatar image

Hi, I was wondering if someone has used the Kalman filter of Opencv inside ROS. The "normal" Opencv program works perfectly, but when i use it inside ros (The same code), it throws me the following error:

‘KF’ does not name a type
 KF.transitionMatrix = *(Mat_<float>(4, 4) << 1,0,1,0,   0,1,0,1,  0,0,1,0,  0,0,0,1);

The relevant include is:

#include <opencv2/video/tracking.hpp>
#include <opencv2/video/video.hpp>

That is the same that I use in the normal Opencv code, but in ROS it doesnt work.


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-07-17 01:20:39 -0500

mgruhler gravatar image

We've been doing this somethimes. It is hard to debug this without more code. But do you have KF initialized? KF is just an object type, right?

So have you done somthing like the following anywhere in your code?

cv::KalmanFilter KF
edit flag offensive delete link more


Yeah, here is it: int stateSize = 4; int measSize = 2; int contrSize = 0; unsigned int type = CV_32F; KalmanFilter KF(stateSize, measSize, contrSize)

erivera1802 gravatar image erivera1802  ( 2015-07-18 13:53:17 -0500 )edit

Do you have the code somewhere available? Because with only this I cannot help more. Everything seems fine, as far as I see. Only difference we have is that we explicitly #include <opencv2/core/core.hpp>, but that shouldn't make a difference. Another guess: Do you link against OpenCV_LIBRARIES?

mgruhler gravatar image mgruhler  ( 2015-07-20 01:21:53 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-07-16 17:26:10 -0500

Seen: 438 times

Last updated: Jul 17 '15