Facemorph.aam
Class CAAMPowell

java.lang.Object
  extended by Facemorph.Powell
      extended by Facemorph.aam.CAAMPowell

public class CAAMPowell
extends Powell

Correlated Active Appearance Model optimised using Powell's method (therefore slow, for comparison with fast method, not for general use)


Field Summary
 
Fields inherited from class Facemorph.Powell
TINY
 
Constructor Summary
CAAMPowell(Mask mask, PCA pca, PCI pci, java.awt.Image subject, Template template)
          Constructor for CAAMPowell
 
Method Summary
 float[] convertParams(double[] params)
          Convert parameters for better behaviour in an optimsation routine
 double func(double[] params)
          Func should be overrided to calculate the error given the parameters params
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.
 double[] reconvertParams(float[] fparams)
          Reconvert the parameters
 Template solve(int maxAppIts, int maxits, double converged)
          Estimate the template iteratively
 Template solveSingle(int maxits, double converged)
          A single iteration of the detection process
static void test(java.lang.String listFile, java.lang.String resFile, PCI pci, PCA pca, Mask mask)
          Test method
 void updateAppearance()
          Update the appearance model parameters
 
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

CAAMPowell

public CAAMPowell(Mask mask,
                  PCA pca,
                  PCI pci,
                  java.awt.Image subject,
                  Template template)
Constructor for CAAMPowell

Parameters:
mask - mask to use
pca - shape pca model
pci - image pca model
subject - subject image
template - template
Method Detail

updateAppearance

public void updateAppearance()
Update the appearance model parameters


convertParams

public float[] convertParams(double[] params)
Convert parameters for better behaviour in an optimsation routine

Parameters:
params - the parameters
Returns:
return the converted parameters

reconvertParams

public double[] reconvertParams(float[] fparams)
Reconvert the parameters

Parameters:
fparams - the parameters to reconvert
Returns:
returns the reconverted parameters

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

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

solveSingle

public Template solveSingle(int maxits,
                            double converged)
A single iteration of the detection process

Parameters:
maxits - the maximum iterations to use
converged - converged when change in error is less than this, or maxits exceeded
Returns:
returnt the estimated Template

solve

public Template solve(int maxAppIts,
                      int maxits,
                      double converged)
Estimate the template iteratively

Parameters:
maxAppIts - the maximum appearance iterations
maxits - the maximum shape iterations
converged - converged when change in error is less than converged, or maxAPpIts exceeded
Returns:
returns the estimated Template

main

public static void main(java.lang.String[] args)
Main method for testing

Parameters:
args - args[0] = PCI, args[1]=PCA, args[2]=mask, args[3] list file, args[4] results file

test

public static void test(java.lang.String listFile,
                        java.lang.String resFile,
                        PCI pci,
                        PCA pca,
                        Mask mask)
Test method

Parameters:
listFile - list file
resFile - results file
pci - image PCA data
pca - shape PCA data
mask - mask