de.unihalle.informatik.MiToBo.fields
Class VectorField2DPotentialFinder

java.lang.Object
  extended by de.unihalle.informatik.MiToBo.fields.VectorField2DPotentialFinder

public class VectorField2DPotentialFinder
extends java.lang.Object

Routines for reconstructing potential from vector field.

Author:
moeller
See Also:
MTBVectorField2D

Nested Class Summary
protected  class VectorField2DPotentialFinder.PotentialFinderOptFunction
          Optimization function for gradient-based potential reconstruction.
 
Field Summary
protected  MTBVectorField2D field
          Vector field the potential is reconstructed for.
 
Constructor Summary
VectorField2DPotentialFinder()
          Standard constructor.
VectorField2DPotentialFinder(MTBVectorField2D f)
          Default constructor.
 
Method Summary
 double[] calcPotential_exactLeastSquares(boolean ignoreBorder)
          Exact least squares reconstruction of the potential.
 double[] calcPotential_gradientDescent(boolean ignoreBorder)
          Reconstruct potential via gradient descent.
 double[] calcPotential_incrementalLeastSquares(boolean ignoreBorder)
          Reconstructs the potential of the vector field incrementally.
private  void normalizePotentialToMin(double[] pot, boolean ignoreBorder)
          Function to normalize a potential to the minimum value of 0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

field

protected MTBVectorField2D field
Vector field the potential is reconstructed for.

Constructor Detail

VectorField2DPotentialFinder

public VectorField2DPotentialFinder()
Standard constructor.


VectorField2DPotentialFinder

public VectorField2DPotentialFinder(MTBVectorField2D f)
Default constructor.

Parameters:
f - Vector field.
Method Detail

calcPotential_exactLeastSquares

public double[] calcPotential_exactLeastSquares(boolean ignoreBorder)
Exact least squares reconstruction of the potential.

Attention!!! This function takes a lot of memory! Never use it with fields larger than approx. 30 x 30 pixels!!!

The function reconstructs the potential by solving a linear system of equations via explicit LQ-decomposition. The linear system contains a lot of rows and columns:

As a consequence the function should only be applied to quite small images not exceeding 30 pixels in width or height.

Parameters:
ignoreBorder - If true, first/last column/row of U and V will be ignored.
Returns:
Calculated potential field.

calcPotential_gradientDescent

public double[] calcPotential_gradientDescent(boolean ignoreBorder)
Reconstruct potential via gradient descent.

Parameters:
ignoreBorder - If true, border pixels are ignored in reconstruction.
Returns:
Calculated potential field.

calcPotential_incrementalLeastSquares

public double[] calcPotential_incrementalLeastSquares(boolean ignoreBorder)
Reconstructs the potential of the vector field incrementally.

Starting with last entry field bottom right in the vector field the potential is reconstructed incrementally by least square solutions of the two given constraint equations for each image pixel. The solution is only approximative as no global optimization criterion is considered. Nevertheless, it might be used as initialization for the gradient descent routines, if it is not of direct interest.

Parameters:
ignoreBorder - If true, first/last row/column of U and V are ignored.

normalizePotentialToMin

private void normalizePotentialToMin(double[] pot,
                                     boolean ignoreBorder)
Function to normalize a potential to the minimum value of 0.

Parameters:
pot - Potential field to normalize.
ignoreBorder - If true outer rows and cols are ignored.