Facemorph.psm
Class PatchFeature

java.lang.Object
  extended by Facemorph.psm.PatchFeature
All Implemented Interfaces:
Feature

public class PatchFeature
extends java.lang.Object
implements Feature

A feature realised as a Gaussian patch


Constructor Summary
PatchFeature()
           
 
Method Summary
 void addSample(int featureIndex, java.awt.geom.Point2D.Float p)
          Adds a sample point for training, image data taken from currently set image
 double[] getFeatureVector(java.awt.geom.Point2D.Float p)
          Get the feature vector
 FloatImage getProbability(int featureIndex)
          Get the feature probability
 void normalise()
          Perform any normalisation at the end of training
 void read(java.io.StreamTokenizer st, java.lang.String folder, boolean url)
          Read a patch feature
 void setFeatureCount(int count)
          Sets the number of features for some initialisation
 void setImage(java.awt.Image img)
          Sets the image to process
 void write(java.io.PrintStream out, java.lang.String folder)
          Write a patch feature
 void writeFeatureMeanImages(java.lang.String baseName)
          Writes the set of mean feature images
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatchFeature

public PatchFeature()
Method Detail

getProbability

public FloatImage getProbability(int featureIndex)
Get the feature probability

Specified by:
getProbability in interface Feature
Parameters:
featureIndex - the point index
Returns:
returns a probability image

getFeatureVector

public double[] getFeatureVector(java.awt.geom.Point2D.Float p)
Get the feature vector

Specified by:
getFeatureVector in interface Feature
Parameters:
p - the point
Returns:
returns the feature vector

setImage

public void setImage(java.awt.Image img)
Sets the image to process

Specified by:
setImage in interface Feature
Parameters:
img - the image

setFeatureCount

public void setFeatureCount(int count)
Sets the number of features for some initialisation

Specified by:
setFeatureCount in interface Feature
Parameters:
count - the number of features

addSample

public void addSample(int featureIndex,
                      java.awt.geom.Point2D.Float p)
Adds a sample point for training, image data taken from currently set image

Specified by:
addSample in interface Feature
Parameters:
featureIndex - the number of the feature
p - the point location

normalise

public void normalise()
Perform any normalisation at the end of training

Specified by:
normalise in interface Feature

read

public void read(java.io.StreamTokenizer st,
                 java.lang.String folder,
                 boolean url)
          throws java.io.IOException
Read a patch feature

Specified by:
read in interface Feature
Parameters:
st - the StreamTokenizer to read from
folder - useful for writing parts in separate files (maybe?)
url - is this a URL you're writing to
Throws:
java.io.IOException

write

public void write(java.io.PrintStream out,
                  java.lang.String folder)
Write a patch feature

Specified by:
write in interface Feature
Parameters:
out - the output stream to write to
folder - the folder to write (this and child nodes) to

writeFeatureMeanImages

public void writeFeatureMeanImages(java.lang.String baseName)
Writes the set of mean feature images

Parameters:
baseName - the base name, which is appended with the feature number + ".fimg"