找到每个像素opencv的光流

0 c++ opencv feature-extraction opticalflow

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

// 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
Run Code Online (Sandbox Code Playgroud)

// 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
Run Code Online (Sandbox Code Playgroud)

cv::calcOpticalFlowPyrLK将前一图像中的点矢量作为输入,并在下一图像上返回适当的点.假设我想计算每个像素的光学流量而不是好的特征

换句话说,开始计算从(1,1)到(m,n)的光流

ber*_*rak 6

cv :: calcOpticalFlowPyrLK执行稀疏OF,即从特征点开始,如果你想为每个像素使用它,请使用

calcOpticalFlowFarneback.

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