1

我使用以下函数作为我的跟踪算法的基础。

//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)的光流

4

1 回答 1

7

cv::calcOpticalFlowPyrLK 确实是稀疏的,即来自特征点,如果您希望每个像素都使用它,请使用

calcOpticalFlowFarneback

计算密集光流(使用 Gunnar Farneback 算法)。

于 2014-01-05T14:29:27.963 回答