Facemorph.mdl
Class SpecificityCombinedTestFile

java.lang.Object
  extended by Facemorph.mdl.SpecificityCombinedTestFile
All Implemented Interfaces:
SpecificityTest<FloatImage[]>

public class SpecificityCombinedTestFile
extends java.lang.Object
implements SpecificityTest<FloatImage[]>

Combined shape and colour specificity model testing


Constructor Summary
SpecificityCombinedTestFile(java.util.ArrayList<java.lang.String> imageNames, java.util.ArrayList<java.lang.String> warpNames, Template average, MaskInterface mask)
          Constructor for SpecificityCombinedTestFile
 
Method Summary
 double calculateError(FloatImage[] img1, FloatImage[] img2)
          Calculates the error between two Ts
 double[] calculateSpecificity(int comps, int trials)
          Calculates the specitivity of the model
 double findMinError(FloatImage[] testImg)
          Find the minimum error from the set of Ts
static void main(java.lang.String[] args)
          Run the tests
 FloatImage[] makeRandom(int comps)
          Makes a random T from the model
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpecificityCombinedTestFile

public SpecificityCombinedTestFile(java.util.ArrayList<java.lang.String> imageNames,
                                   java.util.ArrayList<java.lang.String> warpNames,
                                   Template average,
                                   MaskInterface mask)
                            throws java.io.FileNotFoundException,
                                   java.io.IOException,
                                   java.lang.ClassNotFoundException
Constructor for SpecificityCombinedTestFile

Parameters:
imageNames - list of image names to test with
warpNames - the names of the warps to test with
average - the average Template
mask - the mask to use to select the face area
Throws:
java.io.FileNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
Method Detail

makeRandom

public FloatImage[] makeRandom(int comps)
Description copied from interface: SpecificityTest
Makes a random T from the model

Specified by:
makeRandom in interface SpecificityTest<FloatImage[]>
Parameters:
comps - the number of model components to use
Returns:
returns the generated Template

calculateError

public double calculateError(FloatImage[] img1,
                             FloatImage[] img2)
Description copied from interface: SpecificityTest
Calculates the error between two Ts

Specified by:
calculateError in interface SpecificityTest<FloatImage[]>
Parameters:
img1 - first T
img2 - second T
Returns:
returns the error

findMinError

public double findMinError(FloatImage[] testImg)
                    throws java.io.IOException
Description copied from interface: SpecificityTest
Find the minimum error from the set of Ts

Specified by:
findMinError in interface SpecificityTest<FloatImage[]>
Parameters:
testImg - the test template
Returns:
returns the error from the most similar in the training set
Throws:
java.io.IOException - may be thrown if data is read

calculateSpecificity

public double[] calculateSpecificity(int comps,
                                     int trials)
                              throws java.io.IOException
Description copied from interface: SpecificityTest
Calculates the specitivity of the model

Specified by:
calculateSpecificity in interface SpecificityTest<FloatImage[]>
Parameters:
comps - the number of model components to use
trials - the number of trials to performs
Returns:
returns the mean and sd of the error in an array {meanErr, sdErr}
Throws:
java.io.IOException - may be thrown if data is read

main

public static void main(java.lang.String[] args)
                 throws java.io.FileNotFoundException,
                        java.io.IOException,
                        java.lang.ClassNotFoundException
Run the tests

Parameters:
args - args[0] = test list file name, args[1] = template to read, args[2] file to write to
Throws:
java.io.FileNotFoundException
java.io.IOException
java.lang.ClassNotFoundException