Skip to content

Commit

Permalink
Merge pull request Smorodov#63 from Nuzhny007/master
Browse files Browse the repository at this point in the history
Tracking improving
  • Loading branch information
Smorodov authored Dec 13, 2017
2 parents 41c61f0 + 4d4fee3 commit 086eeda
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 9 additions & 7 deletions Tracker/Kalman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,16 @@ void TKalmanFilter::CreateLinear(cv::Rect_<track_t> rect0, Point_t rectv0)

cv::setIdentity(m_linearKalman->measurementMatrix);

track_t n1 = pow(m_deltaTime, 4.) / 4.;
track_t n2 = pow(m_deltaTime, 3.) / 2.;
track_t n3 = pow(m_deltaTime, 2.);
m_linearKalman->processNoiseCov = (cv::Mat_<track_t>(6, 6) <<
pow(m_deltaTime,4.)/4., 0, 0, 0, pow(m_deltaTime,3.)/2., 0,
0, pow(m_deltaTime,4.)/4., 0, 0, pow(m_deltaTime,3.)/2., 0,
0, 0, pow(m_deltaTime,4.)/4., 0, 0, 0,
0, 0, 0, pow(m_deltaTime,4.)/4., 0, 0,
pow(m_deltaTime,3.)/2., 0, 0, 0, pow(m_deltaTime,2.), 0,
0, pow(m_deltaTime,3.)/2., 0, 0, 0, pow(m_deltaTime,2.));

n1, 0, 0, 0, n2, 0,
0, n1, 0, 0, 0, n2,
0, 0, n1, 0, 0, 0,
0, 0, 0, n1, 0, 0,
n2, 0, 0, 0, n3, 0,
0, n2, 0, 0, 0, n3);

m_linearKalman->processNoiseCov *= m_accelNoiseMag;

Expand Down
3 changes: 2 additions & 1 deletion Tracker/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void CTrack::RectUpdate(
#ifdef USE_OCV_KCF
if (!dataCorrect)
{
cv::Size roiSize(std::max(2 * m_predictionRect.width, currFrame.cols / 2), std::min(2 * m_predictionRect.height, currFrame.rows / 2));
cv::Size roiSize(std::max(2 * m_predictionRect.width, currFrame.cols / 4), std::min(2 * m_predictionRect.height, currFrame.rows / 4));
if (roiSize.width > currFrame.cols)
{
roiSize.width = currFrame.cols;
Expand Down Expand Up @@ -334,6 +334,7 @@ void CTrack::CreateExternalTracker()
params.desc_pca = cv::TrackerKCF::GRAY;
params.desc_npca = cv::TrackerKCF::GRAY;
params.resize = true;
params.detect_thresh = 0.3;
#if (((CV_VERSION_MAJOR == 3) && (CV_VERSION_MINOR >= 3)) || (CV_VERSION_MAJOR > 3))
m_tracker = cv::TrackerKCF::create(params);
#else
Expand Down

0 comments on commit 086eeda

Please sign in to comment.