next up previous contents index
Next: motionseg Up: Reference Previous: thinning   Contents   Index

hs_flow

$ \bigcirc$Name


hs_flow Horn and Schunck iterative scheme to compute optical flow




$ \bigcirc$Command Synopsis


hs_flow [-n niter] [-a alpha] in xflow yflow



-n niter : number of iterations, default 200

-a alpha : weight on smoothing term, default 50.

in : input Fmovie

xflow : output Fmovie: x coordinate of optical flow

yflow : output Fmovie: y coordinate of optical flow




$ \bigcirc$Function Summary


void hs_flow (niter , alpha , in , xflow , yflow )

int *niter ;

float *alpha ;

Fmovie in , xflow , yflow ;




$ \bigcirc$Description


This module computes the optical flow of a Fmovie of N Fimages using the method proposed by Horn and Schunck [HS81]. It generates two movies of N-1 Fimages representing the coordinates of the vectors w of the apparent motion.

Let I(x, y, t) be the intensity brightness at point (x, y) of an image $ \Omega$ of the sequence.

With Horn and Schunck the functionnal which has to be minimized is the following:

E(u, v) = $\displaystyle \int_{\Omega}^{}$((Ix.u+Iy.v+It)2 + $\displaystyle \alpha$(|$\displaystyle \nabla$u|2 + (|$\displaystyle \nabla$v|2) dxdy,

where u and v are the velocity components of the apparent motion w. The first term is a term of basic measurement preserving, and the second one is a smoothing term which is controlled by the weight $ \alpha$. The Euler-Lagrange equations are a system of two differential equations which can be solved with an iterative scheme:

Start from u0 and v0 ( u0 = v0 = 0)

$\displaystyle \left\{\vphantom{ \begin{array}{ccc}
u^{n+1} &=& \overline{u}^n -...
...n + I_y\overline{v}^n +I_t}{{\alpha}^2 + I^2_x+ I^2_y}}\\
\end{array}}\right.$$\displaystyle \begin{array}{ccc}
u^{n+1} &=& \overline{u}^n - I_x\displaystyle{...
...line{u}^n + I_y\overline{v}^n +I_t}{{\alpha}^2 + I^2_x+ I^2_y}}\\
\end{array}$

The estimates of the derivatives Ix, Iy and It are
Ix = $\displaystyle {\frac{{1}}{{4}}}$(Ii+1, j+1, t+1 - Ii, j+1, t+1 + Ii+1, j, t+1 - Ii, j, t+1  
      + Ii+1, j+1, t - Ii, j+1, t + Ii+1, j, t - Ii, j, t) *0.3cm  
Iy = $\displaystyle {\frac{{1}}{{4}}}$(Ii+1, j+1, t+1 - Ii+1, j, t+1 + Ii, j+1, t+1 - Ii, j, t+1  
      + Ii+1, j+1, t - Ii+1, j, t + Ii, j+1, t - Ii, j, t) *0.3cm  
It = $\displaystyle {\frac{{1}}{{4}}}$(Ii+1, j+1, t+1 - Ii+1, j, t + Ii, j+1, t+1 - Ii, j+1, t  
      + Ii+1, j, t+1 - Ii+1, j, t + Ii, j, t+1 - Ii, j, t)  

$ \overline{{u}}$ and $ \overline{{v}}$ are the local averages

$\displaystyle \overline{{u}}_{{i,j,t}}^{}$ = $\displaystyle {\frac{{1}}{{6}}}$(ui-1, j, t + ui, j+1, t + ui+1, j, t + ui, j-1, t)  
    + $\displaystyle {\frac{{1}}{{12}}}$(ui-1, j-1, t + ui-1, j+1, t + ui+1, j+1, t + ui+1, j-1, t) *0.3cm  
$\displaystyle \overline{{v}}_{{i,j,t}}^{}$ = $\displaystyle {\frac{{1}}{{6}}}$(vi-1, j, t + vi, j+1, t + vi+1, j, t + vi, j-1, t)  
    + $\displaystyle {\frac{{1}}{{12}}}$(vi-1, j-1, t + vi-1, j+1, t + vi+1, j+1, t + vi+1, j-1, t)  

The -n option gives the number of iterations to be done.
The -a option changes the weight of parameter $ \alpha$.


Exemple of use:

hs_flow cmovie /tmp/U /tmp/V
ofdraw /tmp/U /tmp/V /tmp/disp
cmview -l /tmp/disp &




$ \bigcirc$Version 1.0


Last Modification date : Thu Apr 15 06:44:30 2004


$ \bigcirc$Author


Olivia Sanchez






next up previous contents index
Next: motionseg Up: Reference Previous: thinning   Contents   Index
mw 2004-05-05