DataConstant Module Reference

Brightness constancy data term.

This implements the BC data term from the learning optical flow paper by Sun et. al.The data term energy looks like\[E_D=\sum_{i,j}\Psi(I_1(i,j)-I_2(i+u_{ij},j+v_{ij}))\]It is a general stencil wich is able to model various kinds of constancy and functions $\Psi$ for local weighting of the bcce data term. With preprocessing of the sequence data, other kinds of constancy like gradient constancy may be realized (providing filtered versions of the sequence as input to DataConstant).The stencil equations are derived using $\nabla_u E_D=0,\nabla_v E_D=0$: \[\nabla_u E_D=\Psi'(I_1(i,j)-I_2(i+u_{ij},j+v_{ij})) \cdot(-I_{2,x}(i+u_{ij},j+v_{ij}))\] Expanding this by the argument of $\Psi'$ leads to \[\nabla_u E_D=\frac{\Psi'(I_1(i,j)-I_2(i+u_{ij},j+v_{ij})) \cdot(-I_{2,x}(i+u_{ij},j+v_{ij}))}{I_2(i+u_{ij},j+v_{ij})-I_1(i,j)} \cdot(I_2(i+u_{ij},j+v_{ij})-I_1(i,j))\] Taylor-expansion of the right part is the usual brighness constancy constraint equation (BCCE): \[I_2(i+u_{ij},j+v_{ij})-I_1(i,j)\approx I_x(i,j)\Delta u_{ij}+I_y(i,j)\Delta v_{ij}+I_t(i,j)\] $\nabla_u E_D$ is now linearized by holding the first part fixed and using the BCCE taylor-expansion instead of the right part. Additionally $I_{2,x}(i+u_{ij},j+v_{ij})$ may be approximated by $I_x(i,j)$: \[\nabla_u E_D\approx\frac{\Psi'(-I_t(i,j))\cdot(-I_x(i,j))}{I_t(i,j)} \cdot (I_x(i,j)*\Delta u_{ij} +I_y(i,j)\Delta v_{ij}+I_t(i,j))\] Usually, $\Psi$ is symmetric (even), so $\Psi'$ is antisymmetric (odd) wich may be used to simplify this further: \[\nabla_u E_D\approx\frac{\Psi'(I_t(i,j))}{I_t(i,j)} \cdot I_x(i,j)(I_x(i,j)*\Delta u_{ij}+I_y(i,j)\Delta v_{ij}+I_t(i,j))\] In the end, this is the usual BCCE stencil locally weighted by \[w_{ij}=\frac{\Psi'(I_t(i,j))}{I_t(i,j)}\]This weight is used, if the option useDiff2Lin is set to true. Otherwise, the term of $\nabla_u E_D$ is linearized direclty by tailer-expansion in $u,v$ wich leads to the local weights \[w_{ij}=\Psi''(I_t(i,j))\] In practice, this turns out to perform worse than the linearization presented above, but both variants are avaliable for testing.As one may see above, using $I_x,I_y$ of the first frame is an approximation, so optionally, setting useImg2 to true, $I_x,I_y$ of the second image are used for calculations.

input slots

InputSlot< CImgList< T > > it
  Image derivative inputs
InputSlot< CImgList< T > > ix
  Image derivative inputs
InputSlot< CImgList< T > > iy
  Image derivative inputs
InputSlot< CImgList< T > > flowGuess
  initial guess of real flow, no zeros, even in warped mode
InputSlot< Function * > psi
  brightness constancy energy function

output slots

parameters

Parameter< bool > calcDifferences
  Calculate flow increments.
Parameter< bool > useDiff2Lin
  use linearization of second derivative
Parameter< bool > useImg2
  Use derivatives $I_x,I_y$ of Img2 istead of Img1.

further information

This Module subclasses Stencil::Mask< T >.
For documentation of parameters and slots inherited by this base class, please have a look at the corresponding Module reference.

This module is templated. There are instances with T=int,float,double.
An additional parameter called templatetype may be used to select which instantiation you want.

The detailed doxygen documentation beyond the parameters/slots may be found here.


Get Charon at SourceForge.net. Fast, secure and Free Open Source software downloads