Package gov.nih.mipav.model.algorithms
Class HornSchunk
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.HornSchunk
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class HornSchunk extends AlgorithmBase
-
-
Field Summary
Fields Modifier and Type Field Description private int
algorithmType
private double
alpha
(package private) int
BOUNDARY_CONDITION
private ModelImage
destuImage
private ModelImage
destvImage
private double
INPUT_PRESMOOTHING_SIGMA
private int
maxiter
(package private) int
MULTI_SCALE
(package private) int
Neumann
private int
niter
private int
nscales
(package private) double
PAR_DEFAULT_ALPHA
(package private) int
PAR_DEFAULT_MAXITER
(package private) int
PAR_DEFAULT_NSCALES
(package private) int
PAR_DEFAULT_NWARPS
(package private) double
PAR_DEFAULT_TOL
(package private) boolean
PAR_DEFAULT_VERBOSE
(package private) double
PAR_DEFAULT_ZFACTOR
(package private) double
PAR_MAX_ZFACTOR
(package private) int
Periodic
(package private) int
SINGLE_SCALE
private double
SOR_EXTRAPOLATION_PARAMETER
private ModelImage
srcImage1
private ModelImage
srcImage2
(package private) int
Symmetric
private double
TOL
(package private) TVL1FLOW
tvl1
private boolean
verbose
private int
warps
private double
zfactor
-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description HornSchunk(ModelImage destuImg, ModelImage destvImg, ModelImage srcImg1, ModelImage srcImg2, double alpha, int nscales, double zfactor, int warps, double TOL, int maxiter, boolean verbose)
HornSchunk(ModelImage destuImg, ModelImage destvImg, ModelImage srcImg1, ModelImage srcImg2, int niter, double alpha)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
compute_bar(double[] ubar, double[] u, int w, int h)
void
compute_input_derivatives(double[] Ex, double[] Ey, double[] Et, double[] a, double[] b, int w, int h)
(package private) void
gradient(double[] input, double[] dx, double[] dy, int nx, int ny)
Compute the gradient of an image using centered differences(package private) void
horn_schunck_optical_flow(double[] I1, double[] I2, double[] u, double[] v, int nx, int ny, double alpha, int warps, double TOL, int maxiter, boolean verbose)
Horn & Schunck method for optical flow estimation at a single scale(package private) void
horn_schunck_pyramidal(double[] I1, double[] I2, double[] u, double[] v, int nx, int ny, double alpha, int nscales, double zfactor, int warps, double TOL, int maxiter, boolean verbose)
Procedure to handle the pyramidal approach.void
hs(double[] u, double[] v, double[] a, double[] b, int w, int h, int n, double alpha)
void
hs_iteration(double[] u, double[] v, double[] Ex, double[] Ey, double[] Et, int w, int h, double alpha)
private double
hypot(double x, double y)
double
p(double[] x, int w, int h, int i, int j)
void
runAlgorithm()
Actually runs the algorithm.double
sor_iteration(double[] Au, double[] Av, double[] Du, double[] Dv, double[] D, double[] u, double[] v, double al, int p, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8)
Function to compute the SOR iteration at a given position (SOR = Successive Over-Relaxation)-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, finalize, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
Neumann
final int Neumann
- See Also:
- Constant Field Values
-
Periodic
final int Periodic
- See Also:
- Constant Field Values
-
Symmetric
final int Symmetric
- See Also:
- Constant Field Values
-
BOUNDARY_CONDITION
int BOUNDARY_CONDITION
-
tvl1
TVL1FLOW tvl1
-
SINGLE_SCALE
final int SINGLE_SCALE
- See Also:
- Constant Field Values
-
MULTI_SCALE
final int MULTI_SCALE
- See Also:
- Constant Field Values
-
algorithmType
private int algorithmType
-
srcImage1
private ModelImage srcImage1
-
srcImage2
private ModelImage srcImage2
-
destuImage
private ModelImage destuImage
-
destvImage
private ModelImage destvImage
-
niter
private int niter
-
alpha
private double alpha
-
nscales
private int nscales
-
zfactor
private double zfactor
-
warps
private int warps
-
TOL
private double TOL
-
verbose
private boolean verbose
-
maxiter
private int maxiter
-
PAR_DEFAULT_ALPHA
final double PAR_DEFAULT_ALPHA
- See Also:
- Constant Field Values
-
PAR_DEFAULT_NSCALES
final int PAR_DEFAULT_NSCALES
- See Also:
- Constant Field Values
-
PAR_DEFAULT_ZFACTOR
final double PAR_DEFAULT_ZFACTOR
- See Also:
- Constant Field Values
-
PAR_DEFAULT_NWARPS
final int PAR_DEFAULT_NWARPS
- See Also:
- Constant Field Values
-
PAR_DEFAULT_TOL
final double PAR_DEFAULT_TOL
- See Also:
- Constant Field Values
-
PAR_DEFAULT_MAXITER
final int PAR_DEFAULT_MAXITER
- See Also:
- Constant Field Values
-
PAR_DEFAULT_VERBOSE
final boolean PAR_DEFAULT_VERBOSE
- See Also:
- Constant Field Values
-
PAR_MAX_ZFACTOR
final double PAR_MAX_ZFACTOR
- See Also:
- Constant Field Values
-
SOR_EXTRAPOLATION_PARAMETER
private final double SOR_EXTRAPOLATION_PARAMETER
- See Also:
- Constant Field Values
-
INPUT_PRESMOOTHING_SIGMA
private final double INPUT_PRESMOOTHING_SIGMA
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HornSchunk
public HornSchunk(ModelImage destuImg, ModelImage destvImg, ModelImage srcImg1, ModelImage srcImg2, int niter, double alpha)
-
HornSchunk
public HornSchunk(ModelImage destuImg, ModelImage destvImg, ModelImage srcImg1, ModelImage srcImg2, double alpha, int nscales, double zfactor, int warps, double TOL, int maxiter, boolean verbose)
-
-
Method Detail
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBase
Actually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithm
in classAlgorithmBase
-
hypot
private double hypot(double x, double y)
-
horn_schunck_pyramidal
void horn_schunck_pyramidal(double[] I1, double[] I2, double[] u, double[] v, int nx, int ny, double alpha, int nscales, double zfactor, int warps, double TOL, int maxiter, boolean verbose)
Procedure to handle the pyramidal approach. This procedure relies on the previous functions to calculate large optical flow fields using a pyramidal scheme.
-
horn_schunck_optical_flow
void horn_schunck_optical_flow(double[] I1, double[] I2, double[] u, double[] v, int nx, int ny, double alpha, int warps, double TOL, int maxiter, boolean verbose)
Horn & Schunck method for optical flow estimation at a single scale
-
gradient
void gradient(double[] input, double[] dx, double[] dy, int nx, int ny)
Compute the gradient of an image using centered differences
-
sor_iteration
public double sor_iteration(double[] Au, double[] Av, double[] Du, double[] Dv, double[] D, double[] u, double[] v, double al, int p, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8)
Function to compute the SOR iteration at a given position (SOR = Successive Over-Relaxation)
-
p
public double p(double[] x, int w, int h, int i, int j)
-
compute_input_derivatives
public void compute_input_derivatives(double[] Ex, double[] Ey, double[] Et, double[] a, double[] b, int w, int h)
-
compute_bar
public void compute_bar(double[] ubar, double[] u, int w, int h)
-
hs_iteration
public void hs_iteration(double[] u, double[] v, double[] Ex, double[] Ey, double[] Et, int w, int h, double alpha)
-
hs
public void hs(double[] u, double[] v, double[] a, double[] b, int w, int h, int n, double alpha)
-
-