Facemorph.aam
Class CLM

java.lang.Object
  extended by Facemorph.aam.CLM

public class CLM
extends java.lang.Object

Consatrained Local Model implementation


Constructor Summary
CLM()
           
 
Method Summary
 void build(java.lang.String file, HaarReader haar, double varianceToExplain)
          Builds a CLM model from a set of images listed in a file
 Template delineate(java.awt.image.BufferedImage bimg, HaarReader haar, Template template, ImageZoomPanel izp)
          Delineate am image using this CLM
 FloatImage getStrip(Template tem, FloatImage fimg, java.awt.Rectangle rect)
          Gets the patches from all points arranged in a strip
 boolean processPatches(double varianceToExplain)
          Builds the patch PCA model
 FloatImage project(FloatImage strip)
          Projects the sampled patches into the patch model space
 void read(java.lang.String file)
          Reads CLM data from a directory
 void write(java.lang.String file)
          Writes PCI data to a directory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CLM

public CLM()
Method Detail

build

public void build(java.lang.String file,
                  HaarReader haar,
                  double varianceToExplain)
           throws java.io.FileNotFoundException,
                  java.io.IOException
Builds a CLM model from a set of images listed in a file

Parameters:
file - the name of the image list file
haar - a face detector
varianceToExplain - the amount of variance in the patch model
Throws:
java.io.FileNotFoundException
java.io.IOException

delineate

public Template delineate(java.awt.image.BufferedImage bimg,
                          HaarReader haar,
                          Template template,
                          ImageZoomPanel izp)
                   throws PowellException
Delineate am image using this CLM

Parameters:
bimg - the image to delineate
haar - the face detector
template - used to initialise if not null
izp - the image zoom panel to use if animating the searcg
Returns:
returns the estimated template
Throws:
PowellException

getStrip

public FloatImage getStrip(Template tem,
                           FloatImage fimg,
                           java.awt.Rectangle rect)
Gets the patches from all points arranged in a strip

Parameters:
tem - the current template
fimg - the image to sample the patches from
rect - the face detection rectangle, if not null this indicates that the priors should be updated
Returns:
returns the patch strip image

project

public FloatImage project(FloatImage strip)
Projects the sampled patches into the patch model space

Parameters:
strip - the current patch strip
Returns:
returns the closest model patch to the one supplied

processPatches

public boolean processPatches(double varianceToExplain)
Builds the patch PCA model

Parameters:
varianceToExplain - the amount of variance to exmplain in the model
Returns:
returns true if the method was able to build a model, or false if not

read

public void read(java.lang.String file)
          throws java.io.IOException
Reads CLM data from a directory

Parameters:
file - The text file containing the names of the image component files and their variance
Throws:
java.io.IOException - if the file can't be read

write

public void write(java.lang.String file)
           throws java.io.IOException
Writes PCI data to a directory

Parameters:
file - The text file containing the names of the image component files and their variance
Throws:
java.io.IOException - throws IOException if problem writing file