Public Member Functions | Protected Member Functions | Protected Attributes

MotionTensor< VOXEL > Class Template Reference
[Tensor Operators]

This class serves for computation of the so-called Motion Tensor (see the the bibliographic references). More...

#include <ofMotionTensor.h>

Inheritance diagram for MotionTensor< VOXEL >:
StructureTensor< VOXEL >

List of all members.

Public Member Functions

 MotionTensor (i3d::Image3d< VOXEL > *Inp, i3d::Image3d< VOXEL > *Inp1, i3d::Vector3d< float >Sp=i3d::Vector3d< float >(1.0f, 1.0f, 1.0f))
 MotionTensor (const MotionTensor< VOXEL > &st)
virtual ~MotionTensor ()
virtual void FreeMemory ()
virtual void ComputeTensor ()
virtual void SetDerivationInput (size_t a)
virtual size_t GetDerivationInput ()
MotionTensoroperator= (const MotionTensor &st)
void SetGamma (VOXEL g)
VOXEL GetGamma ()

Protected Member Functions

void MultiplyTensorEntries ()
void MultiplyByScalar (VOXEL a)
void AddTensor (MotionTensor< VOXEL > *Second)

Protected Attributes

i3d::Image3d< VOXEL > * InputT1
size_t DerivationInput
VOXEL Gamma

Detailed Description

template<class VOXEL>
class MotionTensor< VOXEL >

This class serves for computation of the so-called Motion Tensor (see the the bibliographic references).

It is an ancestor of the class StructureTensor<VOXEL>. The core functionality is inherited.

Let $ f $ is the input gray-scale image sequence. Let $ \nabla f = (\frac{\partial f}{\partial x},\frac{\partial f}{\partial y},\frac{\partial f}{\partial t} )$ denotes the image gradient (2D image sequence). Let $ J_0 := \nabla f \otimes \nabla f^T $, where $ \otimes $ denotes the standard tensor product. Then the Motion Tensor has following form: For every pixel $ p $ are computed the spatial and temporal derivatives and their products are convolved with Gaussian blur with standard deviation $ \rho $ and saved in following matrix:

\[ J_{\rho} = G_{\rho} \ast J_0 = G_{\rho} \ast \left( \begin{array}{ccc} (f_x)^2 & f_{x}f_y & f_{x}f_t \\ f_x f_y & (f_y)^2 & f_y f_t \\ f_x f_t & f_y f_t & (f_t)^2 \\ \end{array} \right) \]

for 2D image sequence and

\[ J_{\rho} = G_{\rho} \ast J_0 = G_{\rho} \ast \left( \begin{array}{cccc} (f_x)^2 & f_{x}f_y & f_{x}f_z & f_{x}f_t \\ f_x f_y & (f_y)^2 & f_y f_z & f_{y}f_t \\ f_{x}f_z & f_y f_z & (f_z)^2 & f_{z}f_t \\ f_{x}f_t & f_{y}f_t & f_{z}f_t & (f_t)^2 \\ \end{array} \right) \]

for 3D images. The motion tensor is computed from two input consecutive images. The spatial derivatives are computed with the stencil $ (1,-8,0,8,-1)/12h$, where $h$ is the spacing. The temporal derivatives are computed with simple two point forward euler operator (See function TemporalDerivation()). The matrix entries are saved in the i3d::Image3d. So the MotionTensor class saves the matrix of Images.

The implementation of this function is based on following articles and book chapters:
Joachim Weickert. Coherence-Enhancing Diffusion Filtering, International Journal of Computer Vision 31(2/3), 111-127 (1999).
Bernd Jahne. DIgital Image Processing Concepts, Algorithms and Scientific Applications. Springer. 4th edition
A. Bruhn, J. Weickert, T. Kohlberger, and C. Schnörr A Multigrid Platform for Real-Time Motion Computation with Discontinuity-Preserving Variational Methods, Technical Report No. 136, Department of Mathematics, Saarland University, Saarbrücken, Germany, Mai 2005

The typical usage:

#include <OFFMGSolver.h>
#include <image3d.h>
......
i3d::Image3d<float> FImg, FImg1;
MotionTensor<float> MT(&FImg, &FImg1,Vector3d<float>(1.0,1.0,1.0));
MT.SetSigma(3.0);
MT.ComputeTensor();
MT.BlurTensor();
ST.GetTensorItem(1,2)->SaveImage("st_yt_deriv.mhd"); // save the fy * ft matrix entry to file
......
Author:
Jan Hubený (xhubeny@fi.muni.cz)
Date:
2006

Constructor & Destructor Documentation

template<class VOXEL >
MotionTensor< VOXEL >::MotionTensor ( i3d::Image3d< VOXEL > *  Inp,
i3d::Image3d< VOXEL > *  Inp1,
i3d::Vector3d< float >  Sp = i3d::Vector3d <float>(1.0f, 1.0f, 1.0f) 
)

Constructor. First and second parameter are pointers to 2 images from the motion sequence. Third parameter is spatial spacing.

template<class VOXEL >
MotionTensor< VOXEL >::MotionTensor ( const MotionTensor< VOXEL > &  st  ) 

Copy constructor.

template<class VOXEL >
MotionTensor< VOXEL >::~MotionTensor (  )  [virtual]

Destructor.


Member Function Documentation

template<class VOXEL >
void MotionTensor< VOXEL >::FreeMemory (  )  [virtual]

Free memory which will not be used by some specific routines which computes optical flow.

Reimplemented from StructureTensor< VOXEL >.

template<class VOXEL >
void MotionTensor< VOXEL >::ComputeTensor (  )  [virtual]

This method computes the tensor $J_0$.

Reimplemented from StructureTensor< VOXEL >.

template<class VOXEL >
void MotionTensor< VOXEL >::SetDerivationInput ( size_t  a  )  [virtual]

Set whether to compute spatial derivatives from first(a = 0), second(a = 1), or average(a = 2) of both frames.

template<class VOXEL >
size_t MotionTensor< VOXEL >::GetDerivationInput (  )  [virtual]

Get whether to compute spatial derivatives from first(return 0), second(return 1), or average(return 2) of both frames.

template<class VOXEL >
MotionTensor< VOXEL > & MotionTensor< VOXEL >::operator= ( const MotionTensor< VOXEL > &  st  ) 

Asignment operator.

template<class VOXEL >
void MotionTensor< VOXEL >::SetGamma ( VOXEL  g  ) 
template<class VOXEL >
VOXEL MotionTensor< VOXEL >::GetGamma (  ) 
template<class VOXEL >
void MotionTensor< VOXEL >::MultiplyTensorEntries (  )  [protected]
template<class VOXEL >
void MotionTensor< VOXEL >::MultiplyByScalar ( VOXEL  a  )  [protected]
template<class VOXEL >
void MotionTensor< VOXEL >::AddTensor ( MotionTensor< VOXEL > *  Second  )  [protected]

Member Data Documentation

template<class VOXEL >
i3d::Image3d<VOXEL>* MotionTensor< VOXEL >::InputT1 [protected]
template<class VOXEL >
size_t MotionTensor< VOXEL >::DerivationInput [protected]
template<class VOXEL >
VOXEL MotionTensor< VOXEL >::Gamma [protected]

The documentation for this class was generated from the following files: