Mercurial > hg > nsaunier > traffic-intelligence
comparison c/feature-based-tracking.cpp @ 815:daa992ac6b44
correcting bug with coordinates in mask
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Sat, 18 Jun 2016 14:25:59 -0400 |
| parents | 2cade72d75ad |
| children | a71455bd8367 |
comparison
equal
deleted
inserted
replaced
| 813:ef8795dba5ed | 815:daa992ac6b44 |
|---|---|
| 180 | 180 |
| 181 std::vector<Point2f> trackedPts; | 181 std::vector<Point2f> trackedPts; |
| 182 std::vector<FeaturePointMatch>::iterator iter = featurePointMatches.begin(); | 182 std::vector<FeaturePointMatch>::iterator iter = featurePointMatches.begin(); |
| 183 while (iter != featurePointMatches.end()) { | 183 while (iter != featurePointMatches.end()) { |
| 184 bool deleteFeature = false; | 184 bool deleteFeature = false; |
| 185 | 185 |
| 186 if (status[iter->pointNum] && (mask.at<uchar>(static_cast<int>(round(currPts[iter->pointNum].y)), static_cast<int>(round(currPts[iter->pointNum].x))) != 0)) { | 186 int currPtX = static_cast<int>(floor(currPts[iter->pointNum].x)); |
| 187 int currPtY = static_cast<int>(floor(currPts[iter->pointNum].y)); | |
| 188 if ((status[iter->pointNum] =!0) && | |
| 189 (currPtX >= 0) && (currPtX < videoSize.width) && | |
| 190 (currPtY >= 0) && (currPtY < videoSize.height) && | |
| 191 (mask.at<uchar>(currPtY, currPtX) != 0)) { | |
| 187 iter->feature->addPoint(frameNum, currPts[iter->pointNum], homography); | 192 iter->feature->addPoint(frameNum, currPts[iter->pointNum], homography); |
| 188 | 193 |
| 189 deleteFeature = iter->feature->isDisplacementSmall(params.nDisplacements, minTotalFeatureDisplacement) | 194 deleteFeature = iter->feature->isDisplacementSmall(params.nDisplacements, minTotalFeatureDisplacement) |
| 190 || !iter->feature->isMotionSmooth(params.accelerationBound, params.deviationBound); | 195 || !iter->feature->isMotionSmooth(params.accelerationBound, params.deviationBound); |
| 191 if (deleteFeature) | 196 if (deleteFeature) |
