mpicbg.models
Class AffineModel2D

java.lang.Object
  extended by mpicbg.models.AbstractModel<M>
      extended by mpicbg.models.AbstractAffineModel2D<AffineModel2D>
          extended by mpicbg.models.AffineModel2D
All Implemented Interfaces:
Serializable, Affine2D<AffineModel2D>, Boundable, CoordinateTransform, InverseBoundable, InverseCoordinateTransform, InvertibleBoundable, InvertibleCoordinateTransform, Model<AffineModel2D>

public class AffineModel2D
extends AbstractAffineModel2D<AffineModel2D>

2d-affine transformation models to be applied to points in 2d-space. This model includes the closed form weighted least squares solution as described by \citet{SchaeferAl06} and implemented by Johannes Schindelin. BibTeX:

 @article{SchaeferAl06,
   author    = {Scott Schaefer and Travis McPhail and Joe Warren},
   title     = {Image deformation using moving least squares},
   journal   = {ACM Transactions on Graphics},
   volume    = {25},
   number    = {3},
   year      = {2006},
   pages     = {533--540},
   publisher = {ACM},
   address   = {New York, NY, USA},
   url       = {http://faculty.cs.tamu.edu/schaefer/research/mls.pdf},
 }
 

Author:
Stephan Saalfeld
See Also:
Serialized Form

Field Summary
protected  double i00
           
protected  double i01
           
protected  double i02
           
protected  double i10
           
protected  double i11
           
protected  double i12
           
protected  double m00
           
protected  double m01
           
protected  double m02
           
protected  double m10
           
protected  double m11
           
protected  double m12
           
protected static int MIN_NUM_MATCHES
           
 
Fields inherited from class mpicbg.models.AbstractModel
cost, rnd
 
Constructor Summary
AffineModel2D()
           
 
Method Summary
 double[] apply(double[] l)
          Apply the CoordinateTransform to a location.
 void applyInPlace(double[] l)
          Apply the CoordinateTransform to a location.
 double[] applyInverse(double[] l)
          Apply the inverse of the model to a point location
 void applyInverseInPlace(double[] l)
          apply the inverse of the model to a point location
 void concatenate(AffineModel2D model)
           
 void concatenate(TranslationModel2D model)
           
 AffineModel2D copy()
          Clone the model.
 AffineTransform createAffine()
          Create an AffineTransform representing the current parameters the model.
 AffineModel2D createInverse()
          TODO Not yet tested
 AffineTransform createInverseAffine()
          Create an AffineTransform representing the inverse of the current parameters of the model.
<P extends PointMatch>
void
fit(Collection<P> matches)
          Closed form weighted least squares solution as described by \citet{SchaeferAl06}.
 void fit(double[][] p, double[][] q, double[] w)
          Closed form weighted least squares solution as described by \citet{SchaeferAl06}.
 void fit(float[][] p, float[][] q, float[] w)
          Closed form weighted least squares solution as described by \citet{SchaeferAl06}.
 int getMinNumMatches()
           
protected  void invert()
           
 void preConcatenate(AffineModel2D model)
           
 void preConcatenate(TranslationModel2D model)
           
 void set(AffineModel2D m)
          Set the model to m
 void set(AffineTransform a)
          Initialize the model with the parameters of an AffineTransform.
 void set(double m00, double m10, double m01, double m11, double m02, double m12)
          Initialize the model such that the respective affine transform is: m00 m01 m02 m10 m11 m12 0 0 1
 void toArray(double[] data)
          Write the 6 parameters of the affine into a double array.
 void toMatrix(double[][] data)
          Write the 6 parameters of the affine into a 3x2 double array.
 
Methods inherited from class mpicbg.models.AbstractAffineModel2D
estimateBounds, estimateInverseBounds, toString
 
Methods inherited from class mpicbg.models.AbstractModel
betterThan, filter, filter, filter, filterRansac, filterRansac, filterRansac, filterRansac, getCost, icp, localSmoothnessFilter, ransac, ransac, setCost, test, test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_NUM_MATCHES

protected static final int MIN_NUM_MATCHES
See Also:
Constant Field Values

m00

protected double m00

m10

protected double m10

m01

protected double m01

m11

protected double m11

m02

protected double m02

m12

protected double m12

i00

protected double i00

i10

protected double i10

i01

protected double i01

i11

protected double i11

i02

protected double i02

i12

protected double i12
Constructor Detail

AffineModel2D

public AffineModel2D()
Method Detail

getMinNumMatches

public final int getMinNumMatches()

createAffine

public final AffineTransform createAffine()
Description copied from class: AbstractAffineModel2D
Create an AffineTransform representing the current parameters the model.

Specified by:
createAffine in interface Affine2D<AffineModel2D>
Specified by:
createAffine in class AbstractAffineModel2D<AffineModel2D>
Returns:
AffineTransform

createInverseAffine

public final AffineTransform createInverseAffine()
Description copied from class: AbstractAffineModel2D
Create an AffineTransform representing the inverse of the current parameters of the model.

Specified by:
createInverseAffine in interface Affine2D<AffineModel2D>
Specified by:
createInverseAffine in class AbstractAffineModel2D<AffineModel2D>
Returns:
AffineTransform

apply

public final double[] apply(double[] l)
Description copied from interface: CoordinateTransform
Apply the CoordinateTransform to a location.

Returns:
transformed location

applyInPlace

public final void applyInPlace(double[] l)
Description copied from interface: CoordinateTransform
Apply the CoordinateTransform to a location.


applyInverse

public final double[] applyInverse(double[] l)
                            throws NoninvertibleModelException
Description copied from interface: InverseCoordinateTransform
Apply the inverse of the model to a point location

Returns:
transformed point
Throws:
NoninvertibleModelException

applyInverseInPlace

public final void applyInverseInPlace(double[] l)
                               throws NoninvertibleModelException
Description copied from interface: InverseCoordinateTransform
apply the inverse of the model to a point location

Throws:
NoninvertibleModelException

fit

public final void fit(double[][] p,
                      double[][] q,
                      double[] w)
               throws NotEnoughDataPointsException,
                      IllDefinedDataPointsException
Closed form weighted least squares solution as described by \citet{SchaeferAl06}.

Specified by:
fit in interface Model<AffineModel2D>
Overrides:
fit in class AbstractModel<AffineModel2D>
Parameters:
p - source points
q - target points
w - weights
Throws:
NotEnoughDataPointsException
IllDefinedDataPointsException

fit

public final void fit(float[][] p,
                      float[][] q,
                      float[] w)
               throws NotEnoughDataPointsException,
                      IllDefinedDataPointsException
Closed form weighted least squares solution as described by \citet{SchaeferAl06}.

Specified by:
fit in interface Model<AffineModel2D>
Overrides:
fit in class AbstractModel<AffineModel2D>
Parameters:
p - source points
q - target points
w - weights
Throws:
NotEnoughDataPointsException
IllDefinedDataPointsException

fit

public final <P extends PointMatch> void fit(Collection<P> matches)
               throws NotEnoughDataPointsException,
                      IllDefinedDataPointsException
Closed form weighted least squares solution as described by \citet{SchaeferAl06}.

Parameters:
matches - set of point correpondences
Throws:
NotEnoughDataPointsException
IllDefinedDataPointsException

set

public final void set(AffineModel2D m)
Description copied from interface: Model
Set the model to m


copy

public AffineModel2D copy()
Description copied from interface: Model
Clone the model.


invert

protected final void invert()

preConcatenate

public final void preConcatenate(AffineModel2D model)
Specified by:
preConcatenate in interface Affine2D<AffineModel2D>
Specified by:
preConcatenate in class AbstractAffineModel2D<AffineModel2D>

concatenate

public final void concatenate(TranslationModel2D model)

preConcatenate

public final void preConcatenate(TranslationModel2D model)

concatenate

public final void concatenate(AffineModel2D model)
Specified by:
concatenate in interface Affine2D<AffineModel2D>
Specified by:
concatenate in class AbstractAffineModel2D<AffineModel2D>

set

public final void set(double m00,
                      double m10,
                      double m01,
                      double m11,
                      double m02,
                      double m12)
Initialize the model such that the respective affine transform is: m00 m01 m02 m10 m11 m12 0 0 1

Parameters:
m00 -
m10 -
m01 -
m11 -
m02 -
m12 -

set

public final void set(AffineTransform a)
Initialize the model with the parameters of an AffineTransform.

Parameters:
a -

createInverse

public AffineModel2D createInverse()
TODO Not yet tested

Specified by:
createInverse in interface Affine2D<AffineModel2D>
Specified by:
createInverse in interface InvertibleCoordinateTransform
Specified by:
createInverse in class AbstractAffineModel2D<AffineModel2D>

toArray

public void toArray(double[] data)
Description copied from interface: Affine2D
Write the 6 parameters of the affine into a double array. The order is m00, m10, m01, m11, m02, m12


toMatrix

public void toMatrix(double[][] data)
Description copied from interface: Affine2D
Write the 6 parameters of the affine into a 3x2 double array. The order is [0][0] -> m00; [0][1] -> m01; [0][2] -> m02; [1][0] -> m10; [1][1] -> m11; [1][2] -> m12;



Copyright © 2007-2016 Fiji. All Rights Reserved.