motris.algorithm
Class EdgeElementAdaption

java.lang.Object
  extended bymotris.data.Description
      extended byparameter.ParameterizedObjectAdaptor
          extended bymotris.algorithm.Algorithm
              extended bymotris.algorithm.EdgeElementAdaption
All Implemented Interfaces:
MinimizationProblem, ParameterizedObject
Direct Known Subclasses:
EdgeElementAdaptionNative

public class EdgeElementAdaption
extends Algorithm
implements MinimizationProblem

Maps Edge Elements to Projected Model Segments. Known as the "Edge Element Adaption Algorithm". Notation as in lecture notes "Kognitive Sichtsysteme"

Author:
ottlik, preuter, dahlkamp

Nested Class Summary
 class EdgeElementAdaption.Assignment
           
 class EdgeElementAdaption.ModelSegmentCache
          this class does some pre-computation on the model Segments to allow faster access for OneEdgeElementCalculations
 class EdgeElementAdaption.OneEdgeElementCalculations
          Convenience class for calculations between one edge element and a model edge
 
Nested classes inherited from class parameter.ParameterizedObject
ParameterizedObject.ParameterChangedListener, ParameterizedObject.ParameterizedObjectManager
 
Field Summary
private  double acceptanceAreaAngle
           
private  boolean assignByDistance
           
private  java.util.Vector assignment
           
private  int assignmentLength
           
private  int[] assignmentRejectionReasons
           
private  double chiSquareConfidenceThreshold
           
private  double confidenceLevel
           
private  int DEBUGMODE
           
private  EdgeElement edgeElementAlgorithm
           
private  EdgeElementAdaption.OneEdgeElementCalculations edgeElementCalculations
           
private  DerivativeImage edgeElements
           
private  int framenum
           
 double[][] hessian
           
private  double maxAngleDifference
           
private  double minModelEdgeLength
           
private  EdgeElementAdaption.ModelSegmentCache modelSegmentCache
           
private  Actor myActor
           
private  double residual
           
private  double sigmaPhi2
           
private  double sigmaU2
           
private  double sigmaV2
           
 double[] stateGradient
           
private  double tanAcceptanceAreaAngle
           
 
Fields inherited from class motris.algorithm.Algorithm
dataManager, experiment
 
Fields inherited from class parameter.ParameterizedObjectAdaptor
parameterChangedNotifyList
 
Fields inherited from class motris.data.Description
 
Constructor Summary
EdgeElementAdaption(Experiment ex)
           
 
Method Summary
 void assignEdgeElement(int x, int y, java.util.Vector assignment, int assignmentPos, double[] _dd_dstate, double _distance, double _measuringCovariance, double _cosDelta, double _mahalanobis, double _perpendicularAssignmentVecU, double _perpendicularAssignmentVecV, double _inKEDirAssignmentVecU, double _inKEDirAssignmentVecV)
           
(package private)  int assignEdgeElementsToModelEdges(DerivativeImage edgeElements, DoubleMatrix predictedCovariance, java.util.Vector assignment)
           
 EdgeElementAdaption calculateAssignments(int _framenum)
           
private  void calculateGradient(DerivativeImage edgeElements, java.util.Vector assignment, int assignmentLength)
           
 double calculateResidual(DoubleMatrix predictedCovariance)
           
 double calculateResidual(DoubleMatrix apCovariance, DoubleVector Gradient, DoubleMatrix[] Hessian)
          Compute Residual, Gradient and Hessian Matrix of the Problem to be minimzed at the current position.
 void debugOutput()
           
 void deregisterLayers()
          Remove all non-used Display layers
 EdgeElementAdaption.Assignment[][] getAssignment()
           
private  java.awt.Rectangle getBoundingBox(EdgeElementAdaption.ModelSegmentCache modelSegmentCache)
           
 EdgeElementAdaption.OneEdgeElementCalculations getEdgeElementCalculations()
           
 DerivativeImage getEdgeElements()
           
 ImageGeometry getImageGeometry()
           
 ParameterSet getParameters()
          Get a Vector of Strings with a description of each Parameter
 JSci.maths.DoubleSquareMatrix getPredictionMeasureCovariance(int matrixDimension)
           
 double getSecondaryResidual()
          compare these secondary residualsafter each scale and only accept the changes of that scale if the secondary residual decreased
 State getState()
           
 boolean isDisplacementBigEnough(DoubleVector stateVectorDelta)
           
 boolean setParameters(ParameterSet _params)
          Set Parameters of this class
 boolean setScale(int scale)
          Set Scale.
 
Methods inherited from class parameter.ParameterizedObjectAdaptor
addParameterChangedListener, finalize, fireParameterChanged, parameterEdited, removeParameterChangedListener
 
Methods inherited from class motris.data.Description
getDescription, getIdentifier, getName, setDescription, setIdentifier, setName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUGMODE

private int DEBUGMODE

edgeElementAlgorithm

private EdgeElement edgeElementAlgorithm

edgeElements

private DerivativeImage edgeElements

edgeElementCalculations

private EdgeElementAdaption.OneEdgeElementCalculations edgeElementCalculations

modelSegmentCache

