mpi.cbg.fly
Class Model

java.lang.Object
  extended by mpi.cbg.fly.Model
Direct Known Subclasses:
TModel2D, TRModel2D

public abstract class Model
extends java.lang.Object

Abstract class for arbitrary geometric transformation models to be applied to points in n-dimensional space. Provides methods for generic optimization and model extraction algorithms. Currently, RANSAC and Monte-Carlo minimization implemented. Needs revision... TODO A model is planned to be a generic transformation pipeline to be applied to images, volumes or arbitrary sets of n-dimensional points. E.g. lens transformation of camera images, pose and location of mosaic tiles, non-rigid bending of confocal stacks etc. License: GPL This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. NOTE: The SIFT-method is protected by U.S. Patent 6,711,293: "Method and apparatus for identifying scale invariant features in an image and use of same for locating an object in an image" by the University of British Columbia. That is, for commercial applications the permission of the author is required.

Version:
0.1b
Author:
Stephan Saalfeld

Field Summary
 double error
          error depends on what kind of algorithm is running small error is better than large error
static int MIN_SET_SIZE
           
 
Constructor Summary
Model()
          instantiates an empty model with maximally large error
 
Method Summary
abstract  float[] apply(float[] point)
          apply the model to a point location
abstract  void applyInPlace(float[] point)
          apply the model to a point location
abstract  float[] applyInverse(float[] point)
          apply the inverse of the model to a point location
abstract  void applyInverseInPlace(float[] point)
          apply the inverse of the model to a point location
 boolean betterThan(Model m)
          less than operater to make the models comparable, returns false for error < 0
abstract  Model clone()
          clone
abstract  boolean fit(PointMatch[] min_matches)
          fit the model to a minimal set of point correpondences estimates a model to transform match.p2.local to match.p1.world
abstract  java.awt.geom.AffineTransform getAffine()
           
abstract  void minimize(java.util.Collection<PointMatch> matches)
           
abstract  void shake(java.util.Collection<PointMatch> matches, float scale, float[] center)
          randomly change the model a bit estimates the necessary amount of shaking for each single dimensional distance in the set of matches
 boolean test(java.util.Collection<PointMatch> candidates, java.util.Collection<PointMatch> inliers, double epsilon, double min_inlier_ratio)
          test the model for a set of point correspondence candidates clears inliers and fills it with the fitting subset of candidates
abstract  java.lang.String toString()
          string to output stream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_SET_SIZE

public static final int MIN_SET_SIZE
See Also:
Constant Field Values

error

public double error
error depends on what kind of algorithm is running small error is better than large error

Constructor Detail

Model

public Model()
instantiates an empty model with maximally large error

Method Detail

fit

public abstract boolean fit(PointMatch[] min_matches)
fit the model to a minimal set of point correpondences estimates a model to transform match.p2.local to match.p1.world

Parameters:
min_matches - minimal set of point correpondences
Returns:
true if a model was estimated

apply

public abstract float[] apply(float[] point)
apply the model to a point location

Parameters:
point -
Returns:
transformed point

applyInPlace

public abstract void applyInPlace(float[] point)
apply the model to a point location

Parameters:
point -

applyInverse

public abstract float[] applyInverse(float[] point)
apply the inverse of the model to a point location

Parameters:
point -
Returns:
transformed point

applyInverseInPlace

public abstract void applyInverseInPlace(float[] point)
apply the inverse of the model to a point location

Parameters:
point -

test

public boolean test(java.util.Collection<PointMatch> candidates,
                    java.util.Collection<PointMatch> inliers,
                    double epsilon,
                    double min_inlier_ratio)
test the model for a set of point correspondence candidates clears inliers and fills it with the fitting subset of candidates

Parameters:
candidates - set of point correspondence candidates
inliers - set of point correspondences that fit the model
epsilon - maximal allowed transfer error
min_inliers - minimal ratio of inliers (0.0 => 0%, 1.0 => 100%)

betterThan

public boolean betterThan(Model m)
less than operater to make the models comparable, returns false for error < 0

Parameters:
m -
Returns:
false for error < 0, otherwise true if this.error is smaller than m.error

shake

public abstract void shake(java.util.Collection<PointMatch> matches,
                           float scale,
                           float[] center)
randomly change the model a bit estimates the necessary amount of shaking for each single dimensional distance in the set of matches

Parameters:
matches - point matches
scale - gives a multiplicative factor to each dimensional distance (scales the amount of shaking)
center - local pivot point for centered shakes (e.g. rotation)

minimize

public abstract void minimize(java.util.Collection<PointMatch> matches)

getAffine

public abstract java.awt.geom.AffineTransform getAffine()

toString

public abstract java.lang.String toString()
string to output stream

Overrides:
toString in class java.lang.Object

clone

public abstract Model clone()
clone

Overrides:
clone in class java.lang.Object