Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Kitti optical flow 2012 : calcOpticalFlowPyrLK
std::vector<cv::Point2f> pts;
std::vector<cv::Point2f> next_pts;
std::vector<unsigned char> status;
cv::Mat err;
int winsize = 11;
int nscales = 4;
for (auto p : i1_gl.domain())
pts.push_back(cv::Point2f(p[1], p[0]));
calcOpticalFlowPyrLK(to_opencv(i1_gl), to_opencv(i2_gl), pts, next_pts, status, err,
cv::Size(winsize, winsize), nscales);
for (unsigned i = 0; i < pts.size(); i++)
if (status[i])
vfloat2 p1(pts[i].y, pts[i].x);
vfloat2 p2(next_pts[i].y, next_pts[i].x);
flow(p1.cast<int>()) = p2 - p1;
has_flow(p1.cast<int>()) = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.