Skip to content

Commit f2c324a

Browse files
sovrasovvpisarev
authored andcommitted
Median flow tracker update (#952)
* Fix several issues in TrackerMedianFlow implementation Particularly, add possibility to tune optical flow parameters for a median flow tracker. * Improve code of TrackerMedianFlow Replace a lot of calls of std::vector::erase by one call of std::remove_if. * Delete unused code, use norm from OpenCV * medianFlow:turn getMedian method into function, small code cleanup * TrackerMedianFlow:fixes in parameters I/O, add test for them * TrackerMedianFlow:replace double with float in temp buffers * Fix indentation * TrackerMedianFlow:add absent parameter case handling in read() * TrackerMedianFlow:use ROI instead of copy when getting a patch * TrackerMedianFlow:don't calc image pyramids 2 times * MedianFlowTracker: use cvIsNan() * MedianFlow: refactor vector filtration code * MedianFlow: change if statements layout in filterPointsInVectors
1 parent 7e5ca52 commit f2c324a

File tree

3 files changed

+338
-178
lines changed

3 files changed

+338
-178
lines changed

modules/tracking/include/opencv2/tracking/tracker.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,9 +1156,16 @@ class CV_EXPORTS TrackerMedianFlow : public Tracker
11561156
public:
11571157
struct CV_EXPORTS Params
11581158
{
1159-
Params();
1160-
int pointsInGrid; //!<square root of number of keypoints used; increase it to trade
1161-
//!<accurateness for speed; default value is sensible and recommended
1159+
Params(); //!<default constructor
1160+
//!<note that the default values of parameters are recommended for most of use cases
1161+
int pointsInGrid; //!<square root of number of keypoints used; increase it to trade
1162+
//!<accurateness for speed
1163+
cv::Size winSize; //!<window size parameter for Lucas-Kanade optical flow
1164+
int maxLevel; //!<maximal pyramid level number for Lucas-Kanade optical flow
1165+
TermCriteria termCriteria; //!<termination criteria for Lucas-Kanade optical flow
1166+
cv::Size winSizeNCC; //!<window size around a point for normalized cross-correlation check
1167+
double maxMedianLengthOfDisplacementDifference; //!<criterion for loosing the tracked object
1168+
11621169
void read( const FileNode& /*fn*/ );
11631170
void write( FileStorage& /*fs*/ ) const;
11641171
};

0 commit comments

Comments
 (0)