Facemorph.mdl
Class GLGroupwiseImageRegistration

java.lang.Object
  extended by Facemorph.Powell
      extended by Facemorph.mdl.GLGroupwiseImageRegistration

public class GLGroupwiseImageRegistration
extends Powell

Open GL groupwise registration implementation


Field Summary
 
Fields inherited from class Facemorph.Powell
TINY
 
Constructor Summary
GLGroupwiseImageRegistration(java.util.ArrayList<java.awt.image.BufferedImage> images, int pw, int ph)
          Constructor for groupwise registration object
 
Method Summary
 java.util.ArrayList<FloatImage[]> calculateDerivatives(FloatImage[] mean, float shift)
          Calculate the derivatives (x and y shift of each point)
 double func(double[] params)
          Func should be overrided to calculate the error given the parameters params
 double func(double[] params, boolean display)
          Evaluate function with optional (debug) output / display
static void main(java.lang.String[] args)
          Main method for testing
 void onIteration(double[] params)
          onIteration is called once per complete itrations to show the best current guess.
 void output(FloatImage[] fimg, java.util.Vector<java.awt.geom.Point2D.Float> pts, java.lang.String fname)
          Output image and other data drawn on it for debugging
 void setUpWarp(FloatImage[] subject, java.util.Vector<java.awt.geom.Point2D.Float> ptVec, java.util.Vector<java.awt.geom.Point2D.Float> iPtVec)
          Sets up the warping
 void zNormalise(FloatImage[] img, int smoothness)
          z normalisation of image
 
Methods inherited from class Facemorph.Powell
linmin, optimiseGA, powell, powell, spsa, spsa2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GLGroupwiseImageRegistration

public GLGroupwiseImageRegistration(java.util.ArrayList<java.awt.image.BufferedImage> images,
                                    int pw,
                                    int ph)
Constructor for groupwise registration object

Parameters:
images - the images to align
pw - the number of grid points horizontally
ph - the number of grid points vertically
Method Detail

calculateDerivatives

public java.util.ArrayList<FloatImage[]> calculateDerivatives(FloatImage[] mean,
                                                              float shift)
Calculate the derivatives (x and y shift of each point)

Parameters:
mean - the mean image (or image whose derivatives you want to calculate)
shift - the pixel shift of each point
Returns:
returns the set of derivatives (x then y of each point in order)

setUpWarp

public void setUpWarp(FloatImage[] subject,
                      java.util.Vector<java.awt.geom.Point2D.Float> ptVec,
                      java.util.Vector<java.awt.geom.Point2D.Float> iPtVec)
Sets up the warping

Parameters:
subject - the image to warp
ptVec - the vector of points
iPtVec - the vector of new point locations

output

public void output(FloatImage[] fimg,
                   java.util.Vector<java.awt.geom.Point2D.Float> pts,
                   java.lang.String fname)
Output image and other data drawn on it for debugging

Parameters:
fimg - the image to write
pts - the current points
fname - the name of the image file to write

func

public double func(double[] params)
Description copied from class: Powell
Func should be overrided to calculate the error given the parameters params

Specified by:
func in class Powell
Parameters:
params - the parameters to evaluate
Returns:
returns the error

func

public double func(double[] params,
                   boolean display)
Evaluate function with optional (debug) output / display

Parameters:
params - the parameter vector
display - should this be output in some way
Returns:
returns the function evaluated at this point

zNormalise

public void zNormalise(FloatImage[] img,
                       int smoothness)
z normalisation of image

Parameters:
img - the image to normalise
smoothness - the smoothness parameter

onIteration

public void onIteration(double[] params)
Description copied from class: Powell
onIteration is called once per complete itrations to show the best current guess. It can be implemented with an empty body if not needed

Specified by:
onIteration in class Powell
Parameters:
params - the current params of the model

main

public static void main(java.lang.String[] args)
                 throws java.io.FileNotFoundException,
                        PowellException,
                        java.io.IOException
Main method for testing

Parameters:
args - the program arguments
Throws:
java.io.FileNotFoundException
PowellException
java.io.IOException