2014-01-05 65 views
0

我使用以下函数作为我的跟踪算法的基础。找到每个像素的光流opencv

// 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需要从以前的图像点向量作为输入,并返回下一张照片上的适当点。 假设我要计算每个pixle代替良好特征

在其他含义

的opical流,开始计算从(1,1)到(M,N)

+0

[Opencv跟踪使用光流]的可能的副本(http://stackoverflow.com/questions/9701276/opencv-tracking-using-optical-flow) –

+0

@RogerRowland不,这个问题是不一样的。 –

+0

我也可以提出这个建议吗?它被称为相位相关:http://stackoverflow.com/questions/16718241/lucas-kanade-dense-optical-flow/21007222#21007222 –

回答

6

CV ::光流calcOpticalFlowPyrLK确实稀疏OF,即从特征点开始,如果您想要它为每个像素,请使用

calcOpticalFlowFarneback

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

+0

非常感谢你亲爱的 – user3050468