Gradient Based Motion Estimation

From MMVLWiki

Detecting sub-pixel shifts
Enlarge
Detecting sub-pixel shifts

Using gradient based motion estimation is good at detecting sub-pixel shifts. During an investigation on depth of defocus, this software was developed for compensating the misalignment of a focus-drive.

The local gradient \cfrac{\delta g}{\delta\vec{x}} of the gray values and the gradient in time \cfrac{\delta g}{\delta t} are related to each other in the first order:

\Big(\cfrac{\delta g}{\delta x_1}(\vec{x},t)\ \cfrac{\delta g}{\delta x_2}(\vec{x},t)\Big)^\top\cdot\vec{v}(\vec{x},t)\approx-\cfrac{\delta g}{\delta t}(\vec{x},t) where g\in\mathbb{R}^2\times\mathbb{R}\mapsto\mathbb{R} is a video and \vec{v}\in\mathbb{R}^2\mapsto\mathbb{R}^2 a motion vector field.

Using the model \vec{v}\big(\begin{pmatrix}x_1\\x_2\end{pmatrix}\big)=\begin{pmatrix}a_1+b_1\,x_1\\a_2+b_2\,x_2\end{pmatrix} this becomes a least square problem: \begin{pmatrix} \cfrac{\delta g}{\delta x_1}(\vec{p_1}) & p_{1,1}\,\cfrac{\delta g}{\delta x_1}(\vec{p_1}) & \cfrac{\delta g}{\delta x_2}(\vec{p_1}) & p_{1,2}\,\cfrac{\delta g}{\delta x_2}(\vec{p_1}) \\ \vdots & \vdots & \vdots & \vdots\\ \cfrac{\delta g}{\delta x_1}(\vec{p_n}) & p_{n,1}\,\cfrac{\delta g}{\delta x_1}(\vec{p_n}) & \cfrac{\delta g}{\delta x_2}(\vec{p_n}) & p_{n,2}\,\cfrac{\delta g}{\delta x_2}(\vec{p_n}) \\ \end{pmatrix} \begin{pmatrix} a_1\\b_1\\a_2\\b_2 \end{pmatrix}= \begin{pmatrix} -\cfrac{\delta g}{\delta t}(\vec{p_1})\\\vdots\\ -\cfrac{\delta g}{\delta t}(\vec{p_n}) \end{pmatrix} +\vec{\epsilon} where a1, a2 are denoting the shift and b1, b2 are denoting the scale between the two images.

The result can be improved by applying the least square algorithm iteratively to the compensated images. It may also be necessary to apply a low-pass filter to the images before performing motion estimation.

See Also

Personal tools