我使用它作为我的跟踪算法的基础.
//1. detect the features
cv::goodFeaturesToTrack(gray_prev, // the image
features, // the output detected features
max_count, // the maximum number of features
qlevel, // quality level
minDist); // min distance between two features
// 2. track features
cv::calcOpticalFlowPyrLK(
gray_prev, gray, // 2 consecutive images
points_prev, // input point positions in first im
points_cur, // output point positions in the 2nd
status, // tracking success
err); // tracking error
Run Code Online (Sandbox Code Playgroud)
cv::calcOpticalFlowPyrLK将前一图像中的点矢量作为输入,并在下一图像上返回适当的点.假设我在前一个图像上有随机像素(x,y),如何使用OpenCV光流功能计算下一个图像上该像素的位置?