MCPcopy Create free account
hub / github.com/Smorodov/Multitarget-tracker / CreateLinear

Method CreateLinear

src/Tracker/Kalman.cpp:40–86  ·  view source on GitHub ↗

\brief TKalmanFilter::CreateLinear \param xy0 \param xyv0

Source from the content-addressed store, hash-verified

38/// \param xyv0
39///
40void TKalmanFilter::CreateLinear(Point_t xy0, Point_t xyv0)
41{
42 // We don't know acceleration, so, assume it to process noise.
43 // But we can guess, the range of acceleration values thich can be achieved by tracked object.
44 // Process noise. (standard deviation of acceleration: m/s^2)
45 // shows, woh much target can accelerate.
46
47 // 4 state variables, 2 measurements
48 m_linearKalman.init(4, 2, 0, El_t);
49 // Transition cv::Matrix
50 m_linearKalman.transitionMatrix = (cv::Mat_<track_t>(4, 4) <<
51 1, 0, m_deltaTime, 0,
52 0, 1, 0, m_deltaTime,
53 0, 0, 1, 0,
54 0, 0, 0, 1);
55
56 // init...
57 m_lastPointResult = xy0;
58 m_linearKalman.statePre.at<track_t>(0) = xy0.x; // x
59 m_linearKalman.statePre.at<track_t>(1) = xy0.y; // y
60 m_linearKalman.statePre.at<track_t>(2) = xyv0.x; // vx
61 m_linearKalman.statePre.at<track_t>(3) = xyv0.y; // vy
62
63 m_linearKalman.statePost.at<track_t>(0) = xy0.x;
64 m_linearKalman.statePost.at<track_t>(1) = xy0.y;
65 m_linearKalman.statePost.at<track_t>(2) = xyv0.x;
66 m_linearKalman.statePost.at<track_t>(3) = xyv0.y;
67
68 cv::setIdentity(m_linearKalman.measurementMatrix);
69
70 m_linearKalman.processNoiseCov = (cv::Mat_<track_t>(4, 4) <<
71 pow(m_deltaTime,4.0)/4.0 ,0 ,pow(m_deltaTime,3.0)/2.0 ,0,
72 0 ,pow(m_deltaTime,4.0)/4.0 ,0 ,pow(m_deltaTime,3.0)/2.0,
73 pow(m_deltaTime,3.0)/2.0 ,0 ,pow(m_deltaTime,2.0) ,0,
74 0 ,pow(m_deltaTime,3.0)/2.0 ,0 ,pow(m_deltaTime,2.0));
75
76
77 m_linearKalman.processNoiseCov *= m_accelNoiseMag;
78
79 cv::setIdentity(m_linearKalman.measurementNoiseCov, cv::Scalar::all(0.1));
80
81 cv::setIdentity(m_linearKalman.errorCovPost, cv::Scalar::all(.1));
82
83 m_initialPoints.reserve(MIN_INIT_VALS);
84
85 m_initialized = true;
86}
87
88///
89/// \brief TKalmanFilter::CreateLinear

Callers

nothing calls this directly

Calls 2

powFunction · 0.85
initMethod · 0.45

Tested by

no test coverage detected