mpicbg.models
Class RigidModel2D

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

public class RigidModel2D
extends AbstractAffineModel2D<RigidModel2D>

2d-rigid 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 cos
           
protected  double itx
           
protected  double ity
           
protected static int MIN_NUM_MATCHES
           
protected  double sin
           
protected  double tx
           
protected  double ty
           
 
Fields inherited from class mpicbg.models.AbstractModel
cost, rnd
 
Constructor Summary
RigidModel2D()
           
 
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(RigidModel2D model)
           
 RigidModel2D copy()
          Clone the model.
 AffineTransform createAffine()
          Create an AffineTransform representing the current parameters the model.
 RigidModel2D 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} and implemented by Johannes Schindelin.
 void fit(double[][] p, double[][] q, double[] w)
          Closed form weighted least squares solution as described by \citet{SchaeferAl06} and implemented by Johannes Schindelin.
 void fit(float[][] p, float[][] q, float[] w)
          Closed form weighted least squares solution as described by \citet{SchaeferAl06} and implemented by Johannes Schindelin.
 int getMinNumMatches()
           
 void preConcatenate(RigidModel2D model)
           
 void set(double theta, double tx, double ty)
          Initialize the model such that the respective affine transform is: cos(θ) -sin(θ) tx sin(θ) cos(θ) ty 0 0 1
 void set(double cos, double sin, double tx, double ty)
          Initialize the model such that the respective affine transform is: cos -sin tx sin cos ty 0 0 1
 void set(RigidModel2D m)
          Set the model to m
 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

cos

protected double cos

sin

protected double sin

tx

protected double tx

ty

protected double ty

itx

protected double itx

ity

protected double ity
Constructor Detail

RigidModel2D

public RigidModel2D()
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<RigidModel2D>
Specified by:
createAffine in class AbstractAffineModel2D<RigidModel2D>
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<RigidModel2D>
Specified by:
createInverseAffine in class AbstractAffineModel2D<RigidModel2D>
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)
Description copied from interface: InverseCoordinateTransform
Apply the inverse of the model to a point location

Returns:
transformed point

applyInverseInPlace

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


fit

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

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

fit

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

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

fit

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

Parameters:
matches - set of point correpondences
Throws:
NotEnoughDataPointsException

copy

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


set

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


preConcatenate

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

concatenate

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

set

public final void set(double theta,
                      double tx,
                      double ty)
Initialize the model such that the respective affine transform is: cos(θ) -sin(θ) tx sin(θ) cos(θ) ty 0 0 1

Parameters:
theta - θ
tx -
ty -

set

public final void set(double cos,
                      double sin,
                      double tx,
                      double ty)
Initialize the model such that the respective affine transform is: cos -sin tx sin cos ty 0 0 1

Parameters:
cos -
sin -
tx -
ty -

createInverse

public RigidModel2D createInverse()
TODO Not yet tested

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

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.