我使用以下函数作为我的跟踪算法的基础。
//1. 检测我的意思的特征,这个函数提取唯一好的特征,
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. 跟踪特征
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
cv::calcOpticalFlowPyrLK
将前一张图像中的点向量作为输入,并返回下一张图像上的适当点。假设我想计算每个像素的光流而不是好的特征
换句话说,开始计算从(1,1)到(m,n)的光流