private EdgeElementAdaption.ModelSegmentCache modelSegmentCache

assignment

private java.util.Vector assignment

assignmentLength

private int assignmentLength

sigmaU2

private double sigmaU2

sigmaV2

private double sigmaV2

sigmaPhi2

private double sigmaPhi2

minModelEdgeLength

private double minModelEdgeLength

maxAngleDifference

private double maxAngleDifference

acceptanceAreaAngle

private double acceptanceAreaAngle

tanAcceptanceAreaAngle

private double tanAcceptanceAreaAngle

confidenceLevel

private double confidenceLevel

chiSquareConfidenceThreshold

private double chiSquareConfidenceThreshold

assignByDistance

private boolean assignByDistance

framenum

private int framenum

myActor

private Actor myActor

residual

private double residual

stateGradient

public double[] stateGradient

hessian

public double[][] hessian

assignmentRejectionReasons

private int[] assignmentRejectionReasons
Constructor Detail

EdgeElementAdaption

public EdgeElementAdaption(Experiment ex)
Method Detail

calculateResidual

public double calculateResidual(DoubleMatrix apCovariance,
                                DoubleVector Gradient,
                                DoubleMatrix[] Hessian)
Description copied from interface: MinimizationProblem
Compute Residual, Gradient and Hessian Matrix of the Problem to be minimzed at the current position. In addition to the function arguments, the State x at which Lambda is to be evaluated (current position) has to be supplied as well. This is not included in the class signature because this supply is done by getState().setFromStateVector().

Specified by:
calculateResidual in interface MinimizationProblem
Parameters:
apCovariance - a-priori-State-Covariance P (input)
Gradient - Gradient of Lambda (result)
Hessian - 1-Dimension Vector with Hesse Matrix of Lambda (result). This needs to be an array s.t. java can _create_ a new Variable instead of just assigning values. For the EM Contour algorithm, the matrix can grow quite big so assigning is too slow.
Returns:
residual Lambda(x).

debugOutput

public void debugOutput()

getState

public State getState()
Specified by:
getState in interface MinimizationProblem

getBoundingBox

private java.awt.Rectangle getBoundingBox(EdgeElementAdaption.ModelSegmentCache modelSegmentCache)

calculateResidual

public double calculateResidual(DoubleMatrix predictedCovariance)

calculateGradient

private void calculateGradient(DerivativeImage edgeElements,
                               java.util.Vector assignment,
                               int assignmentLength)

assignEdgeElementsToModelEdges

int assignEdgeElementsToModelEdges(DerivativeImage edgeElements,
                                   DoubleMatrix predictedCovariance,
                                   java.util.Vector assignment)
Parameters:
edgeElements -
Returns:

assignEdgeElement

public final void assignEdgeElement(int x,
                                    int y,
                                    java.util.Vector assignment,
                                    int assignmentPos,
                                    double[] _dd_dstate,
                                    double _distance,
                                    double _measuringCovariance,
                                    double _cosDelta,
                                    double _mahalanobis,
                                    double _perpendicularAssignmentVecU,
                                    double _perpendicularAssignmentVecV,
                                    double _inKEDirAssignmentVecU,
                                    double _inKEDirAssignmentVecV)

calculateAssignments

public EdgeElementAdaption calculateAssignments(int _framenum)

getParameters

public ParameterSet getParameters()
Description copied from interface: ParameterizedObject
Get a Vector of Strings with a description of each Parameter

Specified by:
getParameters in interface ParameterizedObject
Overrides:
getParameters in class ParameterizedObjectAdaptor

setParameters

public boolean setParameters(ParameterSet _params)
Description copied from interface: ParameterizedObject
Set Parameters of this class

Specified by:
setParameters in interface ParameterizedObject
Overrides:
setParameters in class ParameterizedObjectAdaptor

getAssignment

public EdgeElementAdaption.Assignment[][] getAssignment()

getEdgeElements

public DerivativeImage getEdgeElements()

getEdgeElementCalculations

public EdgeElementAdaption.OneEdgeElementCalculations getEdgeElementCalculations()

setScale

public boolean setScale(int scale)
Description copied from interface: MinimizationProblem
Set Scale. The scale is starting at 0 and increased as long as this function returns true.

Specified by:
setScale in interface MinimizationProblem
Parameters:
scale -

getSecondaryResidual

public double getSecondaryResidual()
Description copied from interface: MinimizationProblem
compare these secondary residualsafter each scale and only accept the changes of that scale if the secondary residual decreased

Specified by:
getSecondaryResidual in interface MinimizationProblem

isDisplacementBigEnough

public boolean isDisplacementBigEnough(DoubleVector stateVectorDelta)
Specified by:
isDisplacementBigEnough in interface MinimizationProblem

getImageGeometry

public ImageGeometry getImageGeometry()

getPredictionMeasureCovariance

public JSci.maths.DoubleSquareMatrix getPredictionMeasureCovariance(int matrixDimension)
Specified by:
getPredictionMeasureCovariance in interface MinimizationProblem

deregisterLayers

public void deregisterLayers()
Description copied from class: Algorithm
Remove all non-used Display layers

Overrides:
deregisterLayers in class Algorithm