Mercurial Hosting > traffic-intelligence
diff c/feature-based-tracking.cpp @ 1125:b358bed29ab4
updates and bugs
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 30 Jan 2020 10:17:07 -0500 |
parents | 05ccd8ef150c |
children | 051cf5bddc1f |
line wrap: on
line diff
--- a/c/feature-based-tracking.cpp Tue Jun 25 17:23:43 2019 -0400 +++ b/c/feature-based-tracking.cpp Thu Jan 30 10:17:07 2020 -0500 @@ -231,15 +231,15 @@ for (int i=MAX(0, currPts[n].y-params.minFeatureDistanceKLT); i<MIN(videoSize.height, currPts[n].y+params.minFeatureDistanceKLT+1); i++) featureMask.at<uchar>(i,j)=0; goodFeaturesToTrack(currentFrameBW, newPts, params.maxNFeatures, params.featureQuality, params.minFeatureDistanceKLT, featureMask, params.blockSize, params.useHarrisDetector, params.k); - if (params.undistort) + if (params.undistort && newPts.size() > 0) undistortPoints(newPts, undistortedPts, intrinsicCameraMatrix, params.distortionCoefficients); else undistortedPts = newPts; for (unsigned int i=0; i<newPts.size(); i++) { - FeatureTrajectoryPtr f = FeatureTrajectoryPtr(new FeatureTrajectory(frameNum, undistortedPts[i], homography)); - featurePointMatches.push_back(FeaturePointMatch(f, currPts.size())); - currPts.push_back(newPts[i]); + FeatureTrajectoryPtr f = FeatureTrajectoryPtr(new FeatureTrajectory(frameNum, undistortedPts[i], homography)); + featurePointMatches.push_back(FeaturePointMatch(f, currPts.size())); + currPts.push_back(newPts[i]); } if (params.display && !displayFrame.empty()) {