|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Facemorph.ASM
public class ASM
AN Active Shape Model (ASM) contains the average shape, image and shape eigenvalues
Field Summary | |
---|---|
static int |
NO_NORMALISATION
Indicates no normalisation |
static int |
RIGID_BODY_NORMALISATION
indicates that this ASM uses rigid body + scale (procrustes) normalisation |
static int |
THREE_POINT_NORMALISATION
Indicates normalisation based on 3 points (affine) |
static int |
TWO_POINT_NORMALISATION
Indicates normalisation based on 2 points |
Constructor Summary | |
---|---|
ASM()
Creates a new instance of ASM |
|
ASM(Template template,
PCA pca,
java.awt.Image image,
int normalisation,
int[] pindex)
Creates a new instance of an ASM using the data specified |
Method Summary | |
---|---|
Template |
delineate(java.awt.Image subjectImage,
java.awt.geom.Point2D.Float... points)
Delineate an image using this ASM |
java.awt.Image |
getImage()
Gets the average Image |
int |
getNormalisation()
Gets the current normalisation constant |
int[] |
getNormalisationPoints()
Returns the array of normalisation point indices |
PCA |
getPCA()
Return the PCA data currently being used |
ASM |
getReduced(int comps)
Gets a version of this ASM scaled down by 50% in size |
Template |
getTemplate()
Gets the average Template |
static void |
main(java.lang.String[] args)
Main method for testing |
void |
read(java.lang.String file,
double maxVar)
Reads an ASM from file |
void |
readResources(java.lang.String folder,
java.lang.String file,
double maxVar)
Reads an ASM from file |
Template |
reconstruct(float[] params)
Reconstructs a Template from a set of shape parameters |
void |
replaceMean(Template temp,
boolean project)
Replaces the mean with the Template specified |
void |
write(java.lang.String file)
Writes this ASM to file |
void |
write(java.lang.String file,
boolean text)
Writes this ASM to file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TWO_POINT_NORMALISATION
public static final int THREE_POINT_NORMALISATION
public static final int RIGID_BODY_NORMALISATION
public static final int NO_NORMALISATION
Constructor Detail |
---|
public ASM()
public ASM(Template template, PCA pca, java.awt.Image image, int normalisation, int[] pindex)
template
- The average Templatepca
- The PCA data representing the principal shape eigen valuesimage
- The average imagenormalisation
- Should be one of TWO_POINT_NORMALISATION, THREE_POINT_NORMALISATION or RIGID_BODY_NORMALISATIONpindex
- An array of the point indeces to use, 2 for two point, 3 for 3 point and none required for rigid body normalisationMethod Detail |
---|
public PCA getPCA()
public Template getTemplate()
public int getNormalisation()
public int[] getNormalisationPoints()
public java.awt.Image getImage()
public ASM getReduced(int comps)
comps
- The number of components to use in the output model
public void write(java.lang.String file) throws java.io.IOException
file
- The name of the file to write to
java.io.IOException
- IOException is thrown e.g. if the file is not foundpublic void write(java.lang.String file, boolean text) throws java.io.IOException
file
- The name of the file to write totext
- indicates that the PCA data should be written in a text (not binary) format
java.io.IOException
- IOException is thrown e.g. if the file is not foundpublic void read(java.lang.String file, double maxVar) throws java.io.FileNotFoundException, java.io.IOException
file
- The name of the file to read, this should just be the text based
part that contains the names of the image, template and asm,
and the type of normalisation and points to use.maxVar
- The maximum amount of variance to explain in this model
java.io.FileNotFoundException
- Thrown if the file is not found
java.io.IOException
- thrown if some other IOException occurspublic void readResources(java.lang.String folder, java.lang.String file, double maxVar) throws java.io.FileNotFoundException, java.io.IOException
folder
- The name of the folder (the path) containing the modelfile
- The name of the file to read, this should just be the text based
part that contains the names of the image, template and asm,
and the type of normalisation and points to use.maxVar
- The maximum amount of variance to explain in this model
java.io.FileNotFoundException
- Thrown if the file is not found
java.io.IOException
- thrown if some other IOException occurspublic void replaceMean(Template temp, boolean project)
temp
- The new Template to use as the meanproject
- Indicates that the template should be projected into the current PCA spacepublic Template delineate(java.awt.Image subjectImage, java.awt.geom.Point2D.Float... points)
subjectImage
- The image to auto delineatepoints
- The target position of the normalisation points
public Template reconstruct(float[] params)
params
- the parameters
public static void main(java.lang.String[] args) throws java.io.FileNotFoundException, java.io.IOException
args
- args[0] = name of ASM file to read, args[1] = name of small file to write
java.io.FileNotFoundException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |