Lucas-Kanade 光流

用一个局部窗口内的多个像素约束,最小二乘求解当前 patch 的二维运动向量。

预设样例 · 可解释演示 Ix u + Iy v + It = 0 · LK · PYRAMID
LUCAS-KANADE FLOW PLAYGROUND

局部窗口约束合并为光流向量

特征点 / Select Feature 5x5 window stable corner
局部窗口与两帧匹配 Local Window · Feature Point + Patch
矩阵求解 Least Squares · \(\mathbf A\mathbf v=\mathbf b\)
A matrix --
b vector --
Normal Equation
\(\mathbf A^\mathsf{T}\mathbf A\mathbf v=\mathbf A^\mathsf{T}\mathbf b\)
Active Row
\(\text{row --}: [I_x,I_y]\mathbf v=-I_t\)
结果向量与可跟踪性 Flow Vector · Confidence
Lucas-Kanade 假设
亮度恒定同一物理点在相邻帧中亮度近似不变。
两帧小运动位移足够小,一阶泰勒展开才有效。
邻域流相似一个窗口内的相邻像素共享同一运动向量。
当前步骤 / Step Notes
OpenCV 对照 cv2.calcOpticalFlowPyrLK( prevImg, nextImg, prevPts, None, winSize=(15,15), maxLevel=2, criteria=(EPS | COUNT, 10, 0.03) ) goodFeaturesToTrack 常用于先找角点,PyrLK 再输出 nextPts、status 和 err。
  1. 1
    特征点Select Feature
  2. 2
    局部窗口Local Window
  3. 3
    矩阵构建A and b rows
  4. 4
    最小二乘Least Squares
  5. 5
    光流向量Flow Vector
  6. 6
    可跟踪性Confidence