24    jevois::Component(instance), itsKF(4, 2, 0), itsProcessNoise(4, 1, CV_32F),
 
   25    itsMeasurement(2, 1, CV_32F), itsLatest(2, 1, CV_32F), itsFresh(false)
 
   27  cv::setIdentity(
itsKF.measurementMatrix);
 
 
   37  itsKF.statePost.at<
float>(0) = 0.0F; 
 
   38  itsKF.statePost.at<
float>(1) = 0.0F; 
 
   39  itsKF.statePost.at<
float>(2) = 0.0F; 
 
   40  itsKF.statePost.at<
float>(3) = 0.0F; 
 
 
   49  if (newval) 
itsKF.transitionMatrix = (cv::Mat_<float>(4, 4) << 1,0,1,0,   0,1,0,1,  0,0,1,0,  0,0,0,1);
 
   50  else        itsKF.transitionMatrix = (cv::Mat_<float>(4, 4) << 1,0,0,0,   0,1,0,0,  0,0,1,0,  0,0,0,1);
 
   56  itsKF.processNoiseCov = (cv::Mat_<float>(4, 4) << 
 
   57                           newval * newval, 0, 0, 0,
 
   58                           0, newval * newval, 0, 0,
 
   66  cv::setIdentity(
itsKF.measurementNoiseCov, cv::Scalar::all(newval * newval));
 
   72  cv::setIdentity(
itsKF.errorCovPost, cv::Scalar::all(newval * newval));
 
   84void Kalman2D::set(
float x, 
float y, 
unsigned int imgwidth, 
unsigned int imgheight)
 
 
  112  if (eps) { x = std::round(x / eps) * eps; y = std::round(y / eps) * eps; }
 
 
  116void Kalman2D::get(
float & x, 
float & y, 
unsigned int imgwidth, 
unsigned int imgheight, 
float const eps)
 
  118  this->
get(x, y, 0.0F);
 
 
  124                   unsigned int imgwidth, 
unsigned int imgheight, 
float const raweps, 
float const imgeps)
 
  127  this->
get(rawx, rawy, 0.0F);
 
  132  if (raweps) { rawx = std::round(rawx / raweps) * raweps; rawy = std::round(rawy / raweps) * raweps; }
 
 
#define JEVOIS_UNUSED_PARAM(x)
void get(float &x, float &y, float const eps=0.01F)
Function to call each time you want to get the Kalman-filtered coordinates.
Kalman2D(std::string const &instance)
Constructor.
void onParamChange(kalman2d::usevel const ¶m, bool const &newval) override
void set(float x, float y, unsigned int imgwidth, unsigned int imgheight)
Function to call each time you have a new measurement (output from a vision algorithm)
void set(float x, float y)
Function to call each time you have a new measurement (output from a vision algorithm)
virtual ~Kalman2D()
Destructor.
void stdToImg(float &x, float &y, RawImage const &camimg, float const eps=0.1F)
void imgToStd(float &x, float &y, RawImage const &camimg, float const eps=0.1F)