next up previous contents index
Next: cfdiff Up: Reference Previous: ofdraw   Contents   Index

ws_flow

$ \bigcirc$Name


ws_flow Weickert and Schnoerr optical flow computation




$ \bigcirc$Command Synopsis


ws_flow [-p percent] [-n n] [-t tau] [-l lambda] [-E eps] [-A alpha] [-R norm_movie] movie wsU wsV



-p percent : if set, stop when |  E(n)-E(n-1) |   <  E(1)*percent/100

-n n : maximum number of iterations, default 100

-t tau : time-step, default 0.166666

-l lambda : contrast parameter, default 1

-E eps : epsilon (may be arbitrary small), default 0.000001

-A alpha : weight of divergence term in pde, default 500.

-R norm_movie : optional output: optical flow norm

movie : Input Fmovie

wsU : Fmovie of OF_{1}(x,y)

wsV : Fmovie of OF_{2}(x,y)




$ \bigcirc$Function Summary


void ws_flow (percent , n , tau , lambda , eps , alpha , norm , movie , wsU , wsV )

float *percent ;

int *n ;

float *tau , *lambda , *eps , *alpha ;

Fmovie norm ;

Fmovie movie , wsU , wsV ;




$ \bigcirc$Description


ws_flow is an implementation of the Weickert and Schnörr optical flow computation by a semi-implicit scheme (in comparison of other schemes, it is quasi-explicit). In [WS01], they consider a functional where the gradients of the two components of the flow are 3D-gradients, i.e. $ \nabla^{{3}}_{}$f = ($ {\frac{{\partial f}}{{\partial x}}}$,$ {\frac{{\partial f}}{{\partial y}}}$,$ {\frac{{\partial f}}{{\partial t}}}$)T and they do not separate the 3D-gradients of the two components ($ \sigma_{{1}}^{}$,$ \sigma_{{2}}^{}$) of the velocity

E($\displaystyle \sigma$) = $\displaystyle \int_{{\Omega\times[0,T]}}^{}$|$\displaystyle \nabla$u . $\displaystyle \sigma$ + ut|2 dx dy dt + $\displaystyle \alpha$$\displaystyle \int_{{\Omega\times[0,T]}}^{}$$\displaystyle \Psi$(|$\displaystyle \nabla^{{3}}_{}$$\displaystyle \sigma_{{1}}^{}$|2 + |$\displaystyle \nabla^{{3}}_{}$$\displaystyle \sigma_{{2}}^{}$|2) dx dy dt

where u is the gray level at pixel (x, y) and time t, $ \lambda$ > 0 and $ \Psi$(s2) = $ \epsilon$s2 + (1 - $ \epsilon$)$ \lambda^{2}_{}$$ \sqrt{{1+\frac{s^2}{\lambda^2}}}$. ($ \epsilon$ is required only for proving well-posedness and can be chosen as weak as possible, e.g. $ \epsilon$ = 10-6). The steepest descent equations are

$\displaystyle {\frac{{\partial \sigma_{1}}}{{\partial t}}}$ = div3($\displaystyle \Psi^{{\prime}}_{}$(|$\displaystyle \nabla^{{3}}_{}$$\displaystyle \sigma_{{1}}^{}$|2 + |$\displaystyle \nabla^{{3}}_{}$$\displaystyle \sigma_{{2}}^{}$|2)$\displaystyle \nabla^{{3}}_{}$$\displaystyle \sigma_{{1}}^{}$) - $\displaystyle {\frac{{1}}{{\alpha}}}$ ux($\displaystyle \nabla$u . $\displaystyle \sigma$ + ut)
     
$\displaystyle {\frac{{\partial \sigma_{2}}}{{\partial t}}}$ = div3($\displaystyle \Psi^{{\prime}}_{}$(|$\displaystyle \nabla^{{3}}_{}$$\displaystyle \sigma_{{1}}^{}$|2 + |$\displaystyle \nabla^{{3}}_{}$$\displaystyle \sigma_{{2}}^{}$|2)$\displaystyle \nabla^{{3}}_{}$$\displaystyle \sigma_{{2}}^{}$) - $\displaystyle {\frac{{1}}{{\alpha}}}$ uy($\displaystyle \nabla$u . $\displaystyle \sigma$ + ut)

The semi-implicit scheme consists in approximating $ {\frac{{\partial \sigma_{1}}}{{\partial t}}}$ by an Euler-forward scheme $ {\frac{{\sigma_{1}^{n+1}-\sigma_{1}^{n}}}{{\delta t}}}$, div3($ \Psi^{{\prime}}_{}$(|$ \nabla^{{3}}_{}$$ \sigma_{{1}}^{}$|2 + |$ \nabla^{{3}}_{}$$ \sigma_{{2}}^{}$|2)$ \nabla^{{3}}_{}$$ \sigma_{{1}}^{}$) at time n by

$\displaystyle \sum_{{(i,j)\in \mathcal{N}_{6}(x,y)}}^{}$w($\displaystyle \sigma_{{1}}^{{n}}$(i, j))$\displaystyle \sigma_{{1}}^{{n}}$(i, j)

( $ \mathcal {N}$6(x, y) is the 6-neighbourhood of pixel (x, y): 4 neighbours in space+2 neighbours in time); $ {\frac{{1}}{{\alpha}}}$ux($ \nabla$u . $ \sigma$ + ut) by

$\displaystyle {\frac{{1}}{{\alpha}}}$ ux(ux$\displaystyle \sigma_{{1}}^{{n+1}}$ + uy$\displaystyle \sigma_{{2}}^{{n}}$ + ut)

and the same way for the second equation.
The values w($ \sigma_{{1}}^{{n}}$(i, j)) come from the Malik and Perona discretization of the divergence (approximation of the derivatives by a centered scheme at semi-nodes)

w($\displaystyle \sigma_{{1}}^{{n}}$(i, j))$\displaystyle \sigma_{{1}}^{{n}}$(i, j) = $\displaystyle {\frac{{\Psi^{\prime}(i,j,n)+\Psi^{\prime}(x,y,n)}}{{2}}}$($\displaystyle \sigma_{{1}}^{{n}}$(i, j) - $\displaystyle \sigma_{{1}}^{{n}}$(x, y))

where $ \Psi^{{\prime}}_{}$(i, j, n) approximates $ \Psi^{{\prime}}_{}$(|$ \nabla^{{3}}_{}$$ \sigma_{{1}}^{{n}}$|2 + |$ \nabla^{{3}}_{}$$ \sigma_{{2}}^{{n}}$|2)(i, j).
This semi-implicit scheme is a median way between a completely explicit scheme and AOS schemes (see [WtHRV98]).
The iterations are performed until n is reached, unless the precision percent is attained. There is no default value for this last parameter, in order to do all the iterations until n in case the user does not want to use the option -p, in the opposite case a value must be chosen.


Exemple of use:

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




$ \bigcirc$See Also


fop.




$ \bigcirc$Version 1.0


Last Modification date : Thu Apr 15 06:26:51 2004


$ \bigcirc$Author


Florent Ranchin






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