BIJ API

FlowJ
Class FlowJLucas

java.lang.Object
  |
  +--FlowJ.FlowJLucas

public class FlowJLucas
extends java.lang.Object

This is a class that implements the Lucas and Kanade optical flow algorithm. Implementation based on convolutions, with local field properties, gradient computation with different kernels including scalable Gaussian derivatives.

 References:
      Lucas and Kanade, Proc IJNA 1981
      Barron, Fleet, Beauchemin, 1994, IJCV 12, 1, 43-77
      Abramoff et al, 2002, IEEE TMI.
 
Copyright (c) 1999-2002, Michael Abramoff. All rights reserved.


Field Summary
protected static int CENTRALDIFF
           
 boolean debug
           
protected  float density
           
 boolean displayon
           
protected  VolumeFloat dt
           
protected  VolumeFloat dx
           
protected  VolumeFloat dy
           
protected  Kernel G
           
protected static int GAUSSIANDERIV
          Types of derivative computation.
protected  Kernel gradientKernel
           
protected  boolean includeNormals
           
protected  int REG_AVERAGE
           
protected  int REG_GAUSSIAN
           
protected  int REG_GAUSSIAN_1D
          Types of regularization (smoothness constraint) computation.
static java.lang.String[] sderiv
           
protected  Kernel1D sgradientKernel
           
protected  Kernel1D sKernel
           
protected static int SOBEL2D
           
protected static int SOBEL3D
           
static java.lang.String[] sregul
           
protected static int SUBTRACT
           
protected  int support
           
protected  float tau
           
protected  Kernel1D tgradientKernel
           
protected  Kernel1D tKernel
           
 
Constructor Summary
FlowJLucas()
           
 
Method Summary
 void computeFull(FlowJFlow flow, boolean includeNormals, float sigmaw, float tau, int regularizationMethod)
          Compute full flow field from the first order gradients in dx, dy, dt for a weighted local neighborhood omega (weighted by G defined by sigmaw) around every image location.
 void filterAll(ij.ImageStack is, int center, float sigmat, float sigmas, int gradientType)
          Do filtering.
static int firstFrame(ij.ImageStack is, float sigmat, int gradientType)
          Return the first frame for which you can compute the flow.
static int getSupport(float sigmat, int gradientType)
          Return the number of frames needed for specific sigmat and gradient type.
static int lastFrame(ij.ImageStack is, float sigmat, int gradientType)
          Return the last frame for which you can compute the flow.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

public final boolean debug

displayon

public final boolean displayon

GAUSSIANDERIV

protected static final int GAUSSIANDERIV
Types of derivative computation.

CENTRALDIFF

protected static final int CENTRALDIFF

SOBEL2D

protected static final int SOBEL2D

SOBEL3D

protected static final int SOBEL3D

SUBTRACT

protected static final int SUBTRACT

sderiv

public static java.lang.String[] sderiv

tau

protected float tau

sKernel

protected Kernel1D sKernel

tKernel

protected Kernel1D tKernel

gradientKernel

protected Kernel gradientKernel

sgradientKernel

protected Kernel1D sgradientKernel

tgradientKernel

protected Kernel1D tgradientKernel

G

protected Kernel G

density

protected float density

dx

protected VolumeFloat dx

dy

protected VolumeFloat dy

dt

protected VolumeFloat dt

REG_GAUSSIAN_1D

protected final int REG_GAUSSIAN_1D
Types of regularization (smoothness constraint) computation.

REG_GAUSSIAN

protected final int REG_GAUSSIAN

REG_AVERAGE

protected final int REG_AVERAGE

sregul

public static java.lang.String[] sregul

support

protected int support

includeNormals

protected boolean includeNormals
Constructor Detail

FlowJLucas

public FlowJLucas()
Method Detail

getSupport

public static int getSupport(float sigmat,
                             int gradientType)
Return the number of frames needed for specific sigmat and gradient type.
Parameters:
sigmat - temporal sigma of the kernel.
gradientType - the type of gradient, one of GAUSSIANDERIV, CENTRALDIFF, SOBEL2D, SOBEL3D, SUBTRACT
Returns:
number of frames needed.

firstFrame

public static int firstFrame(ij.ImageStack is,
                             float sigmat,
                             int gradientType)
Return the first frame for which you can compute the flow.
Parameters:
is - an ImageStack containing the images.
sigmat - temporal sigma of the kernel.
gradientType - the type of gradient, one of GAUSSIANDERIV, CENTRALDIFF, SOBEL2D, SOBEL3D, SUBTRACT

lastFrame

public static int lastFrame(ij.ImageStack is,
                            float sigmat,
                            int gradientType)
Return the last frame for which you can compute the flow.
Parameters:
is - an ImageStack containing the images.
sigmat - temporal sigma of the kernel.
gradientType - the type of gradient, one of GAUSSIANDERIV, CENTRALDIFF, SOBEL2D, SOBEL3D, SUBTRACT

filterAll

public void filterAll(ij.ImageStack is,
                      int center,
                      float sigmat,
                      float sigmas,
                      int gradientType)
               throws FlowJException
Do filtering.

computeFull

public void computeFull(FlowJFlow flow,
                        boolean includeNormals,
                        float sigmaw,
                        float tau,
                        int regularizationMethod)
Compute full flow field from the first order gradients in dx, dy, dt for a weighted local neighborhood omega (weighted by G defined by sigmaw) around every image location. Find the best fit for that location using a LSE using the pseudoinverse. A SVD decreased speed and did not influence errors. All elements with eigenvalues of the pseudoinverse matrix m smaller than threshold tau are rejected. Only if the second eigenvalue of the pseudoinverse is larger than tau, normal flow instead of full flow is computed for that location.
Parameters:
flow - will contain the x,y flows.
includeNormals - a flag whether to include normals or not.
sigmaw - SD of the probability function associated with the Gaussian defining the size of the neighborhood
tau - the eigenvalue threshold
regularizationMethod - is one of REG_GAUSSIAN, REG_GAUSSIAN_1D, 0 defines how the local neighborhood is filtered.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

BIJ API

Submit a bug or feature

Copyright (c) 1997-2003 Michael Abramoff
Licensing available. All Rights Reserved.