I've implemented OpenCV's Kalman filter in a previous C++ project and I am now trying to use it in the context of a class.
This is how I usually construct my Kalman filter:
cv::KalmanFilter KF(4,2,0);
I am now trying to have the filter as a member of a class and I'm having trouble initialising it.
I have tried:
1)
class foo
{
public:
...
private:
cv::KalmanFilter m_filter(4,2,0);
};
And I get the following error:
error: expected identifier before numeric constant
cv::KalmanFilter m_filter(4,2,0);
^
foo.hpp:31:39: error: expected ‘,’ or ‘...’ before numeric constant
2)
If I try to remove the initialisation there and do it in the class constructor with:
.hpp
...
private:
cv::KalmanFilter m_filter;
.cpp
constructor(...)
{
m_filter(4,2,0);
}
I get:
error: no match for call to ‘(cv::KalmanFilter) (int, int, int)’
m_filter(4,2,0);
^
constructor(...) : m_filter(4,2,0) {...}
– Dmitrii Z.foo
's destructor. – Dmitrii Z.