|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Facemorph.psm.PSMNode
public class PSMNode
PSMNode: an implementation of Pictorial Structure Models
Constructor Summary | |
---|---|
PSMNode()
PSMNode constructor |
|
PSMNode(int start,
BigMat mst,
Feature appGauss,
DiagonalGaussian[][] gauss,
boolean[] visited,
int w,
int h)
Contruct a PSMNode |
Method Summary | |
---|---|
void |
batchTest(java.lang.String outfold,
java.util.ArrayList<java.lang.String> imageNames,
java.util.ArrayList<java.lang.String> templateNames,
int w,
HaarReader haar)
Batch testing method |
FloatImage |
evaluateProbability(java.awt.Image img)
Evaluate the probability of this feature in the image supplied |
static int |
findBestRoot(BigMat tree,
BigMat graph)
Finds the "best" root of the tree |
static Feature |
getFeature(java.lang.String className)
Dynamically loads the Feature given its class name |
java.util.ArrayList<java.awt.geom.Point2D.Float> |
getFeatures()
Get the feature points |
Template |
getFeatures(java.awt.image.BufferedImage bimg,
HaarReader haar)
Detect the deature in the image using this model |
java.util.ArrayList<java.awt.geom.Point2D.Float> |
getFeatures(java.awt.Image source)
Get the feature points in the image |
static void |
main(java.lang.String[] args)
Main method for testing |
static BigMat |
minimumSpanningTree(BigMat graph)
Get the minimum spanning tree of the graph |
static double |
ncc(double[] v1,
double[] v2)
The normalised cross correlation |
void |
read(java.io.InputStream in,
java.lang.String folder,
boolean url)
Read from the named input stream |
void |
read(java.io.StreamTokenizer st,
Feature app,
java.lang.String folder,
boolean url)
Read a PSM |
void |
read(java.lang.String fileName)
Read from a file |
void |
read(java.lang.String fileName,
boolean url)
Read a PSMNode from file |
double |
shapeError(java.util.ArrayList<java.awt.geom.Point2D.Float> detectedPoints,
Template template,
int[] pointList)
Find the RMS error |
static PSMNode |
train(java.util.ArrayList<java.lang.String> imageNames,
java.util.ArrayList<java.lang.String> templateNames,
int[] pointList,
int w,
int enrich,
java.lang.String featureClassName,
HaarReader haar)
Train a PSM model |
void |
write(java.io.PrintStream ps,
boolean writeApp,
java.lang.String folder)
Write a PSMNode |
void |
write(java.lang.String fileName)
Write a PSMNode to the file named |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PSMNode()
public PSMNode(int start, BigMat mst, Feature appGauss, DiagonalGaussian[][] gauss, boolean[] visited, int w, int h)
start
- the node to start atmst
- the minimum spanning treeappGauss
- the appearancegauss
- the conditional positional probability model of the nodesvisited
- indicates which nodes have been visitedw
- the widthh
- the heightMethod Detail |
---|
public void write(java.lang.String fileName)
fileName
- the name of the filepublic void write(java.io.PrintStream ps, boolean writeApp, java.lang.String folder)
ps
- the print stream to write towriteApp
- Should the appearance be writtenfolder
- the folder to write topublic void read(java.lang.String fileName, boolean url)
fileName
- the name of the file or URLurl
- if true the name referes to a URLpublic void read(java.lang.String fileName)
fileName
- the name of the filepublic void read(java.io.InputStream in, java.lang.String folder, boolean url) throws java.io.IOException
in
- the input streamfolder
- folder to read (children) fromurl
- indicates that the children should be read from a URL
java.io.IOException
public static Feature getFeature(java.lang.String className)
className
- Name of the class to load, must implement the Feature interface and be in the class path to be loaded
public void read(java.io.StreamTokenizer st, Feature app, java.lang.String folder, boolean url) throws java.io.IOException
st
- the stream tokenizer to read fromapp
- the appearance of this nodefolder
- indicates the base folder/url to read children fromurl
- indicates children should be read from a URL
java.io.IOException
public static PSMNode train(java.util.ArrayList<java.lang.String> imageNames, java.util.ArrayList<java.lang.String> templateNames, int[] pointList, int w, int enrich, java.lang.String featureClassName, HaarReader haar)
imageNames
- the list of training imagestemplateNames
- the list of training template namespointList
- the list of points to use from the templatew
- the desired width for training the appearance modelenrich
- the amount of enrichment of the training data to use (currently disabled)featureClassName
- the name of the feature model to usehaar
- the face detector to use
public static int findBestRoot(BigMat tree, BigMat graph)
tree
- contains the MST, with 1 or 0 to indicate tree edgesgraph
- the graph contains the edge weights of the complete graph
public static BigMat minimumSpanningTree(BigMat graph)
graph
- the edge weight matrix
public FloatImage evaluateProbability(java.awt.Image img)
img
- the image to test, or if null the currently set image is used
public java.util.ArrayList<java.awt.geom.Point2D.Float> getFeatures(java.awt.Image source)
source
- the input image
public java.util.ArrayList<java.awt.geom.Point2D.Float> getFeatures()
public static double ncc(double[] v1, double[] v2)
v1
- the first vectorv2
- the second vector
public double shapeError(java.util.ArrayList<java.awt.geom.Point2D.Float> detectedPoints, Template template, int[] pointList)
detectedPoints
- the detected pointstemplate
- the ground truthpointList
- the list of points in template that correspond to the detected points
public void batchTest(java.lang.String outfold, java.util.ArrayList<java.lang.String> imageNames, java.util.ArrayList<java.lang.String> templateNames, int w, HaarReader haar)
outfold
- the output folderimageNames
- the names of the images to testtemplateNames
- the names of the templatesw
- the desired appearance image sizehaar
- the face detectorpublic Template getFeatures(java.awt.image.BufferedImage bimg, HaarReader haar)
bimg
- the image to searchhaar
- the face detector
public static void main(java.lang.String[] args)
args
- the program args
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |