@@ -13,11 +13,9 @@ TKalmanFilter::TKalmanFilter(
1313 m_deltaTime(deltaTime),
1414 m_deltaTimeMin(deltaTime),
1515 m_deltaTimeMax(2 * deltaTime),
16- m_lastDist(0 ),
1716 m_accelNoiseMag(accelNoiseMag),
1817 m_type(type),
19- m_useAcceleration(useAcceleration),
20- m_initialized(false )
18+ m_useAcceleration(useAcceleration)
2119{
2220 m_deltaStep = (m_deltaTimeMax - m_deltaTimeMin) / m_deltaStepsCount;
2321}
@@ -283,7 +281,6 @@ class AcceleratedModel: public cv::tracking::UkfSystemModel
283281 m_deltaTime (deltaTime),
284282 m_rectModel (rectModel)
285283 {
286-
287284 }
288285
289286 void stateConversionFunction (const cv::Mat& x_k, const cv::Mat& u_k, const cv::Mat& v_k, cv::Mat& x_kplus1)
@@ -309,13 +306,9 @@ class AcceleratedModel: public cv::tracking::UkfSystemModel
309306 }
310307
311308 if (v_k.size () == u_k.size ())
312- {
313309 x_kplus1 += v_k + u_k;
314- }
315310 else
316- {
317311 x_kplus1 += v_k;
318- }
319312 }
320313
321314 void measurementFunction (const cv::Mat& x_k, const cv::Mat& n_k, cv::Mat& z_k)
@@ -564,10 +557,6 @@ Point_t TKalmanFilter::GetPointPrediction()
564557 }
565558
566559 m_lastPointResult = Point_t (prediction.at <track_t >(0 ), prediction.at <track_t >(1 ));
567- }
568- else
569- {
570-
571560 }
572561 return m_lastPointResult;
573562}
@@ -658,13 +647,10 @@ Point_t TKalmanFilter::Update(Point_t pt, bool dataCorrect)
658647 {
659648 track_t currDist = sqrtf (sqr (estimated.at <track_t >(0 ) - pt.x ) + sqr (estimated.at <track_t >(1 ) - pt.y ));
660649 if (currDist > m_lastDist)
661- {
662650 m_deltaTime = std::min (m_deltaTime + m_deltaStep, m_deltaTimeMax);
663- }
664651 else
665- {
666652 m_deltaTime = std::max (m_deltaTime - m_deltaStep, m_deltaTimeMin);
667- }
653+
668654 m_lastDist = currDist;
669655
670656 m_linearKalman.transitionMatrix .at <track_t >(0 , 2 ) = m_deltaTime;
@@ -690,9 +676,7 @@ Point_t TKalmanFilter::Update(Point_t pt, bool dataCorrect)
690676 else
691677 {
692678 if (dataCorrect)
693- {
694679 m_lastPointResult = pt;
695- }
696680 }
697681 return m_lastPointResult;
698682}
@@ -722,10 +706,6 @@ cv::Rect TKalmanFilter::GetRectPrediction()
722706 }
723707
724708 m_lastRectResult = cv::Rect_<track_t >(prediction.at <track_t >(0 ), prediction.at <track_t >(1 ), prediction.at <track_t >(2 ), prediction.at <track_t >(3 ));
725- }
726- else
727- {
728-
729709 }
730710 return cv::Rect (static_cast <int >(m_lastRectResult.x ), static_cast <int >(m_lastRectResult.y ), static_cast <int >(m_lastRectResult.width ), static_cast <int >(m_lastRectResult.height ));
731711}
@@ -838,13 +818,10 @@ cv::Rect TKalmanFilter::Update(cv::Rect rect, bool dataCorrect)
838818 {
839819 track_t currDist = sqrtf (sqr (estimated.at <track_t >(0 ) - rect.x ) + sqr (estimated.at <track_t >(1 ) - rect.y ) + sqr (estimated.at <track_t >(2 ) - rect.width ) + sqr (estimated.at <track_t >(3 ) - rect.height ));
840820 if (currDist > m_lastDist)
841- {
842821 m_deltaTime = std::min (m_deltaTime + m_deltaStep, m_deltaTimeMax);
843- }
844822 else
845- {
846823 m_deltaTime = std::max (m_deltaTime - m_deltaStep, m_deltaTimeMin);
847- }
824+
848825 m_lastDist = currDist;
849826
850827 m_linearKalman.transitionMatrix .at <track_t >(0 , 4 ) = m_deltaTime;
0 commit comments