追跡アルゴリズムのベースとして、次の関数を使用します。
//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) へのオプティカル フローの計算を開始します。